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
+1
View File
@@ -42,6 +42,7 @@ data ItemSF -- Structural Function
| CapacitorSF
| TransformerSF
| PulseBallSF
| TorchSF
deriving (Eq, Ord, Show, Read)
type CItem = (Item, ItemSF)
+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
+1 -1
View File
@@ -31,7 +31,7 @@ data WdWd
| WdWdNegateTrig Int
-- | WdWdFromItCrixWdWd (LabelDoubleTree ComposeLinkType Item) Int ItCrWdWd
| MakeTempLight LSParam Int
| UseInvItem Int PressType
| UseInvItem Int Int -- invid presstime
| WdWdBurstFireRepetition Int Int
--deriving (Eq, Show, Read) --, Generic)
--h--deriving (Eq, Show, Read) --Generic, Flat)