| 37 | } |
| 38 | |
| 39 | void Label::onRender() |
| 40 | { |
| 41 | Control::onRender(); |
| 42 | |
| 43 | std::list<UString> lines = font->wordWrapText(text, Size.x); |
| 44 | |
| 45 | int ysize = font->getFontHeight(text, Size.x); |
| 46 | if (scroller) |
| 47 | { |
| 48 | scroller->setVisible(ysize > this->Size.y && lines.size() > 1); |
| 49 | scroller->setMaximum(ysize - this->Size.y); |
| 50 | } |
| 51 | |
| 52 | int ypos = align(TextVAlign, Size.y, ysize); |
| 53 | if (scroller && scroller->isVisible()) |
| 54 | { |
| 55 | ypos = -scrollOffset; |
| 56 | } |
| 57 | |
| 58 | for (const auto &line : lines) |
| 59 | { |
| 60 | int xpos = align(TextHAlign, Size.x, font->getFontWidth(line)); |
| 61 | |
| 62 | auto textImage = font->getString(line); |
| 63 | fw().renderer->drawTinted(textImage, Vec2<float>{xpos, ypos}, Tint); |
| 64 | |
| 65 | ypos += font->getFontHeight(); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | void Label::update() |
| 70 | { |
nothing calls this directly
no test coverage detected