mach: render during resize

This commit is contained in:
Ali Chraghi 2022-12-28 20:44:42 +03:30 committed by Stephen Gutekanst
parent 69cbe954ac
commit c26592ea89

View file

@ -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,17 +593,21 @@ pub fn main() !void {
defer app.deinit(core);
while (!core.internal.window.shouldClose()) {
// On Darwin targets, Dawn requires an NSAutoreleasePool per frame to release
// some resources. See Dawn's CHelloWorld example.
const pool = try util.AutoReleasePool.init();
defer util.AutoReleasePool.release(pool);
try coreUpdate(core, null);
try app.update(core);
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();
defer util.AutoReleasePool.release(pool);
try coreUpdate(core, null);
try app.update(core);
}
pub fn coreInit(allocator: std.mem.Allocator) !*Core {
const core: *Core = try allocator.create(Core);
errdefer allocator.destroy(core);