ecs: add support for module global values
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
3fddb687bc
commit
f74faf90df
2 changed files with 94 additions and 0 deletions
|
|
@ -53,6 +53,9 @@ test "example" {
|
|||
.components = .{
|
||||
.id = u16,
|
||||
},
|
||||
.globals = struct{
|
||||
pointer: u8,
|
||||
},
|
||||
}),
|
||||
.geometry = Module(.{
|
||||
.components = .{
|
||||
|
|
@ -66,6 +69,10 @@ test "example" {
|
|||
var world = try World(modules).init(allocator);
|
||||
defer world.deinit();
|
||||
|
||||
// Initialize globals.
|
||||
world.set(.physics, .pointer, 123);
|
||||
_ = world.get(.physics, .pointer); // == 123
|
||||
|
||||
const player1 = try world.entities.new();
|
||||
const player2 = try world.entities.new();
|
||||
const player3 = try world.entities.new();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue