mach: Use math.inf instead of math.floatMax for indefinite wait of events
This commit is contained in:
parent
ff69efea52
commit
f80161bc72
2 changed files with 5 additions and 6 deletions
|
|
@ -62,7 +62,7 @@ pub fn setShouldClose(engine: *Engine, value: bool) void {
|
|||
// again.
|
||||
//
|
||||
// timeout is in seconds (<= 0.0 disables waiting)
|
||||
// - pass std.math.floatMax(f64) to wait with no timeout
|
||||
// - pass std.math.inf(f64) to wait with no timeout
|
||||
//
|
||||
// update() can be called earlier than timeout if an event happens (key press,
|
||||
// mouse motion, etc.)
|
||||
|
|
|
|||
|
|
@ -556,16 +556,15 @@ pub fn main() !void {
|
|||
const window = engine.internal.window;
|
||||
while (!window.shouldClose()) {
|
||||
if (engine.internal.wait_event_timeout > 0.0) {
|
||||
// wait for an event
|
||||
if (engine.internal.wait_event_timeout == std.math.floatMax(f64)) {
|
||||
// no timeout
|
||||
if (engine.internal.wait_event_timeout == std.math.inf(f64)) {
|
||||
// Wait for an event
|
||||
try glfw.waitEvents();
|
||||
} else {
|
||||
// with a timeout
|
||||
// Wait for an event with a timeout
|
||||
try glfw.waitEventsTimeout(engine.internal.wait_event_timeout);
|
||||
}
|
||||
} else {
|
||||
// don't wait
|
||||
// Don't wait for events
|
||||
try glfw.pollEvents();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue