diff options
Diffstat (limited to 'examples/render-quad')
-rw-r--r-- | examples/render-quad/Cargo.toml | 1 | ||||
-rw-r--r-- | examples/render-quad/src/main.rs | 21 |
2 files changed, 15 insertions, 7 deletions
diff --git a/examples/render-quad/Cargo.toml b/examples/render-quad/Cargo.toml index d32aa6e..9988c66 100644 --- a/examples/render-quad/Cargo.toml +++ b/examples/render-quad/Cargo.toml @@ -11,6 +11,7 @@ stockton-input-codegen = { path = "../../stockton-input-codegen" } stockton-types = { path = "../../stockton-types" } stockton-levels = { path = "../../stockton-levels" } stockton-contrib = { path = "../../stockton-contrib", features = ["delta_time", "flycam"] } +stockton-passes = { path = "../../stockton-passes" } winit = "^0.21" log = "0.4.0" simplelog = "^0.10" diff --git a/examples/render-quad/src/main.rs b/examples/render-quad/src/main.rs index 3dbb824..0cc8b83 100644 --- a/examples/render-quad/src/main.rs +++ b/examples/render-quad/src/main.rs @@ -9,14 +9,19 @@ extern crate legion; use anyhow::{Context, Result}; use log::warn; use std::collections::BTreeMap; +use stockton_passes::camera::calc_vp_matrix_system; +use stockton_passes::window::{process_window_events_system, UiState, WindowEvent, WindowFlow}; +use winit::event_loop::ControlFlow; use std::path::Path; use std::sync::{Arc, RwLock}; use stockton_levels::parts::data::{Geometry, Vertex}; use stockton_levels::types::Rgba; -use stockton_render::draw::{ - texture::resolver::FsResolver, ConsDrawPass, LevelDrawPass, LevelDrawPassConfig, UiDrawPass, +use stockton_passes::{ + level::{LevelDrawPass, LevelDrawPassConfig}, + ui::UiDrawPass, }; +use stockton_render::{draw_passes::ConsDrawPass, texture::resolver::FsResolver}; use winit::{event::Event, event_loop::EventLoop, window::WindowBuilder}; use egui::{containers::CentralPanel, Frame}; @@ -26,8 +31,7 @@ use stockton_contrib::flycam::*; use stockton_input::{Axis, InputManager, Mouse}; use stockton_render::error::full_error_display; -use stockton_render::systems::*; -use stockton_render::{Renderer, UiState, WindowEvent}; +use stockton_render::Renderer; use stockton_types::components::{CameraSettings, CameraVPMatrix, Transform}; use stockton_types::{Session, Vector2, Vector3}; @@ -186,9 +190,9 @@ fn try_main<'a>() -> Result<()> { )); // Create the renderer - let (renderer, tx): (Renderer<Dp<'static>>, _) = Renderer::new( + let renderer = Renderer::<Dp<'static>>::new( &window, - &session, + &mut session, ( LevelDrawPassConfig { active_camera: player, @@ -200,7 +204,10 @@ fn try_main<'a>() -> Result<()> { (), ), )?; - let new_control_flow = renderer.update_control_flow.clone(); + + let new_control_flow = Arc::new(RwLock::new(ControlFlow::Poll)); + let (window_flow, tx) = WindowFlow::new(new_control_flow.clone()); + session.resources.insert(window_flow); // Populate the initial UI state { |