Dawn/src/dawn/scene/components/ui/UILabelNew.cpp

58 lines
1.3 KiB
C++

// Copyright (c) 2023 Dominic Masters
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
#include "UILabelNew.hpp"
#include "game/DawnGame.hpp"
using namespace Dawn;
UILabelNew::UILabelNew(SceneItem *item) : UIComponentRenderable(item) {
}
void UILabelNew::onStart() {
std::cout << "Hello new Label" << std::endl;
QuadMesh::initQuadMesh(&this->mesh,
glm::vec2(0, 0), glm::vec2(0, 0),
glm::vec2(32, 32), glm::vec2(1, 1),
0.0f
);
this->shaderBuffer.init();
}
std::vector<struct ShaderPassItem> UILabelNew::getUIRenderPasses() {
auto canvas = this->getCanvas();
auto shader = getGame()->renderManager.fontShader;
struct ShaderPassItem item;
item.shader = shader;
item.mesh = &mesh;
item.matrixValues[shader->paramModel] = transform->getWorldTransform();
item.parameterBuffers[shader->bufferUiCanvas] = &canvas->shaderBuffer;
item.parameterBuffers[shader->bufferFont] = &this->shaderBuffer;
struct FontShaderBufferData fontData;
fontData.fontParts[9].color = COLOR_BLUE;
shaderBuffer.buffer(&fontData);
return { item };
}
float_t UILabelNew::getWidth() {
return 0;
}
float_t UILabelNew::getHeight() {
return 0;
}
float_t UILabelNew::getContentWidth() {
return 0;
}
float_t UILabelNew::getContentHeight() {
return 0;
}