feat: upgrade molecules, new frame

This commit is contained in:
Nova
2023-01-26 09:24:10 -05:00
parent 1c66cdcd2c
commit fbed29da66
4 changed files with 17 additions and 24 deletions

14
Cargo.lock generated
View File

@@ -1217,7 +1217,7 @@ dependencies = [
[[package]] [[package]]
name = "protostar" name = "protostar"
version = "0.3.0" version = "0.4.0"
dependencies = [ dependencies = [
"clap", "clap",
"color-eyre", "color-eyre",
@@ -1596,8 +1596,6 @@ dependencies = [
[[package]] [[package]]
name = "stardust-xr" name = "stardust-xr"
version = "0.10.5" version = "0.10.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd8541caad6c5c3e9c43ce4fa43a330f7a3df5ec293c88fd062fff46172ceb97"
dependencies = [ dependencies = [
"chrono", "chrono",
"cluFlock", "cluFlock",
@@ -1615,9 +1613,7 @@ dependencies = [
[[package]] [[package]]
name = "stardust-xr-fusion" name = "stardust-xr-fusion"
version = "0.33.0" version = "0.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a95836cb0147824ee1be564ba104de65d022da86d50bdac526e29830e8e1cf7c"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"color-rs", "color-rs",
@@ -1638,9 +1634,7 @@ dependencies = [
[[package]] [[package]]
name = "stardust-xr-molecules" name = "stardust-xr-molecules"
version = "0.16.0" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73d9a445dc6aef7010c17d972885cea278f96d5da70b030e6a39e3e041ca85df"
dependencies = [ dependencies = [
"color-rs", "color-rs",
"flexbuffers", "flexbuffers",
@@ -1658,8 +1652,6 @@ dependencies = [
[[package]] [[package]]
name = "stardust-xr-schemas" name = "stardust-xr-schemas"
version = "1.3.0" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12b2b760187d18535aadf608d6221506b1364a4fff14653f31c51a2fd6696fd9"
dependencies = [ dependencies = [
"flatbuffers", "flatbuffers",
"flexbuffers", "flexbuffers",

View File

@@ -1,6 +1,6 @@
[package] [package]
name = "protostar" name = "protostar"
version = "0.3.0" version = "0.4.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
@@ -17,7 +17,7 @@ mint = "0.5.9"
nix = "0.26.1" nix = "0.26.1"
resvg = "0.28.0" resvg = "0.28.0"
rustc-hash = "1.1.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"] } tokio = { version = "1.24.1", features = ["full"] }
tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }
tween = "2.0.0" tween = "2.0.0"

View File

@@ -6,7 +6,7 @@ use protostar::{
xdg::{get_desktop_files, parse_desktop_file, DesktopFile}, xdg::{get_desktop_files, parse_desktop_file, DesktopFile},
}; };
use stardust_xr_molecules::fusion::{ use stardust_xr_molecules::fusion::{
client::{Client, LifeCycleHandler, LogicStepInfo}, client::{Client, FrameInfo, RootHandler},
spatial::Spatial, spatial::Spatial,
}; };
@@ -24,7 +24,7 @@ async fn main() -> Result<()> {
let (client, event_loop) = Client::connect_with_async_loop().await?; let (client, event_loop) = Client::connect_with_async_loop().await?;
client.set_base_prefixes(&[directory_relative_path!("res")]); 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::select! {
_ = tokio::signal::ctrl_c() => (), _ = tokio::signal::ctrl_c() => (),
@@ -58,10 +58,10 @@ impl AppGrid {
AppGrid { apps } AppGrid { apps }
} }
} }
impl LifeCycleHandler for AppGrid { impl RootHandler for AppGrid {
fn logic_step(&mut self, info: LogicStepInfo) { fn frame(&mut self, info: FrameInfo) {
for app in &mut self.apps { for app in &mut self.apps {
app.logic_step(info); app.frame(info);
} }
} }
} }
@@ -109,8 +109,8 @@ impl App {
}) })
} }
} }
impl LifeCycleHandler for App { impl RootHandler for App {
fn logic_step(&mut self, info: LogicStepInfo) { fn frame(&mut self, info: FrameInfo) {
self.protostar.logic_step(info); self.protostar.frame(info);
} }
} }

View File

@@ -5,7 +5,7 @@ use mint::Vector3;
use nix::unistd::{execv, fork}; use nix::unistd::{execv, fork};
use stardust_xr_molecules::{ use stardust_xr_molecules::{
fusion::{ fusion::{
client::{Client, LifeCycleHandler, LogicStepInfo}, client::{Client, FrameInfo, RootHandler},
core::values::Transform, core::values::Transform,
drawable::{MaterialParameter, Model, ResourceID}, drawable::{MaterialParameter, Model, ResourceID},
fields::BoxField, fields::BoxField,
@@ -113,8 +113,8 @@ impl ProtoStar {
self.grabbable.content_parent() self.grabbable.content_parent()
} }
} }
impl LifeCycleHandler for ProtoStar { impl RootHandler for ProtoStar {
fn logic_step(&mut self, info: LogicStepInfo) { fn frame(&mut self, info: FrameInfo) {
self.grabbable.update(); self.grabbable.update();
if let Some(icon_shrink) = &mut self.icon_shrink { if let Some(icon_shrink) = &mut self.icon_shrink {
@@ -147,6 +147,7 @@ impl LifeCycleHandler for ProtoStar {
tokio::task::spawn(async move { tokio::task::spawn(async move {
std::env::set_var("STARDUST_STARTUP_TOKEN", future.await.unwrap()); std::env::set_var("STARDUST_STARTUP_TOKEN", future.await.unwrap());
if unsafe { fork() }.unwrap().is_parent() { if unsafe { fork() }.unwrap().is_parent() {
println!("Launching \"{}\"...", &executable);
execv::<&CStr>( execv::<&CStr>(
ustr("/bin/sh").as_cstr(), ustr("/bin/sh").as_cstr(),
&[ &[