From e0a272fb4e27d7bf19bbaca0af530a3168008864 Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 21 Sep 2018 22:25:23 +0200 Subject: [PATCH] restart on escape --- src/Main.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index 69f373f..af117ba 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -68,7 +68,15 @@ pre = do quitGame :: KeyboardMessage -> Affection UserData () quitGame (MsgKeyboardEvent _ _ SDL.Pressed False sym) - | SDL.keysymKeycode sym == SDL.KeycodeEscape = quit + | SDL.keysymKeycode sym == SDL.KeycodeEscape = do + ad <- A.get + ud <- getAffection + SDL.glMakeCurrent (drawWindow ad) (glContext ad) + (ws, _) <- yieldSystemT (0, defStorage) (return ()) + putAffection ud + { worldState = ws + } + smLoad Load | otherwise = return () quitGame _ = return ()