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