Fixed CSV Parsing on tools

This commit is contained in:
2023-01-28 21:01:30 -08:00
parent 104af8ff45
commit 9ebd4eb6ad
16 changed files with 345 additions and 18 deletions

View File

@ -7,6 +7,7 @@
#include "scene/Scene.hpp"
#include "ui/UIComponent.hpp"
#include "game/DawnGame.hpp"
#include "ui/UIMenu.hpp"
using namespace Dawn;
@ -26,6 +27,12 @@ void UICanvas::onRenderTargetResize(float_t w, float_t h){
}
}
void UICanvas::onSceneUpdate() {
if(this->currentMenu != nullptr) {
this->currentMenu->onTick();
}
}
void UICanvas::setCamera(Camera *camera) {
assertTrue(camera != this->camera);
@ -58,11 +65,23 @@ float_t UICanvas::getHeight() {
return this->camera->getRenderTarget()->getHeight();
}
struct UIMenu * UICanvas::getCurrentMenu() {
return this->currentMenu;
}
void UICanvas::setCurrentMenu(struct UIMenu *menu) {
if(this->currentMenu != nullptr) this->currentMenu->onInactive();
this->currentMenu = menu;
if(menu != nullptr) menu->onActive();
}
void UICanvas::onStart() {
if(this->camera == nullptr) {
auto camera = this->getScene()->findComponent<Camera>();
this->setCamera(camera);
}
this->getScene()->eventSceneUpdate.addListener(this, &UICanvas::onSceneUpdate);
}
void UICanvas::onDispose() {
@ -71,6 +90,8 @@ void UICanvas::onDispose() {
this, &UICanvas::onRenderTargetResize
);
}
this->getScene()->eventSceneUpdate.removeListener(this, &UICanvas::onSceneUpdate);
auto it = this->children.begin();
while(it != this->children.end()) {