This commit is contained in:
2023-07-08 19:10:59 -07:00
parent a844c93eca
commit 83f5d99c65
4 changed files with 8 additions and 7 deletions

View File

@ -20,8 +20,7 @@
alignX="UI_COMPONENT_ALIGN_MIDDLE"
alignY="UI_COMPONENT_ALIGN_MIDDLE"
ref="uiLabel"
>
</UIRichTextLabel>
/>
</child>
<VNTextboxScroller ref="textboxScroller" label="uiLabel" visibleLines="6" />

View File

@ -144,8 +144,6 @@
<text>
<string lang="en">I exhale. The town is stirring awake.</string>
</text>
<marker name="test" />
<text>
<string lang="en">I get dressed.</string>
@ -160,6 +158,8 @@
<string lang="en">A pink tulle, a kind of prettier dress.</string>
</choice>
</choices>
<marker name="test" />
<text>
<string lang="en">On the morning of May 29th, my mother is proud of me. She had been Angelwood's Queen in her eighteens. I am carrying her legacy on my shoulders, and today she finally believes I will be victorious.</string>

View File

@ -29,7 +29,7 @@ void VNTextboxScroller::onStart() {
x();
useEvent(x, this->label->eventTextChanged);
// useEffect(x, visibleLines);
useEffect(x, visibleLines);
useEvent([&](float_t delta){
auto game = this->getGame();

View File

@ -108,6 +108,8 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
quadCountTotal = 0;
std::vector<struct UILabelText> realNewTexts;
float_t maxWidth = this->width;
// Reset
lines.clear();
@ -236,8 +238,8 @@ void UILabel::rebufferQuads(const std::vector<struct UILabelText> newTexts) {
if(
ch != ' ' &&
lastSpaceCharacter != -1 &&
this->width > charInfo.bitmapSize.x &&
(position.x + charInfo.advanceX) > this->width
maxWidth > charInfo.bitmapSize.x &&
(position.x + charInfo.advanceX) > maxWidth
) {
// Basically this rewinds everything we've done to the last space char,
// changes it to a newline, and then moves the position along.