-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshell.sml
37 lines (34 loc) · 1015 Bytes
/
shell.sml
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
30
31
32
33
34
35
36
37
structure Shell =
struct
open GameTypes
fun loop (window, game: game_board) =
if not (Glfw.windowShouldClose window) then
let
val _ = Gles3.clearColor (0.1, 0.1, 0.1, 0.1)
val _ = Gles3.clear ()
val game = GameUpdate.update game
val _ = GameDraw.draw game
val _ = Glfw.pollEvents ()
val _ = Glfw.swapBuffers window
in
loop (window, game)
end
else
Glfw.terminate ()
fun main () =
let
(* Set up GLFW. *)
val _ = Glfw.init ()
val _ = Glfw.windowHint (Glfw.CONTEXT_VERSION_MAJOR (), 3)
val _ = Glfw.windowHint (Glfw.DEPRECATED (), Glfw.FALSE ())
val _ = Glfw.windowHint (Glfw.SAMPLES (), 4)
val window = Glfw.createWindow (500, 500, "MLton - Pong Wars")
val _ = Glfw.makeContextCurrent window
val _ = Gles3.loadGlad ()
(* Note: Create initial game state. *)
val game = GameInit.initBoard ()
in
loop (window, game)
end
end
val _ = Shell.main ()