app: refactor WindowContext name and creation

This commit is contained in:
Florian RICHER 2025-05-31 12:56:00 +02:00
parent a293b962f7
commit 45ccf030f6
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
6 changed files with 42 additions and 52 deletions

View file

@ -2,7 +2,7 @@ use std::error::Error;
use super::settings_scene::SettingsScene;
use crate::core::app::DEPTH_IMAGE_ID;
use crate::core::app::context::ApplicationContext;
use crate::core::app::context::WindowContext;
use crate::core::app::user_event::UserEvent;
use crate::core::render::primitives::camera::Camera3D;
use crate::core::render::primitives::transform::Transform;
@ -38,10 +38,7 @@ impl Scene for MainScene {
self.state.is_some()
}
fn load(
&mut self,
app_context: &mut ApplicationContext,
) -> Result<(), Box<dyn std::error::Error>> {
fn load(&mut self, app_context: &mut WindowContext) -> Result<(), Box<dyn std::error::Error>> {
let depth_image_view = app_context.with_renderer_mut(|renderer| {
renderer.get_additional_image_view(DEPTH_IMAGE_ID).clone()
});
@ -118,7 +115,7 @@ impl Scene for MainScene {
Ok(())
}
fn update(&mut self, app_context: &mut ApplicationContext) -> Result<(), Box<dyn Error>> {
fn update(&mut self, app_context: &mut WindowContext) -> Result<(), Box<dyn Error>> {
let state = self.state.as_mut().unwrap();
app_context.with_input_manager(|input_manager| {
app_context.with_timer(|timer| {
@ -168,7 +165,7 @@ impl Scene for MainScene {
fn render(
&mut self,
before_future: Box<dyn GpuFuture>,
app_context: &mut ApplicationContext,
app_context: &mut WindowContext,
) -> Result<Box<dyn GpuFuture>, Box<dyn Error>> {
let state = self.state.as_ref().ok_or("State not loaded")?;