本文整理汇总了C++中BitmapText::setString方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapText::setString方法的具体用法?C++ BitmapText::setString怎么用?C++ BitmapText::setString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitmapText
的用法示例。
在下文中一共展示了BitmapText::setString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateSpellSlots
void Spellbook::calculateSpellSlots() {
float yOffset = GUIConstants::TOP + SPELL_OFFSET;
float xOffset = GUIConstants::LEFT + GUIConstants::TEXT_OFFSET / 2.f + SpellSlot::ICON_OFFSET;
for (auto& it : m_core->getData().spellsLearned) {
for (auto& it2 : it.second) {
SpellSlot slot = SpellSlot(it2);
slot.setPosition(sf::Vector2f(xOffset, yOffset));
BitmapText text;
text.setCharacterSize(GUIConstants::CHARACTER_SIZE_M);
text.setColor(COLOR_WHITE);
text.setString(g_textProvider->getText(EnumNames::getSpellIDName(it2)));
text.setPosition(sf::Vector2f(xOffset + SpellSlot::ICON_SIZE + SpellSlot::ICON_OFFSET + MARGIN, yOffset));
BitmapText textDesc;
textDesc.setCharacterSize(GUIConstants::CHARACTER_SIZE_S);
textDesc.setColor(COLOR_LIGHT_GREY);
textDesc.setString(g_textProvider->getCroppedText(
EnumNames::getSpellIDName(it2) + "Desc", GUIConstants::CHARACTER_SIZE_S,
static_cast<int>(WIDTH - (SpellSlot::SIZE + 4 * MARGIN))));
textDesc.setPosition(sf::Vector2f(xOffset + SpellSlot::ICON_SIZE + SpellSlot::ICON_OFFSET + MARGIN, yOffset + GUIConstants::CHARACTER_SIZE_M + 4.f));
std::pair<BitmapText, BitmapText> texts = std::pair<BitmapText, BitmapText>(text, textDesc);
m_typeMap.at(it.first)->push_back(std::pair<SpellSlot, std::pair<BitmapText, BitmapText>>(slot, texts));
yOffset += SpellSlot::SIZE + MARGIN;
}
yOffset = GUIConstants::TOP + SPELL_OFFSET;
}
}
示例2: calculateModifierSlots
void Spellbook::calculateModifierSlots() {
float yOffset = GUIConstants::TOP + SPELL_OFFSET;
float xOffset = GUIConstants::LEFT + 2 * GUIConstants::TEXT_OFFSET;
float modifierXOffset = 213.f;
float textYOffset = SpellSlot::ICON_SIZE / 2.f - GUIConstants::CHARACTER_SIZE_S / 2.f;
for (auto& it : m_core->getData().modfiersLearned) {
BitmapText text;
text.setCharacterSize(GUIConstants::CHARACTER_SIZE_S);
text.setColor(COLOR_WHITE);
text.setPosition(sf::Vector2f(xOffset, yOffset + textYOffset));
text.setString(g_textProvider->getText(EnumNames::getSpellModifierTypeName(it.first)));
m_modifierTexts.push_back(text);
for (int i = 0; i < it.second; i++) {
SpellModifier modifier;
modifier.level = i + 1;
modifier.type = it.first;
ModifierSlot slot(modifier);
slot.setPosition(sf::Vector2f(modifierXOffset + (i * (ModifierSlot::SIZE + MARGIN)), yOffset));
m_modifierSlots.push_back(slot);
}
yOffset += ModifierSlot::SIZE + 6.f;
}
}
示例3: calculateModifierSlots
void Spellbook::calculateModifierSlots()
{
float yOffset = GUIConstants::TOP + GUIConstants::TEXT_OFFSET + 2 * GUIConstants::CHARACTER_SIZE_M + 2 * MARGIN + 2 * BUTTON_SIZE.y;
float xOffset = GUIConstants::LEFT + GUIConstants::TEXT_OFFSET;
int maxY = 4;
int y = 1;
for (auto& it : m_core->getData().modfiersLearned)
{
BitmapText text;
text.setCharacterSize(GUIConstants::CHARACTER_SIZE_M);
text.setColor(CENDRIC_COLOR_WHITE);
text.setPosition(sf::Vector2f(xOffset, yOffset));
text.setString(g_textProvider->getText(EnumNames::getSpellModifierTypeName(it.first)));
m_modifierTexts.push_back(text);
yOffset += GUIConstants::CHARACTER_SIZE_M * 2;
for (int i = 0; i < it.second; i++)
{
SpellModifier modifier;
modifier.level = i + 1;
modifier.type = it.first;
ModifierSlot slot(modifier);
slot.setPosition(sf::Vector2f(xOffset + (i * (ModifierSlot::SIDE_LENGTH + MARGIN)), yOffset));
m_modifierSlots.push_back(slot);
}
if (y >= maxY)
{
yOffset = GUIConstants::TOP + GUIConstants::TEXT_OFFSET + 2 * GUIConstants::CHARACTER_SIZE_M + 2 * MARGIN + 2 * BUTTON_SIZE.y;
xOffset = GUIConstants::LEFT + WIDTH - (3 * ModifierSlot::SIDE_LENGTH + 2 * MARGIN + GUIConstants::TEXT_OFFSET);
y = 0;
}
else
{
y++;
yOffset += GUIConstants::CHARACTER_SIZE_M + ModifierSlot::SIDE_LENGTH;
}
}
}