Unify key press and mouse button press timings

Both now use Ints for presses.
Still no release timer for keyboard events.
This commit is contained in:
2025-07-28 23:16:05 +01:00
parent ea35753744
commit 81f88c32e9
15 changed files with 52 additions and 58 deletions
+7 -7
View File
@@ -12,11 +12,11 @@ import SDL (MouseButton, Scancode)
import Data.Aeson
import Data.Aeson.TH
data PressType
= InitialPress
| ShortPress
| LongPress
deriving (Eq, Show)
--data PressType
-- = InitialPress Int
-- | ShortPress Int
-- | LongPress Int
-- deriving (Eq, Show)
data MouseContext
= NoMouseContext
@@ -45,7 +45,7 @@ data Input = Input
{ _mousePos :: Point2 -- in pixels, from the center of the screen
, _mouseContext :: MouseContext
, _mouseMoving :: Bool
, _pressedKeys :: M.Map Scancode PressType
, _pressedKeys :: M.Map Scancode Int
, _mouseButtons :: M.Map MouseButton Int -- counts number of frames held down
, _mouseButtonsReleased :: M.Map MouseButton Int -- counts number of frames released
, _scrollAmount :: Int
@@ -72,4 +72,4 @@ data TermSignal
makeLenses ''Input
makeLenses ''MouseContext
deriveJSON defaultOptions ''PressType
--deriveJSON defaultOptions ''PressType