The Game Engine  1
CollisionCircle Class Reference

This defines CollisionCircle boundaries and data for objects/levels. More...

#include <CollisionObject.h>

+ Inheritance diagram for CollisionCircle:
+ Collaboration diagram for CollisionCircle:

Public Member Functions

 CollisionCircle (string n)
 
 CollisionCircle (string n, Point2D pt, double r)
 
pair< WorldObject
*, CollisionObject * > 
collision (const CollisionRectangle *c, WorldObject *wo, WorldObject *mObj) const
 This does collision between Rectangles and Circles. More...
 
virtual pair< WorldObject
*, CollisionObject * > 
collision (const CollisionObject *c, WorldObject *wo, WorldObject *mObj) const
 Check collision with objects implements circle on circle. 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

double radius
 The raidus of the circle. 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...
 

Detailed Description

This defines CollisionCircle boundaries and data for objects/levels.

This class is tasked with the following:

  • Defining a collision circle.
    • Checking collisions with Rectangles
    • Checking collisions with other circles

Definition at line 125 of file CollisionObject.h.

Constructor & Destructor Documentation

CollisionCircle::CollisionCircle ( string  n)
inline

Definition at line 128 of file CollisionObject.h.

CollisionCircle::CollisionCircle ( string  n,
Point2D  pt,
double  r 
)
inline

Definition at line 129 of file CollisionObject.h.

Member Function Documentation

pair< WorldObject *, CollisionObject * > CollisionCircle::collision ( const CollisionRectangle c,
WorldObject wo,
WorldObject mObj 
) const

This does collision between Rectangles and Circles.

Parameters
ca single collision data for an object
woPointer to Object with checking bound
mObjthe current collision's world object
Returns
Returns true if any of the object's collision datas are colliding .

check rect vs circle

Todo:
test

Definition at line 145 of file CollisionObject.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pair< WorldObject *, CollisionObject * > CollisionCircle::collision ( const CollisionObject c,
WorldObject wo,
WorldObject mObj 
) const
virtual

Check collision with objects implements circle on circle.

Parameters
ca single collision data for an object
woPointer to Object with checking bound
mObjthe current collision's world object
Returns
Returns true if any of the object's collision datas are colliding .

call the circle rect fn

check circle vs circle

Implements CollisionObject.

Definition at line 119 of file CollisionObject.cpp.

+ Here is the call graph for this function:

void CollisionCircle::draw ( const Point2D pos)
virtual

Draws the collision data to the screen.

<The relative x,y pos

<the midpt of the circle

Implements CollisionObject.

Definition at line 55 of file CollisionObject.cpp.

+ Here is the call graph for this function:

virtual CollisionObjectType CollisionCircle::getType ( ) const
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 154 of file CollisionObject.h.

Member Data Documentation

double CollisionCircle::radius

The raidus of the circle.

Definition at line 130 of file CollisionObject.h.


The documentation for this class was generated from the following files: