aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport.hs
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-21 13:19:48 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-21 13:19:56 +0530
commita2a8e8dd046678816c3797cb894b20abfe84e360 (patch)
tree0b40288086b055b0a13f3a5621b836eca1d7b2c5 /src/Chelleport.hs
parentd8667213fa49242701db4bf592754ab87749efa5 (diff)
downloadchelleport-a2a8e8dd046678816c3797cb894b20abfe84e360.tar.gz
chelleport-a2a8e8dd046678816c3797cb894b20abfe84e360.zip
Fix issue with pointer coordinates + Add mouse press/release actions
Diffstat (limited to '')
-rw-r--r--src/Chelleport.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Chelleport.hs b/src/Chelleport.hs
index d00d112..3f78aba 100644
--- a/src/Chelleport.hs
+++ b/src/Chelleport.hs
@@ -1,11 +1,9 @@
-{-# LANGUAGE MultiParamTypeClasses #-}
-
module Chelleport where
import Chelleport.AppShell (MonadAppShell (hideWindow, showWindow, shutdownApp), setupAppShell)
import Chelleport.Context (initializeContext)
-import Chelleport.Control (MonadControl (getMousePointerPosition, moveMousePointer, pressMouseButton), directionalIncrement, eventToKeycode, isKeyPressWith, isKeyPressed, isKeyReleaseWith, withShift)
-import Chelleport.Draw (MonadDraw, cellSize)
+import Chelleport.Control (MonadControl (getMousePointerPosition, mouseButtonDown, mouseButtonUp, moveMousePointer, pressMouseButton), directionalIncrement, eventToKeycode, isKeyPressWith, isKeyPressed, isKeyReleaseWith, withShift)
+import Chelleport.Draw (MonadDraw (windowPosition), cellSize)
import Chelleport.KeySequence (findMatchPosition, generateGrid, isValidKey, nextChars, toKeyChar)
import Chelleport.Types
import Chelleport.Utils (intToCInt)
@@ -110,7 +108,8 @@ update state (MoveMousePosition (row, col)) = do
(wcell, hcell) <- cellSize state
let x = (wcell `div` 2) + wcell * intToCInt col
let y = (hcell `div` 2) + hcell * intToCInt row
- pure (x, y)
+ (winx, winy) <- windowPosition
+ pure (winx + x, winy + y)
-- Reset entered key sequence and state
update state ResetKeys = do