Переход к RenderEngine

This commit is contained in:
2025-12-21 17:26:19 +03:00
parent 6f58967049
commit 3ac35a5046
11 changed files with 138 additions and 33 deletions

View File

@@ -1,9 +1,9 @@
const std = @import("std");
const builtin = @import("builtin");
const dvui = @import("dvui");
const dvui_ext = @import("./ui/dvui_ext.zig");
const dvui_ext = @import("ui/dvui_ext.zig");
const SDLBackend = @import("sdl-backend");
const Document = @import("Document.zig");
const Document = @import("models/Document.zig");
const WindowContext = @import("WindowContext.zig");
const sdl_c = SDLBackend.c;
const Allocator = std.mem.Allocator;
@@ -29,7 +29,7 @@ pub fn main() !void {
});
defer win.deinit();
var ctx = WindowContext.init(allocator);
var ctx = try WindowContext.init(allocator);
defer ctx.deinit();
var interrupted = false;
@@ -90,7 +90,7 @@ fn gui_frame(ctx: *WindowContext) bool {
{
dvui.label(@src(), "Tools", .{}, .{});
if (dvui.button(@src(), "Fill Random Color", .{}, .{})) {
canvas.fillRandomGradient() catch |err| {
canvas.exampleReset() catch |err| {
std.debug.print("Error filling canvas: {}\n", .{err});
};
canvas.pos = .{ .x = 400, .y = 400 };
@@ -198,7 +198,7 @@ fn gui_frame(ctx: *WindowContext) bool {
switch (action) {
.wheel_y => |y| {
canvas.addZoom(y / 1000);
canvas.redrawGradient() catch {};
canvas.redrawExample() catch {};
},
else => {},
}