From 80add34b15855932e9201d7426d9df01aa82c845 Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 14 Dec 2024 11:23:35 +0530 Subject: Add key sequence filtering and rendering matched keys --- src/Chelleport/AppShell.hs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/Chelleport/AppShell.hs') 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 -- cgit v1.3.1