module Graphics.UI.Fungen.Display (
        display
) where
import Graphics.UI.Fungen.Game
import Graphics.UI.Fungen.Util (when)
import Graphics.Rendering.OpenGL
import Graphics.UI.GLUT
display :: Game t s u v -> IOGame t s u v () -> DisplayCallback
display g gameCycle = do 
        clear [ColorBuffer]
        runIOGame (displayIOGame gameCycle) g
        swapBuffers
        flush
displayIOGame :: IOGame t s u v () -> IOGame t s u v ()
displayIOGame gameCycle = do
        (_,_,objectsMoving) <- getGameFlags
        when objectsMoving moveAllObjects
	gameCycle
        (mapDrawing,objectsDrawing,_) <- getGameFlags
        when mapDrawing drawMap
        when objectsDrawing drawAllObjects
        printText