V-Gears 0
Free Final Fantasy VII engine.
UiManager.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 <OgreRenderQueueListener.h>
19#include <OgreSingleton.h>
20#include <OgreUTFString.h>
21#include <tinyxml.h>
22#include "Manager.h"
23#include "UiFont.h"
24#include "UiWidget.h"
25
29class UiManager :
30 public Manager, public Ogre::RenderQueueListener, public Ogre::Singleton<UiManager>
31{
32
33 public:
34
38 UiManager();
39
43 virtual ~UiManager();
44
51 void Initialise();
52
58 void Input(const VGears::Event& event) override;
59
63 void UpdateDebug() override;
64
68 void OnResize();
69
73 void ClearField() override;
74
78 void ClearBattle() override;
79
83 void ClearWorld() override;
84
90 void AddFont(UiFont* font);
91
98 UiFont* GetFont(const Ogre::String& name);
99
107 void AddPrototype(const Ogre::String& name, TiXmlNode* prototype);
108
117 TiXmlNode* GetPrototype(const Ogre::String& name) const;
118
124 void AddWidget(UiWidget* widget);
125
132 UiWidget* GetWidget(const Ogre::String& name);
133
140 UiWidget* ScriptGetWidget(const char* name);
141
150 Ogre::uint8 queueGroupId, const Ogre::String& invocation,
151 bool& skipThisInvocation
152 );
153
154 private:
155
159 void UpdateField() override;
160
164 void UpdateBattle() override;
165
169 void UpdateWorld() override;
170
174 std::vector<UiFont*> fonts_;
175
182
187
191 TiXmlNode* node;
192 };
193
197 std::vector<UiPrototype> prototypes_;
198
202 std::vector<UiWidget*> widgets_;
203};
A base manager.
Definition: Manager.h:24
The UI widgets font.
Definition: UiFont.h:64
The UI manager.
Definition: UiManager.h:31
std::vector< UiPrototype > prototypes_
List of prototypes.
Definition: UiManager.h:197
std::vector< UiFont * > fonts_
List of fonts in the manager.
Definition: UiManager.h:174
UiWidget * ScriptGetWidget(const char *name)
Retrieves a UI widget by name.
Definition: UiManager.cpp:124
void AddFont(UiFont *font)
Adds a font to the manager.
Definition: UiManager.cpp:68
void renderQueueStarted(Ogre::uint8 queueGroupId, const Ogre::String &invocation, bool &skipThisInvocation)
Updates the render queue.
Definition: UiManager.cpp:126
void Input(const VGears::Event &event) override
Handles an input event.
Definition: UiManager.cpp:54
UiFont * GetFont(const Ogre::String &name)
Retrieves a font by name.
Definition: UiManager.cpp:81
void OnResize()
Handles resizing events.
Definition: UiManager.cpp:64
void UpdateWorld() override
Updates the world map UI elements in the manager.
Definition: UiManager.cpp:143
void ClearWorld() override
Clears all world map UI elements in the manager.
Definition: UiManager.cpp:62
void Initialise()
Initializes the manager.
Definition: UiManager.cpp:47
UiWidget * GetWidget(const Ogre::String &name)
Retrieves a UI widget by name.
Definition: UiManager.cpp:108
TiXmlNode * GetPrototype(const Ogre::String &name) const
Retrieves a prototype by name.
Definition: UiManager.cpp:100
void ClearBattle() override
Clears all battle UI elements in the manager.
Definition: UiManager.cpp:60
void AddPrototype(const Ogre::String &name, TiXmlNode *prototype)
Adds a prototype to the manager.
Definition: UiManager.cpp:93
void UpdateDebug() override
Updates the elements in the manager with debug information.
Definition: UiManager.cpp:56
UiManager()
Constructor.
Definition: UiManager.cpp:37
void AddWidget(UiWidget *widget)
Adds a UI widget to the manager.
Definition: UiManager.cpp:106
std::vector< UiWidget * > widgets_
List of widgets.
Definition: UiManager.h:202
virtual ~UiManager()
Destructor.
Definition: UiManager.cpp:41
void ClearField() override
Clears all field UI elements in the manager.
Definition: UiManager.cpp:58
void UpdateField() override
Updates the field UI elements in the manager.
Definition: UiManager.cpp:135
void UpdateBattle() override
Updates the battle UI elements in the manager.
Definition: UiManager.cpp:141
An UI widget.
Definition: UiWidget.h:28
Ogre::String String
Definition: TypeDefine.h:37
unsigned char uint8
Definition: scummsys.h:431
A UI prototype.
Definition: UiManager.h:181
TiXmlNode * node
The prototype structure as an XML node.
Definition: UiManager.h:191
Ogre::String name
The prototype node.
Definition: UiManager.h:186
An input event.
Definition: Event.h:84