#include "../include/MessagePart.hpp" #include "../include/ResourceCache.hpp" #include "../include/Settings.hpp" using namespace std; namespace dchat { const float MESSAGE_PART_SIZE = 27; float MessagePart::getSizeScaled() { return MESSAGE_PART_SIZE * Settings::getScaling(); } MessagePartText::MessagePartText(const string &_text) : MessagePart(Type::TEXT), text(_text, ResourceCache::getFont("fonts/Roboto-Regular.ttf"), MessagePartText::getFontSizeScaled()) { } float MessagePartText::getFontSizeScaled() { return MessagePart::getSizeScaled() * 0.8f; } sf::Vector2f MessagePartText::getPosition() const { return text.getPosition(); } sf::Vector2f MessagePartText::getSize() const { return sf::Vector2f(text.getLocalBounds().width, getFontSizeScaled()); } }