feat: newer input system

This commit is contained in:
Nova
2024-07-02 18:27:40 -04:00
parent 4fc7a513b6
commit 0025e8d955
11 changed files with 885 additions and 255 deletions

888
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -7,8 +7,8 @@ serde = "1.0.197"
[workspace.dependencies.stardust-xr-fusion]
git = "https://github.com/StardustXR/core.git"
# path = "../../core/fusion"
branch = "dev"
[workspace.dependencies.stardust-xr-molecules]
git = "https://github.com/StardustXR/molecules.git"
# path = "../../molecules"
branch = "dev"

View File

@@ -12,11 +12,5 @@ manifest-dir-macros = "0.1.18"
glam = "0.24.2"
tween = "2.0.1"
tracing-subscriber = "0.3.17"
[dependencies.stardust-xr-fusion]
git = "https://github.com/StardustXR/core.git"
# path = "../../core/fusion"
[dependencies.stardust-xr-molecules]
git = "https://github.com/StardustXR/molecules.git"
# path = "../../molecules"
stardust-xr-fusion = { workspace = true }
stardust-xr-molecules = { workspace = true }

View File

@@ -6,14 +6,15 @@ use protostar::{
xdg::{get_desktop_files, parse_desktop_file, DesktopFile, Icon, IconType},
};
use stardust_xr_fusion::{
client::{Client, ClientState, FrameInfo, RootHandler},
client::Client,
core::values::{color::rgba_linear, ResourceID, Vector3},
drawable::{
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
YAlign,
},
fields::BoxField,
fields::{Field, Shape},
node::NodeType,
root::{ClientState, FrameInfo, RootAspect, RootHandler},
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
};
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
@@ -32,9 +33,11 @@ async fn main() -> Result<()> {
.pretty()
.init();
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")])
.unwrap();
let _root = client.wrap_root(AppGrid::new(&client))?;
let _root = client.get_root().alias().wrap(AppGrid::new(&client))?;
tokio::select! {
_ = tokio::signal::ctrl_c() => (),
@@ -44,7 +47,6 @@ async fn main() -> Result<()> {
}
struct AppGrid {
root: Spatial,
apps: Vec<App>,
//style: TextStyle,
}
@@ -69,20 +71,17 @@ impl AppGrid {
.ok()
})
.collect::<Vec<_>>();
AppGrid {
root: client.get_root().alias(),
apps,
}
AppGrid { apps }
}
}
impl RootHandler for AppGrid {
fn frame(&mut self, info: FrameInfo) {
for app in &mut self.apps {
app.frame(info);
app.frame(&info);
}
}
fn save_state(&mut self) -> ClientState {
ClientState::from_root(&self.root)
fn save_state(&mut self) -> Result<ClientState> {
Ok(ClientState::default())
}
}
@@ -99,11 +98,11 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
Transform::from_rotation(Quat::from_rotation_y(PI)),
&ResourceID::new_namespaced("protostar", "cartridge"),
)?;
model.model_part("Cartridge")?.set_material_parameter(
model.part("Cartridge")?.set_material_parameter(
"color",
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
)?;
model.model_part("Icon")?.set_material_parameter(
model.part("Icon")?.set_material_parameter(
"diffuse",
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
)?;
@@ -122,18 +121,18 @@ pub struct App {
root: Spatial,
application: Application,
grabbable: Grabbable,
_field: BoxField,
_field: Field,
_icon: Model,
_label: Option<Text>,
}
impl App {
pub fn create_from_desktop_file(
parent: &impl SpatialAspect,
parent: &impl SpatialRefAspect,
position: impl Into<Vector3<f32>>,
desktop_file: DesktopFile,
) -> Result<Self> {
let root = Spatial::create(parent, Transform::from_translation(position), false)?;
let field = BoxField::create(&root, Transform::none(), [APP_SIZE; 3])?;
let field = Field::create(&root, Transform::none(), Shape::Box([APP_SIZE; 3].into()))?;
let application = Application::create(desktop_file)?;
let icon = application.icon(128, true);
let grabbable = Grabbable::create(
@@ -171,7 +170,7 @@ impl App {
};
let label = application.name().and_then(|name| {
Text::create(
&icon.model_part("Label").ok()?,
&icon.part("Label").ok()?,
Transform::none(),
name,
label_style,
@@ -198,7 +197,7 @@ impl App {
// .unwrap();
// }
fn frame(&mut self, info: FrameInfo) {
fn frame(&mut self, info: &FrameInfo) {
let _ = self.grabbable.update(&info);
if self.grabbable.grab_action().actor_stopped() {

Binary file not shown.

View File

@@ -5,14 +5,14 @@ use protostar::{
xdg::{DesktopFile, Icon, IconType},
};
use stardust_xr_fusion::{
client::FrameInfo,
core::values::{ResourceID, Vector3},
drawable::{
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
YAlign,
},
fields::BoxField,
fields::{Field, Shape},
node::NodeType,
root::FrameInfo,
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
};
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
@@ -36,9 +36,9 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
)?;
model
.model_part("Hex")?
.part("Hex")?
.set_material_parameter("color", MaterialParameter::Color(DEFAULT_HEX_COLOR))?;
model.model_part("Icon")?.set_material_parameter(
model.part("Icon")?.set_material_parameter(
"diffuse",
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
)?;
@@ -58,7 +58,7 @@ pub struct App {
parent: Spatial,
position: Vector3<f32>,
grabbable: Grabbable,
_field: BoxField,
_field: Field,
icon: Model,
label: Option<Text>,
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
@@ -73,7 +73,11 @@ impl App {
state: &State,
) -> Result<Self> {
let position = position.into();
let field = BoxField::create(parent, Transform::identity(), [APP_SIZE; 3])?;
let field = Field::create(
parent,
Transform::identity(),
Shape::Box([APP_SIZE; 3].into()),
)?;
let application = Application::create(desktop_file)?;
let icon = application.icon(128, false);
let grabbable = Grabbable::create(
@@ -81,7 +85,7 @@ impl App {
Transform::from_translation(position),
&field,
GrabbableSettings {
max_distance: 0.01,
max_distance: 0.025,
zoneable: false,
..Default::default()
},
@@ -167,12 +171,12 @@ impl App {
}
}
pub fn frame(&mut self, info: FrameInfo, state: &State) {
pub fn frame(&mut self, info: &FrameInfo, state: &State) {
let _ = self.grabbable.update(&info);
if let Some(grabbable_move) = &mut self.grabbable_move {
if !grabbable_move.is_finished() {
let scale = grabbable_move.move_by(info.delta);
let scale = grabbable_move.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(
@@ -192,7 +196,7 @@ impl App {
}
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
if !grabbable_shrink.is_finished() {
let scale = grabbable_shrink.move_by(info.delta);
let scale = grabbable_shrink.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
@@ -227,7 +231,7 @@ impl App {
}
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
if !grabbable_grow.is_finished() {
let scale = grabbable_grow.move_by(info.delta);
let scale = grabbable_grow.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))

View File

@@ -9,23 +9,21 @@ use manifest_dir_macros::directory_relative_path;
use protostar::xdg::{get_desktop_files, parse_desktop_file, DesktopFile};
use serde::{Deserialize, Serialize};
use stardust_xr_fusion::{
client::{Client, ClientState, FrameInfo, RootHandler},
core::{
schemas::flex::flexbuffers,
values::{
color::{color_space::LinearRgb, rgba_linear, Rgba},
ResourceID,
},
client::Client,
core::values::{
color::{color_space::LinearRgb, rgba_linear, Rgba},
ResourceID,
},
drawable::{MaterialParameter, Model, ModelPartAspect},
node::{NodeError, NodeType},
root::{ClientState, FrameInfo, RootAspect, RootHandler},
spatial::{Spatial, SpatialAspect, Transform},
};
use stardust_xr_molecules::{
button::{Button, ButtonSettings},
Grabbable, GrabbableSettings, PointerMode,
};
use std::{f32::consts::PI, time::Duration};
use std::{f32::consts::PI, sync::Arc, time::Duration};
const APP_SIZE: f32 = 0.06;
const PADDING: f32 = 0.005;
@@ -44,9 +42,14 @@ async fn main() -> Result<()> {
.pretty()
.init();
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")])
.unwrap();
let _root = client.wrap_root(AppHexGrid::new(&client).await)?;
let _root = client
.get_root()
.alias()
.wrap(AppHexGrid::new(&client).await)?;
tokio::select! {
_ = tokio::signal::ctrl_c() => (),
@@ -55,7 +58,7 @@ async fn main() -> Result<()> {
Ok(())
}
#[derive(Debug, Default, Serialize, Deserialize)]
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct State {
unfurled: bool,
}
@@ -67,13 +70,13 @@ struct AppHexGrid {
state: State,
}
impl AppHexGrid {
async fn new(client: &Client) -> Self {
let state = flexbuffers::from_slice(&client.state().data).unwrap_or_default();
async fn new(client: &Arc<Client>) -> Self {
let state = client.get_state().data().unwrap_or_default();
let movable_root =
Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
let button = CenterButton::new(client, &client.state()).unwrap();
let button = CenterButton::new(client, &client.get_state()).unwrap();
tokio::time::sleep(Duration::from_millis(10)).await; // give it a bit of time to send the messages properly
let mut desktop_files: Vec<DesktopFile> = get_desktop_files()
@@ -119,11 +122,11 @@ impl AppHexGrid {
}
impl RootHandler for AppHexGrid {
fn frame(&mut self, info: FrameInfo) {
self.button.frame(info);
self.button.frame(&info);
if self.button.button.pressed() {
self.button
.model
.model_part("Hex")
.part("Hex")
.unwrap()
.set_material_parameter("color", MaterialParameter::Color(BTN_SELECTED_COLOR))
.unwrap();
@@ -134,33 +137,33 @@ impl RootHandler for AppHexGrid {
} else if self.button.button.released() {
self.button
.model
.model_part("Hex")
.part("Hex")
.unwrap()
.set_material_parameter("color", MaterialParameter::Color(BTN_COLOR))
.unwrap();
}
for app in &mut self.apps {
app.frame(info, &self.state);
app.frame(&info, &self.state);
}
}
fn save_state(&mut self) -> ClientState {
fn save_state(&mut self) -> Result<ClientState> {
self.movable_root
.set_relative_transform(
self.button.grabbable.content_parent(),
Transform::from_translation([0.0; 3]),
)
.unwrap();
ClientState {
data: flexbuffers::to_vec(&self.state).unwrap(),
root: self.movable_root.alias(),
spatial_anchors: [(
ClientState::new(
Some(self.state.clone()),
&self.movable_root,
[(
"content_parent".to_string(),
self.button.grabbable.content_parent().alias(),
self.button.grabbable.content_parent(),
)]
.into_iter()
.collect(),
}
)
}
}
@@ -170,7 +173,7 @@ struct CenterButton {
model: Model,
}
impl CenterButton {
fn new(client: &Client, state: &ClientState) -> Result<Self, NodeError> {
fn new(client: &Arc<Client>, state: &ClientState) -> Result<Self, NodeError> {
// (APP_SIZE + PADDING) / 2.0,
let button = Button::create(
client.get_root(),
@@ -206,9 +209,9 @@ impl CenterButton {
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
)?;
model
.model_part("Hex")?
.part("Hex")?
.set_material_parameter("color", MaterialParameter::Color(BTN_COLOR))?;
if let Some(content_parent) = state.spatial_anchors.get("content_parent") {
if let Some(content_parent) = state.spatial_anchors(client).get("content_parent") {
grabbable
.content_parent()
.set_relative_transform(content_parent, Transform::identity())?;
@@ -220,7 +223,7 @@ impl CenterButton {
})
}
fn frame(&mut self, info: FrameInfo) {
fn frame(&mut self, info: &FrameInfo) {
let _ = self.grabbable.update(&info);
self.button.update();
}

View File

@@ -2,9 +2,9 @@ use crate::xdg::{DesktopFile, Icon, IconType};
use nix::libc::setsid;
use regex::Regex;
use stardust_xr_fusion::{
client::ClientState,
node::{NodeError, NodeType},
spatial::Spatial,
node::{NodeError, NodeResult},
root::{ClientState, RootAspect},
spatial::SpatialRefAspect,
};
use std::{
os::unix::process::CommandExt,
@@ -44,7 +44,7 @@ impl Application {
icon.and_then(|i| i.cached_process(preferred_px_size).ok())
}
pub fn launch(&self, launch_space: &Spatial) -> Result<(), NodeError> {
pub fn launch(&self, launch_space: &impl SpatialRefAspect) -> NodeResult<()> {
let client = launch_space.node().client()?;
let launch_space = launch_space.alias();
@@ -55,16 +55,14 @@ impl Application {
.ok_or(NodeError::DoesNotExist)?;
tokio::task::spawn(async move {
let Ok(startup_token) = client
.state_token(&ClientState::from_root(&launch_space))
.get_root()
.generate_state_token(ClientState::from_root(&launch_space).unwrap())
.await
else {
return;
};
let Ok(future_connection_env) = client.get_connection_environment() else {
return;
};
let Ok(connection_env) = future_connection_env.await else {
let Ok(connection_env) = client.get_root().get_connection_environment().await else {
return;
};
for (k, v) in connection_env.into_iter() {

View File

@@ -4,7 +4,7 @@ use clap::Parser;
use color_eyre::{eyre::Result, Report};
use manifest_dir_macros::directory_relative_path;
use protostar::xdg::parse_desktop_file;
use stardust_xr_fusion::client::Client;
use stardust_xr_fusion::{client::Client, node::NodeType, root::RootAspect};
use std::path::PathBuf;
use tracing_subscriber::EnvFilter;
@@ -26,7 +26,7 @@ async fn main() -> Result<()> {
color_eyre::install()?;
let args = Args::parse();
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 protostar = Single::create_from_desktop_file(
client.get_root(),
@@ -34,7 +34,7 @@ async fn main() -> Result<()> {
parse_desktop_file(args.desktop_file).map_err(Report::msg)?,
)?;
let _root = client.wrap_root(protostar)?;
let _root = client.get_root().alias().wrap(protostar)?;
tokio::select! {
_ = tokio::signal::ctrl_c() => (),

View File

@@ -5,14 +5,14 @@ use protostar::{
xdg::{DesktopFile, Icon, IconType},
};
use stardust_xr_fusion::{
client::{ClientState, FrameInfo, RootHandler},
core::values::{color::rgba_linear, ResourceID, Vector3},
drawable::{
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
YAlign,
},
fields::BoxField,
fields::{Field, Shape},
node::NodeType,
root::{ClientState, FrameInfo, RootHandler},
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
};
use stardust_xr_molecules::{Grabbable, GrabbableSettings};
@@ -35,11 +35,11 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
t,
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
)?;
model.model_part("Hex")?.set_material_parameter(
model.part("Hex")?.set_material_parameter(
"color",
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
)?;
model.model_part("Icon")?.set_material_parameter(
model.part("Icon")?.set_material_parameter(
"diffuse",
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
)?;
@@ -59,7 +59,7 @@ pub struct Single {
root: Spatial,
position: Vector3<f32>,
grabbable: Grabbable,
_field: BoxField,
_field: Field,
icon: Model,
label: Option<Text>,
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
@@ -70,13 +70,17 @@ pub struct Single {
impl Single {
pub fn create_from_desktop_file(
parent: &impl SpatialAspect,
parent: &impl SpatialRefAspect,
position: impl Into<Vector3<f32>>,
desktop_file: DesktopFile,
) -> Result<Self> {
let root = Spatial::create(parent, Transform::identity(), false)?;
let position = position.into();
let field = BoxField::create(&root, Transform::identity(), [MODEL_SCALE * 2.0; 3])?;
let field = Field::create(
&root,
Transform::identity(),
Shape::Box([MODEL_SCALE * 2.0; 3].into()),
)?;
let application = Application::create(desktop_file)?;
let icon = application.icon(128, false);
let grabbable = Grabbable::create(
@@ -148,7 +152,7 @@ impl RootHandler for Single {
if let Some(grabbable_move) = &mut self.grabbable_move {
if !grabbable_move.is_finished() {
let scale = grabbable_move.move_by(info.delta);
let scale = grabbable_move.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(
@@ -172,7 +176,7 @@ impl RootHandler for Single {
}
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
if !grabbable_shrink.is_finished() {
let scale = grabbable_shrink.move_by(info.delta);
let scale = grabbable_shrink.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(&self.root, Transform::from_scale([scale; 3]))
@@ -204,7 +208,7 @@ impl RootHandler for Single {
}
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
if !grabbable_grow.is_finished() {
let scale = grabbable_grow.move_by(info.delta);
let scale = grabbable_grow.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(&self.root, Transform::from_scale([scale; 3]))
@@ -240,7 +244,7 @@ impl RootHandler for Single {
}
}
fn save_state(&mut self) -> ClientState {
fn save_state(&mut self) -> color_eyre::eyre::Result<ClientState> {
ClientState::from_root(self.content_parent())
}
}

View File

@@ -8,17 +8,15 @@ use protostar::{
};
use serde::{Deserialize, Serialize};
use stardust_xr_fusion::{
client::{Client, ClientState, FrameInfo, RootHandler},
core::{
schemas::flex::flexbuffers,
values::{color::rgba_linear, ResourceID, Vector3},
},
client::Client,
core::values::{color::rgba_linear, ResourceID, Vector3},
drawable::{
MaterialParameter, Model, ModelPartAspect, Text, TextBounds, TextFit, TextStyle, XAlign,
YAlign,
},
fields::BoxField,
fields::{Field, Shape},
node::{NodeError, NodeType},
root::{ClientState, FrameInfo, RootAspect, RootHandler},
spatial::{Spatial, SpatialAspect, SpatialRefAspect, Transform},
};
use stardust_xr_molecules::{
@@ -53,9 +51,12 @@ async fn main() -> Result<()> {
}
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 _wrapped_root = client.wrap_root(Sirius::new(&client, args)?)?;
let _wrapped_root = client
.get_root()
.alias()
.wrap(Sirius::new(&client, args)?)?;
tokio::select! {
_ = tokio::signal::ctrl_c() => (),
@@ -64,7 +65,7 @@ async fn main() -> Result<()> {
Ok(())
}
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
struct State {
visible: bool,
}
@@ -80,7 +81,8 @@ impl Sirius {
fn new(client: &Client, args: Args) -> Result<Self, NodeError> {
let root = Spatial::create(client.get_root(), Transform::identity(), false).unwrap();
let field = BoxField::create(&root, Transform::identity(), [0.1; 3]).unwrap();
let field =
Field::create(&root, Transform::identity(), Shape::Box([0.1; 3].into())).unwrap();
let grabbable = Grabbable::create(
&root,
Transform::identity(),
@@ -142,7 +144,7 @@ impl Sirius {
impl RootHandler for Sirius {
fn frame(&mut self, info: FrameInfo) {
for app in &mut self.clients {
app.frame(info);
app.frame(&info);
}
self.grabbable.update(&info).unwrap();
@@ -179,7 +181,7 @@ impl RootHandler for Sirius {
}
}
self.model
.model_part("?????")
.part("?????")
.unwrap()
.set_material_parameter(
"color",
@@ -187,7 +189,7 @@ impl RootHandler for Sirius {
)
.unwrap();
self.model
.model_part("?????")
.part("?????")
.unwrap()
.set_material_parameter(
"emission_factor",
@@ -199,7 +201,7 @@ impl RootHandler for Sirius {
if self.button.released() {
println!("Touch ended");
self.model
.model_part("?????")
.part("?????")
.unwrap()
.set_material_parameter(
"color",
@@ -207,7 +209,7 @@ impl RootHandler for Sirius {
)
.unwrap();
self.model
.model_part("?????")
.part("?????")
.unwrap()
.set_material_parameter(
"emission_factor",
@@ -217,17 +219,17 @@ impl RootHandler for Sirius {
}
}
fn save_state(&mut self) -> ClientState {
ClientState {
data: flexbuffers::to_vec(&self.state).unwrap(),
root: self.grabbable.content_parent().alias(),
spatial_anchors: [(
fn save_state(&mut self) -> Result<ClientState> {
ClientState::new(
Some(self.state.clone()),
self.grabbable.content_parent(),
[(
"content_parent".to_string(),
self.grabbable.content_parent().alias(),
self.grabbable.content_parent(),
)]
.into_iter()
.collect(),
}
)
}
}
@@ -244,11 +246,11 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
t,
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
)?;
model.model_part("Hex")?.set_material_parameter(
model.part("Hex")?.set_material_parameter(
"color",
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
)?;
model.model_part("Icon")?.set_material_parameter(
model.part("Icon")?.set_material_parameter(
"diffuse",
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
)?;
@@ -268,7 +270,7 @@ pub struct App {
parent: Spatial,
position: Vector3<f32>,
grabbable: Grabbable,
_field: BoxField,
_field: Field,
icon: Model,
label: Option<Text>,
grabbable_shrink: Option<Tweener<f32, f64, QuartInOut>>,
@@ -283,7 +285,11 @@ impl App {
desktop_file: DesktopFile,
) -> Result<Self> {
let position = position.into();
let field = BoxField::create(parent, Transform::identity(), [APP_SIZE; 3])?;
let field = Field::create(
parent,
Transform::identity(),
Shape::Box([APP_SIZE; 3].into()),
)?;
let application = Application::create(desktop_file)?;
let icon = application.icon(128, false);
let grabbable = Grabbable::create(
@@ -367,12 +373,12 @@ impl App {
self.currently_shown = !self.currently_shown;
}
fn frame(&mut self, info: FrameInfo) {
fn frame(&mut self, info: &FrameInfo) {
let _ = self.grabbable.update(&info);
if let Some(grabbable_move) = &mut self.grabbable_move {
if !grabbable_move.is_finished() {
let scale = grabbable_move.move_by(info.delta);
let scale = grabbable_move.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(
@@ -392,7 +398,7 @@ impl App {
}
if let Some(grabbable_shrink) = &mut self.grabbable_shrink {
if !grabbable_shrink.is_finished() {
let scale = grabbable_shrink.move_by(info.delta);
let scale = grabbable_shrink.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))
@@ -427,7 +433,7 @@ impl App {
}
} else if let Some(grabbable_grow) = &mut self.grabbable_grow {
if !grabbable_grow.is_finished() {
let scale = grabbable_grow.move_by(info.delta);
let scale = grabbable_grow.move_by(info.delta.into());
self.grabbable
.content_parent()
.set_relative_transform(&self.parent, Transform::from_scale([scale; 3]))