36 lines
996 B
C++
36 lines
996 B
C++
//
|
|
// Created by sebastian on 10.02.26.
|
|
//
|
|
|
|
#include "UiContainer.h"
|
|
|
|
UiContainer::UiContainer(){
|
|
uiPositioner.screenSpace.set(0.f, 0.f, 1.f, 1.f);
|
|
}
|
|
|
|
void UiContainer::setBackgroundTexture(GLuint textureID) {
|
|
backgroundTextureID = textureID;
|
|
}
|
|
|
|
bool UiContainer::isMouseOver(float mouseX, float mouseY) {
|
|
for (const auto &child : children) {
|
|
if (child->isMouseOver(mouseX, mouseY)) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void UiContainer::onUpdate(float x) {
|
|
|
|
}
|
|
|
|
void UiContainer::onCollectRenderData(UiRenderBundle& renderBundle) {
|
|
if (backgroundTextureID.has_value()) {
|
|
GUITextureBuilder builder = GUITextureBuilder();
|
|
builder.Foreground(backgroundTextureID.value());
|
|
builder.Scale(glm::vec2(uiPositioner.screenSpace.width, uiPositioner.screenSpace.height));
|
|
builder.Position(glm::vec2(uiPositioner.screenSpace.x, uiPositioner.screenSpace.y));
|
|
renderBundle.addGUITexture(std::make_shared<GUITexture>(builder.Build()));
|
|
}
|
|
}
|
|
|