Fixed some bugs and added parsing
This commit is contained in:
@ -25,7 +25,7 @@ void UILabel::onStart() {
|
||||
}
|
||||
|
||||
std::vector<struct ShaderPassItem> UILabel::getUIRenderPasses() {
|
||||
// if(this->texts.size() == 0) return {};
|
||||
if(this->textsBuffered.empty()) return {};
|
||||
|
||||
auto canvas = this->getCanvas();
|
||||
auto shader = getGame()->renderManager.fontShader;
|
||||
@ -264,10 +264,12 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
}
|
||||
|
||||
// Create mesh
|
||||
this->mesh.createBuffers(
|
||||
QUAD_VERTICE_COUNT * vertices.size(),
|
||||
QUAD_INDICE_COUNT * vertices.size()
|
||||
);
|
||||
if(!vertices.empty()) {
|
||||
this->mesh.createBuffers(
|
||||
QUAD_VERTICE_COUNT * vertices.size(),
|
||||
QUAD_INDICE_COUNT * vertices.size()
|
||||
);
|
||||
}
|
||||
|
||||
// Now buffer the quads.
|
||||
int32_t j = 0;
|
||||
|
@ -22,6 +22,11 @@ void UIRichTextLabel::onStart() {
|
||||
struct UILabelStyle current;
|
||||
styleStack.push_back(current);
|
||||
std::vector<struct UILabelText> bufferTexts;
|
||||
|
||||
if(this->richText._realValue.empty()) {
|
||||
this->rebufferQuads(bufferTexts);
|
||||
return;
|
||||
}
|
||||
|
||||
std::function<void(Xml*)> parseChildren = [&](Xml *node) {
|
||||
if(node->children.empty()) {
|
||||
|
@ -9,6 +9,7 @@
|
||||
namespace Dawn {
|
||||
class UIRichTextLabel : public UILabel {
|
||||
public:
|
||||
// @innerXml
|
||||
StateProperty<std::string> richText;
|
||||
|
||||
UIRichTextLabel(SceneItem *item);
|
||||
|
Reference in New Issue
Block a user