File tree Expand file tree Collapse file tree 7 files changed +39
-39
lines changed Expand file tree Collapse file tree 7 files changed +39
-39
lines changed Original file line number Diff line number Diff line change @@ -80,14 +80,14 @@ main = do
8080 SDL. KeyboardEvent e ->
8181 (\ x -> (mempty , x)) $
8282 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
83- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
84- in if | scancode == SDL. ScancodeQ -> Sum (V3 32 0 0 )
85- | scancode == SDL. ScancodeW -> Sum (V3 0 32 0 )
86- | scancode == SDL. ScancodeE -> Sum (V3 0 0 32 )
87- | scancode == SDL. ScancodeA -> Sum (V3 (- 32 ) 0 0 )
88- | scancode == SDL. ScancodeS -> Sum (V3 0 (- 32 ) 0 )
89- | scancode == SDL. ScancodeD -> Sum (V3 0 0 (- 32 ))
90- | otherwise -> mempty
83+ case SDL. keysymScancode (SDL. keyboardEventKeysym e) of
84+ SDL. ScancodeQ -> Sum (V3 32 0 0 )
85+ SDL. ScancodeW -> Sum (V3 0 32 0 )
86+ SDL. ScancodeE -> Sum (V3 0 0 32 )
87+ SDL. ScancodeA -> Sum (V3 (- 32 ) 0 0 )
88+ SDL. ScancodeS -> Sum (V3 0 (- 32 ) 0 )
89+ SDL. ScancodeD -> Sum (V3 0 0 (- 32 ))
90+ _ -> mempty
9191 | otherwise -> mempty
9292 _ -> mempty ) $
9393 map SDL. eventPayload events
Original file line number Diff line number Diff line change @@ -86,10 +86,10 @@ main = do
8686 SDL. KeyboardEvent e ->
8787 (\ x -> (mempty , x)) $
8888 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
89- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
90- in if | scancode == SDL. ScancodeW -> Sum 32
91- | scancode == SDL. ScancodeS -> Sum (- 32 )
92- | otherwise -> mempty
89+ case SDL. keysymScancode (SDL. keyboardEventKeysym e) of
90+ SDL. ScancodeW -> Sum 32
91+ SDL. ScancodeS -> Sum (- 32 )
92+ _ -> mempty
9393 | otherwise -> mempty
9494 _ -> mempty ) $
9595 map SDL. eventPayload events
Original file line number Diff line number Diff line change @@ -87,13 +87,13 @@ main = do
8787 SDL. KeyboardEvent e ->
8888 (\ (x,y) -> (mempty , x,y)) $
8989 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
90- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
91- in if | scancode == SDL. ScancodeQ -> (mempty , Last (Just (V2 True False )))
92- | scancode == SDL. ScancodeW -> (mempty , Last (Just (V2 False False )))
93- | scancode == SDL. ScancodeE -> (mempty , Last (Just (V2 False True )))
94- | scancode == SDL. ScancodeA -> (Sum (- 60 ), mempty )
95- | scancode == SDL. ScancodeD -> (Sum 60 , mempty )
96- | otherwise -> mempty
90+ case SDL. keysymScancode (SDL. keyboardEventKeysym e) of
91+ SDL. ScancodeQ -> (mempty , Last (Just (V2 True False )))
92+ SDL. ScancodeW -> (mempty , Last (Just (V2 False False )))
93+ SDL. ScancodeE -> (mempty , Last (Just (V2 False True )))
94+ SDL. ScancodeA -> (Sum (- 60 ), mempty )
95+ SDL. ScancodeD -> (Sum 60 , mempty )
96+ _ -> mempty
9797 | otherwise -> mempty
9898 _ -> mempty ) $
9999 map SDL. eventPayload events
Original file line number Diff line number Diff line change @@ -106,9 +106,9 @@ main = do
106106 SDL. QuitEvent -> (Any True , mempty )
107107 SDL. KeyboardEvent e ->
108108 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
109- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
110- in if | scancode == SDL. ScancodeEscape -> (Any True , mempty )
111- | otherwise -> mempty
109+ case SDL. keysymScancode (SDL. keyboardEventKeysym e) of
110+ SDL. ScancodeEscape -> (Any True , mempty )
111+ _ -> mempty
112112 | otherwise -> mempty
113113 SDL. JoyAxisEvent e ->
114114 if | SDL. joyAxisEventWhich e == joystickID ->
Original file line number Diff line number Diff line change @@ -100,9 +100,9 @@ main = do
100100 SDL. QuitEvent -> (Any True , mempty )
101101 SDL. KeyboardEvent e ->
102102 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
103- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
104- in if | scancode == SDL. ScancodeEscape -> (Any True , mempty )
105- | otherwise -> mempty
103+ case scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e) of
104+ SDL. ScancodeEscape -> (Any True , mempty )
105+ _ -> mempty
106106 | otherwise -> mempty
107107 SDL. JoyButtonEvent e ->
108108 if | SDL. joyButtonEventState e /= 0 -> (mempty , Any True )
Original file line number Diff line number Diff line change @@ -65,13 +65,13 @@ main = do
6565 SDL. QuitEvent -> (Any True , mempty )
6666 SDL. KeyboardEvent e ->
6767 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
68- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
69- in if | scancode == SDL. ScancodeUp -> (Any False , Sum (V2 0 (- 10 )))
70- | scancode == SDL. ScancodeDown -> (Any False , Sum (V2 0 10 ))
71- | scancode == SDL. ScancodeLeft -> (Any False , Sum (V2 (- 10 ) 0 ))
72- | scancode == SDL. ScancodeRight -> (Any False , Sum (V2 10 0 ))
73- | scancode == SDL. ScancodeQ -> (Any True , mempty )
74- | otherwise -> mempty
68+ case SDL. keysymScancode (SDL. keyboardEventKeysym e) of
69+ SDL. ScancodeUp -> (Any False , Sum (V2 0 (- 10 )))
70+ SDL. ScancodeDown -> (Any False , Sum (V2 0 10 ))
71+ SDL. ScancodeLeft -> (Any False , Sum (V2 (- 10 ) 0 ))
72+ SDL. ScancodeRight -> (Any False , Sum (V2 10 0 ))
73+ SDL. ScancodeQ -> (Any True , mempty )
74+ _ -> mempty
7575 | otherwise -> mempty
7676 _ -> mempty ) $
7777 map SDL. eventPayload events
Original file line number Diff line number Diff line change @@ -72,13 +72,13 @@ main = do
7272 SDL. QuitEvent -> (Any True , mempty )
7373 SDL. KeyboardEvent e ->
7474 if | SDL. keyboardEventKeyMotion e == SDL. Pressed ->
75- let scancode = SDL. keysymScancode (SDL. keyboardEventKeysym e)
76- in if | scancode == SDL. Scancode1 -> (Any False , Last (Just spriteOne))
77- | scancode == SDL. Scancode2 -> (Any False , Last (Just spriteTwo))
78- | scancode == SDL. Scancode3 -> (Any False , Last (Just spriteThree))
79- | scancode == SDL. Scancode4 -> (Any False , Last (Just spriteFour))
80- | scancode == SDL. ScancodeQ -> (Any True , mempty )
81- | otherwise -> mempty
75+ case SDL. keysymScancode (SDL. keyboardEventKeysym e) of
76+ SDL. Scancode1 -> (Any False , Last (Just spriteOne))
77+ SDL. Scancode2 -> (Any False , Last (Just spriteTwo))
78+ SDL. Scancode3 -> (Any False , Last (Just spriteThree))
79+ SDL. Scancode4 -> (Any False , Last (Just spriteFour))
80+ SDL. ScancodeQ -> (Any True , mempty )
81+ _ -> mempty
8282 | otherwise -> mempty
8383 _ -> mempty ) $
8484 map SDL. eventPayload events
You can’t perform that action at this time.
0 commit comments