key-state 0.0.0 → 0.1.0
raw patch · 3 files changed
+28/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ KeyState: maintainKeyState :: Num count => count -> KeyState count -> KeyState count
+ KeyState: pressedKeyState :: KeyState count
+ KeyState: releasedKeyState :: KeyState count
Files
- key-state.cabal +1/−1
- library/KeyState.hs +26/−1
- package.yaml +1/−1
key-state.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: key-state-version: 0.0.0+version: 0.1.0 synopsis: Manage key and button states and statuses description: Manage key and button states and statuses category: Game
library/KeyState.hs view
@@ -1,4 +1,12 @@-module KeyState where+module KeyState+ ( KeyStatus(..)+ , KeyState(..)+ , initKeyState+ , pressedKeyState+ , releasedKeyState+ , updateKeyState+ , maintainKeyState+ ) where data KeyStatus = KeyStatus'Untouched@@ -15,6 +23,12 @@ initKeyState :: KeyState count initKeyState = KeyState KeyStatus'Untouched Nothing +pressedKeyState :: KeyState count+pressedKeyState = KeyState KeyStatus'Pressed Nothing++releasedKeyState :: KeyState count+releasedKeyState = KeyState KeyStatus'Released Nothing+ updateKeyState :: Num count => count -- ^ Counter delta@@ -30,4 +44,15 @@ KeyStatus'Untouched -> KeyState KeyStatus'Untouched (Just $ delta + (case ksCounter of Nothing -> 0; Just counter -> counter)) KeyStatus'Pressed -> KeyState KeyStatus'Released Nothing KeyStatus'Held -> KeyState KeyStatus'Released Nothing+ KeyStatus'Released -> KeyState KeyStatus'Untouched Nothing++maintainKeyState+ :: Num count+ => count -- ^ Counter delta+ -> KeyState count+ -> KeyState count+maintainKeyState delta KeyState{ksStatus, ksCounter} = case ksStatus of+ KeyStatus'Untouched -> KeyState KeyStatus'Untouched (Just $ delta + (case ksCounter of Nothing -> 0; Just counter -> counter))+ KeyStatus'Pressed -> KeyState KeyStatus'Held Nothing+ KeyStatus'Held -> KeyState KeyStatus'Held (Just $ delta + (case ksCounter of Nothing -> 0; Just counter -> counter)) KeyStatus'Released -> KeyState KeyStatus'Untouched Nothing
package.yaml view
@@ -1,5 +1,5 @@ name: key-state-version: '0.0.0'+version: '0.1.0' category: Game synopsis: Manage key and button states and statuses description: Manage key and button states and statuses