CollisionStrategy

Trait CollisionStrategy 

Source
pub trait CollisionStrategy {
    // Required methods
    fn collides(&self, pos: Vector, r: &Rectangle) -> bool;
    fn add(&mut self, pos: Vector, r: Rectangle);
}
Expand description

Struct implementing this trait can detect rectangles collisions.

Required Methods§

Source

fn collides(&self, pos: Vector, r: &Rectangle) -> bool

Does the given rectangle at the given position collide with an already added rectangle?

Source

fn add(&mut self, pos: Vector, r: Rectangle)

Add the given rectangle at the given position to the list of rectangles to detect collisions with.

Implementors§