pub struct SimpleTopDownController {
pub speed: f32,
pub active: bool,
}Fields§
§speed: f32§active: boolImplementations§
Source§impl SimpleTopDownController
impl SimpleTopDownController
Sourcepub fn new(speed: f32) -> Self
pub fn new(speed: f32) -> Self
Examples found in repository?
examples/camera-2d.rs (line 34)
25pub fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
26 let duck = commands
27 .spawn((
28 SpriteBundle {
29 texture: asset_server.load("ducky.png"),
30 transform: Transform::from_xyz(-300.0, 0.0, 0.0),
31 ..Default::default()
32 },
33 Duck1,
34 SimpleTopDownController::new(10.0),
35 ))
36 .id();
37 commands.spawn((
38 SpriteBundle {
39 texture: asset_server.load("ducky.png"),
40 transform: Transform::from_xyz(300.0, 0.0, 0.0),
41 ..Default::default()
42 },
43 Duck2,
44 ));
45
46 commands.spawn((
47 Camera2dBundle::default(),
48 Camera2DController::new_follow_with_speed(duck, 300.0),
49 ));
50}Trait Implementations§
Source§impl Component for SimpleTopDownController
impl Component for SimpleTopDownController
Source§type Storage = TableStorage
type Storage = TableStorage
A marker type indicating the storage type used for this component.
This must be either
TableStorage or SparseStorage.Auto Trait Implementations§
impl Freeze for SimpleTopDownController
impl RefUnwindSafe for SimpleTopDownController
impl Send for SimpleTopDownController
impl Sync for SimpleTopDownController
impl Unpin for SimpleTopDownController
impl UnsafeUnpin for SimpleTopDownController
impl UnwindSafe for SimpleTopDownController
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
Return the
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut Components, storages: &mut Storages, ids: &mut impl FnMut(ComponentId), )
unsafe fn from_components<T, F>(ctx: &mut T, func: &mut F) -> C
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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.