Compare commits

..

1 commit

Author SHA1 Message Date
f05a61db3b Update Rust crate openvr to 0.7.0 2025-03-03 15:02:36 +00:00
6 changed files with 29 additions and 54 deletions

View file

@ -72,7 +72,6 @@ impl Context {
) {
Ok(res) => {
if !res {
self.device().wait_idle()?;
return Ok(false);
}
}
@ -120,10 +119,6 @@ impl Context {
pub fn controllers(&self) -> impl Iterator<Item = &Controller> {
self.presentation.event_system().controllers()
}
pub fn joysticks(&self) -> impl Iterator<Item = &Joystick> {
self.presentation.event_system().joysticks()
}
}
impl std::fmt::Debug for Context {

View file

@ -175,14 +175,18 @@ impl Engine {
let asset_manager = AssetManager::new(&engine_settings)?;
let gui_handler = GuiHandler::new(create_info.gui_info, &context)?;
let engine = Engine {
resource_base_path: create_info.resource_base_path,
};
context
.render_core_mut()
.add_render_routine::<GuiHandlerRenderer>(10_000_000);
context.render_core_mut().add_render_routine::<Scene>(100);
// context.render_core_mut().add_render_routine::<Scene>(100);
world.resources.insert(context);
Scene::new(
let scene = Scene::new(
create_info.rasterizer_info,
create_info.raytracing_info,
create_info.graphics_info,
@ -200,10 +204,9 @@ impl Engine {
world.resources.insert(GuiHandlerRenderer);
world.resources.insert(InputMap { direction_mapping });
world.resources.insert(asset_manager);
world.resources.insert(Engine {
resource_base_path: create_info.resource_base_path,
});
world.resources.insert(engine);
world.resources.insert(engine_settings);
world.resources.insert(scene);
world.add_system(Self::main_system::<T>);

View file

@ -12,18 +12,13 @@ pub enum EngineEvent<'a> {
KeyDown(Keycode),
KeyUp(Keycode),
ControllerButtonDown(&'a Controller, ControllerButton),
ControllerButtonUp(&'a Controller, ControllerButton),
ControllerAxis(&'a Controller, ControllerAxis),
ButtonDown(ControllerButton),
ButtonUp(ControllerButton),
ControllerAxis(ControllerAxis),
ControllerAdded(&'a Controller),
ControllerRemoved(&'a Controller),
JoystickButtonDown(&'a Joystick),
JoystickButtonUp(&'a Joystick),
JoystickAxis(&'a Joystick),
JoystickAdded(&'a Joystick),
JoystickRemoved(&'a Joystick),
FileDrop(String),
}
@ -71,11 +66,11 @@ impl Engine {
Event::TextInput(text) => {
Self::text_input(gui_handler, text)?;
}
Event::ControllerButtonDown(controller, button) => {
Self::button_down_event(world, gui_handler, consumer, controller, button)?;
Event::ControllerButtonDown(_controller, button) => {
Self::button_down_event(world, gui_handler, consumer, button)?;
}
Event::ControllerButtonUp(controller, button) => {
Self::button_up_event(world, consumer, controller, button)?;
Event::ControllerButtonUp(_controller, button) => {
Self::button_up_event(world, consumer, button)?;
}
Event::ControllerAxis(controller) => {
if !gui_handler.check_navigatable()? {
@ -91,21 +86,11 @@ impl Engine {
Self::controller_removed(world, consumer, controller)?
}
Event::JoystickAxis(joystick) => {
consumer.event(world, EngineEvent::JoystickAxis(joystick))?
}
Event::JoystickButtonDown(joystick) => {
consumer.event(world, EngineEvent::JoystickButtonDown(joystick))?
}
Event::JoystickButtonUp(joystick) => {
consumer.event(world, EngineEvent::JoystickButtonUp(joystick))?
}
Event::JoystickAdded(joystick) => {
consumer.event(world, EngineEvent::JoystickAdded(joystick))?
}
Event::JoystickRemoved(joystick) => {
consumer.event(world, EngineEvent::JoystickRemoved(joystick))?
}
Event::JoystickAxis(_joystick) => todo!(),
Event::JoystickButtonDown(_joystick) => todo!(),
Event::JoystickButtonUp(_joystick) => todo!(),
Event::JoystickAdded(_joystick) => todo!(),
Event::JoystickRemoved(_joystick) => todo!(),
Event::FileDrop(filename) => consumer.event(world, EngineEvent::FileDrop(filename))?,
}
@ -207,10 +192,9 @@ impl Engine {
fn button_up_event<T: EventConsumer>(
world: &mut World,
consumer: &mut T,
controller: &Controller,
button: ControllerButton,
) -> Result<()> {
consumer.event(world, EngineEvent::ControllerButtonUp(controller, button))?;
consumer.event(world, EngineEvent::ButtonUp(button))?;
Ok(())
}
@ -220,13 +204,12 @@ impl Engine {
world: &mut World,
gui_handler: &GuiHandler,
consumer: &mut T,
controller: &Controller,
button: ControllerButton,
) -> Result<()> {
if gui_handler.check_navigatable()? {
Self::check_button_down(world, gui_handler, consumer, controller, button)?;
Self::check_button_down(world, gui_handler, consumer, button)?;
} else {
consumer.event(world, EngineEvent::ControllerButtonDown(controller, button))?;
consumer.event(world, EngineEvent::ButtonDown(button))?;
}
Ok(())
@ -240,7 +223,7 @@ impl Engine {
) -> Result<()> {
consumer.event(
world,
EngineEvent::ControllerAxis(controller, controller.controller_axis()),
EngineEvent::ControllerAxis(controller.controller_axis()),
)?;
Ok(())
@ -251,7 +234,6 @@ impl Engine {
world: &mut World,
gui_handler: &GuiHandler,
consumer: &mut T,
controller: &Controller,
button: ControllerButton,
) -> Result<()> {
match button {
@ -331,7 +313,7 @@ impl Engine {
}
if !gui_handler.accept_custom_selection(button)? {
consumer.event(world, EngineEvent::ControllerButtonDown(controller, button))?;
consumer.event(world, EngineEvent::ButtonDown(button))?;
}
Ok(())

View file

@ -14,8 +14,8 @@ fn main() -> Result<()> {
world_builder.add_system(GameState::update);
world_builder.resources.insert(GameState::Startup);
// let dir = Path::new("C:/Users/M.Huebner/Downloads/Space Skybox Generator/Export");
let dir = Path::new("/home/michaelh/Sync/skybox");
let dir = Path::new("C:/Users/M.Huebner/Downloads/Space Skybox Generator/Export");
// let dir = Path::new("/home/michaelh/Sync/skybox");
SkyBox::new(
&mut world_builder,
[

View file

@ -362,10 +362,6 @@ impl EventSystem {
pub fn controllers(&self) -> impl Iterator<Item = &Controller> {
self.connected_controllers.values()
}
pub fn joysticks(&self) -> impl Iterator<Item = &Joystick> {
self.connected_joysticks.values()
}
}
unsafe impl Send for EventSystem {}

View file

@ -1,6 +1,6 @@
pub use crate::traits::*;
pub use crate::{RenderCoreCreateInfo, create_render_core};
pub use crate::{create_render_core, RenderCoreCreateInfo};
pub use crate::presentationcore::{ApplicationInfo, PresentationBackend, PresentationCore, VRMode};
@ -10,7 +10,6 @@ pub use crate::renderbackend::{Eye, VRTransformations};
pub use crate::input::{
controller::{Controller, ControllerDeadzones},
controlleraxis::ControllerAxis,
joystick::Joystick,
};
// wsi