pituicat/src/Types/Application.hs

41 lines
917 B
Haskell
Raw Normal View History

{-# LANGUAGE ExistentialQuantification #-}
2020-09-21 02:26:45 +00:00
module Types.Application where
import Affection
import qualified SDL
2020-09-23 23:26:47 +00:00
import Control.Concurrent.STM
2020-09-21 02:26:45 +00:00
import qualified Data.Map.Strict as M
import qualified Data.Text as T
2020-09-21 02:26:45 +00:00
-- internal imports
import Types.Subsystems
2020-10-09 23:00:33 +00:00
import Types.GameMap
2020-09-21 02:26:45 +00:00
data GameData = GameData
{ gameScene :: TMVar Stage
, gameState :: TVar State
, gameStateLoadProgress :: TMVar Progress
2020-09-21 02:26:45 +00:00
, gameSubsystems :: Subsystems
, gameActionTranslation :: TVar ActionTranslation
2020-09-23 23:26:47 +00:00
, gameRunning :: TVar Bool
2020-09-21 02:26:45 +00:00
}
-- 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
2020-09-21 02:26:45 +00:00
data State
2020-09-22 12:07:13 +00:00
= Loading
| Running
| Pausing
2020-09-21 02:26:45 +00:00
type Progress = (Float, T.Text)
2020-09-21 02:26:45 +00:00
type ActionTranslation = M.Map SDL.Keycode Action