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 | 5851b43ca65d979b2d290eb94bd0187f9b9e5736 (patch) | |
tree | 8da72b834b03b0f8d8bbe8679530278044693cf8 /examples | |
parent | a098066875fd554f7d1a6538b55d6b39a3e055e9 (diff) |
chore(render-quad): add textures
Diffstat (limited to 'examples')
-rw-r--r-- | examples/render-quad/src/main.rs | 25 | ||||
-rwxr-xr-x | examples/render-quad/textures/example_texture | bin | 0 -> 128311 bytes |
2 files changed, 20 insertions, 5 deletions
diff --git a/examples/render-quad/src/main.rs b/examples/render-quad/src/main.rs index 681c2a1..9c3748d 100644 --- a/examples/render-quad/src/main.rs +++ b/examples/render-quad/src/main.rs @@ -10,10 +10,13 @@ use anyhow::{Context, Result}; use log::warn; use std::collections::BTreeMap; +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::{ConsDrawPass, LevelDrawPass, UiDrawPass}; +use stockton_render::draw::{ + texture::resolver::FsResolver, ConsDrawPass, LevelDrawPass, LevelDrawPassConfig, UiDrawPass, +}; use winit::{event::Event, event_loop::EventLoop, window::WindowBuilder}; use egui::{containers::CentralPanel, Frame}; @@ -150,8 +153,8 @@ fn try_main<'a>() -> Result<()> { // Load everything into the session let mut session = Session::new( - move |resources| { - resources.insert(map); + |resources| { + resources.insert(map.clone()); resources.insert(manager); resources.insert(Timing::default()); resources.insert(Mouse::default()); @@ -188,8 +191,20 @@ fn try_main<'a>() -> Result<()> { )); // Create the renderer - let (renderer, tx): (Renderer<Dp<'static>>, _) = - Renderer::new(&window, &session, (player, ()))?; + let (renderer, tx): (Renderer<Dp<'static>>, _) = Renderer::new( + &window, + &session, + ( + LevelDrawPassConfig { + active_camera: player, + tex_resolver: FsResolver::new( + Path::new("./examples/render-quad/textures"), + map.clone(), + ), + }, + (), + ), + )?; let new_control_flow = renderer.update_control_flow.clone(); // Populate the initial UI state diff --git a/examples/render-quad/textures/example_texture b/examples/render-quad/textures/example_texture Binary files differnew file mode 100755 index 0000000..eb4e502 --- /dev/null +++ b/examples/render-quad/textures/example_texture |