Allow for no-ammo muzzles

This commit is contained in:
2025-08-10 08:09:03 +01:00
parent 9d973b2570
commit aa412f1911
9 changed files with 283 additions and 283 deletions
+15 -11
View File
@@ -1,3 +1,4 @@
{-# LANGUAGE LambdaCase #-}
{- | Capture input events, store them in structures for later use.
-}
module Dodge.Event.Input (
@@ -28,17 +29,20 @@ handleKeyboardEvent kev = case keyboardEventKeyMotion kev of
scode = (keysymScancode . keyboardEventKeysym) kev
addTermSignal :: Scancode -> Input -> Input
addTermSignal sc = case sc of
ScancodeBackspace -> textInput .:~ Left TSbackspace
ScancodeEscape -> textInput .:~ Left TSescape
ScancodeReturn -> textInput .:~ Left TSreturn
ScancodeDelete -> textInput .:~ Left TSdelete
ScancodeTab -> textInput .:~ Left TStab
ScancodeLeft -> textInput .:~ Left TSleft
ScancodeRight -> textInput .:~ Left TSright
ScancodeUp -> textInput .:~ Left TSup
ScancodeDown -> textInput .:~ Left TSdown
_ -> id
addTermSignal = maybe id (\ts -> textInput .:~ Left ts) . scToTS
scToTS :: Scancode -> Maybe TermSignal
scToTS = \case
ScancodeBackspace -> Just TSbackspace
ScancodeEscape -> Just TSescape
ScancodeReturn -> Just TSreturn
ScancodeDelete -> Just TSdelete
ScancodeTab -> Just TStab
ScancodeLeft -> Just TSleft
ScancodeRight -> Just TSright
ScancodeUp -> Just TSup
ScancodeDown -> Just TSdown
_ -> Nothing
handleMouseMotionEvent :: MouseMotionEventData -> Configuration -> Input -> Input
handleMouseMotionEvent mmev cfig = set mousePos themousepos . set mouseMoving True