feat: simplify arguments
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -4,7 +4,11 @@ mod protostar;
|
|||||||
use manifest_dir_macros::directory_relative_path;
|
use manifest_dir_macros::directory_relative_path;
|
||||||
use protostar::ProtoStar;
|
use protostar::ProtoStar;
|
||||||
use stardust_xr_molecules::fusion::client::Client;
|
use stardust_xr_molecules::fusion::client::Client;
|
||||||
use std::{env::args, path::PathBuf, str::FromStr};
|
use std::{
|
||||||
|
env::{args, current_dir},
|
||||||
|
path::{Path, PathBuf},
|
||||||
|
str::FromStr,
|
||||||
|
};
|
||||||
|
|
||||||
#[tokio::main(flavor = "current_thread")]
|
#[tokio::main(flavor = "current_thread")]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
@@ -13,9 +17,10 @@ async fn main() {
|
|||||||
|
|
||||||
let _root = client.wrap_root(ProtoStar::new(
|
let _root = client.wrap_root(ProtoStar::new(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
PathBuf::from_str(&args().nth(2).unwrap()).unwrap(),
|
|
||||||
0.1,
|
0.1,
|
||||||
PathBuf::from_str(&args().nth(1).unwrap()).unwrap(),
|
current_dir()
|
||||||
|
.unwrap()
|
||||||
|
.join(Path::new(&args().nth(1).unwrap())),
|
||||||
));
|
));
|
||||||
|
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use stardust_xr_molecules::{
|
|||||||
drawable::Model,
|
drawable::Model,
|
||||||
fields::SphereField,
|
fields::SphereField,
|
||||||
node::NodeType,
|
node::NodeType,
|
||||||
|
resource::NamespacedResource,
|
||||||
startup_settings::StartupSettings,
|
startup_settings::StartupSettings,
|
||||||
},
|
},
|
||||||
GrabData, Grabbable,
|
GrabData, Grabbable,
|
||||||
@@ -26,7 +27,7 @@ pub struct ProtoStar {
|
|||||||
executable_path: PathBuf,
|
executable_path: PathBuf,
|
||||||
}
|
}
|
||||||
impl ProtoStar {
|
impl ProtoStar {
|
||||||
pub fn new(client: Arc<Client>, icon: PathBuf, size: f32, executable_path: PathBuf) -> Self {
|
pub fn new(client: Arc<Client>, size: f32, executable_path: PathBuf) -> Self {
|
||||||
let field =
|
let field =
|
||||||
SphereField::create(client.get_root(), Vector3::from([0.0; 3]), size * 0.5).unwrap();
|
SphereField::create(client.get_root(), Vector3::from([0.0; 3]), size * 0.5).unwrap();
|
||||||
let grabbable = Grabbable::new(
|
let grabbable = Grabbable::new(
|
||||||
@@ -42,7 +43,7 @@ impl ProtoStar {
|
|||||||
let icon = Model::create(
|
let icon = Model::create(
|
||||||
grabbable.content_parent(),
|
grabbable.content_parent(),
|
||||||
Transform::from_scale([size; 3]),
|
Transform::from_scale([size; 3]),
|
||||||
&icon,
|
&NamespacedResource::new("protostar", "default_icon"),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
ProtoStar {
|
ProtoStar {
|
||||||
|
|||||||
Reference in New Issue
Block a user