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

This class is used to draw, a string composed the horizontal justapposition of Different cubes on which the skin is a letter that compose the string. Letters are generated from an instance of the class Alphabet. More...

#include <cubestring.h>

Collaboration diagram for CubeString:
Collaboration graph

Public Member Functions

 CubeString (QString _label, GLfloat _cubeDimension, Alphabet *_alphabet, GLuint _name=0)
 Creates a CubeString of the text _label, using the Alphabet _alphabet and every cube letter of the string will be of dimension _cubeDimension. More...
 
 CubeString (QString _label, GLfloat _maxWidth, GLfloat _maxHeight, Alphabet *_alphabet, GLfloat _maxCubeDimension=0.0f, GLuint _name=0)
 Creates a CubeString of the text _label, using the Alphabet _alphabet and the entire CubeString can grow up to _maxWidth as width and _maxHeight as height. More...
 
 ~CubeString ()
 Safely destroys a CubeString. More...
 
GLvoid draw (GLboolean simplifyForPicking=false)
 Draws the CubeString in the current selected point of the scene. More...
 
QString getLabel ()
 Returns the text of the CubeString. More...
 
GLuint getName ()
 Returns the name given to the entire string (for picking purposes). [default = 0]. More...
 
GLvoid startLetterRotation (GLuint _letterName, GLint _angleStep, GLint _turns)
 Start the rotation of a letter in the CubeString. More...
 
GLvoid startStringRotation (GLint _angleStep, GLint _turns)
 Start the rotation of the entire CubeString. More...
 
GLboolean isRotating (GLuint _letterName)
 Check if a letter of the CubeString is already rotating. More...
 
GLfloat setCurrentAngle (GLfloat _firstLetterAngle, GLfloat _nextLetterDelta=0)
 Set the current angle for the letters in the CubeString. More...
 

Private Member Functions

GLuint createLetterDisplayList (QChar _letter)
 It is an internal function to create the OpenGL displayList of a letter. More...
 
GLuint createLetterDisplayList (Skin *_skin)
 It is an internal function to create the OpenGL displayList from a skin. More...
 
GLvoid init ()
 It is an internal function used to initialize CubeString's values.
 

Private Attributes

QString label
 
GLfloat cubeDimension
 
GLuint name
 
Alphabetalphabet
 
QList< GLint > angleSteps
 
QList< GLint > currentAngles
 
QList< GLint > finalAngles
 
QList< Skin * > letterSkins
 

Detailed Description

This class is used to draw, a string composed the horizontal justapposition of Different cubes on which the skin is a letter that compose the string. Letters are generated from an instance of the class Alphabet.

You can create a CubeString defining its cubes dimension or defining the maximum width and height the entire CubeString can grow up to.

CubeString uses OpenGL displayLists to speed the drawing process.

Version
1.0
Author
#34

Constructor & Destructor Documentation

CubeString::CubeString ( QString  _label,
GLfloat  _cubeDimension,
Alphabet _alphabet,
GLuint  _name = 0 
)
explicit

Creates a CubeString of the text _label, using the Alphabet _alphabet and every cube letter of the string will be of dimension _cubeDimension.

You can define a name for the entire string setting the parameter _name for picking purposes. If you don't set a name 0 will be used.

Parameters
_labelis the text you want to write using the CubeString.
_cubeDimensionis the dimension of the single cube of the string.
_alphabetis the reference to the Alphabet you want to use.
_nameis the name given to the entire string (for picking purposes). [default = 0]

Here is the call graph for this function:

CubeString::CubeString ( QString  _label,
GLfloat  _maxWidth,
GLfloat  _maxHeight,
Alphabet _alphabet,
GLfloat  _maxCubeDimension = 0.0f,
GLuint  _name = 0 
)
explicit

Creates a CubeString of the text _label, using the Alphabet _alphabet and the entire CubeString can grow up to _maxWidth as width and _maxHeight as height.

You can define a name for the entire string setting the parameter _name for picking purposes. If you don't set a name 0 will be used.

Parameters
_labelis the text you want to write using the CubeString.
_maxWidthis the maximum width the CubeString can grow up to.
_maxHeightis the maximum height the CubeString can grow up to.
_alphabetis the reference to the Alphabet you want to use.
_maxCubeDimensionis the maximum cubeDimension. If set to a number <= 0 it will not be computated. [default = 0.0f]
_nameis the name given to the entire string (for picking purposes). [default = 0]

