all: get ECS running on revised module system

All ECS `examples/` now run on the revised module system.

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-03-19 21:32:36 -07:00 committed by Stephen Gutekanst
parent cd2f3fbc3f
commit 3898995c4c
6 changed files with 249 additions and 219 deletions

View file

@ -50,6 +50,7 @@ pub fn init(
sprite_mod: *Sprite.Mod,
text_mod: *Text.Mod,
game: *Mod,
world: *mach.World,
) !void {
// The Mach .core is where we set window options, etc.
core.setTitle("gfx.Sprite example");
@ -59,10 +60,12 @@ pub fn init(
// Tell sprite_mod to use the texture
sprite_mod.send(.init, .{});
world.dispatchNoError(); // TODO: no dispatch in user code
sprite_mod.send(.initPipeline, .{Sprite.PipelineOptions{
.pipeline = @intFromEnum(Pipeline.text),
.texture = text_mod.state.texture,
}});
world.dispatchNoError(); // TODO: no dispatch in user code
// We can create entities, and set components on them. Note that components live in a module
// namespace, e.g. the `Sprite` module could have a 3D `.location` component with a different