|
The Game Engine
1
|
This defines CollisionObject boundaries and data for objects/backgrounds. More...
#include <CollisionObject.h>
Inheritance diagram for CollisionObject:
Collaboration diagram for CollisionObject:Public Types | |
| enum | CollisionObjectType { COLLISIONRECTANGLE, COLLISIONCIRCLE, COLLISIONSEGMENT } |
| This is to be used for Type checking so as to make no need for dynamic_cast and it's inefficiency. More... | |
Public Member Functions | |
| CollisionObject (string n) | |
| bool | checkCollisions (const vector< CollisionObject * > &c, const Point2D cPos, const Point2D pos, vector< string > names=vector< string >()) |
| Check collision with objects. More... | |
| virtual pair< WorldObject *, CollisionObject * > | collision (const CollisionObject *c, WorldObject *wo, WorldObject *mObj) const =0 |
| Check collision with objects. More... | |
| virtual void | draw (const Point2D &pos)=0 |
| Draws the collision data to the screen. More... | |
| virtual CollisionObjectType | getType () const =0 |
| This provides a simple interface to determine types of objects. More... | |
Public Attributes | |
| Point2D | mPos |
| The position of the center of the collision data. More... | |
Protected Attributes | |
| string | name |
| Name of the collision type. More... | |
| Uint32 | color |
| The collision box color. More... | |
This defines CollisionObject boundaries and data for objects/backgrounds.
This class is tasked with the following:
Definition at line 20 of file CollisionObject.h.
This is to be used for Type checking so as to make no need for dynamic_cast and it's inefficiency.
| Enumerator | |
|---|---|
| COLLISIONRECTANGLE | |
| COLLISIONCIRCLE | |
| COLLISIONSEGMENT | |
Definition at line 30 of file CollisionObject.h.
|
inline |
Definition at line 23 of file CollisionObject.h.
| bool CollisionObject::checkCollisions | ( | const vector< CollisionObject * > & | c, |
| const Point2D | cPos, | ||
| const Point2D | pos, | ||
| vector< string > | names = vector<string>() |
||
| ) |
Check collision with objects.
| c | the collision data associated with the sprite to check collision with. |
| cPos | the position of the sprite we want to check collision with. |
| pos | the current sprite's position. |
| names | the names that should be checked (empty checks all) |
Definition at line 74 of file CollisionObject.cpp.
|
pure virtual |
Check collision with objects.
| c | a single collision data for an object |
| wo | Pointer to Object with checking bound |
| mObj | the current collision's world object |
Implemented in CollisionSegment, CollisionCircle, and CollisionRectangle.
Here is the caller graph for this function:
|
pure virtual |
Draws the collision data to the screen.
Implemented in CollisionSegment, CollisionCircle, and CollisionRectangle.
|
pure virtual |
This provides a simple interface to determine types of objects.
Returns the name of the Class and Descendants i.e. Something inheriting from Sprite would look like Sprite:Thing
Implemented in CollisionSegment, CollisionCircle, and CollisionRectangle.
Here is the caller graph for this function:
|
protected |
The collision box color.
Definition at line 63 of file CollisionObject.h.
| Point2D CollisionObject::mPos |
The position of the center of the collision data.
Definition at line 23 of file CollisionObject.h.
|
protected |
Name of the collision type.
Definition at line 62 of file CollisionObject.h.