Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes

Entity Class Reference

Base class for derivitives. More...

#include <Entity.h>

Inheritance diagram for Entity:
Npc Prop

List of all members.

Public Member Functions

 Entity (const std::string &name="Undefined")
 Entity (const Entity &copy)
virtual ~Entity ()
Entityoperator= (const Entity &copy)
void setPositionRaw (int x, int y)
void setPosition (int x, int y)
void setPositionX (int x)
void setPositionY (int y)
void setWorldDimensions (int width, int height)
const int getPositionX () const
const int getPositionY () const
const int getWidth () const
const int getHeight () const
Recti getRect (int x, int y) const
ImagegetCurrentFrame ()
void movePosition (int x, int y)
void movePositionX (int x)
void movePositionY (int y)
void update ()
void draw (int rasterX, int rasterY)
void setAlpha (int alpha)
void drawBorder (bool border)
void setBorderColor (Uchar red, Uchar green, Uchar blue, Uchar alpha)
bool canCollide ()
void canCollide (bool collide)
void setWorldCollisionMap (CollisionMap *map)
void setName (const std::string &name)
const std::string & getName ()

Protected Member Functions

void setSprite (Sprite &sprite)

Protected Attributes

SpritemSprite
bool mCanCollide
bool mDrawBorder
string mName

Private Member Functions

virtual void logic ()

Private Attributes

CollisionMapmWorldCollisionMap
Color4ub mBorderColor
bool mIsVisible
int mVisibility
int mPositionX
int mPositionY
int mWorldWidth
int mWorldHeight

Detailed Description

Base class for derivitives.

Note:
Entities assume that the world they're in exist from 0, 0 to WorldWidth, WorldHeight.

Constructor & Destructor Documentation

Entity::Entity ( const std::string &  name = "Undefined"  ) 

Entity Constructor.

Parameters:
renderer A pointer to a Renderer object. Must not be NULL.
name Name for this Entity.
Entity::Entity ( const Entity copy  ) 

Copy Constructor

Entity::~Entity (  )  [virtual]

Garbage Cleanup


Member Function Documentation

bool Entity::canCollide (  )  [inline]
void Entity::canCollide ( bool  collide  )  [inline]
void Entity::draw ( int  rasterX,
int  rasterY 
)
void Entity::drawBorder ( bool  border  )  [inline]
Image* Entity::getCurrentFrame (  )  [inline]
const int Entity::getHeight (  )  const [inline]
const string & Entity::getName (  ) 

Returns the name of this Entity.

const int Entity::getPositionX (  )  const [inline]
const int Entity::getPositionY (  )  const [inline]
Recti Entity::getRect ( int  x,
int  y 
) const [inline]
const int Entity::getWidth (  )  const [inline]
virtual void Entity::logic (  )  [inline, private, virtual]

Logic that this entity should perform.

void Entity::movePosition ( int  x,
int  y 
)

Moves Entity along its X and Y axis the number of world units specified.

void Entity::movePositionX ( int  x  ) 

Moves Entity along its X axis the number of world units specified.

void Entity::movePositionY ( int  y  ) 

Moves Entity along its Y axis the number of world units specified.

Entity & Entity::operator= ( const Entity copy  ) 

Assignment Operator

void Entity::setAlpha ( int  alpha  )  [inline]
void Entity::setBorderColor ( Uchar  red,
Uchar  green,
Uchar  blue,
Uchar  alpha 
) [inline]
void Entity::setName ( const std::string &  name  ) 
void Entity::setPosition ( int  x,
int  y 
)

Sets the absolute X and Y position of this Entity.

void Entity::setPositionRaw ( int  x,
int  y 
)

Sets the absolute X and Y position of the Entity without any boundry checks.

void Entity::setPositionX ( int  x  ) 

Sets the absolute X position of this Entity.

void Entity::setPositionY ( int  y  ) 

Sets the absolute Y position of this Entity.

void Entity::setSprite ( Sprite sprite  )  [protected]

Sets a sprite.

Parameters:
sprite A reference to a Sprite.
Note:
This function creates a new copy of a Sprite using the provided reference.
void Entity::setWorldCollisionMap ( CollisionMap map  )  [inline]
void Entity::setWorldDimensions ( int  width,
int  height 
)

Sets the world dimensions for the Entity.

void Entity::update (  ) 

Updates the Entity.

Note:
This function calls the logic functions of the Entity.

Member Data Documentation

bool Entity::mCanCollide [protected]

Indicates whether or not the Entity can cause collisions with other Entity objects.

bool Entity::mDrawBorder [protected]

Indicates that the Entity should draw a frame around itself.

bool Entity::mIsVisible [private]

Indicates whether or not this Entity is visible or not regardless of the current visibility value. Defaults to true.

string Entity::mName [protected]

Name of the Entity.

int Entity::mPositionX [private]

World X-Coordinate.

int Entity::mPositionY [private]

World Y-Coordinate.

Sprite* Entity::mSprite [protected]

Sprite used to represent this object. Sprite is allowed to be NULL to indicate an invisible Entity.

int Entity::mVisibility [private]

A value between 0 - 255 representing the opacity of this Entity. 0 is completely transparent and 255 is completely opaque.

A pointer to an array of bool values indicating the world units this Entity is allowed to occupy. If this is empty, the Entity will asume that all areas can be occupied.

Note:
This pointer is defined outside of the Entity. See CollisionMap for more information.
int Entity::mWorldHeight [private]

World Height. Entity will assume that any value is valid if either of these are 0.

int Entity::mWorldWidth [private]

World Width. Entity will assume that any value is valid if either of these are 0.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines