std::vector<upoint> textbox::text_position() const { internal_scope_guard lock; auto editor = get_drawer_trigger().editor(); if (editor) return editor->text_position(); return{}; }
void Player::initStatisticsText() { if (!font.loadFromFile("resources/sansation.ttf")) return; sf::Vector2f text_position(850., 20.); sf::Vector2f to_next_position(0., 25.); statisticsText.name.setFont(font); statisticsText.name.setCharacterSize(25); statisticsText.name.setPosition(text_position); statisticsText.name.setColor(sf::Color::Red); text_position += to_next_position; statisticsText.connectoins.setFont(font); statisticsText.connectoins.setCharacterSize(20); statisticsText.connectoins.setPosition(text_position); statisticsText.connectoins.setColor(sf::Color::White); statisticsText.ects.setFont(font); statisticsText.ects.setCharacterSize(20); text_position += to_next_position; statisticsText.ects.setPosition(text_position); statisticsText.flair.setFont(font); statisticsText.flair.setCharacterSize(20); text_position += to_next_position; statisticsText.flair.setPosition(text_position); statisticsText.hangover.setFont(font); statisticsText.hangover.setCharacterSize(20); text_position += to_next_position; statisticsText.hangover.setPosition(text_position); statisticsText.knowledge.setFont(font); statisticsText.knowledge.setCharacterSize(20); text_position += to_next_position; statisticsText.knowledge.setPosition(text_position); statisticsText.name.setString(name); statisticsText.connectoins.setString("Znajomosci: " + to_string(stats.connections)); statisticsText.ects.setString("ECTS: " + to_string(stats.ects)); statisticsText.flair.setString("Spryt: " + to_string(stats.flair)); statisticsText.hangover.setString("Kac: " + to_string(stats.hangover)); statisticsText.knowledge.setString("Wiedza: " + to_string(stats.knowledge)); }
// need msg to be initialized beforehand void SimpleCircleFacingVisualizer::updateTextUnderLine() { Ogre::Vector3 text_position(size_ * cos(45.0 / 180.0 * M_PI) + size_ / 2.0, size_ * sin(45.0 / 180.0 * M_PI) + size_ / 2.0, 0); target_text_node_->setPosition(text_position); Ogre::Vector3 msg_size = msg_->GetAABB().getSize(); text_under_line_->clear(); text_under_line_->setColor(color_.r, color_.g, color_.b, color_.a); text_under_line_->setLineWidth(0.01); text_under_line_->setNumLines(1); text_under_line_->setMaxPointsPerLine(1024); Ogre::Vector3 A(size_ * cos(45.0 / 180.0 * M_PI), size_ * sin(45.0 / 180.0 * M_PI), 0); Ogre::Vector3 B(text_position + Ogre::Vector3(- size_ / 4.0, 0, 0)); Ogre::Vector3 C(text_position + Ogre::Vector3(msg_size[0], 0, 0)); text_under_line_->addPoint(A); text_under_line_->addPoint(B); text_under_line_->addPoint(C); }