examples: rename main modules -> App

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-28 11:14:42 -07:00 committed by Stephen Gutekanst
parent e0640cc948
commit fb37f74d41
12 changed files with 14 additions and 16 deletions

View file

@ -2,7 +2,7 @@ const std = @import("std");
const mach = @import("mach"); const mach = @import("mach");
const gpu = mach.gpu; const gpu = mach.gpu;
pub const name = .game; pub const name = .app;
pub const Mod = mach.Mod(@This()); pub const Mod = mach.Mod(@This());
pub const global_events = .{ pub const global_events = .{

View file

@ -3,7 +3,7 @@ const mach = @import("mach");
// The global list of Mach modules registered for use in our application. // The global list of Mach modules registered for use in our application.
pub const modules = .{ pub const modules = .{
mach.Core, mach.Core,
@import("Game.zig"), @import("App.zig"),
}; };
pub fn main() !void { pub fn main() !void {

View file

@ -30,7 +30,7 @@ pub const global_events = .{
// Define the globally unique name of our module. You can use any name here, but keep in mind no // Define the globally unique name of our module. You can use any name here, but keep in mind no
// two modules in the program can have the same name. // two modules in the program can have the same name.
pub const name = .game; pub const name = .app;
// The mach.Mod type corresponding to our module struct (this file.) This provides methods for // The mach.Mod type corresponding to our module struct (this file.) This provides methods for
// working with this module (e.g. sending events, working with its components, etc.) // working with this module (e.g. sending events, working with its components, etc.)
@ -147,7 +147,7 @@ fn tick(
// Query all the entities that have the .follower tag indicating they should follow the player. // Query all the entities that have the .follower tag indicating they should follow the player.
// TODO(important): better querying API // TODO(important): better querying API
var archetypes_iter = core.entities.query(.{ .all = &.{ var archetypes_iter = core.entities.query(.{ .all = &.{
.{ .game = &.{.follower} }, .{ .app = &.{.follower} },
} }); } });
while (archetypes_iter.next()) |archetype| { while (archetypes_iter.next()) |archetype| {
// Iterate the ID and position of each entity // Iterate the ID and position of each entity
@ -161,7 +161,7 @@ fn tick(
var avoidance = Vec3.splat(0); var avoidance = Vec3.splat(0);
var avoidance_div: f32 = 1.0; var avoidance_div: f32 = 1.0;
var archetypes_iter_2 = core.entities.query(.{ .all = &.{ var archetypes_iter_2 = core.entities.query(.{ .all = &.{
.{ .game = &.{.follower} }, .{ .app = &.{.follower} },
} }); } });
while (archetypes_iter_2.next()) |archetype_2| { while (archetypes_iter_2.next()) |archetype_2| {
const other_ids = archetype_2.slice(.entity, .id); const other_ids = archetype_2.slice(.entity, .id);

View file

@ -1,14 +1,12 @@
const std = @import("std"); const std = @import("std");
const mach = @import("mach"); const mach = @import("mach");
const Renderer = @import("Renderer.zig");
const Game = @import("Game.zig");
// The global list of Mach modules registered for use in our application. // The global list of Mach modules registered for use in our application.
pub const modules = .{ pub const modules = .{
mach.Core, mach.Core,
Renderer, @import("App.zig"),
Game, @import("Renderer.zig"),
}; };
// TODO: move this to a mach "entrypoint" zig module // TODO: move this to a mach "entrypoint" zig module

View file

@ -29,7 +29,7 @@ frame_render_pass: *gpu.RenderPassEncoder = undefined,
// Define the globally unique name of our module. You can use any name here, but keep in mind no // Define the globally unique name of our module. You can use any name here, but keep in mind no
// two modules in the program can have the same name. // two modules in the program can have the same name.
pub const name = .game; pub const name = .app;
pub const Mod = mach.Mod(@This()); pub const Mod = mach.Mod(@This());
pub const global_events = .{ pub const global_events = .{

View file

@ -5,8 +5,8 @@ pub const modules = .{
mach.Core, mach.Core,
mach.gfx.Sprite, mach.gfx.Sprite,
mach.gfx.SpritePipeline, mach.gfx.SpritePipeline,
@import("App.zig"),
@import("Glyphs.zig"), @import("Glyphs.zig"),
@import("Game.zig"),
}; };
// TODO(important): use standard entrypoint instead // TODO(important): use standard entrypoint instead

View file

@ -20,7 +20,7 @@ pub const App = @This();
var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var gpa = std.heap.GeneralPurposeAllocator(.{}){};
pub const name = .piano; pub const name = .app;
pub const Mod = mach.Mod(@This()); pub const Mod = mach.Mod(@This());
pub const global_events = .{ pub const global_events = .{

View file

@ -4,7 +4,7 @@ const mach = @import("mach");
pub const modules = .{ pub const modules = .{
mach.Core, mach.Core,
mach.Audio, mach.Audio,
@import("Piano.zig"), @import("App.zig"),
}; };
// TODO(important): use standard entrypoint instead // TODO(important): use standard entrypoint instead

View file

@ -33,7 +33,7 @@ frame_render_pass: *gpu.RenderPassEncoder = undefined,
// Define the globally unique name of our module. You can use any name here, but keep in mind no // Define the globally unique name of our module. You can use any name here, but keep in mind no
// two modules in the program can have the same name. // two modules in the program can have the same name.
pub const name = .game; pub const name = .app;
pub const Mod = mach.Mod(@This()); pub const Mod = mach.Mod(@This());
pub const global_events = .{ pub const global_events = .{

View file

@ -5,7 +5,7 @@ pub const modules = .{
mach.Core, mach.Core,
mach.gfx.Sprite, mach.gfx.Sprite,
mach.gfx.SpritePipeline, mach.gfx.SpritePipeline,
@import("Game.zig"), @import("App.zig"),
}; };
// TODO(important): use standard entrypoint instead // TODO(important): use standard entrypoint instead

View file

@ -6,7 +6,7 @@ pub const modules = .{
mach.gfx.Text, mach.gfx.Text,
mach.gfx.TextPipeline, mach.gfx.TextPipeline,
mach.gfx.TextStyle, mach.gfx.TextStyle,
@import("Game.zig"), @import("App.zig"),
}; };
// TODO(important): use standard entrypoint instead // TODO(important): use standard entrypoint instead