Start to unify selection lists
This commit is contained in:
@@ -8,8 +8,8 @@ module Dodge.Event.Input (
|
||||
) where
|
||||
|
||||
import qualified Data.Text as T
|
||||
import Dodge.Data.Input
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.Input
|
||||
import LensHelp
|
||||
import SDL
|
||||
|
||||
@@ -18,23 +18,23 @@ import SDL
|
||||
handleTextInput :: T.Text -> Input -> Input
|
||||
handleTextInput text = textInput %~ (`T.append` text)
|
||||
|
||||
{- | Handles keyboard press and release.
|
||||
-}
|
||||
-- | Handles keyboard press and release.
|
||||
handleKeyboardEvent :: KeyboardEventData -> Input -> Input
|
||||
handleKeyboardEvent kev = case keyboardEventKeyMotion kev of
|
||||
Released -> pressedKeys . at scode .~ Nothing
|
||||
Pressed -> pressedKeys . at scode ?~ val
|
||||
where
|
||||
val | keyboardEventRepeat kev = LongPress
|
||||
val
|
||||
| keyboardEventRepeat kev = LongPress
|
||||
| otherwise = InitialPress
|
||||
scode = (keysymScancode . keyboardEventKeysym) kev
|
||||
|
||||
handleMouseMotionEvent :: MouseMotionEventData -> Configuration -> Input -> Input
|
||||
handleMouseMotionEvent mmev cfig inp =
|
||||
inp & mousePos
|
||||
.~ V2
|
||||
(fromIntegral x - 0.5 * _windowX cfig)
|
||||
(0.5 * _windowY cfig - fromIntegral y)
|
||||
handleMouseMotionEvent mmev cfig =
|
||||
mousePos
|
||||
.~ V2
|
||||
(fromIntegral x - 0.5 * _windowX cfig)
|
||||
(0.5 * _windowY cfig - fromIntegral y)
|
||||
where
|
||||
P (V2 x y) = mouseMotionEventPos mmev
|
||||
|
||||
|
||||
Reference in New Issue
Block a user