Annchienta::Map Class Reference

List of all members.

Public Member Functions

void addNewLayer (int z=0)
void addObject (StaticObject *so, Point position)
void depthSort ()
void draw (bool scripts=true) const
LayergetCurrentLayer () const
int getCurrentLayerIndex () const
const char * getFileName () const
int getHeight () const
LayergetLayer (int index) const
int getNumberOfLayers () const
StaticObjectgetObject (const char *name)
PersongetPerson (const char *name)
TileSetgetTileSet () const
int getWidth () const
 Map (int w, int h, const char *tileset)
 Map (const char *fileName, bool scripts=true)
void onPostRender () const
void onPreRender () const
void removeObject (StaticObject *so)
void setCurrentLayer (int index)
void sortLayers ()
void update ()
 ~Map ()

Private Attributes

int currentLayer
char fileName [DEFAULT_STRING_SIZE]
int height
std::vector< Layer * > layers
char * onPostRenderCode
char * onPostRenderScript
char * onPreRenderCode
char * onPreRenderScript
Layer ** sortedLayers
TileSettileSet
VideoManagervideoManager
int width


Detailed Description

A Map is probably one of the most important classes in the engine. It holds a game map and everything in it. For an example map XML file, see Example of a Map file

Constructor & Destructor Documentation

Annchienta::Map::Map ( const char *  fileName,
bool  scripts = true 
)

Load a new map.

Parameters:
fileName XML file where the Map should be loaded from.
scripts If the onload scripts should be executed. This also means all <if> tags will evaluate to true.

Annchienta::Map::Map ( int  w,
int  h,
const char *  tileset 
)

Creates a new, empty Map.

Parameters:
w The new map width.
h The new map height.
tileset Directory where the Map TileSet should be loaded from.

Annchienta::Map::~Map (  ) 


Member Function Documentation

void Annchienta::Map::addNewLayer ( int  z = 0  ) 

Adds a new, empty Layer to this Map.

Parameters:
z Initial Z offset of the new Layer.

void Annchienta::Map::addObject ( StaticObject so,
Point  position 
)

Adds a StaticObject to this Map. The object is placed in the current Layer.

Parameters:
so StaticObject to be added.
position Where this StaticObject should be placed.

void Annchienta::Map::depthSort (  ) 

Depthsorts this Map. Calls Layer::depthSort() for all Layers.

void Annchienta::Map::draw ( bool  scripts = true  )  const

Draws the Map to the screen.

Parameters:
scripts If the onPreRender and onPostRender scripts should be executed.

Layer* Annchienta::Map::getCurrentLayer (  )  const

Returns:
A reference to the current Layer in this Map.

int Annchienta::Map::getCurrentLayerIndex (  )  const

Returns:
The index of the current Layer.

const char* Annchienta::Map::getFileName (  )  const

Returns:
The fileName from which this Map was loaded.

int Annchienta::Map::getHeight (  )  const

Returns:
The height of this Map.

Layer* Annchienta::Map::getLayer ( int  index  )  const

Parameters:
index The index of Layer you want to retrieve.
Returns:
A reference to the desired Layer.

int Annchienta::Map::getNumberOfLayers (  )  const

Returns:
The number of layers in this Map.

StaticObject* Annchienta::Map::getObject ( const char *  name  ) 

Finds an object in this Map. This function starts searching in the current Layer, when not found in continues to search the other Layers.

Parameters:
name Name of the StaticObject to be found.
Returns:
The found object.

Person* Annchienta::Map::getPerson ( const char *  name  ) 

The same as getObject(), but returns a Person.

Parameters:
name Name of the Person to be found.
Returns:
The found person.

TileSet* Annchienta::Map::getTileSet (  )  const

Returns:
The TileSet used in this Map.

int Annchienta::Map::getWidth (  )  const

Returns:
The width of this Map.

void Annchienta::Map::onPostRender (  )  const

Executes onPostRender code. Automatically called by draw().

void Annchienta::Map::onPreRender (  )  const

Executes onPreRender code. Automatically called by draw().

void Annchienta::Map::removeObject ( StaticObject so  ) 

Removes an object from this Map. If you don't have a pointer to it, only the name, use getObject() first.

Parameters:
so StaticObject to be removed.

void Annchienta::Map::setCurrentLayer ( int  index  ) 

Sets a new current Layer.

Parameters:
index The index of the new current Layer.

void Annchienta::Map::sortLayers (  ) 

Sorts Layers by their respective Z offset.

void Annchienta::Map::update (  ) 

Updates this Map, all Layers and all objects in those Layers.


Member Data Documentation

char Annchienta::Map::fileName[DEFAULT_STRING_SIZE] [private]

int Annchienta::Map::height [private]

std::vector<Layer*> Annchienta::Map::layers [private]

int Annchienta::Map::width [private]


Generated on Wed Feb 4 16:31:47 2009 for Annchienta by  doxygen 1.5.7.1