push examples to new sdl version

This commit is contained in:
nek0 2019-10-28 17:10:56 +01:00
parent 8ff4b216c3
commit 25fd9acffd
3 changed files with 10 additions and 6 deletions

View file

@ -12,6 +12,7 @@ import Control.Monad (when)
import qualified SDL hiding (Window(..)) import qualified SDL hiding (Window(..))
import Data.Maybe (isJust, fromJust) import Data.Maybe (isJust, fromJust)
import Data.String
data StateData = StateData data StateData = StateData
{ sdSubs :: Subsystems { sdSubs :: Subsystems
@ -111,7 +112,7 @@ main = do
[ [
( 0 ( 0
, SDL.defaultWindow , SDL.defaultWindow
{ SDL.windowOpenGL = Just SDL.defaultOpenGL { SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3 { SDL.glProfile = SDL.Core SDL.Normal 3 3
} }
} }
@ -183,7 +184,8 @@ handle es = do
=<< consumeSDLEvents b =<< consumeSDLEvents b
=<< consumeSDLEvents c =<< consumeSDLEvents c
=<< consumeSDLEvents d es =<< consumeSDLEvents d es
mapM_ (\e -> liftIO $ logIO Verbose $ "LEFTOVER: " ++ show e) leftovers mapM_ (\e -> liftIO $ logIO Verbose $ "LEFTOVER: " <> fromString (show e))
leftovers
update _ = return () update _ = return ()

View file

@ -14,6 +14,7 @@ import Control.DeepSeq (deepseq)
import Data.Matrix as M import Data.Matrix as M
import qualified Data.Set as S import qualified Data.Set as S
import Data.String
import System.Random (randomRIO) import System.Random (randomRIO)
@ -40,7 +41,7 @@ main = do
[ [
( 0 ( 0
, SDL.defaultWindow , SDL.defaultWindow
{ SDL.windowOpenGL = Just SDL.defaultOpenGL { SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3 { SDL.glProfile = SDL.Core SDL.Normal 3 3
} }
, SDL.windowInitialSize = SDL.V2 600 600 , SDL.windowInitialSize = SDL.V2 600 600
@ -133,7 +134,7 @@ showFPS (MsgKeyboardEvent _ _ _ _ sym) =
case SDL.keysymKeycode sym of case SDL.keysymKeycode sym of
SDL.KeycodeF -> do SDL.KeycodeF -> do
dt <- getDelta dt <- getDelta
liftIO $ logIO A.Debug $ "FPS: " ++ show (1 / dt) liftIO $ logIO A.Debug $ "FPS: " <> fromString (show (1 / dt))
_ -> return () _ -> return ()
showFPS _ = return () showFPS _ = return ()

View file

@ -14,6 +14,7 @@ import Control.DeepSeq (deepseq)
import Data.Matrix as M import Data.Matrix as M
import qualified Data.Set as S import qualified Data.Set as S
import Data.String
import System.Random (randomRIO) import System.Random (randomRIO)
@ -43,7 +44,7 @@ main = do
[ [
( 0 ( 0
, SDL.defaultWindow , SDL.defaultWindow
{ SDL.windowOpenGL = Just SDL.defaultOpenGL { SDL.windowGraphicsContext = SDL.OpenGLContext SDL.defaultOpenGL
{ SDL.glProfile = SDL.Core SDL.Normal 3 3 { SDL.glProfile = SDL.Core SDL.Normal 3 3
} }
, SDL.windowInitialSize = SDL.V2 600 600 , SDL.windowInitialSize = SDL.V2 600 600
@ -136,7 +137,7 @@ showFPS (MsgKeyboardEvent _ _ _ _ sym) =
case SDL.keysymKeycode sym of case SDL.keysymKeycode sym of
SDL.KeycodeF -> do SDL.KeycodeF -> do
dt <- getDelta dt <- getDelta
liftIO $ logIO A.Debug $ "FPS: " ++ show (1 / dt) liftIO $ logIO A.Debug $ "FPS: " <> fromString (show (1 / dt))
_ -> return () _ -> return ()
showFPS _ = return () showFPS _ = return ()