Here is the call graph for this function:

CubeString::~CubeString ( )

Safely destroys a CubeString.

It also safely deletes the displayList associated to the CubeString.

Here is the caller graph for this function:

Member Function Documentation

GLuint CubeString::createLetterDisplayList ( QChar  _letter)
private

It is an internal function to create the OpenGL displayList of a letter.

Parameters
_letteris the QChar letter you want to create a displayList for.
Returns
the displayList ID.

Here is the call graph for this function:

Here is the caller graph for this function:

GLuint CubeString::createLetterDisplayList ( Skin _skin)
private

It is an internal function to create the OpenGL displayList from a skin.

Parameters
_skinis the skin you want to create a displayList for.
Returns
the displayList ID.
GLvoid CubeString::draw ( GLboolean  simplifyForPicking = false)

Draws the CubeString in the current selected point of the scene.

The CubeString will be drawn using the current point as the center of the drawn CubeString.

Parameters
simplifyForPickingis the is used to draw a simplified scene used for the picking function and does not compute the change to angles. [default = false]

Here is the caller graph for this function:

QString CubeString::getLabel ( )

Returns the text of the CubeString.

Returns
the text of the CubeString.

Here is the caller graph for this function:

GLuint CubeString::getName ( )

Returns the name given to the entire string (for picking purposes). [default = 0].

Returns
the name given to the entire string (for picking purposes). [default = 0]

Here is the caller graph for this function:

GLboolean CubeString::isRotating ( GLuint  _letterName)

Check if a letter of the CubeString is already rotating.

Parameters
_letterNameis the name of the letter (it is the second name (after the entire string name) in the nameList of the picking function. You don't have to know which is, let the picking function and the CubeString code work for you.
Returns
true if the letter is already rotating, else false.

Here is the caller graph for this function:

GLfloat CubeString::setCurrentAngle ( GLfloat  _firstLetterAngle,
GLfloat  _nextLetterDelta = 0 
)

Set the current angle for the letters in the CubeString.

Parameters
_firstLetterAngleis the angle of the current letter of the CubeString.
_nextLetterDeltais the delta you want to apply from the previous and the next letter's angle. [default = 0]
Returns
the angle the next letter after this CubeString should have.

Here is the caller graph for this function:

GLvoid CubeString::startLetterRotation ( GLuint  _letterName,
GLint  _angleStep,
GLint  _turns 
)

Start the rotation of a letter in the CubeString.

If you use this function when a letter is already rotating, the _turns will be summed to the current rotation but the new _angleStep will be used only if: (current angleStep) % _angleStep == 0 This is the only sure way to keep the validity.

Warning
In order to prevent infinite rotations, only valid rotations will be accepted, a rotation is valid if: (_turns * 90) % _angleStep == 0
Parameters
_letterNameis the name of the Letter (it is the second name (after the entire string name) in the nameList of the picking function. You don't have to know which is, let the picking function and the CubeString code work for you.
_angleStepis the angle that will be summed to letter on each frame.
_turnsis an integer that states how many 90 degrees turns you want the letter to do.

Here is the caller graph for this function:

GLvoid CubeString::startStringRotation ( GLint  _angleStep,
GLint  _turns 
)

Start the rotation of the entire CubeString.

If you use this function when a CubeString is already rotating, the _turns will be summed to the current rotation but the new _angleStep will be used only if: (current angleStep) % _angleStep == 0 This is the only sure way to keep the validity.

Warning
In order to prevent infinite rotations, only valid rotations will be accepted, a rotation is valid if: (_turns * 90) % _angleStep == 0
Parameters
_angleStepis the angle that will be summed to every letter on each frame.
_turnsis an integer that states how many 90 degrees turns you want each letter to do.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

Alphabet* CubeString::alphabet
private

It is the reference to the Alphabet you want to use.

QList<GLint> CubeString::angleSteps
private

It is a list to save the angle step of each letter.

GLfloat CubeString::cubeDimension
private

It is the dimension of the single cube of the CubeString.

QList<GLint> CubeString::currentAngles
private

It is a list to save the current angle of each letter.

QList<GLint> CubeString::finalAngles
private

It is a list to save the final angle of each letter.

QString CubeString::label
private

It is the text of the CubeString.

QList<Skin*> CubeString::letterSkins
private

It is a list to save the skin of each letter.

GLuint CubeString::name
private

It is the name given to the entire string (for picking purposes). [default = 0]


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