Collision System class. Provides collision checks for SFML ConvexShapes. Provides SAT collision for narrow-phase checks and bounding box collision for broad-phase checks.
More...
#include <CollisionSystem.hpp>
|
| CollisionSystem (std::list< Ship * > &shipList, std::list< Bullet * > &bulletList, std::list< Pickup * > &pickupList) |
|
| ~CollisionSystem () |
|
void | Check () const |
| Checks for collision between all game entities. Checks for ship-ship collision (broad and narrow phase), checks for ship-bullet collision (broad phase only, with PLAYER/ENEMY factions), checks for ship-powerup collision (broad and narrow phase, only player and predators can collect powerups). More...
|
|
|
bool | checkPair (sf::ConvexShape *first, sf::ConvexShape *second) const |
| Check two ships for collision. More...
|
|
void | getAxies (const sf::ConvexShape *const shape, std::list< sf::Vector2f > &axies) const |
| Get the axies of a shape and insert them into the list. More...
|
|
sf::Vector2f | projectOntoAxis (const sf::ConvexShape *const shape, sf::Vector2f &axis) const |
| Project a shape onto an axis and return the line projection. More...
|
|
Collision System class. Provides collision checks for SFML ConvexShapes. Provides SAT collision for narrow-phase checks and bounding box collision for broad-phase checks.
CollisionSystem::CollisionSystem |
( |
std::list< Ship * > & |
shipList, |
|
|
std::list< Bullet * > & |
bulletList, |
|
|
std::list< Pickup * > & |
pickupList |
|
) |
| |
Creates a collision system with references to lists of entities from Game
- Parameters
-
shipList | A reference to a list of ship pointers. |
bulletList | A reference to a list of bullet pointers. |
pickupList | A reference to a list of pickup pointers. |
CollisionSystem::~CollisionSystem |
( |
| ) |
|
void CollisionSystem::Check |
( |
| ) |
const |
Checks for collision between all game entities. Checks for ship-ship collision (broad and narrow phase), checks for ship-bullet collision (broad phase only, with PLAYER/ENEMY factions), checks for ship-powerup collision (broad and narrow phase, only player and predators can collect powerups).
bool CollisionSystem::checkPair |
( |
sf::ConvexShape * |
first, |
|
|
sf::ConvexShape * |
second |
|
) |
| const |
|
private |
Check two ships for collision.
void CollisionSystem::getAxies |
( |
const sf::ConvexShape *const |
shape, |
|
|
std::list< sf::Vector2f > & |
axies |
|
) |
| const |
|
private |
Get the axies of a shape and insert them into the list.
sf::Vector2f CollisionSystem::projectOntoAxis |
( |
const sf::ConvexShape *const |
shape, |
|
|
sf::Vector2f & |
axis |
|
) |
| const |
|
private |
Project a shape onto an axis and return the line projection.
std::list<Bullet*>& CollisionSystem::bullets_ |
|
private |
std::list<Pickup*>& CollisionSystem::pickups_ |
|
private |
std::list<Ship*>& CollisionSystem::ships_ |
|
private |
The documentation for this class was generated from the following files: