VN Textbox Scroll initial version
This commit is contained in:
@ -13,7 +13,9 @@ UILabel::UILabel(SceneItem *item) :
|
||||
text(""),
|
||||
fontSize(10.0f),
|
||||
font(&item->scene->game->renderManager.defaultFont),
|
||||
maxWidth(UI_LABEL_MAX_WIDTH_ALIGN)
|
||||
maxWidth(UI_LABEL_MAX_WIDTH_ALIGN),
|
||||
startQuad(0),
|
||||
quadCount(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -30,7 +32,12 @@ void UILabel::updateMesh() {
|
||||
if(!this->hasText()) return;
|
||||
|
||||
float_t width = this->maxWidth;
|
||||
assertTrue(width == UI_LABEL_MAX_WIDTH_NONE || width == UI_LABEL_MAX_WIDTH_ALIGN || width > 0);
|
||||
assertTrue(
|
||||
width == UI_LABEL_MAX_WIDTH_NONE ||
|
||||
width == UI_LABEL_MAX_WIDTH_ALIGN ||
|
||||
width > 0
|
||||
);
|
||||
|
||||
if(width == UI_LABEL_MAX_WIDTH_ALIGN) {
|
||||
auto dimensional = this->getParentDimensional();
|
||||
auto align = (glm::vec4)this->alignment;
|
||||
@ -56,6 +63,8 @@ void UILabel::updateMesh() {
|
||||
);
|
||||
|
||||
this->needsRebuffering = false;
|
||||
|
||||
this->eventFontRebuffered.invoke();
|
||||
}
|
||||
|
||||
std::vector<struct ShaderPassItem> UILabel::getPassItems(
|
||||
@ -100,7 +109,7 @@ void UILabel::onStart() {
|
||||
|
||||
useEffect([&]{
|
||||
alignmentNeedsUpdating = true;
|
||||
}, { &fontSize, &font, &text, &maxWidth });
|
||||
}, { &fontSize, &font, &text, &maxWidth, &startQuad, &quadCount });
|
||||
|
||||
useEffect([&]{
|
||||
needsRebuffering = true;
|
||||
|
@ -39,10 +39,14 @@ namespace Dawn {
|
||||
StateProperty<float_t> maxWidth;
|
||||
/* @optional */
|
||||
struct Color textColor = COLOR_WHITE;
|
||||
// @optional
|
||||
StateProperty<int32_t> startQuad;
|
||||
// @optional
|
||||
StateProperty<int32_t> quadCount;
|
||||
|
||||
StateEvent<> eventFontRebuffered;
|
||||
|
||||
struct FontMeasure measure;
|
||||
int32_t startQuad = 0;
|
||||
int32_t quadCount = -1;
|
||||
|
||||
UILabel(SceneItem *item);
|
||||
|
||||
|
Reference in New Issue
Block a user