diff --git a/examples/custom-renderer/App.zig b/examples/custom-renderer/App.zig index 30b93726..81b7f79e 100644 --- a/examples/custom-renderer/App.zig +++ b/examples/custom-renderer/App.zig @@ -48,7 +48,7 @@ fn init( // These are injected dependencies - as long as these modules were registered in the top-level // of the program we can have these types injected here, letting us work with other modules in // our program seamlessly and with a type-safe API: - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, renderer: *Renderer.Mod, game: *Mod, @@ -56,7 +56,7 @@ fn init( renderer.send(.init, .{}); // Create our player entity. - const player = try entity.new(); + const player = try entities.new(); // Give our player entity a .renderer.position and .renderer.scale component. Note that these // are defined by the Renderer module, so we use `renderer: *Renderer.Mod` to interact with @@ -82,7 +82,7 @@ fn init( // TODO(important): remove need for returning an error here fn tick( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, renderer: *Renderer.Mod, game: *Mod, @@ -136,7 +136,7 @@ fn tick( _ = game.state().spawn_timer.lap(); // Reset the timer for (0..5) |_| { // Spawn a new entity at the same position as the player, but smaller in scale. - const new_entity = try entity.new(); + const new_entity = try entities.new(); try renderer.set(new_entity, .position, player_pos); try renderer.set(new_entity, .scale, 1.0 / 6.0); @@ -162,7 +162,7 @@ fn tick( } }); while (archetypes_iter.next()) |archetype| { // Iterate the ID and position of each entity - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const positions = archetype.slice(.renderer, .position); for (ids, positions) |id, position| { // Nested query to find all the other follower entities that we should move away from. @@ -175,7 +175,7 @@ fn tick( .{ .app = &.{.follower} }, } }); while (archetypes_iter_2.next()) |archetype_2| { - const other_ids = archetype_2.slice(.entity, .id); + const other_ids = archetype_2.slice(.entities, .id); const other_positions = archetype_2.slice(.renderer, .position); for (other_ids, other_positions) |other_id, other_position| { if (id == other_id) continue; diff --git a/examples/custom-renderer/Renderer.zig b/examples/custom-renderer/Renderer.zig index 35e4238b..bdfe6579 100644 --- a/examples/custom-renderer/Renderer.zig +++ b/examples/custom-renderer/Renderer.zig @@ -143,7 +143,7 @@ fn renderFrame( } }); var num_entities: usize = 0; while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const positions = archetype.slice(.renderer, .position); const scales = archetype.slice(.renderer, .scale); for (ids, positions, scales) |id, position, scale| { diff --git a/examples/glyphs/App.zig b/examples/glyphs/App.zig index a0132da2..b6459ed2 100644 --- a/examples/glyphs/App.zig +++ b/examples/glyphs/App.zig @@ -60,7 +60,7 @@ fn init(core: *mach.Core.Mod, sprite_pipeline: *gfx.SpritePipeline.Mod, glyphs: } fn afterInit( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, sprite: *gfx.Sprite.Mod, sprite_pipeline: *gfx.SpritePipeline.Mod, glyphs: *Glyphs.Mod, @@ -68,7 +68,7 @@ fn afterInit( ) !void { // Create a sprite rendering pipeline const texture = glyphs.state().texture; - const pipeline = try entity.new(); + const pipeline = try entities.new(); try sprite_pipeline.set(pipeline, .texture, texture); sprite_pipeline.send(.update, .{}); @@ -77,7 +77,7 @@ fn afterInit( // type than the `.physics2d` module's `.location` component if you desire. const r = glyphs.state().regions.get('?').?; - const player = try entity.new(); + const player = try entities.new(); try sprite.set(player, .transform, Mat4x4.translate(vec3(-0.02, 0, 0))); try sprite.set(player, .pipeline, pipeline); try sprite.set(player, .size, vec2(@floatFromInt(r.width), @floatFromInt(r.height))); @@ -98,7 +98,7 @@ fn afterInit( } fn tick( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, sprite: *gfx.Sprite.Mod, sprite_pipeline: *gfx.SpritePipeline.Mod, @@ -152,7 +152,7 @@ fn tick( const rand_index = game.state().rand.random().intRangeAtMost(usize, 0, glyphs.state().regions.count() - 1); const r = glyphs.state().regions.entries.get(rand_index).value; - const new_entity = try entity.new(); + const new_entity = try entities.new(); try sprite.set(new_entity, .transform, Mat4x4.translate(new_pos).mul(&Mat4x4.scaleScalar(0.3))); try sprite.set(new_entity, .size, vec2(@floatFromInt(r.width), @floatFromInt(r.height))); try sprite.set(new_entity, .uv_transform, Mat3x3.translate(vec2(@floatFromInt(r.x), @floatFromInt(r.y)))); @@ -169,7 +169,7 @@ fn tick( .{ .mach_gfx_sprite = &.{.transform} }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const transforms = archetype.slice(.mach_gfx_sprite, .transform); for (ids, transforms) |id, *old_transform| { var location = old_transform.translation(); diff --git a/examples/piano/App.zig b/examples/piano/App.zig index bb3fff66..d4a9649e 100644 --- a/examples/piano/App.zig +++ b/examples/piano/App.zig @@ -65,7 +65,7 @@ fn deinit(core: *mach.Core.Mod, audio: *mach.Audio.Mod) void { } fn audioStateChange( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, audio: *mach.Audio.Mod, app: *Mod, ) !void { @@ -75,14 +75,14 @@ fn audioStateChange( } }); while (archetypes_iter.next()) |archetype| { for ( - archetype.slice(.entity, .id), + archetype.slice(.entities, .id), archetype.slice(.mach_audio, .playing), ) |id, playing| { if (playing) continue; if (app.get(id, .play_after)) |frequency| { // Play a new sound - const e = try entity.new(); + const e = try entities.new(); try audio.set(e, .samples, try fillTone(audio, frequency)); try audio.set(e, .channels, @intCast(audio.state().player.channels().len)); try audio.set(e, .playing, true); @@ -90,13 +90,13 @@ fn audioStateChange( } // Remove the entity for the old sound - try entity.remove(id); + try entities.remove(id); } } } fn tick( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, audio: *mach.Audio.Mod, app: *Mod, @@ -123,7 +123,7 @@ fn tick( // Piano keys else => { // Play a new sound - const e = try entity.new(); + const e = try entities.new(); try audio.set(e, .samples, try fillTone(audio, keyToFrequency(ev.key))); try audio.set(e, .channels, @intCast(audio.state().player.channels().len)); try audio.set(e, .playing, true); diff --git a/examples/play-opus/App.zig b/examples/play-opus/App.zig index f69365e6..07756ff9 100644 --- a/examples/play-opus/App.zig +++ b/examples/play-opus/App.zig @@ -33,7 +33,7 @@ pub const components = .{ sfx: Opus, fn init( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, audio: *mach.Audio.Mod, app: *Mod, @@ -53,7 +53,7 @@ fn init( // Initialize module state app.init(.{ .sfx = sfx }); - const bgm_entity = try entity.new(); + const bgm_entity = try entities.new(); try app.set(bgm_entity, .is_bgm, {}); try audio.set(bgm_entity, .samples, bgm.samples); try audio.set(bgm_entity, .channels, bgm.channels); @@ -80,7 +80,7 @@ fn deinit(core: *mach.Core.Mod, audio: *mach.Audio.Mod) void { } fn audioStateChange( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, audio: *mach.Audio.Mod, app: *Mod, ) !void { @@ -88,7 +88,7 @@ fn audioStateChange( var archetypes_iter = audio.__entities.queryDeprecated(.{ .all = &.{.{ .mach_audio = &.{.playing} }} }); while (archetypes_iter.next()) |archetype| { for ( - archetype.slice(.entity, .id), + archetype.slice(.entities, .id), archetype.slice(.mach_audio, .playing), ) |id, playing| { if (playing) continue; @@ -99,14 +99,14 @@ fn audioStateChange( try audio.set(id, .playing, true); } else { // Remove the entity for the old sound - try entity.remove(id); + try entities.remove(id); } } } } fn tick( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, audio: *mach.Audio.Mod, app: *Mod, @@ -128,7 +128,7 @@ fn tick( }, else => { // Play a new SFX - const e = try entity.new(); + const e = try entities.new(); try audio.set(e, .samples, app.state().sfx.samples); try audio.set(e, .channels, app.state().sfx.channels); try audio.set(e, .index, 0); diff --git a/examples/sprite/App.zig b/examples/sprite/App.zig index ab1cb41c..74713052 100644 --- a/examples/sprite/App.zig +++ b/examples/sprite/App.zig @@ -52,7 +52,7 @@ fn deinit( } fn init( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, sprite: *gfx.Sprite.Mod, sprite_pipeline: *gfx.SpritePipeline.Mod, @@ -66,12 +66,12 @@ fn init( // Create a sprite rendering pipeline const allocator = gpa.allocator(); - const pipeline = try entity.new(); + const pipeline = try entities.new(); try sprite_pipeline.set(pipeline, .texture, try loadTexture(core, allocator)); sprite_pipeline.send(.update, .{}); // Create our player sprite - const player = try entity.new(); + const player = try entities.new(); try sprite.set(player, .transform, Mat4x4.translate(vec3(-0.02, 0, 0))); try sprite.set(player, .size, vec2(32, 32)); try sprite.set(player, .uv_transform, Mat3x3.translate(vec2(0, 0))); @@ -95,7 +95,7 @@ fn init( } fn tick( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, sprite: *gfx.Sprite.Mod, sprite_pipeline: *gfx.SpritePipeline.Mod, @@ -145,7 +145,7 @@ fn tick( new_pos.v[0] += game.state().rand.random().floatNorm(f32) * 25; new_pos.v[1] += game.state().rand.random().floatNorm(f32) * 25; - const new_entity = try entity.new(); + const new_entity = try entities.new(); try sprite.set(new_entity, .transform, Mat4x4.translate(new_pos).mul(&Mat4x4.scale(Vec3.splat(0.3)))); try sprite.set(new_entity, .size, vec2(32, 32)); try sprite.set(new_entity, .uv_transform, Mat3x3.translate(vec2(0, 0))); @@ -162,7 +162,7 @@ fn tick( .{ .mach_gfx_sprite = &.{.transform} }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const transforms = archetype.slice(.mach_gfx_sprite, .transform); for (ids, transforms) |id, *old_transform| { _ = id; diff --git a/examples/text/App.zig b/examples/text/App.zig index 5dadddb6..25c1e22c 100644 --- a/examples/text/App.zig +++ b/examples/text/App.zig @@ -63,7 +63,7 @@ fn deinit( } fn init( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, text: *gfx.Text.Mod, text_pipeline: *gfx.TextPipeline.Mod, @@ -74,21 +74,21 @@ fn init( // TODO: a better way to initialize entities with default values // TODO(text): most of these style options are not respected yet. - const style1 = try entity.new(); + const style1 = try entities.new(); try text_style.set(style1, .font_name, "Roboto Medium"); // TODO try text_style.set(style1, .font_size, 48 * gfx.px_per_pt); // 48pt try text_style.set(style1, .font_weight, gfx.font_weight_normal); try text_style.set(style1, .italic, false); try text_style.set(style1, .color, vec4(0.6, 1.0, 0.6, 1.0)); - const style2 = try entity.new(); + const style2 = try entities.new(); try text_style.set(style2, .font_name, "Roboto Medium"); // TODO try text_style.set(style2, .font_size, 48 * gfx.px_per_pt); // 48pt try text_style.set(style2, .font_weight, gfx.font_weight_normal); try text_style.set(style2, .italic, true); try text_style.set(style2, .color, vec4(0.6, 1.0, 0.6, 1.0)); - const style3 = try entity.new(); + const style3 = try entities.new(); try text_style.set(style3, .font_name, "Roboto Medium"); // TODO try text_style.set(style3, .font_size, 48 * gfx.px_per_pt); // 48pt try text_style.set(style3, .font_weight, gfx.font_weight_bold); @@ -96,12 +96,12 @@ fn init( try text_style.set(style3, .color, vec4(0.6, 1.0, 0.6, 1.0)); // Create a text rendering pipeline - const pipeline = try entity.new(); + const pipeline = try entities.new(); try text_pipeline.set(pipeline, .is_pipeline, {}); text_pipeline.send(.update, .{}); // Create some text - const player = try entity.new(); + const player = try entities.new(); try text.set(player, .pipeline, pipeline); try text.set(player, .transform, Mat4x4.scaleScalar(upscale).mul(&Mat4x4.translate(vec3(0, 0, 0)))); @@ -133,7 +133,7 @@ fn init( } fn tick( - entity: *mach.Entity.Mod, + entities: *mach.Entities.Mod, core: *mach.Core.Mod, text: *gfx.Text.Mod, text_pipeline: *gfx.TextPipeline.Mod, @@ -183,7 +183,7 @@ fn tick( new_pos.v[0] += game.state().rand.random().floatNorm(f32) * 50; new_pos.v[1] += game.state().rand.random().floatNorm(f32) * 50; - const new_entity = try entity.new(); + const new_entity = try entities.new(); try text.set(new_entity, .pipeline, game.state().pipeline); try text.set(new_entity, .transform, Mat4x4.scaleScalar(upscale).mul(&Mat4x4.translate(new_pos))); @@ -205,7 +205,7 @@ fn tick( .{ .mach_gfx_text = &.{.transform} }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const transforms = archetype.slice(.mach_gfx_text, .transform); for (ids, transforms) |id, *old_transform| { _ = id; diff --git a/src/Audio.zig b/src/Audio.zig index 794bea4e..1e114364 100644 --- a/src/Audio.zig +++ b/src/Audio.zig @@ -139,7 +139,7 @@ fn audioTick(audio: *Mod) !void { } }); while (archetypes_iter.next()) |archetype| { for ( - archetype.slice(.entity, .id), + archetype.slice(.entities, .id), archetype.slice(.mach_audio, .samples), archetype.slice(.mach_audio, .channels), archetype.slice(.mach_audio, .playing), diff --git a/src/Core.zig b/src/Core.zig index 0a46498d..d0c6c993 100644 --- a/src/Core.zig +++ b/src/Core.zig @@ -106,7 +106,7 @@ fn start(core: *Mod) !void { core.state().run_state = .running; } -fn init(entity: *mach.Entity.Mod, core: *Mod) !void { +fn init(entities: *mach.Entities.Mod, core: *Mod) !void { mach.core.allocator = gpa.allocator(); // TODO: banish this global allocator // Initialize GPU implementation @@ -116,7 +116,7 @@ fn init(entity: *mach.Entity.Mod, core: *Mod) !void { try mach.core.init(.{}); // TODO(important): update this information upon framebuffer resize events - const main_window = try entity.new(); + const main_window = try entities.new(); try core.set(main_window, .framebuffer_format, mach.core.descriptor.format); try core.set(main_window, .framebuffer_width, mach.core.descriptor.width); try core.set(main_window, .framebuffer_height, mach.core.descriptor.height); @@ -141,7 +141,7 @@ fn update(core: *Mod) !void { var num_windows: usize = 0; while (archetypes_iter.next()) |archetype| { for ( - archetype.slice(.entity, .id), + archetype.slice(.entities, .id), archetype.slice(.mach_core, .title), ) |window_id, title| { num_windows += 1; diff --git a/src/gfx/Sprite.zig b/src/gfx/Sprite.zig index 4b96e6d8..9aeeef90 100644 --- a/src/gfx/Sprite.zig +++ b/src/gfx/Sprite.zig @@ -49,7 +49,7 @@ fn update(core: *mach.Core.Mod, sprite: *Mod, sprite_pipeline: *gfx.SpritePipeli } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const built_pipelines = archetype.slice(.mach_gfx_sprite_pipeline, .built); for (ids, built_pipelines) |pipeline_id, *built| { try updatePipeline(core, sprite, sprite_pipeline, pipeline_id, built); diff --git a/src/gfx/SpritePipeline.zig b/src/gfx/SpritePipeline.zig index f1783436..0a762d22 100644 --- a/src/gfx/SpritePipeline.zig +++ b/src/gfx/SpritePipeline.zig @@ -144,7 +144,7 @@ fn update(core: *mach.Core.Mod, sprite_pipeline: *Mod) !void { } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const textures = archetype.slice(.mach_gfx_sprite_pipeline, .texture); for (ids, textures) |pipeline_id, texture| { @@ -373,7 +373,7 @@ fn render(sprite_pipeline: *Mod) !void { } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const built_pipelines = archetype.slice(.mach_gfx_sprite_pipeline, .built); for (ids, built_pipelines) |pipeline_id, built| { // Draw the sprite batch diff --git a/src/gfx/Text.zig b/src/gfx/Text.zig index 83e4b405..5b0dc9b2 100644 --- a/src/gfx/Text.zig +++ b/src/gfx/Text.zig @@ -65,7 +65,7 @@ fn update(core: *mach.Core.Mod, text: *Mod, text_pipeline: *gfx.TextPipeline.Mod } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const built_pipelines = archetype.slice(.mach_gfx_text_pipeline, .built); for (ids, built_pipelines) |pipeline_id, *built| { try updatePipeline(core, text, text_pipeline, pipeline_id, built); @@ -106,7 +106,7 @@ fn updatePipeline( } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const transforms = archetype.slice(.mach_gfx_text, .transform); const segment_slices = archetype.slice(.mach_gfx_text, .text); const style_slices = archetype.slice(.mach_gfx_text, .style); diff --git a/src/gfx/TextPipeline.zig b/src/gfx/TextPipeline.zig index 1bc4777a..d0c086d9 100644 --- a/src/gfx/TextPipeline.zig +++ b/src/gfx/TextPipeline.zig @@ -169,7 +169,7 @@ fn update(core: *mach.Core.Mod, text_pipeline: *Mod) !void { } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); for (ids) |pipeline_id| { try buildPipeline(core, text_pipeline, pipeline_id); } @@ -402,7 +402,7 @@ fn render(text_pipeline: *Mod) !void { } }, } }); while (archetypes_iter.next()) |archetype| { - const ids = archetype.slice(.entity, .id); + const ids = archetype.slice(.entities, .id); const built_pipelines = archetype.slice(.mach_gfx_text_pipeline, .built); for (ids, built_pipelines) |pipeline_id, built| { // Draw the text batch diff --git a/src/main.zig b/src/main.zig index 23ea0173..a4a8cf05 100644 --- a/src/main.zig +++ b/src/main.zig @@ -40,7 +40,7 @@ pub const EventID = @import("module/main.zig").EventID; pub const AnyEvent = @import("module/main.zig").AnyEvent; pub const merge = @import("module/main.zig").merge; pub const builtin_modules = @import("module/main.zig").builtin_modules; -pub const Entity = @import("module/main.zig").Entity; +pub const Entities = @import("module/main.zig").Entities; /// To use experimental sysgpu graphics API, you can write this in your main.zig: /// diff --git a/src/module/Archetype.zig b/src/module/Archetype.zig index bd96a57d..3190a9b5 100644 --- a/src/module/Archetype.zig +++ b/src/module/Archetype.zig @@ -290,8 +290,8 @@ pub fn Slicer(comptime modules: anytype) type { @field(component_types_by_name, @tagName(namespace_name)), @tagName(component_name), ).type; - if (namespace_name == .entity and component_name == .id) { - const name_id = slicer.archetype.component_names.index("entity.id").?; + if (namespace_name == .entities and component_name == .id) { + const name_id = slicer.archetype.component_names.index("entities.id").?; return slicer.archetype.getColumnValues(name_id, Type).?[0..slicer.archetype.len]; } const name = @tagName(namespace_name) ++ "." ++ @tagName(component_name); diff --git a/src/module/entities.zig b/src/module/entities.zig index b26d3062..b685fdd4 100644 --- a/src/module/entities.zig +++ b/src/module/entities.zig @@ -9,7 +9,7 @@ const StringTable = @import("StringTable.zig"); const ComponentTypesByName = @import("module.zig").ComponentTypesByName; const merge = @import("main.zig").merge; const builtin_modules = @import("main.zig").builtin_modules; -const Entity = @import("main.zig").Entity; +const Entities = @import("main.zig").Entities; const ModuleName = @import("module.zig").ModuleName; const ComponentNameM = @import("module.zig").ComponentNameM; const ComponentName = @import("module.zig").ComponentName; @@ -130,7 +130,7 @@ pub fn Database(comptime modules: anytype) type { .component_names = component_names, .buckets = buckets, }; - entities.id_name = entities.componentName(Entity.name, .id); + entities.id_name = entities.componentName(Entities.name, .id); const columns = try allocator.alloc(Archetype.Column, 1); columns[0] = .{ @@ -1076,7 +1076,7 @@ test "example" { // Query for all entities that have all of the given components const W = @TypeOf(world); var q = try world.query(.{ - .ids = W.ComponentQuery{ .read = W.ModuleComponentName{ .module = Entity.name, .component = .id } }, + .ids = W.ComponentQuery{ .read = W.ModuleComponentName{ .module = Entities.name, .component = .id } }, .rotations = W.ComponentQuery{ .write = W.ModuleComponentName{ .module = Game.name, .component = .rotation } }, }); while (q.next()) |v| { @@ -1090,7 +1090,7 @@ test "example" { // Dynamic queries (e.g. issued from another programming language without comptime) var q2 = try world.queryDynamic(.{ .op_and = &.{ - .{ .read = world.componentName(Entity.name, .id) }, + .{ .read = world.componentName(Entities.name, .id) }, .{ .read = world.componentName(Game.name, .rotation) }, }, }); diff --git a/src/module/main.zig b/src/module/main.zig index fd4d2099..5da55979 100644 --- a/src/module/main.zig +++ b/src/module/main.zig @@ -13,11 +13,11 @@ pub const AnyEvent = @import("module.zig").AnyEvent; pub const Merge = @import("module.zig").Merge; pub const merge = @import("module.zig").merge; -pub const builtin_modules = .{Entity}; +pub const builtin_modules = .{Entities}; -/// Builtin .entity module -pub const Entity = struct { - pub const name = .entity; +/// Builtin .entities module +pub const Entities = struct { + pub const name = .entities; pub const Mod = mach.Mod(@This()); @@ -82,15 +82,15 @@ test "entities DB" { defer world.deinit(allocator); // Initialize module state. - var entity = &world.mod.entity; + var entities = &world.mod.entities; var physics = &world.mod.physics; var renderer = &world.mod.renderer; physics.init(.{ .pointer = 123 }); _ = physics.state().pointer; // == 123 - const player1 = try entity.new(); - const player2 = try entity.new(); - const player3 = try entity.new(); + const player1 = try try entities.new(); + const player2 = try try entities.new(); + const player3 = try try entities.new(); try physics.set(player1, .id, 1001); try renderer.set(player1, .id, 1001); diff --git a/src/module/module.zig b/src/module/module.zig index 8388aaba..b5607588 100644 --- a/src/module/module.zig +++ b/src/module/module.zig @@ -575,8 +575,8 @@ pub fn ModSet(comptime modules: anytype) type { const module_tag = M.name; const components = ComponentTypesM(M){}; - if (M.name == .entity) { - // The .entity module is a special builtin module, with its own unique API. + if (M.name == .entities) { + // The .entities module is a special builtin module, with its own unique API. return struct { /// Private/internal fields __entities: *Database(modules),