Annchienta::MapManager::MapManager | ( | ) |
Annchienta::MapManager::~MapManager | ( | ) |
void Annchienta::MapManager::cameraFollow | ( | StaticObject * | object | ) |
Makes the camera smoothly follow object, until another object is set. If you don't want to follow any objects anymore, use cameraFollow(0).
void Annchienta::MapManager::cameraPeekAt | ( | StaticObject * | object, | |
bool | instantly = false | |||
) |
Makes the camera have a quick peek at the provided object. Usually, this means the camera will move one step in the directioin of object. If you want to instantly peek at object, set instantly to true.
void Annchienta::MapManager::draw | ( | ) | const |
Draws the current Map to the screen.
StaticObject* Annchienta::MapManager::getCameraFollow | ( | ) | const |
int Annchienta::MapManager::getCameraX | ( | ) | const |
int Annchienta::MapManager::getCameraY | ( | ) | const |
int Annchienta::MapManager::getMaxAscentHeight | ( | ) | const |
int Annchienta::MapManager::getMaxDescentHeight | ( | ) | const |
StaticObject* Annchienta::MapManager::getObject | ( | const char * | name | ) |
Searches the current Map for a StaticObject with the given name. This basically calls to Map::getObject().
int Annchienta::MapManager::getTileHeight | ( | ) | const |
int Annchienta::MapManager::getTileWidth | ( | ) | const |
int Annchienta::MapManager::getUpdatesNeeded | ( | ) | const |
bool Annchienta::MapManager::isRunning | ( | ) | const |
Polls if the game (the MapManager) is running.
void Annchienta::MapManager::renderFrame | ( | ) | const |
The same as draw()... both are kept for comptability issues.
void Annchienta::MapManager::resync | ( | ) |
Resynchronizes the timing. Some explanation:
Every time update() is called, the MapManager calls updateOnce() a number of times. When more time has passed since the last update, updateOnce() will be called more.
When, for example, you use a blocking function you wrote yourself that displays a text window, a lot of time will pass. This would mean that updateOnce() would be called hundreds of times.
In order to prevent this, call this function at the end of your function. That way, the number of updates will be reduced to a more fitting number.
void Annchienta::MapManager::run | ( | ) |
This function runs the MapManager. It should basically run your game. It does not return until the player quits the game.
void Annchienta::MapManager::setCameraX | ( | int | x | ) |
Sets the camera X offset. This can also be handled automatically by using cameraFollow() or cameraPeekAt().
void Annchienta::MapManager::setCameraY | ( | int | y | ) |
Sets the camera Y offset.
void Annchienta::MapManager::setCurrentMap | ( | Map * | map | ) |
Sets the current Map to be displayed, updated...
void Annchienta::MapManager::setMaxAscentHeight | ( | int | maxAscentHeight | ) |
Sets the maximum height the player can ascent during one step. If the height difference is larger than this value, the player will not be able to enter the Tile.
void Annchienta::MapManager::setMaxDescentHeight | ( | int | maxDescentHeight | ) |
Sets the maximum height the player can descent during one step. If the height difference is larger than this value, the player will not be able to enter the Tile.
void Annchienta::MapManager::setNullMap | ( | ) |
Sets a NullMap, which simply means no Map. I don't think anyone needs this, actually?
void Annchienta::MapManager::setOnUpdateCode | ( | const char * | code | ) |
Sets a piece of code that will be run every time updateOnce() is called.
void Annchienta::MapManager::setOnUpdateScript | ( | const char * | filename | ) |
Sets a script that will be run every time updateOnce() is called.
void Annchienta::MapManager::setTileHeight | ( | int | tileHeight | ) |
Sets the tileheight. You should call this before actually using the MapManager.
tileHeight | The new Tile height. |
void Annchienta::MapManager::setTileWidth | ( | int | tileWidth | ) |
Sets the tilewidth. You should call this before actually using the MapManager. Typically, you would use (64,32) or (32,16) for tileWidth and tileHeight.
tileWidth | The new Tile width. |
void Annchienta::MapManager::setUpdatesPerSecond | ( | int | ) |
Sets the number of times updateOnce() will be called per second. You usually do this before actually using the MapManager.
void Annchienta::MapManager::stop | ( | ) |
Stops the MapManager from running. You should call this on game over, when the player quits your game...
void Annchienta::MapManager::update | ( | bool | updateInput = true |
) |
Updates the MapManager. This calls to updateOnce a number of times, this number depends on the amount set by setUpdatesPerSecond() and the time passed since the last update.
updateInput | If we should update the InputManager as well. |
void Annchienta::MapManager::updateOnce | ( | bool | updateInput = true |
) |
Updates the MapManager a single time. This is mostly used internally. See update().
StaticObject* Annchienta::MapManager::cameraTarget [private] |
int Annchienta::MapManager::cameraX [private] |
int Annchienta::MapManager::cameraY [private] |
Map* Annchienta::MapManager::currentMap [private] |
InputManager* Annchienta::MapManager::inputManager [private] |
int Annchienta::MapManager::maxAscentHeight [private] |
int Annchienta::MapManager::maxDescentHeight [private] |
char * Annchienta::MapManager::onUpdateCode [private] |
char* Annchienta::MapManager::onUpdateScript [private] |
bool Annchienta::MapManager::running [private] |
int Annchienta::MapManager::tileHeight [private] |
int Annchienta::MapManager::tileWidth [private] |
int Annchienta::MapManager::updatesPerSecond [private] |