Added last run to renderinput

master
Mark 2024-01-25 21:25:21 -08:00
parent f85c2e082a
commit f70f79e96a
Signed by: Mark
GPG Key ID: C6D63995FE72FD80
2 changed files with 7 additions and 0 deletions

View File

@ -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(_) => {}

View File

@ -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,