Gamgine 0.3 → 0.4
raw patch · 5 files changed
+9/−19 lines, 5 files
Files
- Gamgine.cabal +1/−1
- Gamgine/State/InputInfo.hs +4/−14
- Gamgine/State/KeyInfo.hs +1/−1
- Gamgine/State/MouseInfo.hs +1/−1
- Gamgine/State/StateTreeZipper.hs +2/−2
Gamgine.cabal view
@@ -1,5 +1,5 @@ name: Gamgine-version: 0.3+version: 0.4 cabal-version: >=1.6 build-type: Simple license: BSD3
Gamgine/State/InputInfo.hs view
@@ -13,17 +13,7 @@ -- | if the key/mouse button was pressed or released data InputState = Pressed | Released deriving (Eq, Ord) -pressedModifiers :: GLFW.Window -> IO [Modifier]-pressedModifiers win = do- ctrlPressed <- isCtrlPressed win- shiftPressed <- isShiftPressed win- altPressed <- isAltPressed win- return $ [Ctrl | ctrlPressed] ++ [Shift | shiftPressed] ++ [Alt | altPressed]--isCtrlPressed, isAltPressed, isShiftPressed :: GLFW.Window -> IO Bool-isCtrlPressed win = (||) <$> isKeyPressed win GLFW.Key'LeftControl <*> isKeyPressed win GLFW.Key'RightControl-isAltPressed win = (||) <$> isKeyPressed win GLFW.Key'LeftAlt <*> isKeyPressed win GLFW.Key'RightAlt-isShiftPressed win = (||) <$> isKeyPressed win GLFW.Key'LeftShift <*> isKeyPressed win GLFW.Key'RightShift--isKeyPressed :: GLFW.Window -> GLFW.Key -> IO Bool-isKeyPressed win key = (== GLFW.KeyState'Pressed) <$> GLFW.getKey win key+isModifierPressed :: Modifier -> GLFW.ModifierKeys -> Bool+isModifierPressed Ctrl = GLFW.modifierKeysControl+isModifierPressed Alt = GLFW.modifierKeysAlt+isModifierPressed Shift = GLFW.modifierKeysShift
Gamgine/State/KeyInfo.hs view
@@ -13,5 +13,5 @@ -- the current mouse position in world coordinates mousePos :: II.MousePos, -- if a modifier key is additionally pressed- modifiers :: [II.Modifier]+ modifiers :: GLFW.ModifierKeys }
Gamgine/State/MouseInfo.hs view
@@ -13,5 +13,5 @@ -- the current mouse position in world coordinates mousePos :: II.MousePos, -- if a modifier key is additionally pressed- modifiers :: [II.Modifier]+ modifiers :: GLFW.ModifierKeys }
Gamgine/State/StateTreeZipper.hs view
@@ -93,7 +93,7 @@ KI.key ki == key && KI.status ki == status transitionAppliesKI ki (ByKeyWithMod key status mod) =- KI.key ki == key && KI.status ki == status && L.any (== mod) (KI.modifiers ki)+ KI.key ki == key && KI.status ki == status && II.isModifierPressed mod (KI.modifiers ki) transitionAppliesKI _ _ = False @@ -104,6 +104,6 @@ MI.button mi == button && MI.status mi == status transitionAppliesMI mi (ByMouseWithMod button status mod) =- MI.button mi == button && MI.status mi == status && L.any (== mod) (MI.modifiers mi)+ MI.button mi == button && MI.status mi == status && II.isModifierPressed mod (MI.modifiers mi) transitionAppliesMI _ _ = False