mach: fundamental changes
- Core doesn't depend to `App` anymore - `setOptions` has replaced with some new functions (`setTitle`, `setSize`, etc) - and more
This commit is contained in:
parent
91a53807ab
commit
1d7cd4be80
26 changed files with 2306 additions and 1999 deletions
|
|
@ -1,20 +1,20 @@
|
|||
const std = @import("std");
|
||||
const platform = @import("platform.zig");
|
||||
|
||||
const Timer = @This();
|
||||
pub const Timer = @This();
|
||||
|
||||
backing_timer: platform.BackingTimerType = undefined,
|
||||
internal: platform.Timer,
|
||||
|
||||
/// Initialize the timer.
|
||||
pub fn start() !Timer {
|
||||
return Timer{
|
||||
.backing_timer = try platform.BackingTimerType.start(),
|
||||
.internal = try platform.Timer.start(),
|
||||
};
|
||||
}
|
||||
|
||||
/// Reads the timer value since start or the last reset in nanoseconds.
|
||||
pub inline fn readPrecise(timer: *Timer) u64 {
|
||||
return timer.backing_timer.read();
|
||||
return timer.internal.read();
|
||||
}
|
||||
|
||||
/// Reads the timer value since start or the last reset in seconds.
|
||||
|
|
@ -24,12 +24,12 @@ pub inline fn read(timer: *Timer) f32 {
|
|||
|
||||
/// Resets the timer value to 0/now.
|
||||
pub inline fn reset(timer: *Timer) void {
|
||||
timer.backing_timer.reset();
|
||||
timer.internal.reset();
|
||||
}
|
||||
|
||||
/// Returns the current value of the timer in nanoseconds, then resets it.
|
||||
pub inline fn lapPrecise(timer: *Timer) u64 {
|
||||
return timer.backing_timer.lap();
|
||||
return timer.internal.lap();
|
||||
}
|
||||
|
||||
/// Returns the current value of the timer in seconds, then resets it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue