aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-15 19:58:31 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-15 20:12:43 +0530
commit2feff9170ade1b68d70bfd0b6ff6f2528f7a862c (patch)
treea399d662602060b13d3f6c9427c7fcf3d51e6b1d /src/Chelleport
parentbee0febb5d98f0993a7a3bd175046f4fbf9c8eec (diff)
downloadchelleport-2feff9170ade1b68d70bfd0b6ff6f2528f7a862c.tar.gz
chelleport-2feff9170ade1b68d70bfd0b6ff6f2528f7a862c.zip
Add hjkl increment movement when match is found
Diffstat (limited to 'src/Chelleport')
-rw-r--r--src/Chelleport/Control.hs5
-rw-r--r--src/Chelleport/Types.hs4
2 files changed, 8 insertions, 1 deletions
diff --git a/src/Chelleport/Control.hs b/src/Chelleport/Control.hs
index c915ae8..7b58fdf 100644
--- a/src/Chelleport/Control.hs
+++ b/src/Chelleport/Control.hs
@@ -18,6 +18,11 @@ moveMouse :: DrawContext -> CInt -> CInt -> IO ()
moveMouse _ x y = do
SDL.warpMouse SDL.WarpGlobal (SDL.P $ SDL.V2 x y)
+currentMousePosition :: DrawContext -> IO (SDL.V2 CInt)
+currentMousePosition _ctx = do
+ (SDL.P p) <- SDL.getAbsoluteMouseLocation
+ pure p
+
isKeyPress :: SDL.KeyboardEventData -> Bool
isKeyPress = (== SDL.Pressed) . SDL.keyboardEventKeyMotion
diff --git a/src/Chelleport/Types.hs b/src/Chelleport/Types.hs
index 8c86d03..2238019 100644
--- a/src/Chelleport/Types.hs
+++ b/src/Chelleport/Types.hs
@@ -12,7 +12,8 @@ type KeyGrid = [[Cell]]
data State = State
{ stateGrid :: KeyGrid,
- stateKeySequence :: KeySequence
+ stateKeySequence :: KeySequence,
+ stateIsMatched :: Bool
}
data AppAction
@@ -20,6 +21,7 @@ data AppAction
| MoveMousePosition (Int, Int)
| ResetKeys
| TriggerLeftClick
+ | IncrementMouseCursor (Int, Int)
data DrawContext = DrawContext
{ ctxWindow :: SDL.Window,