I guess I fixed a bug, not really sure, moving on to restoring game functionality
This commit is contained in:
@ -28,7 +28,7 @@ void VNTextboxScroller::onStart() {
|
||||
x();
|
||||
|
||||
useEvent(x, this->label->eventTextChanged);
|
||||
useEffect(x, visibleLines);
|
||||
// useEffect(x, visibleLines);
|
||||
|
||||
useEvent([&](float_t delta){
|
||||
auto game = this->getGame();
|
||||
|
@ -98,6 +98,8 @@ float_t UILabel::getContentHeight() {
|
||||
}
|
||||
|
||||
void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
assertTrue(newTexts.size() < FONT_SHADER_PARTS_MAX);
|
||||
|
||||
int32_t nextTexture = 0;
|
||||
glm::vec2 position(0, 0);
|
||||
int32_t partIndex = 0;
|
||||
@ -180,26 +182,31 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
|
||||
// Finalize current line
|
||||
lineWidth += wordWidth;
|
||||
currentLine.width = lineWidth;
|
||||
currentLine.quadCount = quadCountTotal - currentLine.quadStart;
|
||||
currentLine.quadCount += quadCountTotal - currentLine.quadStart;
|
||||
|
||||
// Move to next line
|
||||
position.x = 0;
|
||||
position.y += realText.style.size;
|
||||
lines.push_back(currentLine);
|
||||
if(i != len) {
|
||||
position.x = 0;
|
||||
position.y += realText.style.size;
|
||||
lines.push_back(currentLine);
|
||||
}
|
||||
|
||||
// Reset line
|
||||
lastSpaceCharacter = i;
|
||||
wordWidth = 0.0f;
|
||||
lineWidth = 0.0f;
|
||||
|
||||
currentLine = UILabelLine();
|
||||
currentLine.quadStart = quadCountTotal;
|
||||
currentLine.position = position;
|
||||
currentLine.height = realText.style.size;
|
||||
// Here I subtract line height from the line position because we start
|
||||
// by moving the text down by the initial line height, so we need to
|
||||
// compensate for that.
|
||||
currentLine.position.y -= realText.style.size;
|
||||
if(i != len) lineWidth = 0.0f;
|
||||
|
||||
if(i != len) {
|
||||
currentLine = UILabelLine();
|
||||
currentLine.quadStart = quadCountTotal;
|
||||
currentLine.position = position;
|
||||
currentLine.height = realText.style.size;
|
||||
// Here I subtract line height from the line position because we start
|
||||
// by moving the text down by the initial line height, so we need to
|
||||
// compensate for that.
|
||||
currentLine.position.y -= realText.style.size;
|
||||
}
|
||||
};
|
||||
|
||||
// Now, iterate each character
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "UIShader.hpp"
|
||||
#include "util/macro.hpp"
|
||||
|
||||
#define FONT_SHADER_PARTS_MAX 4
|
||||
#define FONT_SHADER_PARTS_MAX 8
|
||||
#define FONT_SHADER_QUADS_MAX 1024
|
||||
#define FONT_SHADER_TEXTURE_MAX 4
|
||||
|
||||
|
Reference in New Issue
Block a user