import Game import Level import Tank import GLDriver import GLX import Control.Concurrent (threadDelay) import Control.Monad.State import Data.Maybe main :: IO () main = do gl <- initGL glxDriver let gameState = GameState {level = testLevel, tanks = [Tank 0.5 0.5 0]} (_, gameState) <- runGame gameState $ mainLoop gl print $ tanks gameState mainLoop :: Driver a => a -> Game () mainLoop gl = do run <- liftIO $ handleEvents gl liftIO $ threadDelay 10000 when run $ mainLoop gl handleEvents :: Driver a => a -> IO Bool handleEvents gl = do event <- nextEvent gl if (isJust event) then handleEvent $ fromJust event else return True handleEvent :: SomeEvent -> IO Bool handleEvent ev = return True