From 2feff9170ade1b68d70bfd0b6ff6f2528f7a862c Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sun, 15 Dec 2024 19:58:31 +0530 Subject: Add hjkl increment movement when match is found --- src/Chelleport/Control.hs | 5 +++++ src/Chelleport/Types.hs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/Chelleport') 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, -- cgit v1.3.1