pub struct FlyOver {
pub enabled: bool,
pub move_speed: f32,
pub rotate_speed: f32,
/* private fields */
}
Expand description
FlyOver is a tool that allows you to fly around the scene using the controller sticks.
§Fields that can be changed before initialization:
move_speed
- The speed at which the camera moves. Default is 2.0.rotate_speed
- The speed at which the camera rotates. Default is 90.0°enabled
- Whether the tool is enabled or not at start. Default is true.
§Events this stepper is listening to:
ENABLE_FLY_OVER
- Event that triggers when the tool is enabled (“true”) or disabled (“false”).
§Examples
use stereokit_rust::{maths::{Vec3, Matrix},
tools::fly_over::{FlyOver, ENABLE_FLY_OVER},
system::Input, system::{Key, Pivot}, sprite::Sprite};
let sprite = Sprite::from_file("icons/fly_over.png", None, Some("MY_ID"))
.expect("fly_over.png should be able to create sprite");
let mut fly_over = FlyOver::default();
sk.send_event(StepperAction::add_default::<FlyOver>("FlyOver"));
filename_scr = "screenshots/fly_over.jpeg"; fov_scr = 45.0;
test_screenshot!( // !!!! Get a proper main loop !!!!
sprite.draw(token, Matrix::Y_180, Pivot::Center, None);
Input::key_inject_press(Key::Left);
if iter == number_of_steps {
sk.send_event(StepperAction::event( "main", ENABLE_FLY_OVER, "false",));
}
);

Fields§
§enabled: bool
§move_speed: f32
§rotate_speed: f32
Trait Implementations§
Source§impl IStepper for FlyOver
impl IStepper for FlyOver
Source§fn enabled(&self) -> bool
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
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)
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
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)
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
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
impl Send for FlyOver
Auto Trait Implementations§
impl Freeze for FlyOver
impl !RefUnwindSafe for FlyOver
impl !Sync for FlyOver
impl Unpin for FlyOver
impl !UnwindSafe for FlyOver
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
Mutably borrows from an owned value. Read more
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>
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>
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)
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)
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.