void Renderer::renderTextWithOverlay(std::string text, int x, int y, sf::Color color, sf::Color overlay, std::string font, int size, int w, int h) { sf::Text sfText(sf::String(text), *renderUtils->getFont(font), static_cast<unsigned int>(size)); sf::FloatRect sfFloatRect = sfText.getLocalBounds(); sf::RectangleShape sfRectangle(sf::Vector2f(sfFloatRect.width + 6, sfFloatRect.height + 8)); sfRectangle.setFillColor(overlay); sfRectangle.setPosition(x - 2, y - 2); sfTarget->draw(sfRectangle); sfText.setColor(color); sfText.setPosition(x, y); sfTarget->draw(sfText); }
void HumanView::drawText(string text, Vec2D<double> position, bm::Color c, string font, int size) { sf::Font *f = FontManager::get()->getFont(font); sf::Text sfText((sf::String)text, *f); sfText.setColor(sf::Color(c.r, c.g, c.b, c.a)); sfText.setPosition(position.x, position.y); sfText.setCharacterSize(size); // save GL state window->pushGLStates(); // draw window->draw(sfText); // restore GL state window->popGLStates(); }
void Renderer::renderText(std::string text, int x, int y, sf::Color color, std::string font, int size, int w, int h) { sf::Text sfText(sf::String(text), *renderUtils->getFont(font), static_cast<unsigned int>(size)); sfText.setColor(color); sfText.setPosition(x, y); sfTarget->draw(sfText); }