Time travel!

This commit is contained in:
duck
2025-06-16 01:49:58 +05:00
parent 3635712a53
commit 5987f9a44f
6 changed files with 185 additions and 70 deletions

View File

@@ -68,9 +68,11 @@ pub fn run(self: *Self) GameError!void {
var current_time: sdl.Time = undefined;
if (sdl.GetCurrentTime(&current_time)) {
const time = self.graph.getResource(Time).?;
time.delta = @as(f32, @floatFromInt(current_time - time.now)) * 0.000000001;
if (time.now != 0) {
time.delta = @as(f32, @floatFromInt(current_time - time.now)) * 0.000000001;
}
time.now = current_time;
}
} else return error.SdlError;
var controller = try self.graph.getController();
controller.queue(.{