// // Created by sebastian on 09.02.26. // #include "UILayer.h" #include "../engine/core/gui/uiComponent/UiImage.h" #include "../engine/renderer/loader/Loader.h" #include "../engine/renderer/model/GUITexture.h" UILayer::UILayer() { Loader& loader = Loader::instance(); guiRenderer = std::make_unique(loader); } void UILayer::onAttach() { Layer::onAttach(); rootContainer = std::make_unique(); auto image = std::make_unique( Loader::instance().loadTextureFromFile("assets/textures/texture.png").getTextureID(), glm::vec2(0.5f, 0.5f), glm::vec2(0.5f) ); rootContainer->addChild(std::move(image)); } void UILayer::onUpdate() { Layer::onUpdate(); std::vector guiTextures; if (rootContainer) { rootContainer->collectRenderData(guiTextures); } printf("Found UI Textures: %lu\n", guiTextures.size()); guiRenderer->render(guiTextures); } void UILayer::onDetach() { Layer::onDetach(); }