pituicat/src/Types/Application.hs

41 lines
1 KiB
Haskell
Raw Normal View History

{-# LANGUAGE ExistentialQuantification #-}
2020-09-21 02:26:45 +00:00
module Types.Application where
2021-01-11 23:51:58 +00:00
import Affection
2020-09-21 02:26:45 +00:00
import qualified SDL
2020-10-28 10:48:58 +00:00
import Control.Concurrent (ThreadId)
2020-09-23 23:26:47 +00:00
import Control.Concurrent.STM
2020-09-21 02:26:45 +00:00
-- internal imports
import Types.Subsystems
2020-10-28 10:48:58 +00:00
import Types.Util
import Classes.Scene
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-10-28 10:48:58 +00:00
, gameLoadThread :: TVar (Maybe ThreadId)
2020-12-06 07:14:50 +00:00
, gameLoadContext :: TVar (Maybe SDL.GLContext)
2021-01-11 23:51:58 +00:00
, gameGeneralClean :: TVar [UUID]
, gameSceneClean :: TVar (Maybe UUID)
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-10-28 10:48:58 +00:00
deriving (Show)