blob: 0ebaa53082a7a92c5d16f153701313b1fd3ab084 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module MainLoop ( MainState(..)
, MainT(..)
, Main
, runMain
) where
import Game
import GLDriver
import Player
import Texture
import Control.Monad.State
import Control.Monad.Trans
import Data.Time
import qualified Data.Map as M
data MainState = MainState
{ run :: !Bool
, driver :: !SomeDriver
, time :: !UTCTime
, players :: ![SomePlayer]
, textures :: !(M.Map Texture TextureObject)
}
newtype MainT m a = MainT (StateT MainState m a)
deriving (Monad, MonadState MainState, MonadIO, MonadTrans)
type Main = MainT Game
runMain :: MainState -> Main a -> Game (a, MainState)
runMain st (MainT a) = runStateT a st
|