41 lines
917 B
Haskell
41 lines
917 B
Haskell
{-# LANGUAGE ExistentialQuantification #-}
|
|
module Types.Application where
|
|
|
|
import Affection
|
|
|
|
import qualified SDL
|
|
|
|
import Control.Concurrent.STM
|
|
|
|
import qualified Data.Map.Strict as M
|
|
|
|
import qualified Data.Text as T
|
|
|
|
-- internal imports
|
|
|
|
import Types.Subsystems
|
|
import Types.GameMap
|
|
|
|
data GameData = GameData
|
|
{ gameScene :: TMVar Stage
|
|
, gameState :: TVar State
|
|
, gameStateLoadProgress :: TMVar Progress
|
|
, gameSubsystems :: Subsystems
|
|
, gameActionTranslation :: TVar ActionTranslation
|
|
, gameRunning :: TVar Bool
|
|
}
|
|
|
|
-- Existential type wrapper to make all Scenes implementing Scene
|
|
-- homogenous.
|
|
-- See more at https://wiki.haskell.org/Existential_type#Dynamic_dispatch_mechanism_of_OOP
|
|
data Stage = forall a. Scene a => Stage a
|
|
|
|
data State
|
|
= Loading
|
|
| Running
|
|
| Pausing
|
|
|
|
type Progress = (Float, T.Text)
|
|
|
|
type ActionTranslation = M.Map SDL.Keycode Action
|