diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2010-02-22 22:25:06 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2010-02-22 22:25:06 +0100 |
commit | f10352a0f1626ce1475acb9c27067e52e90a20fb (patch) | |
tree | 20fe46d9cea347a66436cac4f192f10987dde540 /HTanks.hs | |
parent | 8f693405d6a0237125836b15c0742bbba9945b5e (diff) | |
download | htanks-f10352a0f1626ce1475acb9c27067e52e90a20fb.tar htanks-f10352a0f1626ce1475acb9c27067e52e90a20fb.zip |
Handle quit events
Diffstat (limited to 'HTanks.hs')
-rw-r--r-- | HTanks.hs | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1,3 +1,5 @@ +{-# LANGUAGE PatternGuards #-} + import Game import Level import Tank @@ -16,8 +18,9 @@ main = do let gameState = GameState {level = testLevel, tanks = [Tank 0.5 0.5 0]} - (_, gameState) <- runGame gameState $ mainLoop gl - print $ tanks gameState + runGame gameState $ mainLoop gl + + deinitGL gl mainLoop :: Driver a => a -> Game () mainLoop gl = do @@ -35,4 +38,6 @@ handleEvents gl = do return True handleEvent :: SomeEvent -> IO Bool -handleEvent ev = return True
\ No newline at end of file +handleEvent ev + | Just QuitEvent <- fromEvent ev = return False + | otherwise = return True |