Переход на CpuRenderEngine
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user