本文整理汇总了C++中Heroes::GetKnowledge方法的典型用法代码示例。如果您正苦于以下问题:C++ Heroes::GetKnowledge方法的具体用法?C++ Heroes::GetKnowledge怎么用?C++ Heroes::GetKnowledge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Heroes
的用法示例。
在下文中一共展示了Heroes::GetKnowledge方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HeroesOpenDialog
Dialog::answer_t PocketPC::HeroesOpenDialog(Heroes & hero, bool readonly)
{
Cursor & cursor = Cursor::Get();
Display & display = Display::Get();
LocalEvent & le = LocalEvent::Get();
cursor.Hide();
cursor.SetThemes(cursor.POINTER);
const u16 window_w = 320;
const u16 window_h = 224;
Dialog::FrameBorder frameborder;
frameborder.SetPosition((display.w() - window_w) / 2 - BORDERWIDTH, (display.h() - window_h) / 2 - BORDERWIDTH, window_w, window_h);
frameborder.Redraw();
const Rect & dst_rt = frameborder.GetArea();
const Sprite & background = AGG::GetICN(ICN::STONEBAK, 0);
const Sprite & backSprite = AGG::GetICN(ICN::SWAPWIN, 0);
background.Blit(Rect(0, 0, window_w, window_h), dst_rt);
// portrait
AGG::GetICN(ICN::BRCREST, 6).Blit(dst_rt.x + 8, dst_rt.y, display);
hero.GetPortrait50x46().Blit(dst_rt.x + 12, dst_rt.y + 4, display);
// name
std::string message = _("%{name} the %{race} ( Level %{level} )");
String::Replace(message, "%{name}", hero.GetName());
String::Replace(message, "%{race}", Race::String(hero.GetRace()));
String::Replace(message, "%{level}", hero.GetLevel());
Text text(message, Font::SMALL);
text.Blit(dst_rt.x + 73, dst_rt.y + 1);
// experience
ExperienceIndicator experienceInfo(hero);
experienceInfo.SetPos(Point(dst_rt.x + 205, dst_rt.y + 14));
experienceInfo.Redraw();
// spell points
SpellPointsIndicator spellPointsInfo(hero);
spellPointsInfo.SetPos(Point(dst_rt.x + 238, dst_rt.y + 16));
spellPointsInfo.Redraw();
// morale
MoraleIndicator moraleIndicator(hero);
moraleIndicator.SetPos(Point(dst_rt.x + 280, dst_rt.y + 20));
moraleIndicator.Redraw();
// luck
LuckIndicator luckIndicator(hero);
luckIndicator.SetPos(Point(dst_rt.x + 280, dst_rt.y + 60));
luckIndicator.Redraw();
// prim skill
const Rect ras(dst_rt.x + 74, dst_rt.y + 14, 34, 34);
backSprite.Blit(Rect(216, 51, ras.w, ras.h), ras);
text.Set(GetString(hero.GetAttack()));
text.Blit(dst_rt.x + 74 + (34 - text.w()) / 2, dst_rt.y + 47);
const Rect rds(dst_rt.x + 107, dst_rt.y + 14, 34, 34);
backSprite.Blit(Rect(216, 84, rds.w, rds.h), rds);
text.Set(GetString(hero.GetDefense()));
text.Blit(dst_rt.x + 107 + (34 - text.w()) / 2, dst_rt.y + 47);
const Rect rps(dst_rt.x + 140, dst_rt.y + 14, 34, 34);
backSprite.Blit(Rect(216, 117, rps.w, rps.h), rps);
text.Set(GetString(hero.GetPower()));
text.Blit(dst_rt.x + 140 + (34 - text.w()) / 2, dst_rt.y + 47);
const Rect rks(dst_rt.x + 173, dst_rt.y + 14, 34, 34);
backSprite.Blit(Rect(216, 150, rks.w, rks.h), rks);
text.Set(GetString(hero.GetKnowledge()));
text.Blit(dst_rt.x + 173 + (34 - text.w()) / 2, dst_rt.y + 47);
// sec skill
backSprite.Blit(Rect(21, 198, 267, 36), dst_rt.x + 7, dst_rt.y + 57);
// secondary skill
SecondarySkillBar secskill_bar;
secskill_bar.SetPos(dst_rt.x + 9, dst_rt.y + 59);
secskill_bar.SetUseMiniSprite();
secskill_bar.SetInterval(1);
secskill_bar.SetSkills(hero.GetSecondarySkills());
secskill_bar.Redraw();
// army bar
const Rect rt1(36, 267, 43, 53);
Surface sfb1(rt1.w, rt1.h);
backSprite.Blit(rt1, 0, 0, sfb1);
Surface sfc1(rt1.w, rt1.h - 10);
Cursor::DrawCursor(sfc1, 0xd6, true);
SelectArmyBar selectArmy;
selectArmy.SetArmy(hero.GetArmy());
selectArmy.SetPos(dst_rt.x + 50, dst_rt.y + 170);
selectArmy.SetInterval(2);
selectArmy.SetBackgroundSprite(sfb1);
selectArmy.SetCursorSprite(sfc1);
selectArmy.SetUseMons32Sprite();
selectArmy.SetSaveLastTroop();
if(readonly) selectArmy.SetReadOnly();
//.........这里部分代码省略.........
示例2: QuickInfo
//.........这里部分代码省略.........
}
const Sprite & l_flag = AGG::GetICN(ICN::FLAG32, index);
dst_pt.x = cur_rt.x + (cur_rt.w - 40) / 2 - l_flag.w();
display.Blit(l_flag, dst_pt);
const Sprite & r_flag = AGG::GetICN(ICN::FLAG32, index + 1);
dst_pt.x = cur_rt.x + (cur_rt.w + 40) / 2;
display.Blit(r_flag, dst_pt);
std::string message;
// attack
message = _("Attack");
message += ":";
text.Set(message);
dst_pt.x = cur_rt.x + 35;
dst_pt.y += port.h() + 4;
text.Blit(dst_pt);
message.clear();
String::AddInt(message, hero.GetAttack());
text.Set(message);
dst_pt.x += 75;
text.Blit(dst_pt);
// defense
message = _("Defense");
message += ":";
text.Set(message);
dst_pt.x = cur_rt.x + 35;
dst_pt.y += 12;
text.Blit(dst_pt);
message.clear();
String::AddInt(message, hero.GetDefense());
text.Set(message);
dst_pt.x += 75;
text.Blit(dst_pt);
// power
message = _("Spell Power");
message += ":";
text.Set(message);
dst_pt.x = cur_rt.x + 35;
dst_pt.y += 12;
text.Blit(dst_pt);
message.clear();
String::AddInt(message, hero.GetPower());
text.Set(message);
dst_pt.x += 75;
text.Blit(dst_pt);
// knowledge
message = _("Knowledge");
message += ":";
text.Set(message);
dst_pt.x = cur_rt.x + 35;
dst_pt.y += 12;
text.Blit(dst_pt);
message.clear();
String::AddInt(message, hero.GetKnowledge());
text.Set(message);
dst_pt.x += 75;
text.Blit(dst_pt);
// spell point
message = _("Spell Points");
message += ":";
text.Set(message);
dst_pt.x = cur_rt.x + 35;
dst_pt.y += 12;
text.Blit(dst_pt);
message.clear();
String::AddInt(message, hero.GetSpellPoints());
message += "/";
String::AddInt(message, hero.GetMaxSpellPoints());
text.Set(message);
dst_pt.x += 75;
text.Blit(dst_pt);
// draw monster sprite in one string
const u8 mycolor = Settings::Get().MyColor();
const bool hide = mycolor != hero.GetColor() && !world.GetKingdom(mycolor).Modes(Kingdom::IDENTIFYHERO);
hero.GetArmy().DrawMons32Line(cur_rt.x - 5, cur_rt.y + 114, 160, 0, 0, hide);
cursor.Show();
display.Flip();
// quick info loop
while(le.HandleEvents() && le.MousePressRight());
// restore background
cursor.Hide();
back.Restore();
cursor.Show();
display.Flip();
}