Implement floating camera

This commit is contained in:
2023-03-26 16:44:19 +01:00
parent 082ce9c9a1
commit 73e742e1a2
12 changed files with 86 additions and 38 deletions
+5 -3
View File
@@ -12,6 +12,7 @@ import Dodge.Data.Config
import Dodge.Data.Input
import LensHelp
import SDL
--import qualified Data.Map.Strict as M
-- annoyingly, the text input event doesn't register backspace, so deletion has to be
-- dealt with separately
@@ -55,7 +56,8 @@ handleMouseWheelEvent mwev = scrollAmount +~ fromIntegral y
handleMouseButtonEvent :: MouseButtonEventData -> Input -> Input
handleMouseButtonEvent mbev = case mouseButtonEventMotion mbev of
Released -> pointtothebutton .~ Nothing
Pressed -> pointtothebutton ?~ False
Released -> mouseButtons . at thebutton .~ Nothing
Pressed -> mouseButtons . at thebutton ?~ 1 -- note that mouse button events are NOT repeating
where
pointtothebutton = mouseButtons . at (mouseButtonEventButton mbev)
-- pointtothebutton = mouseButtons . at thebutton
thebutton = mouseButtonEventButton mbev