Qubet  1.0
The ultimate QGL addicting videogame!
 All Classes Functions Variables Pages
level.h
1 // Qubet - Copyright (C) 2011
2 // Enrico Bacis
3 // Daniele Ciriello
4 
5 // Qubet is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
9 
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 
15 // You should have received a copy of the GNU General Public License
16 // along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18 
19 #ifndef LEVEL_H
20 #define LEVEL_H
21 
22 #include "obstacle.h"
23 #include "skybox.h"
24 
33 class Level : public QObject
34 {
35  Q_OBJECT
36 
37 public:
48  explicit Level(QString _name, GLfloat _length, GLfloat _width, QObject *_parent = 0, Skin *_asphaltSkin = NULL);
49 
58  explicit Level(QString _filename, QObject *_parent = 0, Skin *_asphaltSkin = NULL);
59 
63  ~Level();
64 
70  QString getFilename();
71 
77  void setFilename(QString _filename);
78 
84  QString getName();
85 
91  void setName(QString _name);
92 
98  bool getIsInStory();
99 
105  void setIsInStory(bool _isInStory);
106 
112  GLfloat getWidth();
113 
119  GLfloat getLength();
120 
126  GLfloat getGravity();
127 
133  GLvoid setGravity(GLfloat _gravity);
134 
140  QString getAmbientMusicFilename();
141 
147  QString getSkyboxName();
148 
154  void addObstacle(Obstacle *_obstacle);
155 
161  void deleteObstacle(GLint _id);
162 
169  void moveObstacle(GLint _id, Vector3f *newCell);
170 
176  QMap<GLint,Obstacle*> getObstaclesList();
177 
183  bool load();
184 
193  bool save(bool *newlyCreated = 0);
194 
200  GLvoid draw(GLboolean simplifyForPicking);
201 
207  GLint getObstacleListCount();
208 
212  GLvoid clearObstaclesList();
213 
217  GLvoid clearTempObstaclesList();
218 
219 
220 private:
221 
223  QString filename;
224  QString name;
225  bool isInStory;
226  QMap<GLint,Obstacle*> obstaclesList;
227  QMap<GLint,Obstacle*> tempObstaclesList;
228  GLint length;
229  GLint width;
230  GLfloat gravity;
232  QString skyboxName;
234  bool isLoaded;
237 };
238 
239 #endif // LEVEL_H
QString getSkyboxName()
Returns the Skybox Name.
Definition: level.cpp:112
QMap< GLint, Obstacle * > getObstaclesList()
Returns the Level's Obstacles List.
Definition: level.cpp:151
GLfloat getWidth()
Returns the width of the Level.
Definition: level.cpp:87
GLint width
Definition: level.h:229
QMap< GLint, Obstacle * > tempObstaclesList
Definition: level.h:227
GLfloat gravity
Definition: level.h:230
bool isInStory
Definition: level.h:225
GLint length
Definition: level.h:228
GLvoid clearTempObstaclesList()
Clears the not saves obstacles.
Definition: level.cpp:357
~Level()
Safely destroies a Level instance.
Definition: level.cpp:48
void deleteObstacle(GLint _id)
Deletes an obstacle.
Definition: level.cpp:124
bool save(bool *newlyCreated=0)
Saves the Level in a xml form using the filename as output.
Definition: level.cpp:219
GLvoid clearObstaclesList()
Returns the number of obstacles in the level.
Definition: level.cpp:351
QString skyboxName
Definition: level.h:232
QString name
Definition: level.h:224
Skin * asphaltSkin
Definition: level.h:235
bool getIsInStory()
Returns the a variable that states if the Level is in the story.
Definition: level.cpp:77
void addObstacle(Obstacle *_obstacle)
Adds an obstacle to the Level.
Definition: level.cpp:117
GLint currentObstacleId
Definition: level.h:233
It is the Skin Class.
Definition: skin.h:30
void setName(QString _name)
Set the name of the Level.
Definition: level.cpp:72
bool isLoaded
Definition: level.h:234
void moveObstacle(GLint _id, Vector3f *newCell)
Moves an obstacle to a new position.
Definition: level.cpp:143
GLvoid setGravity(GLfloat _gravity)
Set the gravity of the Level.
Definition: level.cpp:102
void setIsInStory(bool _isInStory)
Set the a variable that states if the Level is in the story.
Definition: level.cpp:82
QString getName()
Returns the name of the Level.
Definition: level.cpp:67
Structure that rapresents a Vector of float in a 3-D space.
Definition: vector3f.h:31
QString ambientMusicFilename
Definition: level.h:231
bool load()
Loads the Level from xml form using the filename as input.
Definition: level.cpp:156
GLfloat getGravity()
Returns the gravity of the Level.
Definition: level.cpp:97
GLint getObstacleListCount()
Returns the number of obstacles in the level.
Definition: level.cpp:346
QString getFilename()
Returns the filename of the Level.
Definition: level.cpp:57
GLvoid draw(GLboolean simplifyForPicking)
Draws the Level and its obstacles.
Definition: level.cpp:318
QObject * parent
Definition: level.h:222
This class rapresents a Level of Qubet, with its obstacle. It is able to draw itself simply using the...
Definition: level.h:33
GLfloat getLength()
Returns the length of the Level.
Definition: level.cpp:92
This class rapresents an Obstacle.
Definition: obstacle.h:30
QString filename
Definition: level.h:223
QMap< GLint, Obstacle * > obstaclesList
Definition: level.h:226
QString getAmbientMusicFilename()
Returns the ambient Music Filename.
Definition: level.cpp:107
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 L...
Definition: level.cpp:34
void setFilename(QString _filename)
Set the Level filename.
Definition: level.cpp:62