finished episode 25
This commit is contained in:
parent
fa0c6c4670
commit
9fca6a7617
1 changed files with 9 additions and 2 deletions
11
src/Main.hs
11
src/Main.hs
|
@ -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 ()
|
||||
|
|
Loading…
Reference in a new issue