Cleanup
This commit is contained in:
@@ -31,13 +31,14 @@ handleKeyboardEvent kev = case keyboardEventKeyMotion kev of
|
||||
|
||||
handleMouseMotionEvent :: MouseMotionEventData -> Configuration -> Input -> Input
|
||||
handleMouseMotionEvent mmev cfig =
|
||||
(mousePos
|
||||
.~ V2
|
||||
(fromIntegral x - 0.5 * _windowX cfig)
|
||||
(0.5 * _windowY cfig - fromIntegral y)
|
||||
) . (mouseMoving .~ True)
|
||||
set mousePos themousepos
|
||||
. set mouseMoving True
|
||||
where
|
||||
P (V2 x y) = mouseMotionEventPos mmev
|
||||
themousepos =
|
||||
V2
|
||||
(fromIntegral x - 0.5 * _windowX cfig)
|
||||
(0.5 * _windowY cfig - fromIntegral y)
|
||||
|
||||
handleMouseWheelEvent :: MouseWheelEventData -> Input -> Input
|
||||
handleMouseWheelEvent mwev = scrollAmount +~ fromIntegral y
|
||||
@@ -46,7 +47,7 @@ handleMouseWheelEvent mwev = scrollAmount +~ fromIntegral y
|
||||
|
||||
handleMouseButtonEvent :: MouseButtonEventData -> Input -> Input
|
||||
handleMouseButtonEvent mbev = case mouseButtonEventMotion mbev of
|
||||
Released -> mouseButtons . at thebutton .~ Nothing
|
||||
Pressed -> mouseButtons . at thebutton ?~ False
|
||||
Released -> pointtothebutton .~ Nothing
|
||||
Pressed -> pointtothebutton ?~ False
|
||||
where
|
||||
thebutton = mouseButtonEventButton mbev
|
||||
pointtothebutton = mouseButtons . at (mouseButtonEventButton mbev)
|
||||
|
||||
Reference in New Issue
Block a user