progrfess scaffolding rgfw (next: consume events and add callbacks for events)

This commit is contained in:
2026-01-23 10:55:43 +00:00
parent df20641af1
commit b4573441fb
6 changed files with 36 additions and 31 deletions

View File

@@ -37,20 +37,6 @@ struct
fun consumeEvents (drawState, window) =
consumeEventsLoop (0, DrawMailbox.getMessagesAndClear (), drawState, window)
fun updateLoop (pos, msgVec, app) =
if pos = Vector.length msgVec then
app
else
let
val msg = Vector.sub (msgVec, pos)
val app = Updater.update (app, msg)
in
updateLoop (pos + 1, msgVec, app)
end
fun update app =
updateLoop (0, InputMailbox.getMessagesAndClear (), app)
fun helpLoop (app, drawState, window, gamepad) =
case Glfw.windowShouldClose window of
false =>
@@ -62,10 +48,10 @@ struct
(* one update reacting to gamepad events *)
val (gamepad, actions) = GlfwGamepad.query gamepad
val app = updateLoop (0, Vector.fromList actions, app)
val app = Updater.updateLoop (0, Vector.fromList actions, app)
(* one update reacting to keyboard events *)
val app = update app
val app = Updater.update app
val _ = GlDraw.draw drawState
val _ = Glfw.swapBuffers window