Qubet  1.0
The ultimate QGL addicting videogame!
 All Classes Functions Variables Pages
game.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 GAME_H
20 #define GAME_H
21 
22 #include "positioncontroller.h"
23 #include "actionlist.h"
24 #include "cubestring.h"
25 
32 class Game : public QObject
33 {
34  Q_OBJECT
35 
36 public:
37 
49  explicit Game(QMap<GLint,GLuint> &_iconsList, Alphabet *_alphabet, Skin *_skin, QMap<GLint,Level*> &_levelsList, QObject *_parent = 0, bool _audioEnabled = true, QGLShaderProgram *_explosionShader = NULL);
50 
62  explicit Game(QMap<GLint,GLuint> &_iconsList, Alphabet *_alphabet, Skin *_skin, Level *_level, QObject *_parent = 0, bool _audioEnabled = true, QGLShaderProgram *_explosionShader = NULL);
63 
67  ~Game();
68 
72  void startGame();
73 
80  void draw(GLboolean simplifyForPicking = false);
81 
82 
83 private:
84 
86  QMap<GLint,GLuint> iconsList;
91  QMap<GLint,Level*> levelsList;
92  bool audioEnabled;
95  GLint gameType;
96  GLint currentLevel;
97  GLint deaths;
107  GLuint introStep;
108  bool isPaused;
109  bool isExploding;
111  QGLShaderProgram *explosionShader;
112  bool isQuitting;
117  GLuint waitCounter;
122  void initGame();
123 
128  void countdown();
129 
133  void playLevel();
134 
138  void nextLevel();
139 
143  void pauseGame();
144 
148  void continueGame();
149 
153  void quitGame();
154 
158  void createResultStrings();
159 
160 
161 private slots:
162 
169  void itemClicked(QMouseEvent *event, QList<GLuint> listNames);
170 
176  void mouseReleased(QMouseEvent *event);
177 
184  void mouseMoved(QMouseEvent *event, QList<GLuint> listNames);
185 
191  void wheelScrolled(QWheelEvent *event);
192 
198  void keyPressed(QKeyEvent *event);
199 
203  void collided();
204 
208  void exploded();
209 
213  void explosionFinished();
214 
218  void levelCompleted();
219 
223  void hideLevelName();
224 
225 
226 signals:
227 
231  void collision();
232 
236  void gameClosedSignal();
237 
249  void setMouseMovementTracking(int mode);
250 
256  void keyPressedSignal(QKeyEvent *event);
257 
263  void enableAudio(bool enabled);
264 
270  void playAmbientMusic(QString filename);
271 
275  void stopAmbientMusic();
276 
282  void playEffect(QString effectName);
283 
289  void setSkybox(QString skyboxName);
290 
291 };
292 
293 #endif // GAME_H
bool isExploding
Definition: game.h:109
~Game()
Safely destroy a Game Object.
Definition: game.cpp:50
Level * next
Definition: game.h:90
GLuint waitCounter
Definition: game.h:117
void levelCompleted()
Slot invoked when level is completed.
Definition: game.cpp:506
void explosionFinished()
Slot invoked when the explosion has finished.
Definition: game.cpp:500
void setMouseMovementTracking(int mode)
This signal is emitted to set the Qubet's Mouse Move Tracking sensibility. The modes are: 0 - no sign...
CubeString * adjectiveCubeString
Definition: game.h:116
void initGame()
Initialize the game.
Definition: game.cpp:223
PositionController Class check if the cube has a collision with obstacles.
Definition: positioncontroller.h:30
PositionController * positionController
Definition: game.h:94
GLint currentLevel
Definition: game.h:96
CubeString * deathCounter
Definition: game.h:110
Skin * asphaltSkin
Definition: game.h:101
Cube * cube
Definition: game.h:93
Vector3f * levelOffset
Definition: game.h:104
void nextLevel()
Go to the next level.
Definition: game.cpp:335
This class is used to keep track of actions to do. For example it can keep track of current view scro...
Definition: actionlist.h:50
void mouseMoved(QMouseEvent *event, QList< GLuint > listNames)
Slot invoked when the user moves the mouse.
Definition: game.cpp:434
void playEffect(QString effectName)
Signal emitted to play an effect.
GLuint introStep
Definition: game.h:107
void continueGame()
Continue the Game from Pause mode.
Definition: game.cpp:373
void enableAudio(bool enabled)
Signal emitted to enable or disable the audio.
GLfloat angleRotVolumeCube
Definition: game.h:99
GLint gameType
Definition: game.h:95
CubeString * levelName
Definition: game.h:114
Game(QMap< GLint, GLuint > &_iconsList, Alphabet *_alphabet, Skin *_skin, QMap< GLint, Level * > &_levelsList, QObject *_parent=0, bool _audioEnabled=true, QGLShaderProgram *_explosionShader=NULL)
Creator for the Story Mode.
Definition: game.cpp:24
void keyPressedSignal(QKeyEvent *event)
Signal relaunched from Qubet when the user presses a key on the keyboard.
Skin * skin
Definition: game.h:88
This class is used to draw, a string composed the horizontal justapposition of Different cubes on whi...
Definition: cubestring.h:37
It is the Skin Class.
Definition: skin.h:30
void createResultStrings()
Creates the resultsCubeString.
Definition: game.cpp:528
Skin * volumeSkin
Definition: game.h:100
CubeString * stateLabel
Definition: game.h:105
void startGame()
Function to start the game.
Definition: game.cpp:62
bool showingResult
Definition: game.h:113
QGLShaderProgram * explosionShader
Definition: game.h:111
Level * level
Definition: game.h:89
CubeString * resultsCubeString
Definition: game.h:115
void quitGame()
Quit the game and returns to Menu.
Definition: game.cpp:391
void collision()
Signal emitted when the cube has a collision with an obstacle.
Alphabet * alphabet
Definition: game.h:87
void playAmbientMusic(QString filename)
Signal emitted to play the ambient music.
QObject * parent
Definition: game.h:85
bool isQuitting
Definition: game.h:112
void wheelScrolled(QWheelEvent *event)
Slot invoked when the user scrolls the wheel of the mouse button.
Definition: game.cpp:458
Structure that rapresents a Vector of float in a 3-D space.
Definition: vector3f.h:31
This class rapresents the player's Cube.
Definition: cube.h:31
void playLevel()
Start the current Level.
Definition: game.cpp:310
void gameClosedSignal()
Signal emitted to close the game.
void setSkybox(QString skyboxName)
Signal emitted to set the Skybox.
It is the Game Class.
Definition: game.h:32
This class rapresents a Level of Qubet, with its obstacle. It is able to draw itself simply using the...
Definition: level.h:33
void draw(GLboolean simplifyForPicking=false)
Method to draw the game.
Definition: game.cpp:67
bool isPaused
Definition: game.h:108
Skin * gridSkin
Definition: game.h:102
void collided()
Slot invoked when the cube has a collision with an obstacle.
Definition: game.cpp:485
GLint deaths
Definition: game.h:97
void countdown()
make the animation for the initial countdown
Definition: game.cpp:265
void pauseGame()
Pause the Game.
Definition: game.cpp:357
CubeString * quitLabel
Definition: game.h:106
This class is used to keep a list of Letter (from this the name Alphabet) It provide access to Letter...
Definition: alphabet.h:33
void stopAmbientMusic()
Signal emitted to stop the current ambient music.
bool audioEnabled
Definition: game.h:92
QMap< GLint, GLuint > iconsList
Definition: game.h:86
void hideLevelName()
Slot invoked to hide the Level Name.
Definition: game.cpp:523
void exploded()
Slot invoked when the cube has exploded (suicide or collided).
Definition: game.cpp:491
void mouseReleased(QMouseEvent *event)
Slot invoked when the user releases the mouse button.
Definition: game.cpp:429
ActionList * currentActions
Definition: game.h:98
QMap< GLint, Level * > levelsList
Definition: game.h:91
void itemClicked(QMouseEvent *event, QList< GLuint > listNames)
Slot invoked when the user clicks on a item.
Definition: game.cpp:402
Vector3f * cameraOffset
Definition: game.h:103
void keyPressed(QKeyEvent *event)
Slot invoked when the user presses a key on the keyboard.
Definition: game.cpp:463