aboutsummaryrefslogtreecommitdiff
path: root/src/Chelleport
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2024-12-20 20:45:11 +0530
committerAkshay Nair <phenax5@gmail.com>2024-12-20 20:45:11 +0530
commit69f9c8ac053de7793c31c87572c9e044ae8369ee (patch)
treee4d017be238d1064c274a33a55550fccc968d21b /src/Chelleport
parent496c7d048df6a9a3650c0a0b996888decb4ea9d1 (diff)
downloadchelleport-69f9c8ac053de7793c31c87572c9e044ae8369ee.tar.gz
chelleport-69f9c8ac053de7793c31c87572c9e044ae8369ee.zip
Minor refactor
Diffstat (limited to 'src/Chelleport')
-rw-r--r--src/Chelleport/AppShell.hs10
-rw-r--r--src/Chelleport/Types.hs12
2 files changed, 11 insertions, 11 deletions
diff --git a/src/Chelleport/AppShell.hs b/src/Chelleport/AppShell.hs
index e8cd3ab..28007f7 100644
--- a/src/Chelleport/AppShell.hs
+++ b/src/Chelleport/AppShell.hs
@@ -1,4 +1,4 @@
-module Chelleport.AppShell where
+module Chelleport.AppShell (setupAppShell, MonadAppShell (..)) where
import Chelleport.Draw (colorBackground)
import Chelleport.Types
@@ -26,6 +26,14 @@ instance (MonadIO m) => MonadAppShell (AppM m) where
X11.closeDisplay $ ctxX11Display ctx
exitSuccess
+type Update state appAction = state -> appAction -> IO (state, Maybe appAction)
+
+type EventHandler state appAction = state -> SDL.Event -> Maybe appAction
+
+type View state = state -> IO ()
+
+type Initializer state = IO state
+
setupAppShell ::
DrawContext ->
Initializer state ->
diff --git a/src/Chelleport/Types.hs b/src/Chelleport/Types.hs
index ca17c23..9752552 100644
--- a/src/Chelleport/Types.hs
+++ b/src/Chelleport/Types.hs
@@ -26,8 +26,8 @@ data AppAction
= HandleKeyInput SDL.Keycode
| MoveMousePosition (Int, Int)
| ResetKeys
- | TriggerLeftClick
- | ChainLeftClick
+ | TriggerMouseClick MouseButtonType
+ | ChainMouseClick MouseButtonType
| IncrementMouseCursor (Int, Int)
| ShutdownApp
| UpdateShiftState Bool
@@ -40,14 +40,6 @@ data DrawContext = DrawContext
ctxX11Display :: X11.Display
}
-type Update state appAction = state -> appAction -> IO (state, Maybe appAction)
-
-type EventHandler state appAction = state -> SDL.Event -> Maybe appAction
-
-type View state = state -> IO ()
-
-type Initializer state = IO state
-
data MouseButtonType = LeftClick
deriving (Show, Eq)