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

A sprite. More...

#include <UiSprite.h>

Inheritance diagram for UiSprite:
Collaboration diagram for UiSprite:

Public Member Functions

 UiSprite (const Ogre::String &name)
 Constructor. More...
 
 UiSprite (const Ogre::String &name, const Ogre::String &path_name, UiWidget *parent)
 Constructor. More...
 
virtual ~UiSprite ()
 Destructor. More...
 
void Initialise ()
 Loads an initializes the sprite. More...
 
virtual void Update ()
 Updates the sprite state. More...
 
virtual void Render ()
 Renders the sprite. More...
 
virtual void UpdateTransformation ()
 Updates the sprite state. More...
 
void SetImage (const Ogre::String &image)
 Sets the sprite image. More...
 
void SetImage (const char *image) override
 Sets the sprite image. More...
 
void SetVertexShader (const Ogre::String &shader)
 Sets the vertex shader for the sprite. More...
 
void SetFragmentShader (const Ogre::String &shader)
 Sets the fragment shader for the sprite. More...
 
void UpdateGeometry ()
 Recalculates the sprite geometry. 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

 UiSprite ()
 Constructor. More...
 
void CreateVertexBuffer ()
 Creates a vertex buffer for the sprite. More...
 
void DestroyVertexBuffer ()
 Destroys a vertex buffer for the sprite. More...
 

Private Attributes

Ogre::MaterialPtr material_
 The sprite material. More...
 
Ogre::SceneManager * scene_manager_
 The scene manager. More...
 
Ogre::RenderSystem * render_system_
 The render system. More...
 
Ogre::RenderOperation render_operation_
 The render operation. More...
 
Ogre::HardwareVertexBufferSharedPtr vertex_buffer_
 The vertex buffer. More...
 

Additional Inherited Members

- 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...
 
- 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

A sprite.

Constructor & Destructor Documentation

◆ UiSprite() [1/3]

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

Constructor.

Parameters
[in]nameThe sprite name.

◆ UiSprite() [2/3]

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

Constructor.

Parameters
[in]nameThe sprinte name.
[in]path_namePath to the sprite file.
[in]parentWidget to be set as parent of the sprite.
Todo:
path_name is relative to data? Filename is needed?

◆ ~UiSprite()

UiSprite::~UiSprite ( )
virtual

Destructor.

◆ UiSprite() [3/3]

UiSprite::UiSprite ( )
private

Constructor.

Member Function Documentation

◆ CreateVertexBuffer()

void UiSprite::CreateVertexBuffer ( )
private

Creates a vertex buffer for the sprite.

◆ DestroyVertexBuffer()

void UiSprite::DestroyVertexBuffer ( )
private

Destroys a vertex buffer for the sprite.

◆ Initialise()

void UiSprite::Initialise ( )

Loads an initializes the sprite.

◆ Render()

void UiSprite::Render ( )
virtual

Renders the sprite.

Reimplemented from UiWidget.

◆ SetFragmentShader()

void UiSprite::SetFragmentShader ( const Ogre::String &  shader)

Sets the fragment shader for the sprite.

Parameters
[in]shaderThe shader to set.

◆ SetImage() [1/2]

void UiSprite::SetImage ( const char *  image)
overridevirtual

Sets the sprite image.

Parameters
[in]imagePath to the image.

Reimplemented from UiWidget.

◆ SetImage() [2/2]

void UiSprite::SetImage ( const Ogre::String &  image)

Sets the sprite image.

Parameters
[in]imagePath to the image.

◆ SetVertexShader()

void UiSprite::SetVertexShader ( const Ogre::String &  shader)

Sets the vertex shader for the sprite.

Parameters
[in]shaderThe shader to set.

◆ Update()

void UiSprite::Update ( )
virtual

Updates the sprite state.

Reimplemented from UiWidget.

◆ UpdateGeometry()

void UiSprite::UpdateGeometry ( )

Recalculates the sprite geometry.

◆ UpdateTransformation()

void UiSprite::UpdateTransformation ( )
virtual

Updates the sprite state.

Reimplemented from UiWidget.

Member Data Documentation

◆ material_

Ogre::MaterialPtr UiSprite::material_
private

The sprite material.

◆ render_operation_

Ogre::RenderOperation UiSprite::render_operation_
private

The render operation.

◆ render_system_

Ogre::RenderSystem* UiSprite::render_system_
private

The render system.

◆ scene_manager_

Ogre::SceneManager* UiSprite::scene_manager_
private

The scene manager.

◆ vertex_buffer_

Ogre::HardwareVertexBufferSharedPtr UiSprite::vertex_buffer_
private

The vertex buffer.


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