TextPipeline: make .init and .deinit explicit
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ed9137fe98
commit
e0640cc948
2 changed files with 11 additions and 4 deletions
|
|
@ -39,6 +39,7 @@ pub const Mod = mach.Mod(@This());
|
|||
|
||||
pub const global_events = .{
|
||||
.init = .{ .handler = init },
|
||||
.deinit = .{ .handler = deinit },
|
||||
.tick = .{ .handler = tick },
|
||||
};
|
||||
|
||||
|
|
@ -56,6 +57,12 @@ const text1: []const []const u8 = &.{
|
|||
|
||||
const text2: []const []const u8 = &.{"$!?😊"};
|
||||
|
||||
fn deinit(
|
||||
text_pipeline: *gfx.TextPipeline.Mod,
|
||||
) !void {
|
||||
text_pipeline.send(.deinit, .{});
|
||||
}
|
||||
|
||||
fn init(
|
||||
core: *mach.Core.Mod,
|
||||
text: *gfx.Text.Mod,
|
||||
|
|
@ -63,6 +70,8 @@ fn init(
|
|||
text_style: *gfx.TextStyle.Mod,
|
||||
game: *Mod,
|
||||
) !void {
|
||||
text_pipeline.send(.init, .{});
|
||||
|
||||
// TODO: a better way to initialize entities with default values
|
||||
// TODO(text): most of these style options are not respected yet.
|
||||
const style1 = try core.newEntity();
|
||||
|
|
|
|||
|
|
@ -60,11 +60,9 @@ pub const components = .{
|
|||
.built = .{ .type = BuiltPipeline, .description = "internal" },
|
||||
};
|
||||
|
||||
pub const global_events = .{
|
||||
.deinit = .{ .handler = deinit },
|
||||
};
|
||||
|
||||
pub const local_events = .{
|
||||
.init = .{ .handler = fn () void },
|
||||
.deinit = .{ .handler = deinit },
|
||||
.update = .{ .handler = update },
|
||||
.pre_render = .{ .handler = preRender },
|
||||
.render = .{ .handler = render },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue