--- a/rust/hwrunner/src/main.rs Sun Nov 15 05:35:18 2020 +0300
+++ b/rust/hwrunner/src/main.rs Mon Nov 16 01:41:42 2020 +0300
@@ -50,8 +50,11 @@
let mut now = Instant::now();
let mut update = Instant::now();
+ let mut render = Instant::now();
+ unsafe { window.make_current().unwrap() };
let mut is_running = true;
+
while is_running {
let curr = Instant::now();
let delta = curr - now;
@@ -100,9 +103,10 @@
_ => (),
});
- unsafe { window.make_current().unwrap() };
-
- engine.render();
- window.swap_buffers().unwrap();
+ if render.elapsed() > Duration::from_millis(16) {
+ render = curr;
+ engine.render();
+ window.swap_buffers().unwrap();
+ }
}
}
--- a/rust/lib-hedgewars-engine/src/render/gear.rs Sun Nov 15 05:35:18 2020 +0300
+++ b/rust/lib-hedgewars-engine/src/render/gear.rs Mon Nov 16 01:41:42 2020 +0300
@@ -12,7 +12,6 @@
use png::{ColorType, Decoder, DecodingError};
-use std::ops::BitAnd;
use std::{
collections::HashMap,
ffi::OsString,