build: update mach-objc build.zig.zon, and small corrections to core-transparent-window example

This commit is contained in:
foxnne 2024-12-08 12:26:51 -06:00 committed by Emi Gutekanst
parent 5ba95f714d
commit a10cbc3419
2 changed files with 6 additions and 7 deletions

View file

@ -22,8 +22,8 @@
.lazy = true, .lazy = true,
}, },
.mach_objc = .{ .mach_objc = .{
.url = "https://pkg.machengine.org/mach-objc/0edc9de456ec90e06006211c8bf0fd72fc8ac0ad.tar.gz", .url = "https://pkg.machengine.org/mach-objc/eb1e1eee9c02039d582f5fd9814d32e48b736ba6.tar.gz",
.hash = "122033028b2bac8c51706c7dcd8133e93215daac758fd7b22d6a020f898358da7cbe", .hash = "12209742f139402c34a8901bfb012a748c7101bef971f0a541338d659baa345b237d",
.lazy = true, .lazy = true,
}, },
.xcode_frameworks = .{ .xcode_frameworks = .{

View file

@ -19,7 +19,7 @@ title_timer: mach.time.Timer,
color_timer: mach.time.Timer, color_timer: mach.time.Timer,
color_time: f32 = 0.0, color_time: f32 = 0.0,
flip: bool = false, flip: bool = false,
pipeline: *gpu.RenderPipeline, pipeline: *gpu.RenderPipeline = undefined,
pub fn init( pub fn init(
core: *mach.Core, core: *mach.Core,
@ -31,7 +31,7 @@ pub fn init(
const window = try core.windows.new(.{ const window = try core.windows.new(.{
.title = "core-transparent-window", .title = "core-transparent-window",
.vsync_mode = .triple, .vsync_mode = .double,
}); });
// Store our render pipeline in our module's state, so we can access it later on. // Store our render pipeline in our module's state, so we can access it later on.
@ -39,7 +39,6 @@ pub fn init(
.window = window, .window = window,
.title_timer = try mach.time.Timer.start(), .title_timer = try mach.time.Timer.start(),
.color_timer = try mach.time.Timer.start(), .color_timer = try mach.time.Timer.start(),
.pipeline = undefined,
}; };
} }
@ -89,7 +88,7 @@ pub fn tick(app: *App, core: *mach.Core) void {
.window_open => |ev| { .window_open => |ev| {
try setupPipeline(core, app, ev.window_id); try setupPipeline(core, app, ev.window_id);
}, },
.key_press => |ev| { .key_repeat, .key_press => |ev| {
switch (ev.key) { switch (ev.key) {
.right => { .right => {
core.windows.set(app.window, .width, core.windows.get(app.window, .width) + 10); core.windows.set(app.window, .width, core.windows.get(app.window, .width) + 10);
@ -154,7 +153,7 @@ pub fn tick(app: *App, core: *mach.Core) void {
app.title_timer.reset(); app.title_timer.reset();
// TODO(object): window-title // TODO(object): window-title
core.windows.set(app.window, .title, std.fmt.allocPrintZ(core.allocator, "core-custom-entrypoint [ {d}fps ] [ Input {d}hz ]", .{ core.frame.rate, core.input.rate }) catch unreachable); core.windows.set(app.window, .title, std.fmt.allocPrintZ(core.allocator, "core-transparent-window [ {d}fps ] [ Input {d}hz ]", .{ core.frame.rate, core.input.rate }) catch unreachable);
} }
if (app.color_time >= 4.0 or app.color_time <= 0.0) { if (app.color_time >= 4.0 or app.color_time <= 0.0) {