From 25fd9acffd0438c9fb90e395cba53aaae896625e Mon Sep 17 00:00:00 2001 From: nek0 Date: Mon, 28 Oct 2019 17:10:56 +0100 Subject: [PATCH] push examples to new sdl version --- examples/example00/Main.hs | 6 ++++-- examples/example01/Main.hs | 5 +++-- examples/example02/Main.hs | 5 +++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/examples/example00/Main.hs b/examples/example00/Main.hs index a56f688..31b3a49 100644 --- a/examples/example00/Main.hs +++ b/examples/example00/Main.hs @@ -12,6 +12,7 @@ import Control.Monad (when) import qualified SDL hiding (Window(..)) import Data.Maybe (isJust, fromJust) +import Data.String data StateData = StateData { sdSubs :: Subsystems @@ -111,7 +112,7 @@ main = do [ ( 0 , SDL.defaultWindow - { SDL.windowOpenGL = Just SDL.defaultOpenGL + { SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL { SDL.glProfile = SDL.Core SDL.Normal 3 3 } } @@ -183,7 +184,8 @@ handle es = do =<< consumeSDLEvents b =<< consumeSDLEvents c =<< consumeSDLEvents d es - mapM_ (\e -> liftIO $ logIO Verbose $ "LEFTOVER: " ++ show e) leftovers + mapM_ (\e -> liftIO $ logIO Verbose $ "LEFTOVER: " <> fromString (show e)) + leftovers update _ = return () diff --git a/examples/example01/Main.hs b/examples/example01/Main.hs index 5c1fabe..28a5dd9 100644 --- a/examples/example01/Main.hs +++ b/examples/example01/Main.hs @@ -14,6 +14,7 @@ import Control.DeepSeq (deepseq) import Data.Matrix as M import qualified Data.Set as S +import Data.String import System.Random (randomRIO) @@ -40,7 +41,7 @@ main = do [ ( 0 , SDL.defaultWindow - { SDL.windowOpenGL = Just SDL.defaultOpenGL + { SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL { SDL.glProfile = SDL.Core SDL.Normal 3 3 } , SDL.windowInitialSize = SDL.V2 600 600 @@ -133,7 +134,7 @@ showFPS (MsgKeyboardEvent _ _ _ _ sym) = case SDL.keysymKeycode sym of SDL.KeycodeF -> do dt <- getDelta - liftIO $ logIO A.Debug $ "FPS: " ++ show (1 / dt) + liftIO $ logIO A.Debug $ "FPS: " <> fromString (show (1 / dt)) _ -> return () showFPS _ = return () diff --git a/examples/example02/Main.hs b/examples/example02/Main.hs index 028e4ad..30454ed 100644 --- a/examples/example02/Main.hs +++ b/examples/example02/Main.hs @@ -14,6 +14,7 @@ import Control.DeepSeq (deepseq) import Data.Matrix as M import qualified Data.Set as S +import Data.String import System.Random (randomRIO) @@ -43,7 +44,7 @@ main = do [ ( 0 , SDL.defaultWindow - { SDL.windowOpenGL = Just SDL.defaultOpenGL + { SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL { SDL.glProfile = SDL.Core SDL.Normal 3 3 } , SDL.windowInitialSize = SDL.V2 600 600 @@ -136,7 +137,7 @@ showFPS (MsgKeyboardEvent _ _ _ _ sym) = case SDL.keysymKeycode sym of SDL.KeycodeF -> do dt <- getDelta - liftIO $ logIO A.Debug $ "FPS: " ++ show (1 / dt) + liftIO $ logIO A.Debug $ "FPS: " <> fromString (show (1 / dt)) _ -> return () showFPS _ = return ()