target fps parameter to run
This commit is contained in:
parent
b528c6adbe
commit
abc2d4b1f9
|
@ -14,7 +14,7 @@ struct World {
|
|||
|
||||
fn main() {
|
||||
rand::thread_rng().gen::<Direction>();
|
||||
run::<World>(WIDTH, HEIGHT);
|
||||
run::<World>(WIDTH, HEIGHT, 240);
|
||||
}
|
||||
|
||||
impl Game for World {
|
||||
|
|
|
@ -74,7 +74,7 @@ impl WindowState {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn run<T: Game + 'static>(width: i32, height: i32) {
|
||||
pub fn run<T: Game + 'static>(width: i32, height: i32, target_fps: u32) {
|
||||
let mut event_loop = EventLoop::new();
|
||||
let window = {
|
||||
let size = LogicalSize::new(width as f64, height as f64);
|
||||
|
@ -109,7 +109,6 @@ pub fn run<T: Game + 'static>(width: i32, height: i32) {
|
|||
let mut last_second = Instant::now();
|
||||
|
||||
let mut last_frame = last_second;
|
||||
let target_fps = 60;
|
||||
let target_frame_duration = Duration::from_secs(1) / target_fps;
|
||||
|
||||
let mut scale = 1usize;
|
||||
|
|
Loading…
Reference in New Issue