lower framerate when not focused

This commit is contained in:
2024-06-27 22:08:36 -04:00
parent 7f7269fb07
commit 03d9c607c2
2 changed files with 8 additions and 2 deletions

View File

@@ -89,8 +89,10 @@ pub fn main() !void {
while (!au.W.should_close()) : (flight_idx = (flight_idx + 1) % flight.len) {
const frame = flight[flight_idx];
// todo switch mode depending on if window is focused
const events = au.wait_events_timeout(0.10);
const events = if (au.W.focused())
au.wait_events_timeout(0.1)
else
au.wait_events_timeout(0.5);
for (events) |u| {
switch (u) {