finished episode 25

This commit is contained in:
nek0 2020-08-29 05:19:47 +02:00
parent fa0c6c4670
commit 9fca6a7617
1 changed files with 9 additions and 2 deletions

View File

@ -119,6 +119,7 @@ main = do
update sceneObject 0
render sceneObject
else do
GL.clearColor $= GL.Color4 0 0 0 1
GL.clear [GL.ColorBuffer]
-- Switch to different scene on keyboard presses F1 thourgh F?
@ -160,9 +161,15 @@ sceneSwitch curScene evs = mapM_ (switch . SDL.eventPayload) evs
(SDL.Keysym _ code mod))) =
when (SDL.toNumber mod == 0) $
case code of
SDL.KeycodeEscape -> do
isEmpty <- isEmptyMVar curScene
when (not isEmpty) $
void $ tryTakeMVar curScene
SDL.KeycodeF1 -> do
void $ tryTakeMVar curScene
putMVar curScene =<< scene1
isEmpty <- isEmptyMVar curScene
when isEmpty $ do
void $ tryTakeMVar curScene
putMVar curScene =<< scene1
_ ->
return ()
switch _ = return ()