Trait mold2d::Actor
[−]
[src]
pub trait Actor<Type, Message> { fn render(
&mut self,
context: &mut Context,
viewport: &mut Viewport,
elapsed: f64
); fn handle_message(&mut self, message: &Message) -> Message; fn collides_with(
&mut self,
other_actor: &ActorData<Type>
) -> Option<CollisionSide>; fn update(&mut self, context: &mut Context, elapsed: f64) -> PositionChange; fn data(&mut self) -> ActorData<Type>; }
A game object that supports sending and receiving messages
Required Methods
fn render(
&mut self,
context: &mut Context,
viewport: &mut Viewport,
elapsed: f64
)
&mut self,
context: &mut Context,
viewport: &mut Viewport,
elapsed: f64
)
Called every frame to render an actor
fn handle_message(&mut self, message: &Message) -> Message
Handle a message sent by another actor
fn collides_with(
&mut self,
other_actor: &ActorData<Type>
) -> Option<CollisionSide>
&mut self,
other_actor: &ActorData<Type>
) -> Option<CollisionSide>
Returns the side of the collision if actor collides with another actor
fn update(&mut self, context: &mut Context, elapsed: f64) -> PositionChange
Called every frame to update an actor
fn data(&mut self) -> ActorData<Type>
Gets the actor data