mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-14 19:45:49 +00:00
imgui delta time needs to use float math
Our prior math converted to float after int which made our delta time wrong making hovers and stuff not work.
This commit is contained in:
@@ -1205,10 +1205,11 @@ pub const Inspector = struct {
|
||||
// Determine our delta time
|
||||
const now = try std.time.Instant.now();
|
||||
io.DeltaTime = if (self.instant) |prev| delta: {
|
||||
const since_ns = now.since(prev);
|
||||
const since_s: f32 = @floatFromInt(since_ns / std.time.ns_per_s);
|
||||
const since_ns: f64 = @floatFromInt(now.since(prev));
|
||||
const ns_per_s: f64 = @floatFromInt(std.time.ns_per_s);
|
||||
const since_s: f32 = @floatCast(since_ns / ns_per_s);
|
||||
break :delta @max(0.00001, since_s);
|
||||
} else (1 / 60);
|
||||
} else (1.0 / 60.0);
|
||||
self.instant = now;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user