pub struct HandMenuRadial {
pub checked_material: Material,
pub on_checked_material: Material,
pub text_style: TextStyle,
/* private fields */
}
Expand description
A menu that shows up in circle around the user’s hand! Selecting an item can perform an action, or even spawn a sub-layer of menu items. This is an easy way to store actions out of the way, yet remain easily accessible to the user.
The user faces their palm towards their head, and then makes a grip motion to spawn the menu. The user can then perform actions by making fast, direction based motions that are easy to build muscle memory for. https://stereokit.net/Pages/StereoKit.Framework/HandMenuRadial.html
§Examples
use stereokit_rust::{framework::*, material::Material, system::{Input, Key}};
// swapping a value
let mut swap_value = true;
// nice icon
let mut menu_ico = Material::pbr_clip()
.tex_file_copy("icons/hamburger.png", true, None).unwrap_or_default();
menu_ico.clip_cutoff(0.1);
//---Create then load hand menu radial
let mut hand_menu_stepper =
HandMenuRadial::new(HandRadialLayer::new("root", None, Some(100.0),
vec![
HandRadial::layer("Todo!", Some(menu_ico), None,
vec![
HandRadial::item("Back", None, || {}, HandMenuAction::Back),
HandRadial::item("Close", None, || {}, HandMenuAction::Close),
],
),
HandRadial::item("Swap", None,
move || {
swap_value = !swap_value;
},
HandMenuAction::Checked(1),
),
HandRadial::item("Close", None, || {}, HandMenuAction::Close),
],
));
let id = HandMenuRadial::build_id("1");
SkInfo::send_event(&Some(sk.get_sk_info_clone()),
StepperAction::add(id.clone(), hand_menu_stepper));
number_of_steps=10;
test_steps!(// !!!! Get a proper main loop !!!!
if iter == 1 {
SkInfo::send_event(&Some(sk.get_sk_info_clone()),
StepperAction::event(id.as_str(), HAND_MENU_RADIAL_FOCUS, &true.to_string()));
}
if iter == 8 {
SkInfo::send_event(&Some(sk.get_sk_info_clone()),
StepperAction::remove(id.clone()));
}
);
Fields§
§checked_material: Material
§on_checked_material: Material
§text_style: TextStyle
Implementations§
Source§impl HandMenuRadial
impl HandMenuRadial
Sourcepub const SIMULATOR_KEY: Key = Key::F1
pub const SIMULATOR_KEY: Key = Key::F1
When using the Simulator, this key will activate the menu on the current hand, regardless of which direction it is facing.
pub const MIN_DIST: f32 = 0.0299999993f32
pub const MID_DIST: f32 = 0.0649999976f32
pub const MAX_DIST: f32 = 0.100000001f32
pub const MIN_SCALE: f32 = 0.0500000007f32
pub const SLICE_GAP: f32 = 0.00200000009f32
pub const OUT_OF_VIEW_ANGLE: f32 = 0.865999996f32
pub const ACTIVATION_ANGLE: f32 = 0.977999985f32
pub fn build_id(id: &str) -> String
Sourcepub fn new(root_layer: HandRadialLayer) -> Self
pub fn new(root_layer: HandRadialLayer) -> Self
Creates a hand menu from the provided array of menu layers! HandMenuRadial is an IStepper, so proper usage is to add it to the Stepper list via (Sk|SkInfo).send_event(StepperAction::add_default()). https://stereokit.net/Pages/StereoKit.Framework/HandMenuRadial/HandMenuRadial.html
Sourcepub fn show(&mut self, at: impl Into<Vec3>, hand: Handed)
pub fn show(&mut self, at: impl Into<Vec3>, hand: Handed)
Force the hand menu to show at a specific location. This will close the hand menu if it was already open, and resets it to the root menu layer. Also plays an opening sound. https://stereokit.net/Pages/StereoKit.Framework/HandMenuRadial/Show.html
Sourcepub fn close(&mut self)
pub fn close(&mut self)
Closes the menu if it’s open! Plays a closing sound. https://stereokit.net/Pages/StereoKit.Framework/HandMenuRadial/Close.html
Trait Implementations§
Source§impl IStepper for HandMenuRadial
impl IStepper for HandMenuRadial
Source§fn enabled(&self) -> bool
fn enabled(&self) -> bool
Source§fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool
fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool
Source§fn step(&mut self, token: &MainThreadToken)
fn step(&mut self, token: &MainThreadToken)
Source§fn initialize_done(&mut self) -> bool
fn initialize_done(&mut self) -> bool
Source§fn shutdown(&mut self)
fn shutdown(&mut self)
Source§fn shutdown_done(&mut self) -> bool
fn shutdown_done(&mut self) -> bool
impl Send for HandMenuRadial
Auto Trait Implementations§
impl Freeze for HandMenuRadial
impl !RefUnwindSafe for HandMenuRadial
impl !Sync for HandMenuRadial
impl Unpin for HandMenuRadial
impl !UnwindSafe for HandMenuRadial
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.