{-# LANGUAGE ExistentialQuantification #-} module Types.Application where import Affection import qualified SDL import Control.Concurrent (ThreadId) import Control.Concurrent.STM -- internal imports import Types.Subsystems import Types.Util import Classes.Scene data GameData = GameData { gameScene :: TMVar Stage , gameState :: TVar State , gameStateLoadProgress :: TMVar Progress , gameSubsystems :: Subsystems , gameActionTranslation :: TVar ActionTranslation , gameRunning :: TVar Bool , gameLoadThread :: TVar (Maybe ThreadId) , gameLoadContext :: TVar (Maybe SDL.GLContext) , gameGeneralClean :: TVar [UUID] , gameSceneClean :: TVar (Maybe UUID) } -- 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 deriving (Show)