restore imperative shell
This commit is contained in:
@@ -15,13 +15,7 @@ struct
|
||||
end
|
||||
in
|
||||
fun update (inputMailbox, drawMailbox, initial) =
|
||||
loop
|
||||
( inputMailbox
|
||||
, drawMailbox
|
||||
, 0.0
|
||||
, 0.0
|
||||
, AppType.getInitial (Constants.windowWidth, Constants.windowHeight)
|
||||
)
|
||||
loop (inputMailbox, drawMailbox, 0.0, 0.0, initial)
|
||||
end
|
||||
|
||||
fun draw
|
||||
@@ -100,14 +94,11 @@ struct
|
||||
| RESIZE_TRIANGLES_BUTTONS_AND_GRAPH {triangles, graphLines} =>
|
||||
let
|
||||
val _ =
|
||||
AppDraw.uploadTrianglesVector
|
||||
(triangleDrawObject, triangles)
|
||||
AppDraw.uploadTrianglesVector (triangleDrawObject, triangles)
|
||||
val triangleDrawLength = Vector.length triangles div 2
|
||||
(* buttons are reset by setting buttonDrawLength to 0 *)
|
||||
val _ =
|
||||
AppDraw.uploadGraphLines
|
||||
(graphDrawObject, graphLines)
|
||||
val drawGraphLength = Vector.length graphLines div 2
|
||||
(* buttons are reset by setting buttonDrawLength to 0 *)
|
||||
val _ = AppDraw.uploadGraphLines (graphDrawObject, graphLines)
|
||||
val drawGraphLength = Vector.length graphLines div 2
|
||||
in
|
||||
draw
|
||||
( drawMailbox
|
||||
|
||||
@@ -15,12 +15,18 @@ struct
|
||||
val _ = Glfw.makeContextCurrent window
|
||||
val _ = Gles3.loadGlad ()
|
||||
|
||||
val initialModel = AppType.getInitial (Constants.windowWidth, Constants.windowHeight)
|
||||
val initialModel =
|
||||
AppInit.fromWindowWidthAndHeight
|
||||
(Constants.windowWidth, Constants.windowHeight)
|
||||
|
||||
val graphLines = #graphLines initialModel
|
||||
val graphLines =
|
||||
let
|
||||
open AppType
|
||||
in
|
||||
#graphLines initialModel
|
||||
end
|
||||
val graphDrawObject = AppDraw.initGraphLines ()
|
||||
val _ =
|
||||
AppDraw.uploadGraphLines (graphDrawObject, graphLines)
|
||||
val _ = AppDraw.uploadGraphLines (graphDrawObject, graphLines)
|
||||
|
||||
val buttonDrawObject = AppDraw.initButton ()
|
||||
val triangleDrawObject = AppDraw.initTriangles ()
|
||||
@@ -30,8 +36,8 @@ struct
|
||||
|
||||
val _ = CML.spawn (fn () =>
|
||||
InputCallbacks.registerCallbacks (window, inputMailbox))
|
||||
val _ = CML.spawn
|
||||
(fn () => EventLoop.update (inputMailbox, drawMailbox, initialModel))
|
||||
val _ = CML.spawn (fn () =>
|
||||
EventLoop.update (inputMailbox, drawMailbox, initialModel))
|
||||
val _ = CML.spawn (fn () =>
|
||||
EventLoop.draw
|
||||
( drawMailbox
|
||||
|
||||
Reference in New Issue
Block a user