V-Gears 0
Free Final Fantasy VII engine.
UiSprite.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <OgreHardwareVertexBuffer.h>
19#include <OgreRenderQueueListener.h>
20#include <OgreRoot.h>
21#include "UiWidget.h"
22
26class UiSprite : public UiWidget{
27
28 public:
29
35 UiSprite(const Ogre::String& name);
36
46 const Ogre::String& name, const Ogre::String& path_name,
47 UiWidget* parent
48 );
49
53 virtual ~UiSprite();
54
58 void Initialise();
59
63 virtual void Update();
64
68 virtual void Render();
69
73 virtual void UpdateTransformation();
74
80 void SetImage(const Ogre::String& image);
81
87 void SetImage(const char* image) override;
88
94 void SetVertexShader(const Ogre::String& shader);
95
101 void SetFragmentShader(const Ogre::String& shader);
102
106 void UpdateGeometry();
107
108 private:
109
114
118 void CreateVertexBuffer();
119
123 void DestroyVertexBuffer();
124
128 Ogre::MaterialPtr material_;
129
133 Ogre::SceneManager* scene_manager_;
134
138 Ogre::RenderSystem* render_system_;
139
143 Ogre::RenderOperation render_operation_;
144
148 Ogre::HardwareVertexBufferSharedPtr vertex_buffer_;
149};
A sprite.
Definition: UiSprite.h:26
void SetImage(const Ogre::String &image)
Sets the sprite image.
Definition: UiSprite.cpp:77
void DestroyVertexBuffer()
Destroys a vertex buffer for the sprite.
Definition: UiSprite.cpp:220
UiSprite()
Constructor.
void Initialise()
Loads an initializes the sprite.
Definition: UiSprite.cpp:32
Ogre::RenderSystem * render_system_
The render system.
Definition: UiSprite.h:138
virtual void Render()
Renders the sprite.
Definition: UiSprite.cpp:55
void UpdateGeometry()
Recalculates the sprite geometry.
Definition: UiSprite.cpp:97
Ogre::MaterialPtr material_
The sprite material.
Definition: UiSprite.h:128
Ogre::SceneManager * scene_manager_
The scene manager.
Definition: UiSprite.h:133
void SetFragmentShader(const Ogre::String &shader)
Sets the fragment shader for the sprite.
Definition: UiSprite.cpp:91
void CreateVertexBuffer()
Creates a vertex buffer for the sprite.
Definition: UiSprite.cpp:202
virtual ~UiSprite()
Destructor.
Definition: UiSprite.cpp:30
virtual void UpdateTransformation()
Updates the sprite state.
Definition: UiSprite.cpp:72
virtual void Update()
Updates the sprite state.
Definition: UiSprite.cpp:53
Ogre::RenderOperation render_operation_
The render operation.
Definition: UiSprite.h:143
void SetVertexShader(const Ogre::String &shader)
Sets the vertex shader for the sprite.
Definition: UiSprite.cpp:85
Ogre::HardwareVertexBufferSharedPtr vertex_buffer_
The vertex buffer.
Definition: UiSprite.h:148
An UI widget.
Definition: UiWidget.h:28
Ogre::String String
Definition: TypeDefine.h:37