mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-09 13:01:49 +00:00
Refactor and fixes
This commit is contained in:
parent
b4a3608302
commit
63b5f4bc6b
25 changed files with 394 additions and 278 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
#include <functional>
|
||||
|
||||
class Batch2D;
|
||||
class Assets;
|
||||
|
|
@ -43,11 +44,19 @@ namespace gui {
|
|||
class UINode;
|
||||
class Container;
|
||||
|
||||
typedef std::function<void()> ontimeout;
|
||||
struct IntervalEvent {
|
||||
ontimeout callback;
|
||||
float interval;
|
||||
float timer;
|
||||
};
|
||||
|
||||
class GUI {
|
||||
Container* container;
|
||||
std::shared_ptr<UINode> hover = nullptr;
|
||||
std::shared_ptr<UINode> pressed = nullptr;
|
||||
std::shared_ptr<UINode> focus = nullptr;
|
||||
std::vector<IntervalEvent> intervalEvents;
|
||||
public:
|
||||
GUI();
|
||||
~GUI();
|
||||
|
|
@ -55,9 +64,11 @@ namespace gui {
|
|||
std::shared_ptr<UINode> getFocused() const;
|
||||
bool isFocusCaught() const;
|
||||
|
||||
void act();
|
||||
void act(float delta);
|
||||
void draw(Batch2D* batch, Assets* assets);
|
||||
void add(std::shared_ptr<UINode> panel);
|
||||
|
||||
void interval(float interval, ontimeout callback);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue