module: write components using a struct pattern

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-04-05 05:35:58 -07:00 committed by Stephen Gutekanst
parent 17db5498ee
commit 2115f5832a
8 changed files with 45 additions and 62 deletions

View file

@ -19,13 +19,13 @@ pub const name = .mach_gfx_sprite;
pub const Mod = mach.Mod(@This());
pub const components = .{
.{ .name = .pipeline, .type = u8, .description =
.pipeline = .{ .type = u8, .description =
\\ The ID of the pipeline this sprite belongs to. By default, zero.
\\
\\ This determines which shader, textures, etc. are used for rendering the sprite.
},
.{ .name = .transform, .type = Mat4x4, .description =
.transform = .{ .type = Mat4x4, .description =
\\ The sprite model transformation matrix. A sprite is measured in pixel units, starting from
\\ (0, 0) at the top-left corner and extending to the size of the sprite. By default, the world
\\ origin (0, 0) lives at the center of the window.
@ -34,11 +34,11 @@ pub const components = .{
\\ cover the top-right hand corner of the window.
},
.{ .name = .uv_transform, .type = Mat3x3, .description =
.uv_transform = .{ .type = Mat3x3, .description =
\\ UV coordinate transformation matrix describing top-left corner / origin of sprite, in pixels.
},
.{ .name = .size, .type = Vec2, .description =
.size = .{ .type = Vec2, .description =
\\ The size of the sprite, in pixels.
},
};