Added last run to renderinput
parent
f85c2e082a
commit
f70f79e96a
|
@ -21,6 +21,7 @@ use nalgebra::Vector2;
|
||||||
use std::{
|
use std::{
|
||||||
fs,
|
fs,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
time::Instant,
|
||||||
};
|
};
|
||||||
use winit::{
|
use winit::{
|
||||||
event::{Event, KeyboardInput, WindowEvent},
|
event::{Event, KeyboardInput, WindowEvent},
|
||||||
|
@ -132,6 +133,7 @@ fn try_main() -> Result<()> {
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut phys_img = PhysImage::new();
|
let mut phys_img = PhysImage::new();
|
||||||
|
let mut last_run = Instant::now();
|
||||||
|
|
||||||
event_loop.run(move |event, _, control_flow| {
|
event_loop.run(move |event, _, control_flow| {
|
||||||
match event {
|
match event {
|
||||||
|
@ -143,9 +145,11 @@ fn try_main() -> Result<()> {
|
||||||
ct: &content,
|
ct: &content,
|
||||||
phys_img: &phys_img,
|
phys_img: &phys_img,
|
||||||
player: &player,
|
player: &player,
|
||||||
|
time_since_last_run: last_run.elapsed().as_secs_f32(),
|
||||||
current_system: SystemHandle { index: 0 },
|
current_system: SystemHandle { index: 0 },
|
||||||
timing: game.get_timing().clone(),
|
timing: game.get_timing().clone(),
|
||||||
};
|
};
|
||||||
|
last_run = Instant::now();
|
||||||
|
|
||||||
match gpu.render(render_input) {
|
match gpu.render(render_input) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
|
|
|
@ -25,6 +25,9 @@ pub struct RenderInput<'a> {
|
||||||
/// The current time, in seconds
|
/// The current time, in seconds
|
||||||
pub current_time: f32,
|
pub current_time: f32,
|
||||||
|
|
||||||
|
/// The amount of time that has passed since the last frame was drawn
|
||||||
|
pub time_since_last_run: f32,
|
||||||
|
|
||||||
/// Game content
|
/// Game content
|
||||||
pub ct: &'a Content,
|
pub ct: &'a Content,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue