diff --git a/assets/games/liminal/prefabs/VNTextbox.xml b/assets/games/liminal/prefabs/VNTextbox.xml
index 56a34a6c..aaea4871 100644
--- a/assets/games/liminal/prefabs/VNTextbox.xml
+++ b/assets/games/liminal/prefabs/VNTextbox.xml
@@ -23,19 +23,23 @@
ref="uiLabel"
>
- Hello World
- How are you today?
- I'm doing great, thanks!
- Thanks, me too!
- Glad to hear it!
- I'm glad to hear it too!
- What a great day!
- It sure is!
- I'm glad we're friends!
- Me too!
- What are you up to?
- Nothing much, just hanging out.
- Cool, me too!
+ Hello World
+
+ How are you today?
+
+ I'm doing great, thanks!
+
+ Thanks, me too!
+ Glad to hear it!
+ I'm glad to hear it too!
+ What a great day!
+ It sure is!
+ I'm glad we're friends!
+ Me too!
+ What are you up to?
+ Nothing much, just hanging out.
+ Cool, me too!
+
diff --git a/src/dawn/games/vn/components/VNTextboxScroller.cpp b/src/dawn/games/vn/components/VNTextboxScroller.cpp
index f76fba9d..5433a6fb 100644
--- a/src/dawn/games/vn/components/VNTextboxScroller.cpp
+++ b/src/dawn/games/vn/components/VNTextboxScroller.cpp
@@ -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();
diff --git a/src/dawn/scene/components/ui/text/UILabel.cpp b/src/dawn/scene/components/ui/text/UILabel.cpp
index f810dfaf..7f27f5fd 100644
--- a/src/dawn/scene/components/ui/text/UILabel.cpp
+++ b/src/dawn/scene/components/ui/text/UILabel.cpp
@@ -98,6 +98,8 @@ float_t UILabel::getContentHeight() {
}
void UILabel::rebufferQuads(const std::vector 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 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
diff --git a/src/dawnopengl/display/shader/shaders/FontShader.hpp b/src/dawnopengl/display/shader/shaders/FontShader.hpp
index 429f04aa..eab266f2 100644
--- a/src/dawnopengl/display/shader/shaders/FontShader.hpp
+++ b/src/dawnopengl/display/shader/shaders/FontShader.hpp
@@ -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