Skip to content

Commit

Permalink
Add back the SDL_Delay when the bot is not playing, to reduce CPU usage
Browse files Browse the repository at this point in the history
by a lot.
  • Loading branch information
kwakzalver committed May 4, 2023
1 parent 1c038fa commit 5fdb930
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/window.zig
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,10 @@ pub fn sdl2_game() anyerror!void {
render_time = last_frame_drawn.read() / std.time.ns_per_ms;
}
}

if (!G.zigtris_bot) {
C.SDL_Delay(@divFloor(TARGET_FPS_DELAY, std.time.ns_per_ms * 4));
}
}

// free up stuff
Expand Down

0 comments on commit 5fdb930

Please sign in to comment.