mach: render during resize
This commit is contained in:
parent
69cbe954ac
commit
c26592ea89
1 changed files with 13 additions and 8 deletions
|
|
@ -299,6 +299,7 @@ pub const Platform = struct {
|
||||||
const pf = (window.getUserPointer(UserPtr) orelse unreachable).platform;
|
const pf = (window.getUserPointer(UserPtr) orelse unreachable).platform;
|
||||||
pf.last_framebuffer_size.width = width;
|
pf.last_framebuffer_size.width = width;
|
||||||
pf.last_framebuffer_size.height = height;
|
pf.last_framebuffer_size.height = height;
|
||||||
|
render(pf.core) catch {};
|
||||||
}
|
}
|
||||||
}.callback;
|
}.callback;
|
||||||
platform.window.setFramebufferSizeCallback(framebuffer_size_callback);
|
platform.window.setFramebufferSizeCallback(framebuffer_size_callback);
|
||||||
|
|
@ -592,6 +593,11 @@ pub fn main() !void {
|
||||||
defer app.deinit(core);
|
defer app.deinit(core);
|
||||||
|
|
||||||
while (!core.internal.window.shouldClose()) {
|
while (!core.internal.window.shouldClose()) {
|
||||||
|
try render(core);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn render(core: *Core) !void {
|
||||||
// On Darwin targets, Dawn requires an NSAutoreleasePool per frame to release
|
// On Darwin targets, Dawn requires an NSAutoreleasePool per frame to release
|
||||||
// some resources. See Dawn's CHelloWorld example.
|
// some resources. See Dawn's CHelloWorld example.
|
||||||
const pool = try util.AutoReleasePool.init();
|
const pool = try util.AutoReleasePool.init();
|
||||||
|
|
@ -600,7 +606,6 @@ pub fn main() !void {
|
||||||
try coreUpdate(core, null);
|
try coreUpdate(core, null);
|
||||||
|
|
||||||
try app.update(core);
|
try app.update(core);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn coreInit(allocator: std.mem.Allocator) !*Core {
|
pub fn coreInit(allocator: std.mem.Allocator) !*Core {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue