Potato Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Widget.cpp
Go to the documentation of this file.
1
2
3
#include "
Debug/Debug.hpp
"
4
#include "
Widget.hpp
"
5
#include "
WidgetElement.hpp
"
6
7
Widget::Widget
(std::string UID) : UID(UID) {
8
SetScreenPosition
(
Vector2
(0.f,0.f));
9
SetScreenSize
(
Vector2
(16.f, 4.f));
10
SetVisibility
(
true
);
11
12
}
13
14
std::string
Widget::GetUID
()
const
{
15
return
UID;
16
}
17
18
const
std::unordered_map<std::string, WidgetElement*>&
Widget::GetAllElements
()
const
{
19
return
Elements;
20
}
21
WidgetElement
*
Widget::GetElement
(std::string name) {
22
if
(Elements.find(name) != Elements.end()) {
23
return
Elements.at(name);
24
}
25
26
return
nullptr
;
27
}
28
29
Widget::~Widget() {
30
31
for
(
auto
it = Elements.begin(); it != Elements.end(); ) {
32
delete
it->second;
33
it = Elements.erase(it);
34
}
35
36
}
Debug.hpp
WidgetElement.hpp
Widget.hpp
UIElement::SetScreenSize
void SetScreenSize(const Vector2 &size)
Sets size of UI.
Definition
UIElement.cpp:8
UIElement::SetScreenPosition
void SetScreenPosition(const Vector2 &ScreenPosition)
Sets screen position of UI.
Definition
UIElement.cpp:16
UIElement::SetVisibility
void SetVisibility(bool visibility)
Sets visibility of UI.
Definition
UIElement.cpp:28
Widget::GetAllElements
const std::unordered_map< std::string, WidgetElement * > & GetAllElements() const
Gets map of all elements.
Definition
Widget.cpp:18
Widget::GetUID
std::string GetUID() const
Gets unique ID of widget.
Definition
Widget.cpp:14
Widget::Widget
Widget(std::string UID)
Constructs widget.
Definition
Widget.cpp:7
Widget::GetElement
WidgetElement * GetElement(std::string name)
Gets specific element by name.
Definition
Widget.cpp:21
Vector2
Standard 2-dimensional vector.
Definition
Vector2.hpp:11
WidgetElement
Wrapper for specialized sub-element that can be rendered by a Widget.
Definition
WidgetElement.hpp:11
Game
UI
Widgets
Widget.cpp
Generated by
1.17.0