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 ())
|
2025-07-13 04:03:44 +01:00
|
|
|
val _ = Glfw.windowHint (Glfw.SAMPLES (), 0)
|
2024-07-31 22:25:15 +01:00
|
|
|
val window =
|
|
|
|
|
Glfw.createWindow
|
2024-08-01 20:52:20 +01:00
|
|
|
(Constants.windowWidth, Constants.windowHeight, "Dotscape")
|
2024-07-28 14:22:17 +01:00
|
|
|
val _ = Glfw.makeContextCurrent window
|
|
|
|
|
val _ = Gles3.loadGlad ()
|
|
|
|
|
|
2024-09-20 21:33:35 +01:00
|
|
|
val initialModel = AppInit.fromWindowWidthAndHeight
|
|
|
|
|
( Constants.windowWidth
|
|
|
|
|
, Constants.windowHeight
|
2025-02-18 11:53:28 +00:00
|
|
|
, Constants.initialWidthClickPoints
|
|
|
|
|
, Constants.initialHeightClickPoints
|
2024-09-20 21:33:35 +01:00
|
|
|
)
|
2024-08-03 06:05:26 +01:00
|
|
|
|
2024-08-13 23:49:34 +01:00
|
|
|
val graphLines = GraphLines.generate initialModel
|
2024-07-30 11:17:19 +01:00
|
|
|
val graphDrawObject = AppDraw.initGraphLines ()
|
2024-08-08 05:56:20 +01:00
|
|
|
val _ = AppDraw.uploadGraphLines (graphDrawObject, graphLines)
|
2024-08-03 06:05:26 +01:00
|
|
|
|
2024-08-14 21:24:46 +01:00
|
|
|
val dotDrawObject = AppDraw.initDot ()
|
2025-07-06 15:14:19 +01:00
|
|
|
val squareDrawObject = AppDraw.initSquares ()
|
2025-02-18 11:53:28 +00:00
|
|
|
|
2024-09-27 09:08:19 +01:00
|
|
|
val modalTextDrawObject = AppDraw.initModalText ()
|
2024-07-30 11:17:19 +01:00
|
|
|
|
2024-07-28 14:22:17 +01:00
|
|
|
val inputMailbox = Mailbox.mailbox ()
|
2024-07-31 12:00:07 +01:00
|
|
|
val drawMailbox = Mailbox.mailbox ()
|
2024-08-28 20:42:52 +01:00
|
|
|
val fileMailbox = Mailbox.mailbox ()
|
|
|
|
|
|
|
|
|
|
val _ = InputCallbacks.registerCallbacks (window, inputMailbox)
|
2024-07-30 17:10:48 +01:00
|
|
|
|
2024-07-31 12:30:12 +01:00
|
|
|
val _ = CML.spawn (fn () =>
|
2024-08-28 20:42:52 +01:00
|
|
|
UpdateThread.run (inputMailbox, drawMailbox, fileMailbox, initialModel))
|
|
|
|
|
|
2024-07-31 12:30:12 +01:00
|
|
|
val _ = CML.spawn (fn () =>
|
2024-08-28 19:34:47 +01:00
|
|
|
DrawThread.run
|
2024-07-31 22:25:15 +01:00
|
|
|
( drawMailbox
|
|
|
|
|
, window
|
|
|
|
|
, graphDrawObject
|
2024-08-03 06:05:26 +01:00
|
|
|
, Vector.length graphLines div 2
|
2024-08-14 21:24:46 +01:00
|
|
|
, dotDrawObject
|
2024-07-31 22:25:15 +01:00
|
|
|
, 0
|
2025-07-06 15:14:19 +01:00
|
|
|
, squareDrawObject
|
2024-07-31 22:25:15 +01:00
|
|
|
, 0
|
2024-09-27 09:08:19 +01:00
|
|
|
, modalTextDrawObject
|
|
|
|
|
, 0
|
2024-07-31 22:25:15 +01:00
|
|
|
))
|
2024-08-28 20:42:52 +01:00
|
|
|
|
2024-08-29 05:38:58 +01:00
|
|
|
val _ = CML.spawn (fn () => FileThread.run (fileMailbox, inputMailbox))
|
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)
|