![]() |
V-Gears 0
Free Final Fantasy VII engine.
|
An ingame textarea. More...
#include <UiTextArea.h>
Public Types | |
enum | TextAlign { LEFT , RIGHT , CENTER } |
Text alignment in the text area. More... | |
![]() | |
enum | Align { LEFT , RIGHT , CENTER } |
Horizontal alignment of the widget. More... | |
enum | VerticalAlign { TOP , BOTTOM , MIDDLE } |
Vertical alignment of the widget. More... | |
Public Member Functions | |
UiTextArea (const Ogre::String &name) | |
Creates a UiTextArea. More... | |
UiTextArea (const Ogre::String &name, const Ogre::String &path_name, UiWidget *parent) | |
Creates a UiTextArea. More... | |
virtual | ~UiTextArea () |
Destroys the UiTextArea. More... | |
void | Initialise () |
Sets default values for the UiTextArea. More... | |
virtual void | Update () |
Updates the UiTextArea. More... | |
virtual void | Render () |
Renders the UiTextArea on the screen. More... | |
virtual void | UpdateTransformation () |
Updates the UiTextArea. More... | |
void | UpdateGeometry () |
Updates the UiTextArea geometry. More... | |
void | InputPressed () |
Handles a keypress. More... | |
void | InputRepeated () |
Handles a key being hold. More... | |
void | SetTextAlign (const TextAlign align) |
Sets the text alignment in the text area. More... | |
void | SetPadding (const float top, const float right, const float bottom, const float left) |
Sets the paddings in the text area. More... | |
void | SetText (const Ogre::UTFString &text) |
Sets the text from a string. More... | |
void | SetText (const char *text) override |
Sets the text from a string. More... | |
void | SetText (TiXmlNode *text) |
Sets the text from an XML node. More... | |
void | TextClear () |
Removes the text from the text area. More... | |
void | RemoveSpritesFromText (const unsigned int end) |
Removes the prites from the text. More... | |
void | SetFont (const Ogre::String &font) |
Set the font for the text. More... | |
const UiFont * | GetFont () const |
Retrieves the font. More... | |
void | SetTextPrintSpeed (const float speed) |
Sets the printing speed. More... | |
void | SetTextScrollTime (const float time) |
Sets the scroll duration. More... | |
void | SetVariable (const Ogre::String &name, const Ogre::UTFString &value) |
Sets a variable in the text. More... | |
Ogre::UTFString | GetVariable (const Ogre::String &name) const |
Gets the value of a variable in the text. More... | |
TextState | GetTextState () const |
Checks the text state. More... | |
float | GetTextLimit () const |
Gets the text limit. More... | |
unsigned int | GetTextSize () const |
Gets the text size. More... | |
float | GetPauseTime () const |
Retrieves the pause time of the text. More... | |
![]() | |
UiWidget (const Ogre::String &name) | |
Constructor. More... | |
UiWidget (const Ogre::String &name, const Ogre::String &path_name, UiWidget *parent) | |
Constructor. More... | |
virtual | ~UiWidget () |
Destructor. More... | |
void | Initialise () |
Initializes the widget. More... | |
virtual void | Update () |
Updates the widget status. More... | |
void | OnResize () |
Handles resizing events. More... | |
virtual void | Render () |
Renders the widget and it's children. More... | |
void | SetVisible (const bool visible) |
Toggles the widget visibility. More... | |
bool | IsVisible () const |
Checks the widget visibility. More... | |
const Ogre::String & | GetName () const |
Retrieves the widget name. More... | |
void | AddChild (UiWidget *widget) |
Add other widget as the widget's child. More... | |
UiWidget * | GetChild (const Ogre::String &name) |
Retrieves a children by name. More... | |
UiWidget * | GetChild (const unsigned int id) |
Retrieves a children by ID. More... | |
unsigned int | GetNumberOfChildren () |
Counts the widget's children. More... | |
void | RemoveAllChildren () |
Removes all children widgets. More... | |
void | AddAnimation (UiAnimation *animation) |
Adds an animation to the widget. More... | |
const Ogre::String & | GetCurrentAnimationName () const |
Retrieves the current animation name. More... | |
UiAnimation::State | GetAnimationState () const |
Retrieves the current animation state. More... | |
void | PlayAnimation (const Ogre::String &animation, UiAnimation::State state, const float start, const float end) |
Plays an animation. More... | |
void | ScriptPlayAnimation (const char *name) |
Plays an animation. More... | |
void | ScriptPlayAnimationStop (const char *name) |
Plays an animation. More... | |
void | ScriptPlayAnimation (const char *name, const float start, const float end) |
void | ScriptPlayAnimationStop (const char *name, const float start, const float end) |
Plays an animation. More... | |
void | ScriptSetDefaultAnimation (const char *animation) |
Sets the default animation for the widget. More... | |
int | ScriptAnimationSync () |
Synchronizes an animation. More... | |
void | SetUpdateTransformation () |
Marks the widget as transformed. More... | |
virtual void | UpdateTransformation () |
Recalculates the widget geometry. More... | |
void | SetAlign (const UiWidget::Align align) |
Sets the widget horizontal alignment. More... | |
void | SetVerticalAlign (const UiWidget::VerticalAlign valign) |
Sets the widget vertical alignment. More... | |
float | GetFinalZ () const |
Retrieves the final Z-index of the widget after a transformation. More... | |
Ogre::Vector2 | GetFinalOrigin () const |
Retrieves the coordinates of the widget after a transformation. More... | |
Ogre::Vector2 | GetFinalTranslate () const |
Retrieves the final translation of the widget after a transformation. More... | |
Ogre::Vector2 | GetFinalSize () const |
Retrieves the final size of the widget after a transformation. More... | |
Ogre::Vector2 | GetFinalScale () const |
Retrieves the final scale of the widget after a transformation. More... | |
Ogre::Vector4 | GetFinalScissor (bool &scissor) const |
Retrieves the final scissor of the widget after a transformation. More... | |
float | GetFinalRotation () const |
Retrieves the final rotation of the widget. More... | |
void | SetOriginX (const float percent, const float x) |
Sets the X coordinate origin for the widget. More... | |
void | SetOriginY (const float percent, const float y) |
Sets the Y coordinate origin for the widget. More... | |
void | SetX (const float percent, const float x) |
Sets the X coordinate for the widget. More... | |
void | GetX (float &percent, float &x) |
Retrieves the X coordinate for the widget. More... | |
void | SetY (const float percent, const float y) |
Sets the Y coordinate for the widget. More... | |
void | GetY (float &percent, float &y) |
Retrieves the Y coordinate for the widget. More... | |
void | SetZ (const float z) |
Sets the widget Z-index. More... | |
void | SetWidth (const float percent, const float width) |
Sets the width the widget. More... | |
void | GetWidth (float &percent, float &width) |
Retrieves the width of the widget. More... | |
void | SetHeight (const float percent, const float height) |
Sets the height the widget. More... | |
void | GetHeight (float &percent, float &height) |
Retrieves the height of the widget. More... | |
void | SetScale (const Ogre::Vector2 &scale) |
Sets the widget scale. More... | |
void | SetRotation (const float degree) |
Sets the widget rotation. More... | |
void | SetScissorArea (const float percent_x1, const float x1, const float percent_y1, const float y1, const float percent_x2, const float x2, const float percent_y2, const float y2) |
Sets the widget scissor area. More... | |
void | SetGlobalScissor (const bool global) |
void | SetColour (const float r, const float g, const float b) |
Sets the widget colour. More... | |
void | SetColours (const float r1, const float g1, const float b1, const float r2, const float g2, const float b2, const float r3, const float g3, const float b3, const float r4, const float g4, const float b4) |
Sets the widget colour. More... | |
void | SetAlpha (const float a) |
Sets the widget transparency. More... | |
virtual void | SetText (const char *text) |
Sets the text of the widget. More... | |
virtual void | SetImage (const char *image) |
Sets the text of the widget. More... | |
float | ScriptGetWidth () |
Retrieves the absolute width of the widget. More... | |
void | ScriptSetWidth (float width) |
Sets the absolute width of the widget. More... | |
float | ScriptGetHeight () |
Retrieves the absolute height of the widget. More... | |
void | ScriptSetHeight (float height) |
Sets the absolute height of the widget. More... | |
Private Member Functions | |
float | GetTextWidth () const |
Retrieves the text width. More... | |
void | PrepareTextFromNode (TiXmlNode *node, const Ogre::ColourValue &colour) |
Prepares text from a XML node. More... | |
void | SetTextFromNode (TiXmlNode *node, const Ogre::ColourValue &colour) |
Prepares text from a XML node. More... | |
void | PrepareTextFromText (const Ogre::UTFString &text, const Ogre::ColourValue &colour) |
Prepares text from a string. More... | |
UiTextArea () | |
Constructor. More... | |
void | CreateVertexBuffer () |
Creates a vertex buffer for the textarea. More... | |
void | DestroyVertexBuffer () |
Destroys a vertex buffer for the textarea. More... | |
Private Attributes | |
Ogre::MaterialPtr | material_ |
Material for the text area. More... | |
Ogre::SceneManager * | scene_manager_ |
The scene manager. More... | |
Ogre::RenderSystem * | render_system_ |
The render system. More... | |
unsigned int | max_letters_ |
Max letter per textarea. More... | |
Ogre::RenderOperation | render_operation_ |
The render operation. More... | |
Ogre::HardwareVertexBufferSharedPtr | vertex_buffer_ |
The text area vertext buffer. More... | |
UiFont * | font_ |
The font for the text. More... | |
TextAlign | text_align_ |
The text alignment. More... | |
std::vector< TextChar > | text_ |
The text. More... | |
float | text_limit_ |
The text limit. More... | |
float | text_print_speed_ |
The text printing speed. More... | |
float | text_print_speed_mod_ |
TextState | text_state_ |
The state of the text. More... | |
std::vector< TextVariable > | text_variable_ |
Variables in the text. More... | |
float | text_scroll_time_ |
Time to scroll the text. More... | |
float | text_y_offset_ |
float | text_y_offset_target_ |
float | pause_time_ |
The time to pause the text. More... | |
unsigned int | next_page_start_ |
bool | next_pressed_ |
Indicates if the 'next' button has been pressed. More... | |
bool | next_repeated_ |
Indicates if the 'next' button is being held down. More... | |
float | padding_top_ |
The top padding. More... | |
float | padding_right_ |
The right padding. More... | |
float | padding_bottom_ |
The bottom padding. More... | |
float | padding_left_ |
The left padding. More... | |
bool | timer_ |
int | timer_time_ |
Additional Inherited Members | |
![]() | |
Ogre::String | name_ |
The widget name. More... | |
Ogre::String | path_name_ |
UiWidget * | parent_ |
The parent widget. More... | |
std::vector< UiWidget * > | children_ |
The list of children widgets. More... | |
float | screen_width_ |
Width, in game screen units. More... | |
float | screen_height_ |
Height, in game screen units. More... | |
bool | visible_ |
Indicates if the widget is visible. More... | |
Ogre::ColourValue | colour_1_ |
Top-left corner colour. More... | |
Ogre::ColourValue | colour_2_ |
Top-right corner colour. More... | |
Ogre::ColourValue | colour_3_ |
Bottom-right corner colour. More... | |
Ogre::ColourValue | colour_4_ |
Bottom-left corner colour. More... | |
Align | align_ |
The vertical alignment. More... | |
VerticalAlign | vertical_align_ |
The evrtical alignment. More... | |
bool | update_transformation_ |
Indicates if the widget is marked as transformed. More... | |
Ogre::Vector2 | final_origin_ |
Final origin point after a transformation. More... | |
Ogre::Vector2 | final_translate_ |
Final translation after a transformation. More... | |
float | final_z_ |
Final Z-index after a transformation. More... | |
Ogre::Vector2 | final_size_ |
Final size after a transformation. More... | |
Ogre::Vector2 | final_scale_ |
Final scale after a transformation. More... | |
float | final_rotation_ |
Final rotation after a transformation. More... | |
float | origin_x_percent_ |
float | origin_x_ |
The origin X coordinate. More... | |
float | origin_y_percent_ |
float | origin_y_ |
The origin Y coordinate. More... | |
float | x_percent_ |
float | x_ |
The widget X coordinate. More... | |
float | y_percent_ |
float | y_ |
The widget Y coordinate. More... | |
float | z_ |
The widget Z coordinate. More... | |
float | width_percent_ |
float | width_ |
The widget width. More... | |
float | height_percent_ |
float | height_ |
The widget height. More... | |
Ogre::Vector2 | scale_ |
The widget scale. More... | |
float | rotation_ |
The widget rotation. More... | |
bool | scissor_ |
bool | local_scissor_ |
bool | global_scissor_ |
int | scissor_top_ |
float | scissor_x_percent_top_ |
float | scissor_x_top_ |
int | scissor_bottom_ |
float | scissor_x_percent_bottom_ |
float | scissor_x_bottom_ |
int | scissor_left_ |
float | scissor_y_percent_left_ |
float | scissor_y_left_ |
int | scissor_right_ |
float | scissor_y_percent_right_ |
float | scissor_y_right_ |
UiAnimation * | animation_current_ |
The current animation. More... | |
std::vector< ScriptId > | animation_sync_ |
The animation stack. More... | |
UiAnimation::State | animation_state_ |
The current animation state. More... | |
Ogre::String | animation_default_ |
The name of the default animation. More... | |
float | animation_end_time_ |
Time for the current animation to end. More... | |
std::vector< UiAnimation * > | animations_ |
The list of animations. More... | |
An ingame textarea.
It may be any window used to represent text: a diaog window, a menu panel, a choice selection...
UiTextArea::UiTextArea | ( | const Ogre::String & | name | ) |
Creates a UiTextArea.
[in] | name | Name for the textarea. |
UiTextArea::UiTextArea | ( | const Ogre::String & | name, |
const Ogre::String & | path_name, | ||
UiWidget * | parent | ||
) |
Creates a UiTextArea.
[in] | name | Name for the textarea. |
[in] | path_name | Path for the widget. |
[in] | parent | Pointer to the widget that will parent the UiTextArea. |
|
virtual |
Destroys the UiTextArea.
|
private |
Constructor.
|
private |
Creates a vertex buffer for the textarea.
|
private |
Destroys a vertex buffer for the textarea.
const UiFont * UiTextArea::GetFont | ( | ) | const |
Retrieves the font.
float UiTextArea::GetPauseTime | ( | ) | const |
Retrieves the pause time of the text.
float UiTextArea::GetTextLimit | ( | ) | const |
Gets the text limit.
unsigned int UiTextArea::GetTextSize | ( | ) | const |
Gets the text size.
TextState UiTextArea::GetTextState | ( | ) | const |
Checks the text state.
|
private |
Retrieves the text width.
Ogre::UTFString UiTextArea::GetVariable | ( | const Ogre::String & | name | ) | const |
Gets the value of a variable in the text.
[in] | name | The variable name. |
void UiTextArea::Initialise | ( | ) |
Sets default values for the UiTextArea.
It's automatically called when the UiTextArea is created.
void UiTextArea::InputPressed | ( | ) |
Handles a keypress.
void UiTextArea::InputRepeated | ( | ) |
Handles a key being hold.
|
private |
Prepares text from a XML node.
Not to be used to set text dinamically from scripts repatedly (i.e. for menus). It can produce memory leaks, and it's slower. Use {
[in] | node | The XML node to get the text from. |
[in] | colour | The text colour. |
|
private |
Prepares text from a string.
[in] | text | The text to prepare. |
[in] | colour | The text colour. |
void UiTextArea::RemoveSpritesFromText | ( | const unsigned int | end | ) |
|
virtual |
Renders the UiTextArea on the screen.
Reimplemented from UiWidget.
void UiTextArea::SetFont | ( | const Ogre::String & | font | ) |
Set the font for the text.
[in] | font | The font to set. |
void UiTextArea::SetPadding | ( | const float | top, |
const float | right, | ||
const float | bottom, | ||
const float | left | ||
) |
Sets the paddings in the text area.
[in] | top | Padding from the top, in pixels. |
[in] | right | Padding from the right, in pixels. |
[in] | bottom | Padding from the bottom, in pixels. |
[in] | left | Padding from the left, in pixels. |
|
overridevirtual |
void UiTextArea::SetText | ( | const Ogre::UTFString & | text | ) |
Sets the text from a string.
[in] | text | Text to set. |
void UiTextArea::SetText | ( | TiXmlNode * | text | ) |
Sets the text from an XML node.
[in] | text | XML node with the text to set. |
void UiTextArea::SetTextAlign | ( | const TextAlign | align | ) |
Sets the text alignment in the text area.
[in] | align | The text alignment. |
|
private |
Prepares text from a XML node.
Use this when setting text dinamically from scripts, instead of {
[in] | node | The XML node to get the text from. |
[in] | colour | The text colour. |
void UiTextArea::SetTextPrintSpeed | ( | const float | speed | ) |
Sets the printing speed.
[in] | speed | The text speed. -1 for instant text. |
void UiTextArea::SetTextScrollTime | ( | const float | time | ) |
void UiTextArea::SetVariable | ( | const Ogre::String & | name, |
const Ogre::UTFString & | value | ||
) |
Sets a variable in the text.
[in] | name | Variable name. |
[in] | value | Variable value. |
void UiTextArea::TextClear | ( | ) |
Removes the text from the text area.
|
virtual |
Updates the UiTextArea.
Reimplemented from UiWidget.
void UiTextArea::UpdateGeometry | ( | ) |
Updates the UiTextArea geometry.
|
virtual |
Updates the UiTextArea.
Reimplemented from UiWidget.
|
private |
The font for the text.
|
private |
Material for the text area.
|
private |
Max letter per textarea.
|
private |
|
private |
Indicates if the 'next' button has been pressed.
|
private |
Indicates if the 'next' button is being held down.
|
private |
The bottom padding.
|
private |
The left padding.
|
private |
The right padding.
|
private |
The top padding.
|
private |
The time to pause the text.
|
private |
The render operation.
|
private |
The render system.
|
private |
The scene manager.
|
private |
The text.
|
private |
The text alignment.
|
private |
The text limit.
|
private |
The text printing speed.
|
private |
|
private |
Time to scroll the text.
|
private |
The state of the text.
|
private |
Variables in the text.
|
private |
|
private |
|
private |
|
private |
|
private |
The text area vertext buffer.