diff --git a/src/InGame.hs b/src/InGame.hs index 586bf56..a1befd2 100644 --- a/src/InGame.hs +++ b/src/InGame.hs @@ -125,8 +125,12 @@ drawGame = do (buffer ud) True -handleGameEvent :: Double -> SDL.Event -> Affection UserData () -handleGameEvent sec e = do +handleGameEvent + :: Affection UserData () + -> Double + -> SDL.Event + -> Affection UserData () +handleGameEvent menuload sec e = do ad <- get wd <- getAffection case SDL.eventPayload e of @@ -206,11 +210,10 @@ handleGameEvent sec e = do , pixelSize = 8 } SDL.KeycodeR -> - when (SDL.keyboardEventKeyMotion dat == SDL.Pressed) $ do + when (SDL.keyboardEventKeyMotion dat == SDL.Pressed && wonlost wd) $ do liftIO $ traceIO "reloading" - liftIO $ clean wd - nd <- liftIO $ load $ drawSurface ad - putAffection nd + -- liftIO $ clean wd + menuload _ -> return () SDL.WindowClosedEvent _ -> do traceM "seeya!" diff --git a/src/StateMachine.hs b/src/StateMachine.hs index 36a578f..7a2f16f 100644 --- a/src/StateMachine.hs +++ b/src/StateMachine.hs @@ -92,7 +92,7 @@ instance StateMachine State UserData where } _ -> return () - smEvent InGame sec e = handleGameEvent sec e + smEvent InGame sec e = handleGameEvent (smLoad Menu) sec e smDraw Menu = do ud <- getAffection