feat: simplify arguments

This commit is contained in:
Nova
2023-01-05 08:30:52 -05:00
parent c8d7fa725f
commit 764483ef3d
2 changed files with 11 additions and 5 deletions

View File

@@ -4,7 +4,11 @@ mod protostar;
use manifest_dir_macros::directory_relative_path;
use protostar::ProtoStar;
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")]
async fn main() {
@@ -13,9 +17,10 @@ async fn main() {
let _root = client.wrap_root(ProtoStar::new(
client.clone(),
PathBuf::from_str(&args().nth(2).unwrap()).unwrap(),
0.1,
PathBuf::from_str(&args().nth(1).unwrap()).unwrap(),
current_dir()
.unwrap()
.join(Path::new(&args().nth(1).unwrap())),
));
tokio::select! {

View File

@@ -8,6 +8,7 @@ use stardust_xr_molecules::{
drawable::Model,
fields::SphereField,
node::NodeType,
resource::NamespacedResource,
startup_settings::StartupSettings,
},
GrabData, Grabbable,
@@ -26,7 +27,7 @@ pub struct ProtoStar {
executable_path: PathBuf,
}
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 =
SphereField::create(client.get_root(), Vector3::from([0.0; 3]), size * 0.5).unwrap();
let grabbable = Grabbable::new(
@@ -42,7 +43,7 @@ impl ProtoStar {
let icon = Model::create(
grabbable.content_parent(),
Transform::from_scale([size; 3]),
&icon,
&NamespacedResource::new("protostar", "default_icon"),
)
.unwrap();
ProtoStar {