Get and set frame rate

This commit is contained in:
2021-11-24 11:15:33 -07:00
parent 149cf2a9b4
commit 3778320a3e
3 changed files with 24 additions and 7 deletions

View File

@ -44,6 +44,22 @@ pub const Window = struct{
else => return UpdateError.InternalError,
}
}
};
pub fn getTargetFPS() u32 {
return minifb_c.mfb_get_target_fps();
}
pub fn setTargetFPS(fps: u32) void {
minifb_c.mfb_set_target_fps(fps);
}
// TODO Figure out how to run this once I have Internet access.
test "set and get target FPS" {
const max = 40;
var fps: u32 = 30;
while (fps < max) {
setTargetFPS(fps);
try std.testing.expectEqual(fps, getTargetFPS());
}
}