aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Spear/App/Input.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Spear/App/Input.hs b/Spear/App/Input.hs
index 8165d8b..3a6090f 100644
--- a/Spear/App/Input.hs
+++ b/Spear/App/Input.hs
@@ -99,15 +99,16 @@ getMouse oldMouse =
99 prop' xpos _ MouseDX = xpos - property oldMouse MouseX 99 prop' xpos _ MouseDX = xpos - property oldMouse MouseX
100 prop' _ ypos MouseDY = ypos - property oldMouse MouseY 100 prop' _ ypos MouseDY = ypos - property oldMouse MouseY
101 101
102 buttons = fmap toEnum [0..fromEnum (maxBound :: MouseButton)] 102 buttons = fmap toEnum [0..fromEnum (maxBound :: MouseButton)]
103 getKeystate = fmap (V.fromList . fmap ((==) GLFW.Press)) . 103 getButtonState =
104 mapM GLFW.getMouseButton . 104 fmap (V.fromList . fmap ((==) GLFW.Press)) .
105 fmap toGLFWbutton $ buttons 105 mapM GLFW.getMouseButton .
106 fmap toGLFWbutton $ buttons
106 in do 107 in do
107 Position xpos ypos <- get GLFW.mousePos 108 Position xpos ypos <- get GLFW.mousePos
108 keystate <- getKeystate 109 buttonState <- getButtonState
109 return $ Mouse 110 return $ Mouse
110 { button = getButton keystate 111 { button = getButton buttonState
111 , property = prop' (fromIntegral xpos) (fromIntegral ypos) 112 , property = prop' (fromIntegral xpos) (fromIntegral ypos)
112 } 113 }
113 114