Refactor and fixes
This commit is contained in:
@@ -20,7 +20,15 @@ GUI::~GUI() {
|
||||
delete container;
|
||||
}
|
||||
|
||||
void GUI::act() {
|
||||
void GUI::act(float delta) {
|
||||
for (IntervalEvent& event : intervalEvents) {
|
||||
event.timer += delta;
|
||||
if (event.timer > event.interval) {
|
||||
event.callback();
|
||||
event.timer = fmod(event.timer, event.interval);
|
||||
}
|
||||
}
|
||||
|
||||
container->size(vec2(Window::width, Window::height));
|
||||
int mx = Events::x;
|
||||
int my = Events::y;
|
||||
@@ -83,3 +91,7 @@ bool GUI::isFocusCaught() const {
|
||||
void GUI::add(shared_ptr<UINode> panel) {
|
||||
container->add(panel);
|
||||
}
|
||||
|
||||
void GUI::interval(float interval, ontimeout callback) {
|
||||
intervalEvents.push_back({callback, interval, 0.0f});
|
||||
}
|
||||
Reference in New Issue
Block a user