Allow for no-ammo muzzles
This commit is contained in:
+15
-11
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user