Qubet  1.0
The ultimate QGL addicting videogame!
 All Classes Functions Variables Pages
Public Member Functions | Private Attributes | List of all members
Level Class Reference

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>

Inheritance diagram for Level:
Inheritance graph
Collaboration diagram for Level:
Collaboration graph

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

QObjectparent
 
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
 
SkinasphaltSkin
 

Detailed Description

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.

Version
1.0
Author
#34

Constructor & Destructor Documentation

Level::Level ( QString  _name,
GLfloat  _length,
GLfloat  _width,
QObject _parent = 0,
Skin _asphaltSkin = NULL 
)
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.

Parameters
_nameis the name of the Level.
_lengthis the length of the Level.
_widthis the width of the Level.
_parentis the parent of the Level.
_asphaltSkinis the asphalt Skin for the Level.
Level::Level ( QString  _filename,
QObject _parent = 0,
Skin _asphaltSkin = NULL 
)
explicit

Creates a Level from a filename. It is used in the Loader.

Parameters
_filenameis the filename to load.
_parentis the parent of the Level.
_asphaltSkinis the asphalt Skin for the Level.

Member Function Documentation

void Level::addObstacle ( Obstacle _obstacle)

Adds an obstacle to the Level.

Parameters
_obstacleis the obstacle to add.

Here is the call graph for this function:

Here is the caller graph for this function:

void Level::deleteObstacle ( GLint  _id)

Deletes an obstacle.

Parameters
_idis the obstacle id.

Here is the caller graph for this function:

GLvoid Level::draw ( GLboolean  simplifyForPicking)

Draws the Level and its obstacles.

Parameters
simplifyForPickingis used to state if you want to draw it simplified.

Here is the caller graph for this function:

QString Level::getAmbientMusicFilename ( )

Returns the ambient Music Filename.

Returns
the ambientMusicFilename.

Here is the caller graph for this function:

QString Level::getFilename ( )

Returns the filename of the Level.

Returns
the filename of the Level.
GLfloat Level::getGravity ( )

Returns the gravity of the Level.

Returns
the gravity of the Level.

Here is the caller graph for this function:

bool Level::getIsInStory ( )

Returns the a variable that states if the Level is in the story.

Returns
true if the Level is in the story, else false.

Here is the caller graph for this function:

GLfloat Level::getLength ( )

Returns the length of the Level.

Returns
the length of the Level.

Here is the caller graph for this function:

QString Level::getName ( )

Returns the name of the Level.

Returns
the name of the Level.

Here is the caller graph for this function:

GLint Level::getObstacleListCount ( )

Returns the number of obstacles in the level.

Returns
the number of obstacles in the level.
QMap< GLint, Obstacle * > Level::getObstaclesList ( )

Returns the Level's Obstacles List.

Returns
the Level's Obstacles List.

Here is the caller graph for this function:

QString Level::getSkyboxName ( )

Returns the Skybox Name.

Returns
the skyboxName.

Here is the caller graph for this function:

GLfloat Level::getWidth ( )

Returns the width of the Level.

Returns
the width of the Level.

Here is the caller graph for this function:

bool Level::load ( )

Loads the Level from xml form using the filename as input.

Returns
true if the load is successful, else false.

Here is the caller graph for this function:

void Level::moveObstacle ( GLint  _id,
Vector3f newCell 
)

Moves an obstacle to a new position.

Parameters
_idis the id of the obstacle to move.
newCellis the new cell.
bool Level::save ( bool *  newlyCreated = 0)

Saves the Level in a xml form using the filename as output.

Parameters
newlyCreatedis the return variable that is true is the level has been newly created, else false.
Returns
true if save is successful, else false.

Here is the call graph for this function:

Here is the caller graph for this function:

void Level::setFilename ( QString  _filename)

Set the Level filename.

Parameters
_filenameis the filename to set.
GLvoid Level::setGravity ( GLfloat  _gravity)

Set the gravity of the Level.

Parameters
_gravityis the new gravity of the Level.

Here is the caller graph for this function:

void Level::setIsInStory ( bool  _isInStory)

Set the a variable that states if the Level is in the story.

Parameters
_isInStoryis the variable to set. (true if the Level is in the story, else false).

Here is the caller graph for this function:

void Level::setName ( QString  _name)

Set the name of the Level.

Parameters
_nameis the name to set.

Here is the caller graph for this function:

Member Data Documentation

QString Level::ambientMusicFilename
private

It is the Level ambient music filename.

Skin* Level::asphaltSkin
private

It is the asphalt Skin.

GLint Level::currentObstacleId
private

It is the current Obstacle Id (used to generate new IDs).

QString Level::filename
private

It is the Level xml description filename.

GLfloat Level::gravity
private

It is the Level gravity.

bool Level::isInStory
private

It is the variable that states if the Level is in the story.

bool Level::isLoaded
private

It is the variable that states if the level has already been fully loaded.

GLint Level::length
private

It is the Level length.

QString Level::name
private

It is the Level name.

QMap<GLint,Obstacle*> Level::obstaclesList
private

It is the Level List of obstacles.

QObject* Level::parent
private

It is the parent of Level.

QString Level::skyboxName
private

It is the name of the skybox to use.

QMap<GLint,Obstacle*> Level::tempObstaclesList
private

It is the Level List of obstacles.

GLint Level::width
private

It is the Level width.


The documentation for this class was generated from the following files: