From fbed29da66a8b811a4abcb481c2f3fd6c61a01ec Mon Sep 17 00:00:00 2001 From: Nova Date: Thu, 26 Jan 2023 09:24:10 -0500 Subject: [PATCH] feat: upgrade molecules, new frame --- Cargo.lock | 14 +++----------- Cargo.toml | 4 ++-- examples/app_grid.rs | 16 ++++++++-------- src/protostar.rs | 7 ++++--- 4 files changed, 17 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf459e2..7813158 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1217,7 +1217,7 @@ dependencies = [ [[package]] name = "protostar" -version = "0.3.0" +version = "0.4.0" dependencies = [ "clap", "color-eyre", @@ -1596,8 +1596,6 @@ dependencies = [ [[package]] name = "stardust-xr" version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8541caad6c5c3e9c43ce4fa43a330f7a3df5ec293c88fd062fff46172ceb97" dependencies = [ "chrono", "cluFlock", @@ -1615,9 +1613,7 @@ dependencies = [ [[package]] name = "stardust-xr-fusion" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a95836cb0147824ee1be564ba104de65d022da86d50bdac526e29830e8e1cf7c" +version = "0.34.0" dependencies = [ "anyhow", "color-rs", @@ -1638,9 +1634,7 @@ dependencies = [ [[package]] name = "stardust-xr-molecules" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d9a445dc6aef7010c17d972885cea278f96d5da70b030e6a39e3e041ca85df" +version = "0.17.0" dependencies = [ "color-rs", "flexbuffers", @@ -1658,8 +1652,6 @@ dependencies = [ [[package]] name = "stardust-xr-schemas" version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b2b760187d18535aadf608d6221506b1364a4fff14653f31c51a2fd6696fd9" dependencies = [ "flatbuffers", "flexbuffers", diff --git a/Cargo.toml b/Cargo.toml index a53c423..d800206 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "protostar" -version = "0.3.0" +version = "0.4.0" edition = "2021" [dependencies] @@ -17,7 +17,7 @@ mint = "0.5.9" nix = "0.26.1" resvg = "0.28.0" rustc-hash = "1.1.0" -stardust-xr-molecules = "0.16.0" +stardust-xr-molecules = "0.17.0" tokio = { version = "1.24.1", features = ["full"] } tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } tween = "2.0.0" diff --git a/examples/app_grid.rs b/examples/app_grid.rs index 9188085..393c421 100644 --- a/examples/app_grid.rs +++ b/examples/app_grid.rs @@ -6,7 +6,7 @@ use protostar::{ xdg::{get_desktop_files, parse_desktop_file, DesktopFile}, }; use stardust_xr_molecules::fusion::{ - client::{Client, LifeCycleHandler, LogicStepInfo}, + client::{Client, FrameInfo, RootHandler}, spatial::Spatial, }; @@ -24,7 +24,7 @@ async fn main() -> Result<()> { let (client, event_loop) = Client::connect_with_async_loop().await?; client.set_base_prefixes(&[directory_relative_path!("res")]); - let _root = client.wrap_root(AppGrid::new(&client)); + let _root = client.wrap_root(AppGrid::new(&client))?; tokio::select! { _ = tokio::signal::ctrl_c() => (), @@ -58,10 +58,10 @@ impl AppGrid { AppGrid { apps } } } -impl LifeCycleHandler for AppGrid { - fn logic_step(&mut self, info: LogicStepInfo) { +impl RootHandler for AppGrid { + fn frame(&mut self, info: FrameInfo) { for app in &mut self.apps { - app.logic_step(info); + app.frame(info); } } } @@ -109,8 +109,8 @@ impl App { }) } } -impl LifeCycleHandler for App { - fn logic_step(&mut self, info: LogicStepInfo) { - self.protostar.logic_step(info); +impl RootHandler for App { + fn frame(&mut self, info: FrameInfo) { + self.protostar.frame(info); } } diff --git a/src/protostar.rs b/src/protostar.rs index acf556a..89dc36d 100644 --- a/src/protostar.rs +++ b/src/protostar.rs @@ -5,7 +5,7 @@ use mint::Vector3; use nix::unistd::{execv, fork}; use stardust_xr_molecules::{ fusion::{ - client::{Client, LifeCycleHandler, LogicStepInfo}, + client::{Client, FrameInfo, RootHandler}, core::values::Transform, drawable::{MaterialParameter, Model, ResourceID}, fields::BoxField, @@ -113,8 +113,8 @@ impl ProtoStar { self.grabbable.content_parent() } } -impl LifeCycleHandler for ProtoStar { - fn logic_step(&mut self, info: LogicStepInfo) { +impl RootHandler for ProtoStar { + fn frame(&mut self, info: FrameInfo) { self.grabbable.update(); if let Some(icon_shrink) = &mut self.icon_shrink { @@ -147,6 +147,7 @@ impl LifeCycleHandler for ProtoStar { tokio::task::spawn(async move { std::env::set_var("STARDUST_STARTUP_TOKEN", future.await.unwrap()); if unsafe { fork() }.unwrap().is_parent() { + println!("Launching \"{}\"...", &executable); execv::<&CStr>( ustr("/bin/sh").as_cstr(), &[