UINodeSprite* UIHelpWindow::addSprite (const EntityType& type, const Animation& animation, float w, float h) { const UINode *node = _nodes.empty() ? nullptr : _nodes.back(); const float pos = (node != nullptr ? node->getRight() : 0.0f) + _iconGap; UINodeSprite *spriteNode = addSpriteNode(type, animation, pos, _currentY, w, h); spriteNode->setAspectRatioSize(w, h, 1.3f); spriteNode->alignToMiddle(); return spriteNode; }
UINodeSprite* UIGameHelpWindow::createSprite (const EntityType& type, const Animation& animation, float w, float h) { const std::string spriteName = SpriteDefinition::get().getSpriteName(type, animation); const SpritePtr& spritePtr = UI::get().loadSprite(spriteName); UINodeSprite* spriteNode = new UINodeSprite(_frontend); spriteNode->addSprite(spritePtr); spriteNode->setSize(w, h); spriteNode->setAspectRatioSize(w, h, 1.3f); spriteNode->alignToMiddle(); return spriteNode; }