Files
sml-projects/imperative-shell/shell.sml

35 lines
1.0 KiB
Standard ML
Raw Normal View History

2024-07-28 14:22:17 +01:00
structure Shell =
struct
open CML
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 (Constants.windowWidth, Constants.windowHeight, "MLton - dot to dot")
2024-07-28 14:22:17 +01:00
val _ = Glfw.makeContextCurrent window
val _ = Gles3.loadGlad ()
val graphDrawObject = AppDraw.initGraphLines ()
val buttonDrawObject = AppDraw.initButton ()
2024-07-28 14:22:17 +01:00
val inputMailbox = Mailbox.mailbox ()
2024-07-31 12:00:07 +01:00
val drawMailbox = Mailbox.mailbox ()
val _ = CML.spawn (fn () =>
InputCallbacks.registerCallbacks (window, inputMailbox))
2024-07-31 12:00:07 +01:00
val _ = CML.spawn (fn () => EventLoop.update (inputMailbox, drawMailbox))
val _ = CML.spawn (fn () =>
EventLoop.draw
(drawMailbox, window, graphDrawObject, buttonDrawObject, 0))
2024-07-28 14:22:17 +01:00
in
2024-07-31 12:00:07 +01:00
()
2024-07-28 14:22:17 +01:00
end
end
val _ = RunCML.doit (Shell.main, NONE)