Skip to content

Commit

Permalink
build: update mach-objc build.zig.zon, and small corrections to `co…
Browse files Browse the repository at this point in the history
…re-transparent-window` example
  • Loading branch information
foxnne authored and slimsag committed Dec 8, 2024
1 parent 5ba95f7 commit a10cbc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
.lazy = true,
},
.mach_objc = .{
.url = "https://pkg.machengine.org/mach-objc/0edc9de456ec90e06006211c8bf0fd72fc8ac0ad.tar.gz",
.hash = "122033028b2bac8c51706c7dcd8133e93215daac758fd7b22d6a020f898358da7cbe",
.url = "https://pkg.machengine.org/mach-objc/eb1e1eee9c02039d582f5fd9814d32e48b736ba6.tar.gz",
.hash = "12209742f139402c34a8901bfb012a748c7101bef971f0a541338d659baa345b237d",
.lazy = true,
},
.xcode_frameworks = .{
Expand Down
9 changes: 4 additions & 5 deletions examples/core-transparent-window/App.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ title_timer: mach.time.Timer,
color_timer: mach.time.Timer,
color_time: f32 = 0.0,
flip: bool = false,
pipeline: *gpu.RenderPipeline,
pipeline: *gpu.RenderPipeline = undefined,

pub fn init(
core: *mach.Core,
Expand All @@ -31,15 +31,14 @@ pub fn init(

const window = try core.windows.new(.{
.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.
app.* = .{
.window = window,
.title_timer = try mach.time.Timer.start(),
.color_timer = try mach.time.Timer.start(),
.pipeline = undefined,
};
}

Expand Down Expand Up @@ -89,7 +88,7 @@ pub fn tick(app: *App, core: *mach.Core) void {
.window_open => |ev| {
try setupPipeline(core, app, ev.window_id);
},
.key_press => |ev| {
.key_repeat, .key_press => |ev| {
switch (ev.key) {
.right => {
core.windows.set(app.window, .width, core.windows.get(app.window, .width) + 10);
Expand Down Expand Up @@ -154,7 +153,7 @@ pub fn tick(app: *App, core: *mach.Core) void {
app.title_timer.reset();
// 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) {
Expand Down

0 comments on commit a10cbc3

Please sign in to comment.