Get and set frame rate
This commit is contained in:
1 parent
149cf2a9b4
commit
3778320a3e
3 files changed
+24
-7
No files matched your search
@@ -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