pub struct GameObjectState<Img, Spr, Data>{
pub name: String,
pub pos: (f64, f64),
pub collider: CollisionShape,
pub cur_spr: Spr,
pub sprs: HashMap<Spr, Sprite<Img>>,
pub custom: Data,
}Expand description
Every game object should have these parameters to return them via state()
- name: String,
- pos: (f64, f64)
- collider: CollisionShape
- cur_spr: SprId (a custom enum defined by you to distinguish between sprites)
- sprs: HashMap<SprId, Sprite
> (a mapping of sprite ids to sprites) - custom: Data (a custom enum containing data for all your objects)
Fields§
§name: String§pos: (f64, f64)§collider: CollisionShape§cur_spr: Spr§sprs: HashMap<Spr, Sprite<Img>>§custom: DataTrait Implementations§
Source§impl<Img, Spr, Data> Clone for GameObjectState<Img, Spr, Data>
impl<Img, Spr, Data> Clone for GameObjectState<Img, Spr, Data>
Source§fn clone(&self) -> GameObjectState<Img, Spr, Data>
fn clone(&self) -> GameObjectState<Img, Spr, Data>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<Img, Spr, Data> Freeze for GameObjectState<Img, Spr, Data>
impl<Img, Spr, Data> RefUnwindSafe for GameObjectState<Img, Spr, Data>
impl<Img, Spr, Data> Send for GameObjectState<Img, Spr, Data>
impl<Img, Spr, Data> Sync for GameObjectState<Img, Spr, Data>
impl<Img, Spr, Data> Unpin for GameObjectState<Img, Spr, Data>
impl<Img, Spr, Data> UnwindSafe for GameObjectState<Img, Spr, Data>
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