Core: add .present_frame event replacing swapbuffers call
Note that on e.g. web platform, swapbuffers is not an explicit call. We also need a signal that the frame has been submitted and finished, and this is it. Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
431e0dbbe1
commit
656b0202f2
9 changed files with 79 additions and 38 deletions
|
|
@ -63,9 +63,6 @@ fn init(
|
|||
text_style: *gfx.TextStyle.Mod,
|
||||
game: *Mod,
|
||||
) !void {
|
||||
// The Mach .core is where we set window options, etc.
|
||||
mach.core.setTitle("gfx.Text example");
|
||||
|
||||
// TODO: a better way to initialize entities with default values
|
||||
// TODO(text): most of these style options are not respected yet.
|
||||
const style1 = try core.newEntity();
|
||||
|
|
@ -268,7 +265,7 @@ fn endFrame(game: *Mod, text: *gfx.Text.Mod, core: *mach.Core.Mod) !void {
|
|||
core.state().queue.submit(&[_]*gpu.CommandBuffer{command});
|
||||
|
||||
// Present the frame
|
||||
mach.core.swap_chain.present();
|
||||
core.send(.present_frame, .{});
|
||||
|
||||
// Every second, update the window title with the FPS
|
||||
if (game.state().fps_timer.read() >= 1.0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue