|
The Game Engine
1
|
This class is tasked with representing a line segment for uni-directional collision capabilities. More...
#include <CollisionObject.h>
Inheritance diagram for CollisionSegment:
Collaboration diagram for CollisionSegment:Public Member Functions | |
| CollisionSegment (string n) | |
| CollisionSegment (string n, Point2D s, Point2D e) | |
| void | calcNormal () |
| Calculates the normal direction from start point fist. More... | |
| pair< WorldObject *, CollisionObject * > | collision (const CollisionRectangle *c, WorldObject *wo, WorldObject *mObj) const |
| This does collision between Rectangles and Collision Rectangles. More... | |
| pair< WorldObject *, CollisionObject * > | collision (const CollisionCircle *c, WorldObject *wo, WorldObject *mObj) const |
| This does collision between Rectangles and Collision Cirles. More... | |
| virtual pair< WorldObject *, CollisionObject * > | collision (const CollisionObject *c, WorldObject *wo, WorldObject *mObj) const |
| Check collision with objects implements segment on segment collision. More... | |
| virtual void | draw (const Point2D &pos) |
| Draws the collision data to the screen. More... | |
| virtual CollisionObjectType | getType () const |
| This provides a simple interface to determine types of objects. More... | |
Public Member Functions inherited from CollisionObject | |
| 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... | |
Public Attributes | |
| Point2D | end |
| Endpoint of the collision segment. More... | |
| double | distance |
| Amount of lookahead to determine a collision. More... | |
| Point2D | norm |
| Normal direction (calculated on construction) More... | |
| bool | twoWay |
| whether or not this is a bi-directional segment. More... | |
Public Attributes inherited from CollisionObject | |
| Point2D | mPos |
| The position of the center of the collision data. More... | |
Additional Inherited Members | |
Public Types inherited from CollisionObject | |
| 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... | |
Protected Attributes inherited from CollisionObject | |
| string | name |
| Name of the collision type. More... | |
| Uint32 | color |
| The collision box color. More... | |
This class is tasked with representing a line segment for uni-directional collision capabilities.
This class is tasked with the following:
Definition at line 166 of file CollisionObject.h.
|
inline |
Definition at line 169 of file CollisionObject.h.
| void CollisionSegment::calcNormal | ( | ) |
Calculates the normal direction from start point fist.
Here is the caller graph for this function:| pair< WorldObject *, CollisionObject * > CollisionSegment::collision | ( | const CollisionRectangle * | c, |
| WorldObject * | wo, | ||
| WorldObject * | mObj | ||
| ) | const |
This does collision between Rectangles and Collision Rectangles.
| c | a single collision data for an object |
| wo | Pointer to Object with checking bound |
| mObj | the current collision's world object |
check rect vs circle
we need to determine pos and use velocity to determine collision (make collision checks also pass along WorldObject*
Definition at line 177 of file CollisionObject.cpp.
Here is the call graph for this function:
Here is the caller graph for this function:| pair< WorldObject *, CollisionObject * > CollisionSegment::collision | ( | const CollisionCircle * | c, |
| WorldObject * | wo, | ||
| WorldObject * | mObj | ||
| ) | const |
This does collision between Rectangles and Collision Cirles.
| c | a single collision data for an object |
| wo | Pointer to Object with checking bound |
| mObj | the current collision's world object |
Definition at line 192 of file CollisionObject.cpp.
|
virtual |
Check collision with objects implements segment on segment collision.
| c | a single collision data for an object |
| wo | Pointer to Object with checking bound |
| mObj | the current collision's world object |
call the circle segment fn
call the circle segment fn
Implements CollisionObject.
Definition at line 198 of file CollisionObject.cpp.
Here is the call graph for this function:
|
virtual |
Draws the collision data to the screen.
Implements CollisionObject.
|
inlinevirtual |
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
Implements CollisionObject.
Definition at line 220 of file CollisionObject.h.
| double CollisionSegment::distance |
Amount of lookahead to determine a collision.
Definition at line 175 of file CollisionObject.h.
| Point2D CollisionSegment::end |
Endpoint of the collision segment.
Definition at line 172 of file CollisionObject.h.
| Point2D CollisionSegment::norm |
Normal direction (calculated on construction)
Definition at line 178 of file CollisionObject.h.
| bool CollisionSegment::twoWay |
whether or not this is a bi-directional segment.
Definition at line 181 of file CollisionObject.h.