#include <object.h>
Inherited by Ball, Paddle, and Rectangle.
Public Member Functions | |
Object (char *imglocation, CollisionMode mode) | |
virtual | ~Object () |
virtual void | Render (SDL_Surface *screen) |
virtual void | Update () |
void | Setsrccolorkey (int r, int g, int b) |
void | SetXPos (float i) |
void | SetYPos (float i) |
void | SetCenterXPos (float i) |
void | SetCenterYPos (float i) |
void | SetXVelocity (float i) |
void | SetYVelocity (float i) |
void | CollidesWith (char *name) |
bool | CollidedWith (char *name) |
void | ClearCollisionList () |
void | GetVelocity (float *x, float *y) |
void | GetPos (float *x, float *y) |
void | GetImageArea (int *w, int *h) |
CollisionMode | GetCollisionMode () |
Protected Attributes | |
SDL_Rect | m_blitrect |
float | m_posx |
float | m_posy |
float | m_velx |
float | m_vely |
SDL_Surface * | m_img |
CollisionMode | m_mode |
std::vector< char * > | m_collision_list |
Object::Object | ( | char * | imglocation, | |
CollisionMode | mode | |||
) |
Constructor
imglocation | the location of the image that is loaded | |
mode | the collision mode that is used |
Object::~Object | ( | ) | [virtual] |
void Object::Render | ( | SDL_Surface * | screen | ) | [virtual] |
renders the image to the specified screen
screen | the screen to which the object is drawn |
Reimplemented in Rectangle.
void Object::Update | ( | ) | [virtual] |
updates the object. Could be everything
Reimplemented in Paddle.
void Object::Setsrccolorkey | ( | int | r, | |
int | g, | |||
int | b | |||
) |
sets the source coler key
r | the value for red | |
g | the value for green | |
b | the value for blue |
void Object::SetXPos | ( | float | i | ) | [inline] |
sets the x value of the position
i | the value for x |
void Object::SetYPos | ( | float | i | ) | [inline] |
sets the y value of the position
i | the value for y |
void Object::SetCenterXPos | ( | float | i | ) | [inline] |
sets the centered x value of the position
i | the value for x |
void Object::SetCenterYPos | ( | float | i | ) | [inline] |
sets the centered y value of the position
i | the value for y |
void Object::SetXVelocity | ( | float | i | ) | [inline] |
sets the x value of the velocity
i | the value for x |
void Object::SetYVelocity | ( | float | i | ) | [inline] |
sets the y value of the velocity
i | the value for y |
void Object::CollidesWith | ( | char * | name | ) | [inline] |
Sets the string for the object with which ths one collided(used by object manager)
name | name of the object with which this one collided |
bool Object::CollidedWith | ( | char * | name | ) |
Gets the boolean for the object with which ths one collided
name | name of the object that could collided with this object |
void Object::ClearCollisionList | ( | ) | [inline] |
Clears the whole collision list
void Object::GetVelocity | ( | float * | x, | |
float * | y | |||
) | [inline] |
Gets the x and y velocity
x | the pointer which will set to the member x | |
y | the pointer which will set to the member y |
void Object::GetPos | ( | float * | x, | |
float * | y | |||
) | [inline] |
Gets the x and y position
x | the pointer which will set to the velocity member x | |
y | the pointer which will set to the velocity member y |
void Object::GetImageArea | ( | int * | w, | |
int * | h | |||
) | [inline] |
Gets the w and h of the image
w | the pointer which will set to the member w | |
h | the pointer which will set to the member h |
CollisionMode Object::GetCollisionMode | ( | ) | [inline] |
Gets the Collision mode
SDL_Rect Object::m_blitrect [protected] |
float Object::m_posx [protected] |
float Object::m_posy [protected] |
float Object::m_velx [protected] |
float Object::m_vely [protected] |
SDL_Surface* Object::m_img [protected] |
CollisionMode Object::m_mode [protected] |
std::vector<char*> Object::m_collision_list [protected] |