add late_draw schedule
This commit is contained in:
+1
-1
@@ -87,7 +87,7 @@ begin :: proc(state: ^RLMU_State = global_state) -> ^mu.Context {
|
||||
}
|
||||
|
||||
// tell microui the frame is finished, then replay its command list as raylib
|
||||
// draw calls (and close any lingering scissor). UIPlugin runs it at POST_DRAW
|
||||
// draw calls (and close any lingering scissor). UIPlugin runs it at LATE_DRAW
|
||||
end :: proc(state := global_state) {
|
||||
// Tell mui that we're done drawing ui
|
||||
mu.end(&state.ctx)
|
||||
|
||||
+3
-5
@@ -11,16 +11,14 @@ ui_ctx: ^ml.Context
|
||||
//
|
||||
// STARTUP init() bakes the microui atlas into a texture
|
||||
// PRE_DRAW begin() forwards raylib input, starts the frame, stashes ui_ctx
|
||||
// POST_DRAW the frame's temp arena is freed, then end() renders the ui
|
||||
// LATE_DRAW end() renders the ui after all game drawing, still in-frame
|
||||
// POST_DRAW the frame's temp arena is freed
|
||||
// DESTROY destroy() unloads the atlas texture
|
||||
//
|
||||
// (systems within a schedule run in registration order, so POST_DRAW frees
|
||||
// the arena first and renders second)
|
||||
UIPlugin :: proc(app: ^ecs.App) {
|
||||
ecs.add_system(app, ecs.STARTUP, proc() {init()})
|
||||
ecs.add_system(app, ecs.POST_DRAW, proc() {free_all(context.temp_allocator)})
|
||||
ecs.add_system(app, ecs.PRE_DRAW, proc() {ui_ctx = begin()})
|
||||
ecs.add_system(app, ecs.POST_DRAW, proc() {end()})
|
||||
ecs.add_system(app, ecs.LATE_DRAW, proc() {end()})
|
||||
ecs.add_system(app, ecs.DESTROY, proc() {destroy()})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user