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
CubeStringList Class Reference

This class is used to draw a vertical list of CubeString. Look at CubeString to have a better specification of the class. More...

#include <cubestringlist.h>

Collaboration diagram for CubeStringList:
Collaboration graph

Public Member Functions

 CubeStringList (QList< QPair< QString, GLuint > > _labels, GLfloat _cubeDimension, Alphabet *_alphabet)
 Creates a CubeStringList from a QList of QPair, the first item of each pair is the string to draw, the second the OpenGL name you want to give the string. Using this constructor you can define the dimension of the cubes. More...
 
 CubeStringList (QList< QPair< QString, GLuint > > _labels, GLfloat _maxWidth, GLfloat _maxHeight, Alphabet *_alphabet, GLfloat _maxCubeDimension=0.0f)
 Creates a CubeStringList from a QList of QPair, the first item of each pair is the string to draw, the second the OpenGL name you want to give the string. Using this constructor you can define a maximum space the CubeStringList can grow, the class then will manage the list to fit this space. More...
 
 CubeStringList (QString _labels, GLfloat _cubeDimension, Alphabet *_alphabet, GLuint _name=0)
 Creates a CubeStringList from QString, it will be splitted on the character space to tokenize the string and create the list of words. You can also set the OpenGL name of the CubeStringList (the same for all the lines). Using this constructor you can define a maximum space the CubeStringList can grow, the class then will manage the list to fit this space. More...
 
 CubeStringList (QString _labels, GLfloat _maxWidth, GLfloat _maxHeight, Alphabet *_alphabet, GLfloat _maxCubeDimension=0.0f, GLuint _name=0)
 Creates a CubeStringList from QString, it will be splitted on the character space to tokenize the string and create the list of words. You can also set the OpenGL name of the CubeStringList (the same for all the lines). Using this constructor you can define a maximum space the CubeStringList can grow, the class then will manage the list to fit this space. More...
 
 ~CubeStringList ()
 Safely destroy a CubeStringList.
 
GLvoid draw (GLboolean simplifyForPicking=false)
 Draws the CubeStringList at the current position. More...
 
GLint getLabelCount ()
 Returns the number of labels in the CubeStringList. More...
 
QString getLabel (GLuint _stringName)
 Returns the label which name is _stringName. More...
 
GLvoid startLetterRotation (GLuint _stringName, GLuint _letterName, GLint _angleStep, GLint _turns)
 Start the rotation of a single letter in a single CubeString contained in the CubeStrigList. More...
 
GLvoid startStringRotation (GLuint _stringName, GLint _angleStep, GLint _turns)
 Start the rotation of a whole CubeString contained in the CubeStringList. More...
 
GLvoid startStringListRotation (GLint _angleStep, GLint _turns)
 Start the rotation of the whole CubeStringList (woo-woo-wao). More...
 
GLboolean isRotating (GLuint _stringName, GLuint _letterName)
 Check if a letter of the CubeString is already rotating. More...
 
GLfloat setCurrentAngle (GLfloat _firstLetterAngle, GLfloat _nextLetterDelta=0.0f)
 Set the current angle for the letters in the CubeString. More...
 

Private Member Functions

GLvoid computeHeights (GLfloat _cubeDimension)
 It compute the heights (firstStringHeight and stringsHeightDelta) basing on constructor parameters. More...
 
CubeStringgetCubeStringFromName (GLuint _name)
 Return a pointer to the CubeString having the parameter OpenGL name. More...
 
CubeStringgetCubeStringFromLabel (QString _label)
 Return a pointer to the CubeString having the parameter label. More...
 
QList< QPair< QString, GLuint > > splitLabels (QString _labels)
 Split the QString in a QList of QPair. More...
 
GLvoid init (QList< QPair< QString, GLuint > > _labels, GLfloat _cubeDimension, Alphabet *_alphabet)
 Common part to the constructors that uses the cubeDimension. More...
 
GLvoid init (QList< QPair< QString, GLuint > > _labels, GLfloat _maxWidth, GLfloat _maxHeight, Alphabet *_alphabet, GLfloat _maxCubeDimension=0.0f)
 Common part to the constructors that uses the maxWidth and maxHeight. More...
 

Private Attributes

QList< CubeString * > cubeStrings
 
GLuint name
 
GLfloat interline
 
GLfloat firstStringHeight
 
GLfloat stringsHeightDelta
 

Detailed Description

This class is used to draw a vertical list of CubeString. Look at CubeString to have a better specification of the class.

Version
1.0
Author
#34

Constructor & Destructor Documentation

CubeStringList::CubeStringList ( QList< QPair< QString, GLuint > >  _labels,
GLfloat  _cubeDimension,
Alphabet _alphabet 
)
explicit

Creates a CubeStringList from a QList of QPair, the first item of each pair is the string to draw, the second the OpenGL name you want to give the string. Using this constructor you can define the dimension of the cubes.

Parameters
_labelsis a QList of QPair, the first item of each pair is the string to draw, the second the OpenGL name you want to give the string.
_cubeDimensionis the dimension of each cube of the single CubeString.
_alphabetis the Alphabet to use.

Here is the call graph for this function:

CubeStringList::CubeStringList ( QList< QPair< QString, GLuint > >  _labels,
GLfloat  _maxWidth,
GLfloat  _maxHeight,
Alphabet _alphabet,
GLfloat  _maxCubeDimension = 0.0f 
)
explicit

Creates a CubeStringList from a QList of QPair, the first item of each pair is the string to draw, the second the OpenGL name you want to give the string. Using this constructor you can define a maximum space the CubeStringList can grow, the class then will manage the list to fit this space.

Parameters
_labelsis a QList of QPair, the first item of each pair is the string to draw, the second the OpenGL name you want to give the string.
_maxWidthis the maximum width the CubeStringList can grow.
_maxHeightis the maximum height the CubeStringList can grow.
_alphabetis the Alphabet to use.
_maxCubeDimensionis the maximum cubeDimension. If set to a number <= 0.0f it will not be computated. [default = 0.0f]

Here is the call graph for this function:

CubeStringList::CubeStringList ( QString  _labels,
GLfloat  _cubeDimension,
Alphabet _alphabet,
GLuint  _name = 0 
)
explicit

Creates a CubeStringList from QString, it will be splitted on the character space to tokenize the string and create the list of words. You can also set the OpenGL name of the CubeStringList (the same for all the lines). Using this constructor you can define a maximum space the CubeStringList can grow, the class then will manage the list to fit this space.

Parameters
_labelsis the QString that will be splitted on the character space to create the list of words.
_cubeDimensionis the dimension of each cube of the single CubeString.
_alphabetis the Alphabet to use.
_nameis the OpenGL name of the CubeStringList (the same for all the lines). [default = 0]

Here is the call graph for this function:

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

Creates a CubeStringList from QString, it will be splitted on the character space to tokenize the string and create the list of words. You can also set the OpenGL name of the CubeStringList (the same for all the lines). Using this constructor you can define a maximum space the CubeStringList can grow, the class then will manage the list to fit this space.

Parameters
_labelsis the QString that will be splitted on the character space to create the list of words.
_maxWidthis the maximum width the CubeStringList can grow.
_maxHeightis the maximum height the CubeStringList can grow.
_alphabetis the Alphabet to use.
_maxCubeDimensionis the maximum cubeDimension. If set to a number <= 0.0f it will not be computated. [default = 0.0f]
_nameis the OpenGL name of the CubeStringList (the same for all the lines). [default = 0]

Here is the call graph for this function:

Member Function Documentation

GLvoid CubeStringList::computeHeights ( GLfloat  _cubeDimension)
private

It compute the heights (firstStringHeight and stringsHeightDelta) basing on constructor parameters.

Parameters
_cubeDimensionis the dimension of the cubes.

Here is the caller graph for this function:

GLvoid CubeStringList::draw ( GLboolean  simplifyForPicking = false)

Draws the CubeStringList at the current position.

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 call graph for this function:

Here is the caller graph for this function:

CubeString * CubeStringList::getCubeStringFromLabel ( QString  _label)
private

Return a pointer to the CubeString having the parameter label.

Parameters
_labelis the label you want the CubeString.
Returns
a pointer to the CubeString having the parameter OpenGL label.

Here is the call graph for this function:

CubeString * CubeStringList::getCubeStringFromName ( GLuint  _name)
private

Return a pointer to the CubeString having the parameter OpenGL name.

Parameters
_nameis the OpenGL name you want the CubeString.
Returns
a pointer to the CubeString having the parameter OpenGL name.

Here is the call graph for this function:

Here is the caller graph for this function:

QString CubeStringList::getLabel ( GLuint  _stringName)

Returns the label which name is _stringName.

Parameters
_stringNameis the name of the string you want the label.
Returns
the label which name is _stringName.

Here is the call graph for this function:

Here is the caller graph for this function:

GLint CubeStringList::getLabelCount ( )

Returns the number of labels in the CubeStringList.

Returns
the number of labels in the CubeStringList.

Here is the caller graph for this function:

GLvoid CubeStringList::init ( QList< QPair< QString, GLuint > >  _labels,
GLfloat  _cubeDimension,
Alphabet _alphabet 
)
private

Common part to the constructors that uses the cubeDimension.

Parameters
_labelsis the QString that will be splitted on the character space to create the list of words.
_cubeDimensionis the dimension of each cube of the single CubeString.
_alphabetis the Alphabet to use.

Here is the call graph for this function:

Here is the caller graph for this function:

GLvoid CubeStringList::init ( QList< QPair< QString, GLuint > >  _labels,
GLfloat  _maxWidth,
GLfloat  _maxHeight,
Alphabet _alphabet,
GLfloat  _maxCubeDimension = 0.0f 
)
private

Common part to the constructors that uses the maxWidth and maxHeight.

Parameters
_labelsis the QString that will be splitted on the character space to create the list of words.
_maxWidthis the maximum width the CubeStringList can grow.
_maxHeightis the maximum height the CubeStringList can grow.
_alphabetis the Alphabet to use.
_maxCubeDimensionis the maximum cubeDimension. If set to a number <= 0.0f it will not be computated. [default = 0.0f]

Here is the call graph for this function:

GLboolean CubeStringList::isRotating ( GLuint  _stringName,
GLuint  _letterName 
)

Check if a letter of the CubeString is already rotating.

Parameters
_stringNameis the name of the string (it is the second name (after the entire list name) in the nameList of the picking function. You don't have to know which is, let the picking function and the CubeStringList code work for you.
_letterNameis the name of the letter (it is the third name (after the entire list and the string names) in the nameList of the picking function. You don't have to know which is, let the picking function and the CubeStringList code work for you.

Here is the call graph for this function:

Here is the caller graph for this function:

GLfloat CubeStringList::setCurrentAngle ( GLfloat  _firstLetterAngle,
GLfloat  _nextLetterDelta = 0.0f 
)

Set the current angle for the letters in the CubeString.

Parameters
_firstLetterAngleis the angle of the current letter of the CubeStringList.
_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 call graph for this function:

Here is the caller graph for this function:

QList< QPair< QString, GLuint > > CubeStringList::splitLabels ( QString  _labels)
private

Split the QString in a QList of QPair.

Parameters
_labelsis the QString to split.
Returns
the splitted QList of QPair.

Here is the caller graph for this function:

GLvoid CubeStringList::startLetterRotation ( GLuint  _stringName,
GLuint  _letterName,
GLint  _angleStep,
GLint  _turns 
)

Start the rotation of a single letter in a single CubeString contained in the CubeStrigList.

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
_stringNameis the string that contains the letter you want to start the rotation.
_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 call graph for this function:

Here is the caller graph for this function:

GLvoid CubeStringList::startStringListRotation ( GLint  _angleStep,
GLint  _turns 
)

Start the rotation of the whole CubeStringList (woo-woo-wao).

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:

GLvoid CubeStringList::startStringRotation ( GLuint  _stringName,
GLint  _angleStep,
GLint  _turns 
)

Start the rotation of a whole CubeString contained in the CubeStringList.

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
_stringNameis the string you want to start the rotation.
_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:

Member Data Documentation

QList<CubeString*> CubeStringList::cubeStrings
private

It is the list of CubeStrings.

GLfloat CubeStringList::firstStringHeight
private

It is the height of the first string of the list.

GLfloat CubeStringList::interline
private

It is the interline from one line to the following one.

GLuint CubeStringList::name
private

It is the OpenGL name of the CubeStringList.

GLfloat CubeStringList::stringsHeightDelta
private

It is the delta from the centers of two strings in the list.


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