aboutsummaryrefslogtreecommitdiff
path: root/examples/render-bsp/src
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:22 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:22 +0100
commit8c1406f7a42822d1b020cc672ed99d02eb34d22f (patch)
treee9b3c21520786d2cb9819e46c504e759e4d2d695 /examples/render-bsp/src
parentb380ad94647c9bc446d5a76bb16dcc286077275a (diff)
feat(render-bsp): process into inputmanager
Diffstat (limited to 'examples/render-bsp/src')
-rw-r--r--examples/render-bsp/src/main.rs27
1 files changed, 26 insertions, 1 deletions
diff --git a/examples/render-bsp/src/main.rs b/examples/render-bsp/src/main.rs
index b18d7f2..96d5e42 100644
--- a/examples/render-bsp/src/main.rs
+++ b/examples/render-bsp/src/main.rs
@@ -17,6 +17,10 @@
//! Renders ./example.bsp
+use stockton_input::{Axis, InputManager};
+#[macro_use]
+extern crate stockton_input_codegen;
+use std::collections::BTreeMap;
use winit::{event::Event, event_loop::EventLoop, window::WindowBuilder};
use stockton_levels::{prelude::*, q3::Q3BSPFile};
@@ -25,6 +29,18 @@ use stockton_render::{
};
use stockton_types::Session;
+#[derive(InputManager, Default, Clone, Debug)]
+struct MovementInputs {
+ #[axis]
+ x: Axis,
+
+ #[axis]
+ y: Axis,
+
+ #[axis]
+ z: Axis,
+}
+
fn main() {
// Initialise logger
simple_logger::SimpleLogger::new()
@@ -54,15 +70,24 @@ fn main() {
let (renderer, tx) = Renderer::new(&window, &bsp);
let new_control_flow = renderer.update_control_flow.clone();
+ // Create the input manager
+ let manager = {
+ let actions = BTreeMap::new();
+ // TODO: An actual control schema
+
+ MovementInputsManager::new(actions)
+ };
+
// Load everything into the session
let mut session = Session::new(
move |resources| {
resources.insert(renderer);
resources.insert(bsp);
+ resources.insert(manager);
},
move |schedule| {
schedule
- .add_system(process_window_events_system())
+ .add_system(process_window_events_system::<MovementInputsManager>())
.add_thread_local(do_render_system::<Q3BSPFile<VulkanSystem>>());
},
);