From 53f0662a4334e469053714dd2aea2bb7394a7872 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Wed, 15 Mar 2023 13:34:23 +1300 Subject: [PATCH] Keep the SDL window open! --- src/Main.hs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Main.hs b/src/Main.hs index 8c843cd..69eb955 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -141,4 +141,14 @@ main = do w <- createWindow "Typograffiti" wcfg _ <- glCreateContext w - putStrLn "Hello, Haskell!" + fix $ \loop -> do + events <- fmap eventPayload <$> pollEvents + liftIO $ glClearColor 0 0 0 1 + liftIO $ glClear GL_COLOR_BUFFER_BIT + + sz@(V2 dw dh) <- liftIO $ glGetDrawableSize w + liftIO $ glViewport 0 0 (fromIntegral dw) (fromIntegral dh) + + liftIO $ glSwapWindow w + unless (QuitEvent `elem` events) loop + return () -- 2.30.2