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>
|
| 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...
|
|
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
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
-
_label | is the text you want to write using the CubeString. |
_cubeDimension | is the dimension of the single cube of the string. |
_alphabet | is the reference to the Alphabet you want to use. |
_name | is the name given to the entire string (for picking purposes). [default = 0] |
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
-
_label | is the text you want to write using the CubeString. |
_maxWidth | is the maximum width the CubeString can grow up to. |
_maxHeight | is the maximum height the CubeString can grow up to. |
_alphabet | is the reference to the Alphabet you want to use. |
_maxCubeDimension | is the maximum cubeDimension. If set to a number <= 0 it will not be computated. [default = 0.0f] |
_name | is the name given to the entire string (for picking purposes). [default = 0] |
CubeString::~CubeString |
( |
| ) |
|
GLuint CubeString::createLetterDisplayList |
( |
QChar |
_letter | ) |
|
|
private |
It is an internal function to create the OpenGL displayList of a letter.
- Parameters
-
_letter | is the QChar letter you want to create a displayList for. |
- Returns
- the displayList ID.
GLuint CubeString::createLetterDisplayList |
( |
Skin * |
_skin | ) |
|
|
private |
It is an internal function to create the OpenGL displayList from a skin.
- Parameters
-
_skin | is 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
-
simplifyForPicking | is the is used to draw a simplified scene used for the picking function and does not compute the change to angles. [default = false] |
QString CubeString::getLabel |
( |
| ) |
|
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]
GLboolean CubeString::isRotating |
( |
GLuint |
_letterName | ) |
|
Check if a letter of the CubeString is already rotating.
- Parameters
-
_letterName | is 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.
GLfloat CubeString::setCurrentAngle |
( |
GLfloat |
_firstLetterAngle, |
|
|
GLfloat |
_nextLetterDelta = 0 |
|
) |
| |
Set the current angle for the letters in the CubeString.
- Parameters
-
_firstLetterAngle | is the angle of the current letter of the CubeString. |
_nextLetterDelta | is 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.
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
-
_letterName | is 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. |
_angleStep | is the angle that will be summed to letter on each frame. |
_turns | is an integer that states how many 90 degrees turns you want the letter to do. |
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
-
_angleStep | is the angle that will be summed to every letter on each frame. |
_turns | is an integer that states how many 90 degrees turns you want each letter to do. |
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 |
QList<Skin*> CubeString::letterSkins |
|
private |
It is a list to save the skin of each letter.
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: