| 57 | } |
| 58 | |
| 59 | void TextComponent::render(const Eigen::Affine3f& parentTrans) |
| 60 | { |
| 61 | std::shared_ptr<Font> font = getFont(); |
| 62 | |
| 63 | Eigen::Affine3f trans = parentTrans * getTransform(); |
| 64 | |
| 65 | if(font && !mText.empty()) |
| 66 | { |
| 67 | Renderer::setMatrix(trans); |
| 68 | |
| 69 | if(mCentered) |
| 70 | { |
| 71 | Eigen::Vector2f textSize = font->sizeWrappedText(mText, getSize().x()); |
| 72 | Eigen::Vector2f pos((getSize().x() - textSize.x()) / 2, 0); |
| 73 | font->drawWrappedText(mText, pos, getSize().x(), (mColor >> 8 << 8) | getOpacity()); |
| 74 | }else{ |
| 75 | font->drawWrappedText(mText, Eigen::Vector2f(0, 0), getSize().x(), mColor >> 8 << 8 | getOpacity()); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | GuiComponent::renderChildren(trans); |
| 80 | } |
| 81 | |
| 82 | void TextComponent::calculateExtent() |
| 83 | { |
nothing calls this directly
no test coverage detected