app: refactor WindowContext name and creation
This commit is contained in:
parent
a293b962f7
commit
45ccf030f6
6 changed files with 42 additions and 52 deletions
|
@ -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")?;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::error::Error;
|
||||
|
||||
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::render_pass_manager::{RenderPassConfig, RenderPassManager};
|
||||
use crate::core::scene::Scene;
|
||||
|
@ -27,7 +27,7 @@ impl Scene for SettingsScene {
|
|||
self.state.is_some()
|
||||
}
|
||||
|
||||
fn load(&mut self, app_context: &mut ApplicationContext) -> Result<(), Box<dyn Error>> {
|
||||
fn load(&mut self, app_context: &mut WindowContext) -> Result<(), Box<dyn Error>> {
|
||||
let current_resolution = app_context.get_window_size();
|
||||
let available_resolutions = app_context.get_available_resolutions();
|
||||
|
||||
|
@ -39,14 +39,14 @@ impl Scene for SettingsScene {
|
|||
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>> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
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 found")?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue