-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGameOfLife.hs
More file actions
29 lines (26 loc) · 770 Bytes
/
GameOfLife.hs
File metadata and controls
29 lines (26 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import qualified Rendering2D
import Game2D
import qualified Rendering3D
import Graphics.UI.GLUT
import Data.IORef
main :: IO ()
main = do
initialDisplayMode $= [DoubleBuffered]
initialWindowSize $= (Size 1000 1000)
getArgsAndInitialize
w <- createWindow "Game of Life"
displayCallback $= display
twoOrThree <- newIORef 0
keyboardMouseCallback $= Just (keyboardMouse)
reshapeCallback $= Just (\x -> (viewport $= (Position 0 0, Size 1000 1000)))
mainLoop
display :: DisplayCallback
display = do
clear [ ColorBuffer ]
flush
keyboardMouse :: KeyboardMouseCallback
keyboardMouse key Down _ _ = case key of
(Char '2') -> (Rendering2D.maindraw)
(Char '3') -> (Rendering3D.maindraw)
_ -> return()
keyboardMouse _ _ _ _ = return ()