module Irg.Lab2.GL.Initialize (initialize) where

--import qualified Graphics.GL.Compatibility33 as GL
import qualified Graphics.UI.GLUT as GLUT
import Graphics.UI.GLUT (($=))
--import Data.IORef
import Irg.Lab2.GL.Utility

initialize :: GameState -> ReshapeCallback -> DisplayCallback -> KeyboardCallback -> MouseCallback -> IO ()
initialize gameState reshapeCallback displayCallback keyboardCallback mouseCallback = do
  _ <- GLUT.initialize "irg" []
  GLUT.initialWindowPosition $= GLUT.Position 100 100
  GLUT.initialWindowSize $= GLUT.Size 400 400
  GLUT.initialDisplayMode $= [GLUT.RGBAMode, GLUT.DoubleBuffered]
  GLUT.actionOnWindowClose $= GLUT.MainLoopReturns

  _ <- GLUT.createWindow "irg"

  GLUT.reshapeCallback $= Just (reshapeCallback gameState)
  GLUT.displayCallback $= displayCallback gameState
  GLUT.keyboardCallback $= Just (keyboardCallback gameState)
  GLUT.mouseCallback $= Just (mouseCallback gameState)
  print "Start end"

  GLUT.get GLUT.initState >>= print
  GLUT.get GLUT.glVersion >>= print

  GLUT.mainLoop
