Переход на CpuRenderEngine

This commit is contained in:
2025-12-21 17:37:43 +03:00
parent 3ac35a5046
commit d640269cad
4 changed files with 52 additions and 55 deletions

View File

@@ -33,7 +33,6 @@ pub fn main() !void {
defer ctx.deinit();
var interrupted = false;
main_loop: while (true) {
// beginWait coordinates with waitTime below to run frames only when needed
const nstime = win.beginWait(interrupted);
@@ -89,12 +88,12 @@ fn gui_frame(ctx: *WindowContext) bool {
var left_panel = dvui.box(@src(), .{ .dir = .vertical }, .{ .expand = .vertical, .min_size_content = .{ .w = 200 }, .background = true });
{
dvui.label(@src(), "Tools", .{}, .{});
if (dvui.button(@src(), "Fill Random Color", .{}, .{})) {
if (dvui.button(@src(), "Fill Random Color", .{}, .{}) or ctx.frame_index == 0) {
canvas.exampleReset() catch |err| {
std.debug.print("Error filling canvas: {}\n", .{err});
};
canvas.pos = .{ .x = 400, .y = 400 };
canvas.setZoom(dvui.windowNaturalScale());
ctx.canvas.pos = .{ .x = 400, .y = 400 };
ctx.canvas.setZoom(dvui.windowNaturalScale());
}
if (dvui.checkbox(@src(), &canvas.native_scaling, "Scaling", .{})) {}
}
@@ -222,5 +221,7 @@ fn gui_frame(ctx: *WindowContext) bool {
}
back.deinit();
ctx.frame_index += 1;
return true;
}