rebase keyconfig changes
This commit is contained in:
+9
-9
@@ -22,28 +22,28 @@ import System.Random
|
||||
import SDL
|
||||
-- }}}
|
||||
|
||||
keyPressedDown :: Event -> Maybe Keycode
|
||||
keyPressedDown :: Event -> Maybe Scancode
|
||||
keyPressedDown e = case eventPayload e of
|
||||
KeyboardEvent (KeyboardEventData _ Pressed False keysym) -> Just $ keysymKeycode keysym
|
||||
KeyboardEvent (KeyboardEventData _ Pressed False keysym) -> Just $ keysymScancode keysym
|
||||
_ -> Nothing
|
||||
|
||||
menuEvents :: (Event -> World -> Maybe World) -> Event -> World -> Maybe World
|
||||
menuEvents f e w = case _menuState w of
|
||||
LevelMenu _ -> case keyPressedDown e of
|
||||
Just KeycodeEscape -> Nothing
|
||||
Just ScancodeEscape -> Nothing
|
||||
Just _ -> startLevel w >>= f e
|
||||
_ -> Just w
|
||||
PauseMenu -> case keyPressedDown e of
|
||||
Just KeycodeEscape -> Nothing
|
||||
Just KeycodeR -> return $ fromMaybe w $ _storedLevel w
|
||||
Just KeycodeN -> Just $ putSound $ generateLevel 1
|
||||
Just ScancodeEscape -> Nothing
|
||||
Just ScancodeR -> return $ fromMaybe w $ _storedLevel w
|
||||
Just ScancodeN -> Just $ putSound $ generateLevel 1
|
||||
$ initialWorld {_randGen = _randGen w}
|
||||
Just _ -> unpause w >>= f e
|
||||
_ -> Just w
|
||||
GameOverMenu -> case keyPressedDown e of
|
||||
Just KeycodeEscape -> Nothing
|
||||
Just KeycodeR -> Just $ fromMaybe w $ _storedLevel w
|
||||
Just KeycodeN -> Just $ putSound $ generateLevel 1
|
||||
Just ScancodeEscape -> Nothing
|
||||
Just ScancodeR -> Just $ fromMaybe w $ _storedLevel w
|
||||
Just ScancodeN -> Just $ putSound $ generateLevel 1
|
||||
$ initialWorld
|
||||
{_randGen = _randGen w}
|
||||
_ -> return w
|
||||
|
||||
Reference in New Issue
Block a user