Core: use .app local init/deinit/tick events (avoid global events)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
fb37f74d41
commit
2c8ba82aa3
9 changed files with 41 additions and 48 deletions
|
|
@ -24,14 +24,12 @@ pub const name = .app;
|
|||
pub const Mod = mach.Mod(@This());
|
||||
|
||||
pub const global_events = .{
|
||||
.init = .{ .handler = init },
|
||||
.deinit = .{ .handler = deinit },
|
||||
.tick = .{ .handler = tick },
|
||||
.audio_state_change = .{ .handler = audioStateChange },
|
||||
};
|
||||
|
||||
pub const local_events = .{
|
||||
.init = .{ .handler = init },
|
||||
.deinit = .{ .handler = deinit },
|
||||
.tick = .{ .handler = tick },
|
||||
};
|
||||
|
||||
|
|
@ -55,9 +53,9 @@ fn init(audio: *mach.Audio.Mod, piano: *Mod) void {
|
|||
std.debug.print("[arrow down] decrease volume 10%\n", .{});
|
||||
}
|
||||
|
||||
fn deinit(audio: *mach.Audio.Mod) void {
|
||||
// Initialize audio module
|
||||
fn deinit(core: *mach.Core.Mod, audio: *mach.Audio.Mod) void {
|
||||
audio.send(.deinit, .{});
|
||||
core.send(.deinit, .{});
|
||||
}
|
||||
|
||||
fn audioStateChange(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue