progress commit: openxr + pipewire + refactor
This commit is contained in:
43
src/main.rs
43
src/main.rs
@@ -7,7 +7,11 @@ mod overlays;
|
||||
mod shaders;
|
||||
mod state;
|
||||
|
||||
use crate::backend::openvr::openvr_run;
|
||||
use std::sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
};
|
||||
|
||||
use env_logger::Env;
|
||||
|
||||
fn main() {
|
||||
@@ -18,5 +22,40 @@ fn main() {
|
||||
env!("CARGO_PKG_VERSION")
|
||||
);
|
||||
|
||||
openvr_run();
|
||||
let running = Arc::new(AtomicBool::new(true));
|
||||
let _ = ctrlc::set_handler({
|
||||
let running = running.clone();
|
||||
move || {
|
||||
running.store(false, Ordering::Relaxed);
|
||||
}
|
||||
});
|
||||
|
||||
#[cfg(all(feature = "openxr", feature = "openvr"))]
|
||||
auto_run(running);
|
||||
|
||||
#[cfg(all(feature = "openvr", not(feature = "openxr")))]
|
||||
crate::backend::openvr::openvr_run(running);
|
||||
|
||||
#[cfg(all(feature = "openxr", not(feature = "openvr")))]
|
||||
crate::backend::openxr::openxr_run(running);
|
||||
|
||||
#[cfg(not(any(feature = "openxr", feature = "openvr")))]
|
||||
compile_error!("You must enable at least one backend feature (openxr or openvr)");
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "openxr", feature = "openvr"))]
|
||||
fn auto_run(running: Arc<AtomicBool>) {
|
||||
use crate::backend::openvr::openvr_run;
|
||||
use crate::backend::openxr::openxr_run;
|
||||
use backend::common::BackendError;
|
||||
|
||||
let Err(BackendError::NotSupported) = openxr_run(running.clone()) else {
|
||||
return;
|
||||
};
|
||||
|
||||
let Err(BackendError::NotSupported) = openvr_run(running) else {
|
||||
return;
|
||||
};
|
||||
|
||||
log::error!("No supported backends found");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user