Potato Engine
Loading...
Searching...
No Matches
HUDController.hpp
Go to the documentation of this file.
1
2#pragma once
3
4
5class Widget;
6
11{
12public:
13 virtual ~IHUDController() = default;
14
21 virtual void RemoveWidget(std::string UID) = 0;
28 template<typename WidgetClass>
29 WidgetClass* AddWidget(std::string UID);
31 virtual Widget* GetWidget(std::string UID) const = 0;
32
33protected:
35 virtual void RegisterWidget(Widget* widget) = 0;
36
37};
38
39template <typename WidgetClass>
40WidgetClass* IHUDController::AddWidget(std::string UID) {
41 WidgetClass* widget = new WidgetClass(UID);
42 RegisterWidget(widget);
43 return widget;
44}
Manages global HUD.
virtual Widget * GetWidget(std::string UID) const =0
Gets widget by UID.
WidgetClass * AddWidget(std::string UID)
Construct and add widget to the screen.
virtual void RemoveWidget(std::string UID)=0
Remove a Widget from the screen.
UI element that can be displayed on screen.
Definition Widget.hpp:15