This class rapresents an instance of the QGLWidget Qubet. It is the game.
More...
#include <qubet.h>
|
void | itemClicked (QMouseEvent *event, QList< GLuint > listNames) |
| Signal emitted when the user clicks on a item. More...
|
|
void | mouseReleased (QMouseEvent *event) |
| Signal emitted when the user releases the mouse button. More...
|
|
void | mouseMoved (QMouseEvent *event, QList< GLuint > listNames) |
| Signal emitted when the user moves the mouse. More...
|
|
void | wheelScrolled (QWheelEvent *event) |
| Signal emitted when the user scrolls the wheel of the mouse. More...
|
|
void | keyPressed (QKeyEvent *event) |
| Signal emitted when the user presses a key on the keyboard. More...
|
|
void | enableAudio (bool enabled) |
| Signal emitted to enable or disable the audio. More...
|
|
void | playAmbientMusic (QString filename) |
| Signal emitted to play the ambient music. More...
|
|
void | stopAmbientMusic () |
| Signal emitted to stop the current ambient music.
|
|
void | playEffect (QString effectName) |
| Signal emitted to play an effect. More...
|
|
|
GLvoid | initializeGL () |
| Initialize the Qt OpenGL. More...
|
|
GLvoid | paintGL () |
| Paint the OpenGL scene. More...
|
|
GLvoid | resizeGL (GLint _width, GLint _height) |
| Resize the OpenGL Window. More...
|
|
GLvoid | mousePressEvent (QMouseEvent *event) |
| This function is invoked when the player clicks inside the game window. More...
|
|
GLvoid | mouseReleaseEvent (QMouseEvent *event) |
| This function is invoked when the player releases the mouse click. More...
|
|
GLvoid | mouseMoveEvent (QMouseEvent *event) |
| This function is invoked when the player moves the mouse inside the game window. More...
|
|
GLvoid | wheelEvent (QWheelEvent *event) |
| This function is invoked when the player scrolls the wheel of the mouse inside the game window. More...
|
|
GLvoid | keyPressEvent (QKeyEvent *event) |
| This function is invoked when the player presses a key. More...
|
|
|
void | draw () |
| This is a duplicated function to call paintGL, but this can be used as a slot.
|
|
void | playStory (GLint skinId) |
| This function is a slot linked to the Menu and invoked when the player chooses to play the Story Mode. More...
|
|
void | playArcade (GLint skinId, GLint levelId) |
| This function is a slot linked to the Menu and invoked when the player chooses to play the Arcade Mode. More...
|
|
void | gameClosed () |
| This function is a slot linked to the Game and invoked when the player chooses to close the current Game instance.
|
|
void | showLevelEditor (GLint _levelId) |
| This function is a slot linked to the Menu and invoked when the player chooses to enter the Level Editor. More...
|
|
void | addLevelToLevelsList (Level *_level) |
| Slot invoked to add a level to the levelList. More...
|
|
void | levelEditorClosed () |
| This function is a slot linked to the LevelEditor and invoked when the player chooses to close the current LevelEditor instance.
|
|
void | setMouseMovementTracking (int mode) |
| This slot is to set the Mouse Move Tracking sensibility. The modes are: 0 - no signal emitted. 1 - the signal mouseMoved is emitted only when the mouse is moved and one of the mouse buttons are clicked. 2 - the signal mouseMoved is emitted always when the mouse is moved. More...
|
|
void | setSkybox (QString skyboxName) |
| This slot is invoked to set the Skybox. More...
|
|
|
GLvoid | initQubet () |
| It is used after the first show of the qubet window to initialize Qubet.
|
|
GLvoid | connectInputEvents (const QObject *receiver) |
| This methos connects mouse and keyboard events to the receiver object to forward user's input to the current view. More...
|
|
GLvoid | connectAudio (const QObject *sender) |
| This method connects audio signals of the sender to their slots in AudioManager. More...
|
|
GLvoid | connectMenu () |
| This function is used to connect all the menu slots to their signals.
|
|
GLvoid | connectLevelEditor () |
| This function is used to connect all the levelEditor slots to their signals.
|
|
GLvoid | connectGame () |
| This function is used to connect all the game slots to their signals.
|
|
QList< GLuint > | getPickedName (GLint mouseX, GLint mouseY) |
| This method returns a list of the names of the foreground item at mouse coordinates (mouseX, mouseY). More...
|
|
GLvoid | loadingCompleted () |
| This function has to be invoked when the loading is finished. More...
|
|
GLvoid | errorLoading () |
| This function has to be invoked when something in the loading process goes wrong.
|
|
GLvoid | showMenu (bool showIntro=true) |
| This function is used to states the paintGL function to show the Menu. More...
|
|
GLvoid | closeMenu () |
| This function is invoked when the player chooses an option from the Menu, so this is no more necessary and will be destroyed. More...
|
|
GLvoid | drawScene (GLboolean simplifyForPicking=false) |
| This function is used to draw the scene on the QGLWidget. It is used by PaintGL that calls this and then do the swap of the buffers. You can use this function either to draw the scene in the background buffer or to draw the scene to use the picking and then not to swap buffers. More...
|
|
GLboolean | load () |
| Load skins, levels and obstacles in Qubet. More...
|
|
GLboolean | loadSkins () |
| Load the skins from the resource file. More...
|
|
GLboolean | loadLevels () |
| Load the levels from the resource file. More...
|
|
GLboolean | loadAlphabet () |
| Load the alphabet. More...
|
|
GLboolean | loadIcons () |
| Load the icons. More...
|
|
GLboolean | loadSkyboxes () |
| Load the skyboxes. More...
|
|
GLboolean | loadShader () |
| Load the Shader. More...
|
|
This class rapresents an instance of the QGLWidget Qubet. It is the game.
- Version
- 1.0
- Author
- #34
Qubet::Qubet |
( |
QWidget * |
parent = 0 | ) |
|
|
explicit |
Create a Qubet object, which is a QGLWidget that contains the game.
- Postcondition
- It also start the loading of game variables and initializes the objects used in the game. To start a new instance of Qubet Game you have only to create this object, it does all for you.
- Parameters
-
parent | is a callback variable to the parent of the widget. |
Destroy a Qubet object.
It will stop rendering, stop the game, safely stop threads and waits for them, so when this function returns you have safely deletes the Qubet instance. This is a syncronous function in order to return only when all operations for the Qubet Widget closure has been terminated.
void Qubet::addLevelToLevelsList |
( |
Level * |
_level | ) |
|
|
privateslot |
Slot invoked to add a level to the levelList.
- Parameters
-
_level | is the Level to add. |
GLvoid Qubet::closeMenu |
( |
| ) |
|
|
private |
This function is invoked when the player chooses an option from the Menu, so this is no more necessary and will be destroyed.
- Precondition
- Keep in mind that you have to show something else to show on the screen using the currentView variable before to delete the current Menu instance.
GLvoid Qubet::connectAudio |
( |
const QObject * |
sender | ) |
|
|
private |
This method connects audio signals of the sender to their slots in AudioManager.
- Parameters
-
sender | is the sender const QObject*. |
GLvoid Qubet::connectInputEvents |
( |
const QObject * |
receiver | ) |
|
|
private |
This methos connects mouse and keyboard events to the receiver object to forward user's input to the current view.
- Precondition
- You have to create the receiver and the receiver have to reimplement mouse and keyboard slots.
- Parameters
-
receiver | is the receiver const QObject*. |
GLvoid Qubet::drawScene |
( |
GLboolean |
simplifyForPicking = false | ) |
|
|
private |
This function is used to draw the scene on the QGLWidget. It is used by PaintGL that calls this and then do the swap of the buffers. You can use this function either to draw the scene in the background buffer or to draw the scene to use the picking and then not to swap buffers.
- Parameters
-
simplifyForPicking | [default = false] is used to draw a simplified scene used for the picking function. |
void Qubet::enableAudio |
( |
bool |
enabled | ) |
|
|
signal |
Signal emitted to enable or disable the audio.
- Parameters
-
enabled | is the variable that states if the audio is to enable or not. |
QList< GLuint > Qubet::getPickedName |
( |
GLint |
mouseX, |
|
|
GLint |
mouseY |
|
) |
| |
|
private |
This method returns a list of the names of the foreground item at mouse coordinates (mouseX, mouseY).
- Parameters
-
mouseX | is the mouse coordinate of x. |
mouseY | is the mouse coordinate of y. |
- Returns
- a list of the names of the item on (mouseX, mouseY).
GLvoid Qubet::initializeGL |
( |
| ) |
|
|
protected |
Initialize the Qt OpenGL.
It is used to manage the OpenGL instance.
void Qubet::itemClicked |
( |
QMouseEvent * |
event, |
|
|
QList< GLuint > |
listNames |
|
) |
| |
|
signal |
Signal emitted when the user clicks on a item.
- Parameters
-
event | is the QMouseEvent. |
listNames | is the QList<GLuint> of item's names. |
void Qubet::keyPressed |
( |
QKeyEvent * |
event | ) |
|
|
signal |
Signal emitted when the user presses a key on the keyboard.
- Parameters
-
GLvoid Qubet::keyPressEvent |
( |
QKeyEvent * |
event | ) |
|
|
protected |
This function is invoked when the player presses a key.
- Parameters
-
GLboolean Qubet::load |
( |
| ) |
|
|
private |
Load skins, levels and obstacles in Qubet.
- Returns
- true if the load is successful, else false.
GLboolean Qubet::loadAlphabet |
( |
| ) |
|
|
private |
Load the alphabet.
- Returns
- true if load is successful, else false.
GLboolean Qubet::loadIcons |
( |
| ) |
|
|
private |
Load the icons.
- Returns
- true if load is successful, else false.
GLvoid Qubet::loadingCompleted |
( |
| ) |
|
|
private |
This function has to be invoked when the loading is finished.
- Postcondition
- It will show the menu.
GLboolean Qubet::loadLevels |
( |
| ) |
|
|
private |
Load the levels from the resource file.
- Returns
- true if load is successful, else false.
GLboolean Qubet::loadShader |
( |
| ) |
|
|
private |
Load the Shader.
- Returns
- true if load is successful, else false.
GLboolean Qubet::loadSkins |
( |
| ) |
|
|
private |
Load the skins from the resource file.
- Returns
- true if load is successful, else false.
GLboolean Qubet::loadSkyboxes |
( |
| ) |
|
|
private |
Load the skyboxes.
- Returns
- true if load is successful, else false.
void Qubet::mouseMoved |
( |
QMouseEvent * |
event, |
|
|
QList< GLuint > |
listNames |
|
) |
| |
|
signal |
Signal emitted when the user moves the mouse.
- Parameters
-
event | is the QMouseEvent*. |
listNames | is the QList<GLuint> of item's names. |
GLvoid Qubet::mouseMoveEvent |
( |
QMouseEvent * |
event | ) |
|
|
protected |
This function is invoked when the player moves the mouse inside the game window.
- Parameters
-
event | is the QMouseEvent*. |
GLvoid Qubet::mousePressEvent |
( |
QMouseEvent * |
event | ) |
|
|
protected |
This function is invoked when the player clicks inside the game window.
- Parameters
-
event | is the QMouseEvent*. |
void Qubet::mouseReleased |
( |
QMouseEvent * |
event | ) |
|
|
signal |
Signal emitted when the user releases the mouse button.
- Parameters
-
event | is the QMouseEvent*. |
GLvoid Qubet::mouseReleaseEvent |
( |
QMouseEvent * |
event | ) |
|
|
protected |
This function is invoked when the player releases the mouse click.
- Parameters
-
event | is the QMouseEvent*. |
GLvoid Qubet::paintGL |
( |
| ) |
|
|
protected |
Paint the OpenGL scene.
This is the most important function since it draws on the screen the game.
void Qubet::playAmbientMusic |
( |
QString |
filename | ) |
|
|
signal |
Signal emitted to play the ambient music.
- Parameters
-
filename | is the filename to play. |
void Qubet::playArcade |
( |
GLint |
skinId, |
|
|
GLint |
levelId |
|
) |
| |
|
privateslot |
This function is a slot linked to the Menu and invoked when the player chooses to play the Arcade Mode.
- Parameters
-
skinId | It is the id of the selected skin. |
levelId | It is the id of the selected level. |
void Qubet::playEffect |
( |
QString |
effectName | ) |
|
|
signal |
Signal emitted to play an effect.
- Parameters
-
effectName | is the name of the effect to play. |
void Qubet::playStory |
( |
GLint |
skinId | ) |
|
|
privateslot |
This function is a slot linked to the Menu and invoked when the player chooses to play the Story Mode.
- Parameters
-
skinId | It is the id of the selected skin. |
GLvoid Qubet::resizeGL |
( |
GLint |
_width, |
|
|
GLint |
_height |
|
) |
| |
|
protected |
Resize the OpenGL Window.
- Parameters
-
_width | is the new width of the window. |
_height | is the new height of the window. |
void Qubet::setMouseMovementTracking |
( |
int |
mode | ) |
|
|
privateslot |
This slot is to set the Mouse Move Tracking sensibility. The modes are: 0 - no signal emitted. 1 - the signal mouseMoved is emitted only when the mouse is moved and one of the mouse buttons are clicked. 2 - the signal mouseMoved is emitted always when the mouse is moved.
- Parameters
-
mode | It is the selected mode. |
void Qubet::setSkybox |
( |
QString |
skyboxName | ) |
|
|
privateslot |
This slot is invoked to set the Skybox.
- Parameters
-
skyboxName | is the name of the Skybox to apply. |
void Qubet::showLevelEditor |
( |
GLint |
_levelId | ) |
|
|
privateslot |
This function is a slot linked to the Menu and invoked when the player chooses to enter the Level Editor.
- Parameters
-
_levelId | is the levelId you want to edit. |
GLvoid Qubet::showMenu |
( |
bool |
showIntro = true | ) |
|
|
private |
This function is used to states the paintGL function to show the Menu.
- Parameters
-
showIntro | is the variable that states if thw intro has to been showed. [default = true] |
GLvoid Qubet::wheelEvent |
( |
QWheelEvent * |
event | ) |
|
|
protected |
This function is invoked when the player scrolls the wheel of the mouse inside the game window.
- Parameters
-
event | is the QWheelEvent*. |
void Qubet::wheelScrolled |
( |
QWheelEvent * |
event | ) |
|
|
signal |
Signal emitted when the user scrolls the wheel of the mouse.
- Parameters
-
event | is the QWheelEvent*. |
GLint Qubet::currentNewLevelNumber |
|
private |
It is the current level value.
QString Qubet::currentText |
|
private |
It is the current string showed on the screen.
It is used to keep track of the current view (menu, game, leveleditor).
It is the QTimer to re-draw the scene.
QGLShaderProgram* Qubet::explosionShader |
|
private |
It is the current explosion Shader.
It is the current widget height.
QMap<GLint,GLuint> Qubet::iconsList |
|
private |
It is the QMap that contains ids of the icons' texture.
QMap<GLint,Level*> Qubet::levelsList |
|
private |
It is the QMap that contains ids and the names of level files.
It is the variable that states if the load has already be done.
GLint Qubet::mouseMovedMode |
|
private |
QMap<GLint,Skin*> Qubet::skinsList |
|
private |
It is the QMap that contains ids and skin images.
GLfloat Qubet::skyboxAngle |
|
private |
It is the Skybox rotation angle.
QMap<QString,Skybox*> Qubet::skyboxesList |
|
private |
It is the Qmap that contains the available skyboxes.
It is the current widget width.
The documentation for this class was generated from the following files: