Struct nitro::GameObject
[−]
[src]
pub struct GameObject { pub transform: Transform, pub sprite: Option<Sprite>, pub body: Option<RigidBodyHandle<f32>>, pub draw_layer: i32, // some fields omitted }
GameObjects are the primary descriptor for things that are visible in the game world. Players, items, enemies, and whatever else exists in your game world are typically GameObjects.
To create a new GameObject use nitro::App::new_gameobject().
Fields
transform: Transform
sprite: Option<Sprite>
body: Option<RigidBodyHandle<f32>>
draw_layer: i32
Methods
impl GameObject
[src]
fn id(&self) -> u64
fn drop(&mut self)
fn send_message_to_component(
&mut self,
app: &mut App,
message: &Message,
component_id: i32
)
&mut self,
app: &mut App,
message: &Message,
component_id: i32
)
fn receive_message(&mut self, app: &mut App, message: &Message)
fn update(&mut self, app: &mut App, delta_time: f32)
fn component_keys<'a>(&'a self) -> Option<Box<Iterator<Item = i32> + 'a>>
fn component_keys_with_type<'a, T>(
&'a self
) -> Option<Box<Iterator<Item = i32> + 'a>> where
T: Component + 'static,
&'a self
) -> Option<Box<Iterator<Item = i32> + 'a>> where
T: Component + 'static,
fn remove_component(
&mut self,
app: &mut App,
index: i32
) -> OptionLoaned<Box<ComponentAny>>
&mut self,
app: &mut App,
index: i32
) -> OptionLoaned<Box<ComponentAny>>
fn component(&self, index: i32) -> OptionLoaned<&Box<ComponentAny>>
fn component_mut(&mut self, index: i32) -> OptionLoaned<&mut Box<ComponentAny>>
fn component_with_type<T>(&self, index: i32) -> Option<&T> where
T: Component + 'static,
T: Component + 'static,
fn component_mut_with_type<T>(&mut self, index: i32) -> Option<&mut T> where
T: Component + 'static,
T: Component + 'static,
fn insert_component<T>(
&mut self,
app: &mut App,
component: T,
index: i32
) -> Option<Box<ComponentAny>> where
T: Component + 'static,
&mut self,
app: &mut App,
component: T,
index: i32
) -> Option<Box<ComponentAny>> where
T: Component + 'static,
fn add_component<T>(&mut self, app: &mut App, component: T) -> i32 where
T: Component + 'static,
T: Component + 'static,