all: rename mach.Entity.Mod -> mach.Entities.Mod
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
11ebce62a3
commit
541ce9e7c0
18 changed files with 69 additions and 69 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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| {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue