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;
|
||||
pf.last_framebuffer_size.width = width;
|
||||
pf.last_framebuffer_size.height = height;
|
||||
render(pf.core) catch {};
|
||||
}
|
||||
}.callback;
|
||||
platform.window.setFramebufferSizeCallback(framebuffer_size_callback);
|
||||
|
|
@ -592,6 +593,11 @@ pub fn main() !void {
|
|||
defer app.deinit(core);
|
||||
|
||||
while (!core.internal.window.shouldClose()) {
|
||||
try render(core);
|
||||
}
|
||||
}
|
||||
|
||||
fn render(core: *Core) !void {
|
||||
// On Darwin targets, Dawn requires an NSAutoreleasePool per frame to release
|
||||
// some resources. See Dawn's CHelloWorld example.
|
||||
const pool = try util.AutoReleasePool.init();
|
||||
|
|
@ -601,7 +607,6 @@ pub fn main() !void {
|
|||
|
||||
try app.update(core);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn coreInit(allocator: std.mem.Allocator) !*Core {
|
||||
const core: *Core = try allocator.create(Core);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue