implemented a frame skip request

This commit is contained in:
Alessandro Mauri 2025-10-11 22:32:00 +02:00
parent b5ef86d092
commit b9e91c3119
5 changed files with 26 additions and 0 deletions

View file

@ -120,6 +120,8 @@ struct Ctx {
Font font;
SpriteAtlas sprite_atlas;
bool skip_frame;
bool has_focus;
InputData input, current_input;
@ -262,6 +264,8 @@ fn void? Ctx.frame_begin(&ctx)
elem.layout.h = @exact(ctx.height);
ctx.div_scissor = elem.bounds;
ctx.skip_frame = false;
}
fn void? Ctx.frame_end(&ctx)
@ -306,6 +310,11 @@ fn void? Ctx.frame_end(&ctx)
ctx.push_update_atlas(&ctx.sprite_atlas.atlas)!;
ctx.sprite_atlas.should_update = false;
}
// send skip frame request
if (ctx.skip_frame) {
ctx.cmd_queue.push({.type = CMD_REQ_SKIP_FRAME});
}
// sort the command buffer by the z-index
// FIXME: sorting the buffer fucks with scissor commands that have to be kept in place