diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-03-09 19:53:59 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-03-09 19:53:59 +0100 |
commit | f3d9814ad5e7efe7aa883b1c58b854a574c0cf61 (patch) | |
tree | 43042420ceac5e474ae4b4efccb6da03a4d06808 /src/MainLoop.hs | |
parent | 9d34024718835132b45c586fc97d75839badf355 (diff) | |
download | htanks-f3d9814ad5e7efe7aa883b1c58b854a574c0cf61.tar htanks-f3d9814ad5e7efe7aa883b1c58b854a574c0cf61.zip |
Moved parts of Main to Simulation module
Diffstat (limited to 'src/MainLoop.hs')
-rw-r--r-- | src/MainLoop.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/MainLoop.hs b/src/MainLoop.hs new file mode 100644 index 0000000..94b5e9d --- /dev/null +++ b/src/MainLoop.hs @@ -0,0 +1,31 @@ +{-# LANGUAGE GeneralizedNewtypeDeriving #-} + +module MainLoop ( MainState(..) + , MainT(..) + , Main + , runMain + ) where + +import Game +import GLDriver +import Player + +import Control.Monad.State +import Control.Monad.Trans +import Data.Time + + +data MainState = MainState + { run :: !Bool + , driver :: !SomeDriver + , time :: !UTCTime + , players :: ![SomePlayer] + } + +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 |