VN Textbox updated
This commit is contained in:
@ -19,6 +19,7 @@ void UILabel::updatePositions() {
|
||||
void UILabel::updateMesh() {
|
||||
if(!this->needsRebuffering) return;
|
||||
if(this->font == nullptr) return;
|
||||
if(this->text.size() == 0) return;
|
||||
|
||||
this->font->buffer(
|
||||
this->text,
|
||||
@ -51,12 +52,12 @@ void UILabel::setFontSize(float_t fontSize) {
|
||||
}
|
||||
|
||||
void UILabel::drawSelf(UIShader &shader, glm::mat4 selfTransform) {
|
||||
if(this->font == nullptr) return;
|
||||
if(this->font == nullptr || this->text.size() == 0) return;
|
||||
|
||||
this->updateMesh();
|
||||
shader.setUIColor(this->textColor);
|
||||
shader.setUIModel(selfTransform);
|
||||
shader.setUITexture(&this->font->getTexture());
|
||||
|
||||
this->font->draw(this->mesh, this->startQuad, this->endQuad);
|
||||
this->font->draw(this->mesh, this->startQuad, this->quadCount);
|
||||
}
|
@ -19,15 +19,10 @@ namespace Dawn {
|
||||
|
||||
void updatePositions() override;
|
||||
|
||||
/**
|
||||
* Internal method to force the font mesh to be recreated.
|
||||
*/
|
||||
void updateMesh();
|
||||
|
||||
public:
|
||||
struct FontMeasure measure;
|
||||
int32_t startQuad = 0;
|
||||
int32_t endQuad = -1;
|
||||
int32_t quadCount = -1;
|
||||
|
||||
/** The colour of this label */
|
||||
struct Color textColor = COLOR_MAGENTA;
|
||||
@ -35,6 +30,11 @@ namespace Dawn {
|
||||
UILabel(UICanvas &canvas);
|
||||
void drawSelf(UIShader &shader, glm::mat4 selfTransform) override;
|
||||
|
||||
/**
|
||||
* Internal method to force the font mesh to be recreated.
|
||||
*/
|
||||
void updateMesh();
|
||||
|
||||
/**
|
||||
* Returns the current text that the label has.
|
||||
*
|
||||
|
Reference in New Issue
Block a user