Separate out input datatype
This commit is contained in:
+4
-4
@@ -35,7 +35,7 @@ handleEvent e = case eventPayload e of
|
||||
handleMouseMotionEvent :: MouseMotionEventData -> Universe -> Maybe Universe
|
||||
handleMouseMotionEvent mmev u =
|
||||
Just $
|
||||
u & uvWorld . mousePos
|
||||
u & uvWorld . input . mousePos
|
||||
.~ V2
|
||||
(fromIntegral x - 0.5 * _windowX cfig)
|
||||
(0.5 * _windowY cfig - fromIntegral y)
|
||||
@@ -45,8 +45,8 @@ handleMouseMotionEvent mmev u =
|
||||
|
||||
handleMouseButtonEvent :: MouseButtonEventData -> World -> World
|
||||
handleMouseButtonEvent mbev = case mouseButtonEventMotion mbev of
|
||||
Released -> mouseButtons . at thebutton .~ Nothing
|
||||
Pressed -> mouseButtons . at thebutton ?~ False
|
||||
Released -> input . mouseButtons . at thebutton .~ Nothing
|
||||
Pressed -> input . mouseButtons . at thebutton ?~ False
|
||||
where
|
||||
thebutton = mouseButtonEventButton mbev
|
||||
|
||||
@@ -80,5 +80,5 @@ handleMouseWheelEvent :: MouseWheelEventData -> Universe -> Maybe Universe
|
||||
handleMouseWheelEvent mwev w = case _uvScreenLayers w of
|
||||
[] -> case mouseWheelEventPos mwev of
|
||||
V2 _ y -> Just $ w -- & uvWorld %~ wheelEvent (fromIntegral y)
|
||||
& uvWorld . scrollAmount +~ fromIntegral y
|
||||
& uvWorld . input . scrollAmount +~ fromIntegral y
|
||||
_ -> Just w
|
||||
|
||||
Reference in New Issue
Block a user