blob: de28499e3ee66592946b723316910b875bf553e8 (
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(..)
, Main(..)
, runMain
) where
import Game
import GLDriver
import Player
import Texture
import Model
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)
, models :: !(M.Map Model InterleavedObj)
, gameState :: !GameState
}
newtype Main a = Main (StateT MainState IO a)
deriving (Monad, MonadState MainState, MonadIO)
runMain :: MainState -> Main a -> IO (a, MainState)
runMain st (Main a) = runStateT a st
|