Get and set frame rate
This commit is contained in:
@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user