module: rename MComponentTypes -> ComponentTypesM (consistency with LocalArgsM, etc.)
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
e6a170a07a
commit
8711e5e3a7
1 changed files with 5 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ fn ModuleInterface(comptime M: type) type {
|
||||||
if (!@hasDecl(M, "events")) @compileError(prefix ++ "must have `pub const events = .{};`");
|
if (!@hasDecl(M, "events")) @compileError(prefix ++ "must have `pub const events = .{};`");
|
||||||
// TODO: re-enable this validation once module event handler arguments would not pose a type dependency loop
|
// TODO: re-enable this validation once module event handler arguments would not pose a type dependency loop
|
||||||
// validateEvents("mach: module ." ++ @tagName(M.name) ++ " ", M.events);
|
// validateEvents("mach: module ." ++ @tagName(M.name) ++ " ", M.events);
|
||||||
_ = MComponentTypes(M);
|
_ = ComponentTypesM(M);
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -372,7 +372,7 @@ pub fn Module(
|
||||||
comptime NSComponents: type,
|
comptime NSComponents: type,
|
||||||
) type {
|
) type {
|
||||||
const module_tag = M.name;
|
const module_tag = M.name;
|
||||||
const components = MComponentTypes(M){};
|
const components = ComponentTypesM(M){};
|
||||||
return struct {
|
return struct {
|
||||||
state: M,
|
state: M,
|
||||||
entities: *Entities(NSComponents{}),
|
entities: *Entities(NSComponents{}),
|
||||||
|
|
@ -698,7 +698,7 @@ fn validateEvents(comptime error_prefix: anytype, comptime events: anytype) void
|
||||||
pub fn ComponentTypesByName(comptime modules: anytype) type {
|
pub fn ComponentTypesByName(comptime modules: anytype) type {
|
||||||
var fields: []const std.builtin.Type.StructField = &[0]std.builtin.Type.StructField{};
|
var fields: []const std.builtin.Type.StructField = &[0]std.builtin.Type.StructField{};
|
||||||
inline for (modules) |M| {
|
inline for (modules) |M| {
|
||||||
const MC = MComponentTypes(M);
|
const MC = ComponentTypesM(M);
|
||||||
fields = fields ++ [_]std.builtin.Type.StructField{.{
|
fields = fields ++ [_]std.builtin.Type.StructField{.{
|
||||||
.name = @tagName(M.name),
|
.name = @tagName(M.name),
|
||||||
.type = MC,
|
.type = MC,
|
||||||
|
|
@ -710,7 +710,7 @@ pub fn ComponentTypesByName(comptime modules: anytype) type {
|
||||||
|
|
||||||
// Builtin components
|
// Builtin components
|
||||||
// TODO: better method of injecting builtin module?
|
// TODO: better method of injecting builtin module?
|
||||||
const BuiltinMC = MComponentTypes(struct {
|
const BuiltinMC = ComponentTypesM(struct {
|
||||||
pub const name = .builtin;
|
pub const name = .builtin;
|
||||||
pub const components = .{
|
pub const components = .{
|
||||||
.{ .name = .id, .type = EntityID, .description = "Entity ID" },
|
.{ .name = .id, .type = EntityID, .description = "Entity ID" },
|
||||||
|
|
@ -743,7 +743,7 @@ pub fn ComponentTypesByName(comptime modules: anytype) type {
|
||||||
/// rotation: @TypeOf() = .{ .type = Vec2, .description = "rotation component" },
|
/// rotation: @TypeOf() = .{ .type = Vec2, .description = "rotation component" },
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
fn MComponentTypes(comptime M: anytype) type {
|
fn ComponentTypesM(comptime M: anytype) type {
|
||||||
const error_prefix = "mach: module ." ++ @tagName(M.name) ++ " .components ";
|
const error_prefix = "mach: module ." ++ @tagName(M.name) ++ " .components ";
|
||||||
if (!@hasDecl(M, "components")) {
|
if (!@hasDecl(M, "components")) {
|
||||||
return struct {};
|
return struct {};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue