V-Gears 0
Free Final Fantasy VII engine.
UiTextArea Class Reference

An ingame textarea. More...

#include <UiTextArea.h>

Inheritance diagram for UiTextArea:
Collaboration diagram for UiTextArea:

Public Types

enum  TextAlign { LEFT , RIGHT , CENTER }
 Text alignment in the text area. More...
 
- Public Types inherited from UiWidget
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 UiFontGetFont () 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...
 
- Public Member Functions inherited from UiWidget
 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...
 
UiWidgetGetChild (const Ogre::String &name)
 Retrieves a children by name. More...
 
UiWidgetGetChild (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...
 
UiFontfont_
 The font for the text. More...
 
TextAlign text_align_
 The text alignment. More...
 
std::vector< TextChartext_
 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< TextVariabletext_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

- Protected Attributes inherited from UiWidget
Ogre::String name_
 The widget name. More...
 
Ogre::String path_name_
 
UiWidgetparent_
 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_
 
UiAnimationanimation_current_
 The current animation. More...
 
std::vector< ScriptIdanimation_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...
 

Detailed Description

An ingame textarea.

It may be any window used to represent text: a diaog window, a menu panel, a choice selection...

Member Enumeration Documentation

◆ TextAlign

Text alignment in the text area.

Enumerator
LEFT 

Left aligned text.

RIGHT 

Right aligned text.

CENTER 

Horizontally centered text.

Constructor & Destructor Documentation

◆ UiTextArea() [1/3]

UiTextArea::UiTextArea ( const Ogre::String &  name)

Creates a UiTextArea.

Parameters
[in]nameName for the textarea.

◆ UiTextArea() [2/3]

UiTextArea::UiTextArea ( const Ogre::String &  name,
const Ogre::String &  path_name,
UiWidget parent 
)

Creates a UiTextArea.

Parameters
[in]nameName for the textarea.
[in]path_namePath for the widget.
[in]parentPointer to the widget that will parent the UiTextArea.

◆ ~UiTextArea()

UiTextArea::~UiTextArea ( )
virtual

Destroys the UiTextArea.

◆ UiTextArea() [3/3]

UiTextArea::UiTextArea ( )
private

Constructor.

Member Function Documentation

◆ CreateVertexBuffer()

void UiTextArea::CreateVertexBuffer ( )
private

Creates a vertex buffer for the textarea.

◆ DestroyVertexBuffer()

void UiTextArea::DestroyVertexBuffer ( )
private

Destroys a vertex buffer for the textarea.

◆ GetFont()

const UiFont * UiTextArea::GetFont ( ) const

Retrieves the font.

Returns
The font used for the text in the textarea.

◆ GetPauseTime()

float UiTextArea::GetPauseTime ( ) const

Retrieves the pause time of the text.

Returns
The time the text must still remain paused, in second.

◆ GetTextLimit()

float UiTextArea::GetTextLimit ( ) const

Gets the text limit.

Returns
The text limit.
Todo:
The limit is the max number of letters per text area? Does it include multiple pages?

◆ GetTextSize()

unsigned int UiTextArea::GetTextSize ( ) const

Gets the text size.

Returns
The number of characters in the text.

◆ GetTextState()

TextState UiTextArea::GetTextState ( ) const

Checks the text state.

Returns
The text state.

◆ GetTextWidth()

float UiTextArea::GetTextWidth ( ) const
private

Retrieves the text width.

Returns
The text width, in pixels.

◆ GetVariable()

Ogre::UTFString UiTextArea::GetVariable ( const Ogre::String &  name) const

Gets the value of a variable in the text.

Parameters
[in]nameThe variable name.
Returns
The variable value, in string format, or an empty string if there is no such variable.

◆ Initialise()

void UiTextArea::Initialise ( )

Sets default values for the UiTextArea.

It's automatically called when the UiTextArea is created.

◆ InputPressed()

void UiTextArea::InputPressed ( )

Handles a keypress.

◆ InputRepeated()

void UiTextArea::InputRepeated ( )

Handles a key being hold.

◆ PrepareTextFromNode()

void UiTextArea::PrepareTextFromNode ( TiXmlNode *  node,
const Ogre::ColourValue &  colour 
)
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 {

See also
SetTextFromNode} for that.
Parameters
[in]nodeThe XML node to get the text from.
[in]colourThe text colour.

◆ PrepareTextFromText()

void UiTextArea::PrepareTextFromText ( const Ogre::UTFString &  text,
const Ogre::ColourValue &  colour 
)
private

Prepares text from a string.

Parameters
[in]textThe text to prepare.
[in]colourThe text colour.

◆ RemoveSpritesFromText()

void UiTextArea::RemoveSpritesFromText ( const unsigned int  end)

Removes the prites from the text.

Parameters
[in]end
Todo:
Understand and document.

◆ Render()

void UiTextArea::Render ( )
virtual

Renders the UiTextArea on the screen.

Reimplemented from UiWidget.

◆ SetFont()

void UiTextArea::SetFont ( const Ogre::String &  font)

Set the font for the text.

Parameters
[in]fontThe font to set.

◆ SetPadding()

void UiTextArea::SetPadding ( const float  top,
const float  right,
const float  bottom,
const float  left 
)

Sets the paddings in the text area.

Parameters
[in]topPadding from the top, in pixels.
[in]rightPadding from the right, in pixels.
[in]bottomPadding from the bottom, in pixels.
[in]leftPadding from the left, in pixels.

◆ SetText() [1/3]

void UiTextArea::SetText ( const char *  text)
overridevirtual

Sets the text from a string.

Parameters
[in]textText to set.

Reimplemented from UiWidget.

◆ SetText() [2/3]

void UiTextArea::SetText ( const Ogre::UTFString &  text)

Sets the text from a string.

Parameters
[in]textText to set.

◆ SetText() [3/3]

void UiTextArea::SetText ( TiXmlNode *  text)

Sets the text from an XML node.

Parameters
[in]textXML node with the text to set.

◆ SetTextAlign()

void UiTextArea::SetTextAlign ( const TextAlign  align)

Sets the text alignment in the text area.

Parameters
[in]alignThe text alignment.

◆ SetTextFromNode()

void UiTextArea::SetTextFromNode ( TiXmlNode *  node,
const Ogre::ColourValue &  colour 
)
private

Prepares text from a XML node.

Use this when setting text dinamically from scripts, instead of {

See also
PrepareTextFromNode}.
Parameters
[in]nodeThe XML node to get the text from.
[in]colourThe text colour.

◆ SetTextPrintSpeed()

void UiTextArea::SetTextPrintSpeed ( const float  speed)

Sets the printing speed.

Parameters
[in]speedThe text speed. -1 for instant text.
Todo:
Explain units or references.

◆ SetTextScrollTime()

void UiTextArea::SetTextScrollTime ( const float  time)

Sets the scroll duration.

Parameters
[in]timeTime to scroll a line.
Todo:
Units or references.

◆ SetVariable()

void UiTextArea::SetVariable ( const Ogre::String &  name,
const Ogre::UTFString &  value 
)

Sets a variable in the text.

Parameters
[in]nameVariable name.
[in]valueVariable value.

◆ TextClear()

void UiTextArea::TextClear ( )

Removes the text from the text area.

◆ Update()

void UiTextArea::Update ( )
virtual

Updates the UiTextArea.

Reimplemented from UiWidget.

◆ UpdateGeometry()

void UiTextArea::UpdateGeometry ( )

Updates the UiTextArea geometry.

◆ UpdateTransformation()

void UiTextArea::UpdateTransformation ( )
virtual

Updates the UiTextArea.

Reimplemented from UiWidget.

Member Data Documentation

◆ font_

UiFont* UiTextArea::font_
private

The font for the text.

◆ material_

Ogre::MaterialPtr UiTextArea::material_
private

Material for the text area.

◆ max_letters_

unsigned int UiTextArea::max_letters_
private

Max letter per textarea.

◆ next_page_start_

unsigned int UiTextArea::next_page_start_
private
Todo:
Understand and document.

◆ next_pressed_

bool UiTextArea::next_pressed_
private

Indicates if the 'next' button has been pressed.

◆ next_repeated_

bool UiTextArea::next_repeated_
private

Indicates if the 'next' button is being held down.

◆ padding_bottom_

float UiTextArea::padding_bottom_
private

The bottom padding.

◆ padding_left_

float UiTextArea::padding_left_
private

The left padding.

◆ padding_right_

float UiTextArea::padding_right_
private

The right padding.

◆ padding_top_

float UiTextArea::padding_top_
private

The top padding.

◆ pause_time_

float UiTextArea::pause_time_
private

The time to pause the text.

◆ render_operation_

Ogre::RenderOperation UiTextArea::render_operation_
private

The render operation.

◆ render_system_

Ogre::RenderSystem* UiTextArea::render_system_
private

The render system.

◆ scene_manager_

Ogre::SceneManager* UiTextArea::scene_manager_
private

The scene manager.

◆ text_

std::vector<TextChar> UiTextArea::text_
private

The text.

◆ text_align_

TextAlign UiTextArea::text_align_
private

The text alignment.

◆ text_limit_

float UiTextArea::text_limit_
private

The text limit.

◆ text_print_speed_

float UiTextArea::text_print_speed_
private

The text printing speed.

◆ text_print_speed_mod_

float UiTextArea::text_print_speed_mod_
private
Todo:
Understand and document.

◆ text_scroll_time_

float UiTextArea::text_scroll_time_
private

Time to scroll the text.

◆ text_state_

TextState UiTextArea::text_state_
private

The state of the text.

◆ text_variable_

std::vector<TextVariable> UiTextArea::text_variable_
private

Variables in the text.

◆ text_y_offset_

float UiTextArea::text_y_offset_
private
Todo:
Understand and document.

◆ text_y_offset_target_

float UiTextArea::text_y_offset_target_
private
Todo:
Understand and document.

◆ timer_

bool UiTextArea::timer_
private
Todo:
Understand and document.

◆ timer_time_

int UiTextArea::timer_time_
private
Todo:
Understand and document.

◆ vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr UiTextArea::vertex_buffer_
private

The text area vertext buffer.


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