This class rapresents a Level of Qubet, with its obstacle. It is able to draw itself simply using the draw function. It can also load the xml description file and parse it. More...
#include <level.h>
Public Member Functions | |
Level (QString _name, GLfloat _length, GLfloat _width, QObject *_parent=0, Skin *_asphaltSkin=NULL) | |
Creates a level from an id, a name, a length and a width. It is used to create a new Level from the LevelEditor. More... | |
Level (QString _filename, QObject *_parent=0, Skin *_asphaltSkin=NULL) | |
Creates a Level from a filename. It is used in the Loader. More... | |
~Level () | |
Safely destroies a Level instance. | |
QString | getFilename () |
Returns the filename of the Level. More... | |
void | setFilename (QString _filename) |
Set the Level filename. More... | |
QString | getName () |
Returns the name of the Level. More... | |
void | setName (QString _name) |
Set the name of the Level. More... | |
bool | getIsInStory () |
Returns the a variable that states if the Level is in the story. More... | |
void | setIsInStory (bool _isInStory) |
Set the a variable that states if the Level is in the story. More... | |
GLfloat | getWidth () |
Returns the width of the Level. More... | |
GLfloat | getLength () |
Returns the length of the Level. More... | |
GLfloat | getGravity () |
Returns the gravity of the Level. More... | |
GLvoid | setGravity (GLfloat _gravity) |
Set the gravity of the Level. More... | |
QString | getAmbientMusicFilename () |
Returns the ambient Music Filename. More... | |
QString | getSkyboxName () |
Returns the Skybox Name. More... | |
void | addObstacle (Obstacle *_obstacle) |
Adds an obstacle to the Level. More... | |
void | deleteObstacle (GLint _id) |
Deletes an obstacle. More... | |
void | moveObstacle (GLint _id, Vector3f *newCell) |
Moves an obstacle to a new position. More... | |
QMap< GLint, Obstacle * > | getObstaclesList () |
Returns the Level's Obstacles List. More... | |
bool | load () |
Loads the Level from xml form using the filename as input. More... | |
bool | save (bool *newlyCreated=0) |
Saves the Level in a xml form using the filename as output. More... | |
GLvoid | draw (GLboolean simplifyForPicking) |
Draws the Level and its obstacles. More... | |
GLint | getObstacleListCount () |
Returns the number of obstacles in the level. More... | |
GLvoid | clearObstaclesList () |
Returns the number of obstacles in the level. | |
GLvoid | clearTempObstaclesList () |
Clears the not saves obstacles. | |
Private Attributes | |
QObject * | parent |
QString | filename |
QString | name |
bool | isInStory |
QMap< GLint, Obstacle * > | obstaclesList |
QMap< GLint, Obstacle * > | tempObstaclesList |
GLint | length |
GLint | width |
GLfloat | gravity |
QString | ambientMusicFilename |
QString | skyboxName |
GLint | currentObstacleId |
bool | isLoaded |
Skin * | asphaltSkin |
This class rapresents a Level of Qubet, with its obstacle. It is able to draw itself simply using the draw function. It can also load the xml description file and parse it.
|
explicit |
Creates a level from an id, a name, a length and a width. It is used to create a new Level from the LevelEditor.
void Level::addObstacle | ( | Obstacle * | _obstacle | ) |
Adds an obstacle to the Level.
_obstacle | is the obstacle to add. |
void Level::deleteObstacle | ( | GLint | _id | ) |
Deletes an obstacle.
_id | is the obstacle id. |
GLvoid Level::draw | ( | GLboolean | simplifyForPicking | ) |
Draws the Level and its obstacles.
simplifyForPicking | is used to state if you want to draw it simplified. |
QString Level::getAmbientMusicFilename | ( | ) |
Returns the ambient Music Filename.
GLfloat Level::getGravity | ( | ) |
bool Level::getIsInStory | ( | ) |
GLfloat Level::getLength | ( | ) |
QString Level::getName | ( | ) |
GLint Level::getObstacleListCount | ( | ) |
Returns the number of obstacles in the level.
QMap< GLint, Obstacle * > Level::getObstaclesList | ( | ) |
QString Level::getSkyboxName | ( | ) |
GLfloat Level::getWidth | ( | ) |
bool Level::load | ( | ) |
Loads the Level from xml form using the filename as input.
void Level::moveObstacle | ( | GLint | _id, |
Vector3f * | newCell | ||
) |
Moves an obstacle to a new position.
_id | is the id of the obstacle to move. |
newCell | is the new cell. |
bool Level::save | ( | bool * | newlyCreated = 0 | ) |
Saves the Level in a xml form using the filename as output.
newlyCreated | is the return variable that is true is the level has been newly created, else false. |
void Level::setFilename | ( | QString | _filename | ) |
Set the Level filename.
_filename | is the filename to set. |
GLvoid Level::setGravity | ( | GLfloat | _gravity | ) |
void Level::setIsInStory | ( | bool | _isInStory | ) |
void Level::setName | ( | QString | _name | ) |
Set the name of the Level.
_name | is the name to set. |
|
private |
It is the Level ambient music filename.
|
private |
It is the current Obstacle Id (used to generate new IDs).
|
private |
It is the Level xml description filename.
|
private |
It is the Level gravity.
|
private |
It is the variable that states if the Level is in the story.
|
private |
It is the variable that states if the level has already been fully loaded.
|
private |
It is the Level length.
|
private |
It is the Level name.
|
private |
It is the name of the skybox to use.
|
private |
It is the Level width.