module: sending global event requires sender module awareness
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
9eac721f24
commit
3661cb8721
4 changed files with 39 additions and 31 deletions
|
|
@ -122,6 +122,6 @@ test "example" {
|
|||
|
||||
//-------------------------------------------------------------------------
|
||||
// Send events to modules
|
||||
world.modules.send(.tick, .{});
|
||||
world.mod.renderer.sendGlobal(.tick, .{});
|
||||
try world.dispatch();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ pub fn World(comptime mods: anytype) type {
|
|||
pub inline fn sendGlobal(m: *@This(), comptime event_name: Modules.GlobalEvent, args: anytype) void {
|
||||
const mod_ptr: *Mods = @alignCast(@fieldParentPtr(Mods, @tagName(module_tag), m));
|
||||
const world = @fieldParentPtr(WorldT, "mod", mod_ptr);
|
||||
world.modules.send(event_name, args);
|
||||
world.modules.sendGlobal(module_tag, event_name, args);
|
||||
}
|
||||
|
||||
pub fn dispatchNoError(m: *@This()) void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue