all: move mach.Timer, core Timer/Frequency to mach.time module
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
d62ddbb6cd
commit
133c89638b
16 changed files with 90 additions and 110 deletions
|
|
@ -11,7 +11,7 @@ pub const systems = .{
|
|||
.tick = .{ .handler = tick },
|
||||
};
|
||||
|
||||
title_timer: mach.Timer,
|
||||
title_timer: mach.time.Timer,
|
||||
pipeline: *gpu.RenderPipeline,
|
||||
|
||||
pub fn deinit(core: *mach.Core.Mod, app: *Mod) void {
|
||||
|
|
@ -62,7 +62,7 @@ fn init(app: *Mod, core: *mach.Core.Mod) !void {
|
|||
|
||||
// Store our render pipeline in our module's state, so we can access it later on.
|
||||
app.init(.{
|
||||
.title_timer = try mach.Timer.start(),
|
||||
.title_timer = try mach.time.Timer.start(),
|
||||
.pipeline = pipeline,
|
||||
});
|
||||
try updateWindowTitle(core);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ pub const systems = .{
|
|||
.tick = .{ .handler = tick },
|
||||
};
|
||||
|
||||
title_timer: mach.Timer,
|
||||
title_timer: mach.time.Timer,
|
||||
pipeline: *gpu.RenderPipeline,
|
||||
|
||||
pub fn deinit(core: *mach.Core.Mod, app: *Mod) void {
|
||||
|
|
@ -62,7 +62,7 @@ fn init(app: *Mod, core: *mach.Core.Mod) !void {
|
|||
|
||||
// Store our render pipeline in our module's state, so we can access it later on.
|
||||
app.init(.{
|
||||
.title_timer = try mach.Timer.start(),
|
||||
.title_timer = try mach.time.Timer.start(),
|
||||
.pipeline = pipeline,
|
||||
});
|
||||
try updateWindowTitle(core);
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ const Vec2 = math.Vec2;
|
|||
const Vec3 = math.Vec3;
|
||||
|
||||
// Global state for our game module.
|
||||
timer: mach.Timer,
|
||||
timer: mach.time.Timer,
|
||||
player: mach.EntityID,
|
||||
direction: Vec2 = vec2(0, 0),
|
||||
spawning: bool = false,
|
||||
spawn_timer: mach.Timer,
|
||||
spawn_timer: mach.time.Timer,
|
||||
|
||||
// Components our game module defines.
|
||||
pub const components = .{
|
||||
|
|
@ -82,8 +82,8 @@ fn init(
|
|||
// file. If this is not done, then app.state() will panic indicating the state was never
|
||||
// initialized.
|
||||
app.init(.{
|
||||
.timer = try mach.Timer.start(),
|
||||
.spawn_timer = try mach.Timer.start(),
|
||||
.timer = try mach.time.Timer.start(),
|
||||
.spawn_timer = try mach.time.Timer.start(),
|
||||
.player = player,
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -12,12 +12,12 @@ const Mat4x4 = math.Mat4x4;
|
|||
|
||||
const Glyphs = @import("Glyphs.zig");
|
||||
|
||||
timer: mach.Timer,
|
||||
timer: mach.time.Timer,
|
||||
player: mach.EntityID,
|
||||
direction: Vec2 = vec2(0, 0),
|
||||
spawning: bool = false,
|
||||
spawn_timer: mach.Timer,
|
||||
fps_timer: mach.Timer,
|
||||
spawn_timer: mach.time.Timer,
|
||||
fps_timer: mach.time.Timer,
|
||||
frame_count: usize,
|
||||
sprites: usize,
|
||||
rand: std.rand.DefaultPrng,
|
||||
|
|
@ -88,10 +88,10 @@ fn init(
|
|||
sprite.schedule(.update);
|
||||
|
||||
app.init(.{
|
||||
.timer = try mach.Timer.start(),
|
||||
.spawn_timer = try mach.Timer.start(),
|
||||
.timer = try mach.time.Timer.start(),
|
||||
.spawn_timer = try mach.time.Timer.start(),
|
||||
.player = player,
|
||||
.fps_timer = try mach.Timer.start(),
|
||||
.fps_timer = try mach.time.Timer.start(),
|
||||
.frame_count = 0,
|
||||
.sprites = 0,
|
||||
.rand = std.rand.DefaultPrng.init(1337),
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
|||
|
||||
info_text: mach.EntityID,
|
||||
info_text_style: mach.EntityID,
|
||||
timer: mach.Timer,
|
||||
timer: mach.time.Timer,
|
||||
gotta_go_fast: bool = false,
|
||||
spawn_timer: mach.Timer,
|
||||
fps_timer: mach.Timer,
|
||||
spawn_timer: mach.time.Timer,
|
||||
fps_timer: mach.time.Timer,
|
||||
frame_count: usize,
|
||||
frame_rate: usize,
|
||||
num_sprites_spawned: usize,
|
||||
|
|
@ -141,9 +141,9 @@ fn init(
|
|||
app.init(.{
|
||||
.info_text = info_text,
|
||||
.info_text_style = style1,
|
||||
.timer = try mach.Timer.start(),
|
||||
.spawn_timer = try mach.Timer.start(),
|
||||
.fps_timer = try mach.Timer.start(),
|
||||
.timer = try mach.time.Timer.start(),
|
||||
.spawn_timer = try mach.time.Timer.start(),
|
||||
.fps_timer = try mach.time.Timer.start(),
|
||||
.frame_count = 0,
|
||||
.frame_rate = 0,
|
||||
.num_sprites_spawned = 0,
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ const Mat4x4 = math.Mat4x4;
|
|||
// TODO: banish global allocator
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
|
||||
timer: mach.Timer,
|
||||
timer: mach.time.Timer,
|
||||
player: mach.EntityID,
|
||||
direction: Vec2 = vec2(0, 0),
|
||||
spawning: bool = false,
|
||||
spawn_timer: mach.Timer,
|
||||
fps_timer: mach.Timer,
|
||||
spawn_timer: mach.time.Timer,
|
||||
fps_timer: mach.time.Timer,
|
||||
frame_count: usize,
|
||||
sprites: usize,
|
||||
rand: std.rand.DefaultPrng,
|
||||
|
|
@ -92,10 +92,10 @@ fn init(
|
|||
sprite.schedule(.update);
|
||||
|
||||
app.init(.{
|
||||
.timer = try mach.Timer.start(),
|
||||
.spawn_timer = try mach.Timer.start(),
|
||||
.timer = try mach.time.Timer.start(),
|
||||
.spawn_timer = try mach.time.Timer.start(),
|
||||
.player = player,
|
||||
.fps_timer = try mach.Timer.start(),
|
||||
.fps_timer = try mach.time.Timer.start(),
|
||||
.frame_count = 0,
|
||||
.sprites = 0,
|
||||
.rand = std.rand.DefaultPrng.init(1337),
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ const Vec3 = math.Vec3;
|
|||
const Mat3x3 = math.Mat3x3;
|
||||
const Mat4x4 = math.Mat4x4;
|
||||
|
||||
timer: mach.Timer,
|
||||
timer: mach.time.Timer,
|
||||
player: mach.EntityID,
|
||||
direction: Vec2 = vec2(0, 0),
|
||||
spawning: bool = false,
|
||||
spawn_timer: mach.Timer,
|
||||
fps_timer: mach.Timer,
|
||||
spawn_timer: mach.time.Timer,
|
||||
fps_timer: mach.time.Timer,
|
||||
frame_count: usize,
|
||||
rand: std.rand.DefaultPrng,
|
||||
time: f32,
|
||||
|
|
@ -104,10 +104,10 @@ fn init(
|
|||
text.schedule(.update);
|
||||
|
||||
app.init(.{
|
||||
.timer = try mach.Timer.start(),
|
||||
.spawn_timer = try mach.Timer.start(),
|
||||
.timer = try mach.time.Timer.start(),
|
||||
.spawn_timer = try mach.time.Timer.start(),
|
||||
.player = player,
|
||||
.fps_timer = try mach.Timer.start(),
|
||||
.fps_timer = try mach.time.Timer.start(),
|
||||
.frame_count = 0,
|
||||
.rand = std.rand.DefaultPrng.init(1337),
|
||||
.time = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue