module Display (display) where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Data.IORef import States import Stones import qualified Data.Map as Map import SetValue (setButtonDiplay) display :: (IORef MState) -> (IORef DState) -> (IORef TexObjGrp) -> IO() display mst dst tObGp = do clearColor $= (Color4 0.4 0.5 0.5 1.0) clear [ColorBuffer] shadeModel $= Smooth loadIdentity mst' <- readIORef mst dst' <- readIORef dst tObGp' <- readIORef tObGp let cks = (Map.keys (eCounter dst')) gbcs = (gBoardCells mst') gModeButton = Map.lookup (gameMode mst') setButtonDiplay if (gameMode mst' == GamePlay1P) || (gameMode mst' == GamePlay2P) then do dboardSet mst' tObGp' 0 mapM_ (dstoneSet mst' tObGp') (Map.keys gbcs) eventFrame mst' mapM_ (counterSet dst' mst' tObGp') cks else return () case gModeButton of Nothing -> return () Just b -> mapM_ (dButtonSet mst' dst' tObGp') b swapBuffers