Struct HandMenuRadial

Source
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

Source

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.

Source

pub const MIN_DIST: f32 = 0.0299999993f32

Source

pub const MID_DIST: f32 = 0.0649999976f32

Source

pub const MAX_DIST: f32 = 0.100000001f32

Source

pub const MIN_SCALE: f32 = 0.0500000007f32

Source

pub const SLICE_GAP: f32 = 0.00200000009f32

Source

pub const OUT_OF_VIEW_ANGLE: f32 = 0.865999996f32

Source

pub const ACTIVATION_ANGLE: f32 = 0.977999985f32

Source

pub fn build_id(id: &str) -> String

Source

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

Source

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

Source

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

Source§

fn enabled(&self) -> bool

Is this IStepper enabled? When false, StereoKit will not call Step. This can be a good way to temporarily disable the IStepper without removing or shutting it down. https://stereokit.net/Pages/StereoKit.Framework/IStepper/Enabled.html
Source§

fn initialize(&mut self, id: StepperId, sk_info: Rc<RefCell<SkInfo>>) -> bool

This is called by StereoKit at the start of the next frame, and on the main thread. This happens before StereoKit’s main Step callback, and always after Sk.initialize. https://stereokit.net/Pages/StereoKit.Framework/IStepper/Initialize.html id : The id of the stepper sk : The SkInfo of the runnin Sk instance. Read more
Source§

fn step(&mut self, token: &MainThreadToken)

This Step method will be called every frame of the application, as long as Enabled is true. This happens immediately before the main application’s Step callback. https://stereokit.net/Pages/StereoKit.Framework/IStepper/Step.html
Source§

fn initialize_done(&mut self) -> bool

If initialization is to be performed in multiple steps, with or without threads and in order to avoid black or frozen screens, write the on going initialization here Read more
Source§

fn shutdown(&mut self)

This is called when the IStepper is removed, or the application shuts down. This is always called on the main thread, and happens at the start of the next frame, before the main application’s Step callback. https://stereokit.net/Pages/StereoKit.Framework/IStepper/Shutdown.html
Source§

fn shutdown_done(&mut self) -> bool

If shutdown is to be performed in multiple steps, with or without threads and in order to avoid black or frozen screens, write the on going shutdown here Read more
Source§

impl Send for HandMenuRadial

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more