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

This class rapresents the player's Cube. More...

#include <cube.h>

Inheritance diagram for Cube:
Inheritance graph
Collaboration diagram for Cube:
Collaboration graph

Signals

void levelCompleted ()
 Signal emitted when the level is completed.
 
void suicide ()
 Signal emitted when the player "suicide" the Cube.
 
void explosionFinished ()
 Signal to inform that the explosion has finished.
 
void hideLevelName ()
 Signal to inform to hide the level name.
 
void playEffect (QString effectName)
 Signal emitted to play an effect. More...
 

Public Member Functions

 Cube (Level *_level, Skin *_skin, QObject *_parent=0, QGLShaderProgram *_explosionShader=NULL)
 Create a Cube. More...
 
 ~Cube ()
 Safely destroy a Cube object.
 
void startCube ()
 Start the motion of the Cube;.
 
void stopCube ()
 Stop the motion of the Cube.
 
Vector3fgetPosition ()
 Returns the position of the Cube. More...
 
GLfloat getZ ()
 Returns the Z of the Cube. More...
 
void setPosition (Vector3f *_position)
 Set the position of the Cube. More...
 
void jump ()
 Make the Cube jump.
 
bool isMoving ()
 Returns true if the Cube is moving, else false. More...
 
void moveLeft ()
 Make the Cube move to the Left.
 
void moveRight ()
 Make the Cube move to the right.
 
void draw (GLboolean simplifyForPicking=false)
 Draw the Cube. More...
 
void updatePosition ()
 Update the position of the Cube.
 

Private Slots

void collided ()
 It is the slot invoked when the Cube collides with an Obstacle.
 
void keyPressed (QKeyEvent *event)
 Slot invoked when the user presses a key on the keyboard. More...
 

Private Member Functions

void createNormalsMatrix ()
 Generate the normalsMatrix Matrix.
 
void drawExplosion ()
 this function is called in the draw function in case of explosion.
 
void explode ()
 Make the Cube explode.
 
void completed ()
 Actions to perform when the level is completed.
 
void resetCube ()
 Reset the Level.
 

Private Attributes

Skinskin
 
QObjectparent
 
Vector3fposition
 
unsigned char state
 
GLfloat speed
 
GLfloat gravity
 
GLint levelCellsLength
 
GLint levelCellsWidth
 
GLfloat scaleFactor
 
GLfloat jumpStartTime
 
GLint jumpStep
 
GLint movingStep
 
GLint explosionStep
 
GLint xCell
 
Vector3fnormalsMatrix [4][4][4]
 
Vector3fanglesMatrix [4][4][4]
 
GLint startXCell
 
bool canMove
 
QGLShaderProgram * explosionShader
 

Detailed Description

This class rapresents the player's Cube.

Version
1.0
Author
#34

Constructor & Destructor Documentation

Cube::Cube ( Level _level,
Skin _skin,
QObject _parent = 0,
QGLShaderProgram *  _explosionShader = NULL 
)
explicit

Create a Cube.

Parameters
_levelis the Level in which the Cube lives.
_skinis the skin of the Cube.
_parentis the parent of the Cube.
_explosionShaderis the shader for the explosion.

Here is the call graph for this function:

Member Function Documentation

void Cube::draw ( GLboolean  simplifyForPicking = false)

Draw the Cube.

Parameters
simplifyForPicking[default = false] is used to draw a simplified scene used for the picking function.

Here is the call graph for this function:

Here is the caller graph for this function:

Vector3f * Cube::getPosition ( )

Returns the position of the Cube.

Returns
the position of the Cube.

Here is the caller graph for this function:

GLfloat Cube::getZ ( )

Returns the Z of the Cube.

Returns
the Z of the Cube.

Here is the caller graph for this function:

bool Cube::isMoving ( )

Returns true if the Cube is moving, else false.

Returns
true if the Cube is moving, else false.

Here is the caller graph for this function:

void Cube::keyPressed ( QKeyEvent *  event)
privateslot

Slot invoked when the user presses a key on the keyboard.

Parameters
eventis the QKeyEvent*.

Here is the call graph for this function:

Here is the caller graph for this function:

void Cube::playEffect ( QString  effectName)
signal

Signal emitted to play an effect.

Parameters
effectNameis the name of the effect to play.

Here is the caller graph for this function:

void Cube::setPosition ( Vector3f _position)

Set the position of the Cube.

Parameters
_positionis the position to set.

Member Data Documentation

Vector3f* Cube::anglesMatrix[4][4][4]
private

It is the 3-dimensional matrix that contain the nomrs vector of each sub-cube in case of explosion.

bool Cube::canMove
private

States if the cube can move or not.

QGLShaderProgram* Cube::explosionShader
private

It is the explosion Shader.

GLint Cube::explosionStep
private

It is the current explosion step.

GLfloat Cube::gravity
private

It is the gravity variable.

GLfloat Cube::jumpStartTime
private

It is the time the Cube has started the jump.

GLint Cube::jumpStep
private

It is the parameter of the jump.

GLint Cube::levelCellsLength
private

It is the number of cells of the Level's length.

GLint Cube::levelCellsWidth
private

It is the number of cells of the Level's width.

GLint Cube::movingStep
private

It is the current moving step for to left and right.

Vector3f* Cube::normalsMatrix[4][4][4]
private

It is the 3-dimensional matrix that contain the nomrs vector of each sub-cube in case of explosion.

QObject* Cube::parent
private

It is the Parent of the Cube.

Vector3f* Cube::position
private

It is the Cube's current position.

GLfloat Cube::scaleFactor
private

It is the scale factor.

Skin* Cube::skin
private

It is the Skin of the Cube.

GLfloat Cube::speed
private

It is the current speed of the Cube.

GLint Cube::startXCell
private

It is the starting x cell.

unsigned char Cube::state
private

It is the state of the cube.

GLint Cube::xCell
private

It is the x cell the Cube is on.


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