diff options
| author | Akshay Nair <phenax5@gmail.com> | 2024-12-14 11:23:35 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2024-12-14 11:23:35 +0530 |
| commit | 80add34b15855932e9201d7426d9df01aa82c845 (patch) | |
| tree | 1a5ce02bf169da0dd49c3bf907da129d5c5f4118 /src/Chelleport/AppShell.hs | |
| parent | 8fb21cb43b610c5a04268637155d3efb07217040 (diff) | |
| download | chelleport-80add34b15855932e9201d7426d9df01aa82c845.tar.gz chelleport-80add34b15855932e9201d7426d9df01aa82c845.zip | |
Add key sequence filtering and rendering matched keys
Diffstat (limited to 'src/Chelleport/AppShell.hs')
| -rw-r--r-- | src/Chelleport/AppShell.hs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/Chelleport/AppShell.hs b/src/Chelleport/AppShell.hs index 5f97877..74ca784 100644 --- a/src/Chelleport/AppShell.hs +++ b/src/Chelleport/AppShell.hs @@ -17,9 +17,18 @@ data DrawContext = DrawContext createContext :: IO DrawContext createContext = do + -- bounds <- fmap SDL.displayBoundsSize <$> SDL.getDisplays + -- let windowSize = case bounds of + -- (x : _) -> x + -- _ -> SDL.V2 800 600 + let windowSize = SDL.V2 0 0 + let windowCfg = - SDL.defaultWindow -- SDL.windowMode = SDL.Fullscreen, + SDL.defaultWindow { SDL.windowInputGrabbed = True, + SDL.windowMode = SDL.FullscreenDesktop, + SDL.windowPosition = SDL.Absolute $ SDL.P $ SDL.V2 0 0, + SDL.windowInitialSize = windowSize, SDL.windowBorder = False } window <- SDL.createWindow "My SDL Application" windowCfg @@ -33,7 +42,7 @@ createContext = do pure $ DrawContext {ctxWindow = window, ctxRenderer = renderer, ctxFont = font} setupAppShell :: - state -> + (DrawContext -> IO state) -> (state -> DrawContext -> appAction -> IO state) -> (state -> SDL.Event -> Maybe (Action appAction)) -> (state -> DrawContext -> IO ()) -> @@ -44,7 +53,8 @@ setupAppShell initState update eventHandler draw = do TTF.initialize ctx <- createContext - appLoop ctx (initState, SysState {sysExit = False}) + state <- initState ctx + appLoop ctx (state, SysState {sysExit = False}) SDL.destroyRenderer $ ctxRenderer ctx SDL.destroyWindow $ ctxWindow ctx |
