diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:23 +0100 |
commit | ccf0074b08ce835cf22e7d46153d1cb3f3d06d32 (patch) | |
tree | cce0a39b4d1e3f272f071d5b9f2de9a403d396b4 /examples | |
parent | 6fd563b20772ad0ad279f6461179978766a77948 (diff) |
fix(render): get aspect ratio from renderer
Diffstat (limited to 'examples')
-rw-r--r-- | examples/render-quad/src/main.rs | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/examples/render-quad/src/main.rs b/examples/render-quad/src/main.rs index 9c3748d..3dbb824 100644 --- a/examples/render-quad/src/main.rs +++ b/examples/render-quad/src/main.rs @@ -149,31 +149,26 @@ fn try_main<'a>() -> Result<()> { MovementInputsManager::new(actions) }; - let ratio = window.inner_size().width as f32 / window.inner_size().height as f32; - // Load everything into the session - let mut session = Session::new( - |resources| { - resources.insert(map.clone()); - resources.insert(manager); - resources.insert(Timing::default()); - resources.insert(Mouse::default()); - resources.insert(ui); - }, - move |schedule| { - schedule - .add_system(update_deltatime_system()) - .add_system(process_window_events_system::< - MovementInputsManager, - Dp<'static>, - >()) - .flush() - .add_system(hello_world_system()) - .add_system(flycam_move_system::<MovementInputsManager>()) - .flush() - .add_thread_local(calc_vp_matrix_system(ratio)); - }, - ); + let mut session = Session::new(move |schedule| { + schedule + .add_system(update_deltatime_system()) + .add_system(process_window_events_system::< + MovementInputsManager, + Dp<'static>, + >()) + .flush() + .add_system(hello_world_system()) + .add_system(flycam_move_system::<MovementInputsManager>()) + .flush() + .add_thread_local(calc_vp_matrix_system::<Dp<'static>>()); + }); + + session.resources.insert(map.clone()); + session.resources.insert(manager); + session.resources.insert(Timing::default()); + session.resources.insert(Mouse::default()); + session.resources.insert(ui); // Add our player entity let player = session.world.push(( |