aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport/AppShell.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Chelleport/AppShell.hs')
-rw-r--r--src/Chelleport/AppShell.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Chelleport/AppShell.hs b/src/Chelleport/AppShell.hs
index ba31982..2e95a85 100644
--- a/src/Chelleport/AppShell.hs
+++ b/src/Chelleport/AppShell.hs
@@ -35,18 +35,19 @@ type EventHandler state appAction = state -> SDL.Event -> Maybe appAction
type View m state = state -> m ()
-type Initializer m state = m state
+type Initializer m state appAction = m (state, Maybe appAction)
setupAppShell ::
(MonadIO m) =>
DrawContext ->
- Initializer m state ->
+ Initializer m state appAction ->
Update m state appAction ->
EventHandler state appAction ->
View m state ->
m ()
-setupAppShell (DrawContext {ctxRenderer = renderer}) getInitState update eventHandler draw =
- getInitState >>= appLoop
+setupAppShell (DrawContext {ctxRenderer = renderer}) getInitState update eventHandler draw = do
+ state <- getInitState >>= evalUpdateResult
+ appLoop state
where
appLoop currentState = do
SDL.rendererDrawColor renderer $= colorBackground