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:
@@ -361,8 +361,8 @@ updateFunctionKeys u =
|
||||
u
|
||||
(u ^. uvWorld . input . pressedKeys)
|
||||
|
||||
updateFunctionKey :: Universe -> Scancode -> PressType -> Universe
|
||||
updateFunctionKey uv sc InitialPress = case sc of
|
||||
updateFunctionKey :: Universe -> Scancode -> Int -> Universe
|
||||
updateFunctionKey uv sc 0 = case sc of
|
||||
ScancodeF1 -> useNormalCamera uv
|
||||
ScancodeF2 -> pauseAndFloatCam uv
|
||||
ScancodeF5 -> doQuicksave uv
|
||||
@@ -387,14 +387,14 @@ updateKeysInTerminal tmid u =
|
||||
& checkEndStatus
|
||||
where
|
||||
checkEndStatus
|
||||
| u ^. uvWorld . input . pressedKeys . at ScancodeReturn == Just InitialPress =
|
||||
| u ^. uvWorld . input . pressedKeys . at ScancodeReturn == Just 0 =
|
||||
uvWorld %~ terminalReturnEffect tmid
|
||||
| otherwise = id
|
||||
|
||||
updateKeyInGame :: Universe -> Scancode -> PressType -> Universe
|
||||
updateKeyInGame :: Universe -> Scancode -> Int -> Universe
|
||||
updateKeyInGame uv sc pt = case pt of
|
||||
InitialPress -> updateInitialPressInGame uv sc
|
||||
LongPress -> updateLongPressInGame uv sc
|
||||
0 -> updateInitialPressInGame uv sc
|
||||
x | x >= 30 -> updateLongPressInGame uv sc
|
||||
_ -> uv
|
||||
|
||||
updateInitialPressInGame :: Universe -> Scancode -> Universe
|
||||
@@ -440,14 +440,14 @@ doRegexInput inp i sss msel filts
|
||||
j = fromMaybe 0 $ do
|
||||
itms <- sss ^? ix (i + 1) . ssItems
|
||||
fst <$> IM.lookupMin itms
|
||||
escapekey = ScancodeEscape `M.lookup` pkeys == Just InitialPress
|
||||
escapekey = ScancodeEscape `M.lookup` pkeys == Just 0
|
||||
endkeys =
|
||||
any
|
||||
((== Just InitialPress) . (`M.lookup` pkeys))
|
||||
((== Just 0) . (`M.lookup` pkeys))
|
||||
[ScancodeReturn, ScancodeSlash]
|
||||
backspacetonothing =
|
||||
filts == Just ""
|
||||
&& ScancodeBackspace `M.lookup` pkeys == Just InitialPress
|
||||
&& ScancodeBackspace `M.lookup` pkeys == Just 0
|
||||
pkeys = inp ^. pressedKeys
|
||||
|
||||
updateBackspaceRegex :: World -> World
|
||||
|
||||
Reference in New Issue
Block a user