本文整理汇总了C++中dialog::FrameBorder::SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ FrameBorder::SetPosition方法的具体用法?C++ FrameBorder::SetPosition怎么用?C++ FrameBorder::SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dialog::FrameBorder
的用法示例。
在下文中一共展示了FrameBorder::SetPosition方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ScenarioInfo
Game::menu_t Game::ScenarioInfo(void)
{
Settings & conf = Settings::Get();
AGG::PlayMusic(MUS::MAINMENU);
MapsFileInfoList lists;
if(!PrepareMapsFileInfoList(lists, (conf.GameType(Game::TYPE_MULTI))))
{
Dialog::Message(_("Warning"), _("No maps available!"), Font::BIG, Dialog::OK);
return MAINMENU;
}
menu_t result = QUITGAME;
LocalEvent & le = LocalEvent::Get();
// cursor
Cursor & cursor = Cursor::Get();
cursor.Hide();
cursor.SetThemes(cursor.POINTER);
Display & display = Display::Get();
Point top, pointDifficultyInfo, pointOpponentInfo, pointClassInfo;
Rect rectPanel;
Button* buttonSelectMaps = NULL;
Button* buttonOk = NULL;
Button* buttonCancel = NULL;
// vector coord difficulty
Rects coordDifficulty;
coordDifficulty.reserve(5);
const Sprite & ngextra = AGG::GetICN(ICN::NGEXTRA, 62);
Dialog::FrameBorder* frameborder = NULL;
// image background
if(conf.QVGA())
{
const u16 window_w = 380;
const u16 window_h = 224;
frameborder = new Dialog::FrameBorder();
frameborder->SetPosition((display.w() - window_w) / 2 - BORDERWIDTH, (display.h() - window_h) / 2 - BORDERWIDTH, window_w, window_h);
frameborder->Redraw();
rectPanel = frameborder->GetArea();
pointDifficultyInfo = Point(rectPanel.x + 4, rectPanel.y + 24);
pointOpponentInfo = Point(rectPanel.x + 4, rectPanel.y + 94);
pointClassInfo = Point(rectPanel.x + 4, rectPanel.y + 148);
coordDifficulty.push_back(Rect(rectPanel.x + 1, rectPanel.y + 21, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 78, rectPanel.y + 21, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 154, rectPanel.y + 21, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 231, rectPanel.y + 21, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 308, rectPanel.y + 21, ngextra.w(), ngextra.h()));
buttonOk = new Button(rectPanel.x + rectPanel.w / 2 - 160, rectPanel.y + rectPanel.h - 30, ICN::NGEXTRA, 66, 67);
buttonCancel = new Button(rectPanel.x + rectPanel.w / 2 + 60, rectPanel.y + rectPanel.h - 30, ICN::NGEXTRA, 68, 69);
const Sprite & background = AGG::GetICN(ICN::STONEBAK, 0);
background.Blit(Rect(0, 0, window_w, window_h), rectPanel);
Text text;
text.Set(conf.CurrentFileInfo().name, Font::BIG);
text.Blit(rectPanel.x + (rectPanel.w - text.w()) / 2, rectPanel.y + 5);
}
else
{
const Sprite &panel = AGG::GetICN(ICN::NGHSBKG, 0);
const Sprite &back = AGG::GetICN(ICN::HEROES, 0);
const Point top((display.w() - back.w()) / 2, (display.h() - back.h()) / 2);
rectPanel = Rect(top.x + 204, top.y + 32, panel.w(), panel.h());
pointDifficultyInfo = Point(rectPanel.x + 24, rectPanel.y + 93);
pointOpponentInfo = Point(rectPanel.x + 24, rectPanel.y + 202);
pointClassInfo = Point(rectPanel.x + 24, rectPanel.y + 282);
coordDifficulty.push_back(Rect(rectPanel.x + 21, rectPanel.y + 91, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 98, rectPanel.y + 91, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 174, rectPanel.y + 91, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 251, rectPanel.y + 91, ngextra.w(), ngextra.h()));
coordDifficulty.push_back(Rect(rectPanel.x + 328, rectPanel.y + 91, ngextra.w(), ngextra.h()));
buttonSelectMaps = new Button(rectPanel.x + 309, rectPanel.y + 45, ICN::NGEXTRA, 64, 65);
buttonOk = new Button(rectPanel.x + 31, rectPanel.y + 380, ICN::NGEXTRA, 66, 67);
buttonCancel = new Button(rectPanel.x + 287, rectPanel.y + 380, ICN::NGEXTRA, 68, 69);
back.Blit(top);
}
const bool reset_starting_settings = conf.MapsFile().empty() || ! IsFile(conf.MapsFile());
Players & players = conf.GetPlayers();
Interface::PlayersInfo playersInfo(true, !conf.QVGA(), !conf.QVGA());
// set first maps settings
if(reset_starting_settings)
conf.SetCurrentFileInfo(lists.front());
playersInfo.UpdateInfo(players, pointOpponentInfo, pointClassInfo);
//.........这里部分代码省略.........
示例2: OpenDialog
/* readonly: false, fade: false */
Dialog::answer_t Heroes::OpenDialog(bool readonly, bool fade)
{
if(Settings::Get().QVGA()) return PocketPC::HeroesOpenDialog(*this, readonly);
Display & display = Display::Get();
Cursor & cursor = Cursor::Get();
cursor.Hide();
cursor.SetThemes(cursor.POINTER);
Dialog::FrameBorder background;
background.SetPosition((display.w() - 640 - BORDERWIDTH * 2) / 2, (display.h() - 480 - BORDERWIDTH * 2) / 2, 640, 480);
background.Redraw();
const Point cur_pt(background.GetArea().x, background.GetArea().y);
Point dst_pt(cur_pt);
// fade
if(fade && Settings::Get().ExtGameUseFade()) display.Fade();
display.FillRect(0, 0, 0, Rect(dst_pt, 640, 480));
AGG::GetICN(ICN::HEROBKG, 0).Blit(dst_pt);
AGG::GetICN(Settings::Get().ExtGameEvilInterface() ? ICN::HEROEXTE : ICN::HEROEXTG, 0).Blit(dst_pt);
std::string message;
// portrait
dst_pt.x = cur_pt.x + 49;
dst_pt.y = cur_pt.y + 31;
GetPortrait101x93().Blit(dst_pt, display);
// name
message = _("%{name} the %{race} ( Level %{level} )");
String::Replace(message, "%{name}", name);
String::Replace(message, "%{race}", Race::String(race));
String::Replace(message, "%{level}", GetLevel());
Text text(message, Font::BIG);
text.Blit(cur_pt.x + 320 - text.w() / 2, cur_pt.y + 1);
// attack
text.Set(_("Attack Skill"), Font::SMALL);
dst_pt.x = cur_pt.x + 196;
dst_pt.y = cur_pt.y + 34;
text.Blit(dst_pt.x - text.w() / 2, dst_pt.y);
text.Set(GetString(GetAttack()), Font::BIG);
dst_pt.y += 70;
text.Blit(dst_pt.x - text.w() / 2, dst_pt.y);
const Rect rectAttackSkill(cur_pt.x + 156, cur_pt.y + 30, 80, 92);
std::string attackDescription(_("Your attack skill is a bonus added to each creature's attack skill."));
message.clear();
GetAttack(&message);
if(message.size())
{
attackDescription.append("\n \n");
attackDescription.append(_("Current Modifiers:"));
attackDescription.append("\n \n");
attackDescription.append(message);
}
// defense
dst_pt.x = cur_pt.x + 284;
dst_pt.y = cur_pt.y + 34;
text.Set(_("Defense Skill"), Font::SMALL);
text.Blit(dst_pt.x - text.w() / 2, dst_pt.y);
dst_pt.y += 70;
text.Set(GetString(GetDefense()), Font::BIG);
text.Blit(dst_pt.x - text.w() / 2, dst_pt.y);
const Rect rectDefenseSkill(cur_pt.x + 156 + 88, cur_pt.y + 30, 80, 92);
std::string defenseDescription(_("Your defense skill is a bonus added to each creature's defense skill."));
message.clear();
GetDefense(&message);
if(message.size())
{
defenseDescription.append("\n \n");
defenseDescription.append(_("Current Modifiers:"));
defenseDescription.append("\n \n");
defenseDescription.append(message);
}
// spell
dst_pt.x = cur_pt.x + 372;
dst_pt.y = cur_pt.y + 34;
text.Set(_("Spell Power"), Font::SMALL);
text.Blit(dst_pt.x - text.w() / 2, dst_pt.y);
dst_pt.y += 70;
text.Set(GetString(GetPower()), Font::BIG);
text.Blit(dst_pt.x - text.w() / 2, dst_pt.y);
const Rect rectSpellSkill(cur_pt.x + 156 + 2 * 88, cur_pt.y + 30, 80, 92);
std::string powerDescription(_("Your spell power determines the length or power of a spell."));
message.clear();
GetPower(&message);
//.........这里部分代码省略.........
示例3: ThievesGuild
void PocketPC::ThievesGuild(bool oracle)
{
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);
background.Blit(Rect(0, 0, window_w, window_h), dst_rt);
const Point & cur_pt = dst_rt;
Point dst_pt(cur_pt);
const u8 count = oracle ? 0xFF : world.GetKingdom(Settings::Get().CurrentColor()).GetCountBuilding(BUILD_THIEVESGUILD);
std::vector<ValueColors> v;
v.reserve(KINGDOMMAX);
const Colors colors(Game::GetActualKingdomColors());
u16 textx = 115;
u16 startx = 120;
u16 maxw = 200;
Text text;
text.Set(Font::SMALL);
// head 1
u8 ii = 0;
for(ii = 0; ii < colors.size(); ++ii)
{
switch(ii+1)
{
case 1: text.Set(_("1st")); break;
case 2: text.Set(_("2nd")); break;
case 3: text.Set(_("3rd")); break;
case 4: text.Set(_("4th")); break;
case 5: text.Set(_("5th")); break;
case 6: text.Set(_("6th")); break;
default: break;
}
dst_pt.x = cur_pt.x + startx + maxw / (colors.size() * 2) + ii * maxw / colors.size() - text.w() / 2;
dst_pt.y = cur_pt.y + 25;
text.Blit(dst_pt);
}
// button exit
const Rect rectExit(dst_rt.x + dst_rt.w - 26, dst_rt.y + 7, 25, 25);
AGG::GetICN(ICN::TOWNWIND, 12).Blit(rectExit.x, rectExit.y);
text.Set(_("Number of Towns:"));
dst_pt.x = cur_pt.x + textx - text.w();
dst_pt.y = cur_pt.y + 35;
text.Blit(dst_pt);
dst_pt.x = cur_pt.x + startx;
GetTownsInfo(v, colors);
DrawFlags(v, dst_pt, maxw, colors.size());
text.Set(_("Number of Castles:"));
dst_pt.x = cur_pt.x + textx - text.w();
dst_pt.y = cur_pt.y + 47;
text.Blit(dst_pt);
dst_pt.x = cur_pt.x + startx;
GetCastlesInfo(v, colors);
DrawFlags(v, dst_pt, maxw, colors.size());
text.Set(_("Number of Heroes:"));
dst_pt.x = cur_pt.x + textx - text.w();
dst_pt.y = cur_pt.y + 59;
text.Blit(dst_pt);
dst_pt.x = cur_pt.x + startx;
GetHeroesInfo(v, colors);
DrawFlags(v, dst_pt, maxw, colors.size());
text.Set(_("Gold in Treasury:"));
dst_pt.x = cur_pt.x + textx - text.w();
dst_pt.y = cur_pt.y + 71;
text.Blit(dst_pt);
dst_pt.x = cur_pt.x + startx;
GetGoldsInfo(v, colors);
if(1 < count) DrawFlags(v, dst_pt, maxw, colors.size());
text.Set(_("Wood & Ore:"));
dst_pt.x = cur_pt.x + textx - text.w();
dst_pt.y = cur_pt.y + 83;
text.Blit(dst_pt);
dst_pt.x = cur_pt.x + startx;
//.........这里部分代码省略.........
示例4: ActionSpellTownPortal
bool ActionSpellTownPortal(Heroes & hero)
{
const Kingdom & kingdom = world.GetKingdom(hero.GetColor());
std::vector<s32> castles;
Display & display = Display::Get();
Cursor & cursor = Cursor::Get();
LocalEvent & le = LocalEvent::Get();
cursor.Hide();
cursor.SetThemes(cursor.POINTER);
for(KingdomCastles::const_iterator it = kingdom.GetCastles().begin(); it != kingdom.GetCastles().end(); ++it)
if(*it && !(*it)->GetHeroes().Guest()) castles.push_back((**it).GetIndex());
if(castles.empty())
{
Dialog::Message("", _("No avaialble town. Spell Failed!!!"), Font::BIG, Dialog::OK);
return false;
}
const u16 window_w = 280;
const u16 window_h = 200;
Dialog::FrameBorder* frameborder = new Dialog::FrameBorder();
frameborder->SetPosition((display.w() - window_w) / 2 - BORDERWIDTH, (display.h() - window_h) / 2 - BORDERWIDTH, window_w, window_h);
frameborder->Redraw();
const Rect & area = frameborder->GetArea();
const Sprite & background = AGG::GetICN(ICN::STONEBAK, 0);
background.Blit(Rect(0, 0, window_w, window_h), area);
u16 result = Dialog::ZERO;
CastleIndexListBox listbox(area, result);
listbox.RedrawBackground(area);
listbox.SetScrollButtonUp(ICN::LISTBOX, 3, 4, Point(area.x + 256, area.y + 55));
listbox.SetScrollButtonDn(ICN::LISTBOX, 5, 6, Point(area.x + 256, area.y + 145));
listbox.SetScrollSplitter(AGG::GetICN(ICN::LISTBOX, 10), Rect(area.x + 261, area.y + 78, 14, 64));
listbox.SetAreaMaxItems(5);
listbox.SetAreaItems(Rect(area.x + 10, area.y + 60, 250, 100));
listbox.SetListContent(castles);
listbox.Redraw();
ButtonGroups btnGroups(area, Dialog::OK|Dialog::CANCEL);
btnGroups.Draw();
cursor.Show();
display.Flip();
while(result == Dialog::ZERO && le.HandleEvents())
{
result = btnGroups.QueueEventProcessing();
listbox.QueueEventProcessing();
if(!cursor.isVisible())
{
listbox.Redraw();
cursor.Show();
display.Flip();
}
}
delete frameborder;
// store
if(result == Dialog::OK)
return HeroesTownGate(hero, world.GetCastle(listbox.GetCurrent()));
return false;
}
示例5: ExtSettings
void Dialog::ExtSettings(bool readonly)
{
Display & display = Display::Get();
const Settings & conf = Settings::Get();
// cursor
Cursor & cursor = Cursor::Get();
cursor.Hide();
cursor.SetThemes(cursor.POINTER);
const u16 window_w = 320;
const u16 window_h = conf.QVGA() ? 224 : 400;
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 & area = frameborder.GetArea();
const Sprite & background = AGG::GetICN(ICN::STONEBAK, 0);
background.Blit(Rect(0, 0, window_w, window_h), area);
Text text("FHeroes2 Settings", Font::YELLOW_BIG);
text.Blit(area.x + (area.w - text.w()) / 2, area.y + 6);
std::vector<u32> states;
states.reserve(64);
states.push_back(Settings::GAME_SAVE_REWRITE_CONFIRM);
states.push_back(Settings::GAME_ALSO_CONFIRM_AUTOSAVE);
states.push_back(Settings::GAME_REMEMBER_LAST_FOCUS);
states.push_back(Settings::GAME_SHOW_SYSTEM_INFO);
states.push_back(Settings::GAME_EVIL_INTERFACE);
states.push_back(Settings::GAME_BATTLE_SHOW_GRID);
states.push_back(Settings::GAME_BATTLE_SHOW_MOUSE_SHADOW);
states.push_back(Settings::GAME_BATTLE_SHOW_MOVE_SHADOW);
states.push_back(Settings::GAME_BATTLE_SHOW_DAMAGE);
if(! conf.QVGA())
{
states.push_back(Settings::GAME_CASTLE_FLASH_BUILDING);
states.push_back(Settings::GAME_HIDE_INTERFACE);
}
if(!conf.PocketPC())
states.push_back(Settings::GAME_DYNAMIC_INTERFACE);
states.push_back(Settings::GAME_AUTOSAVE_ON);
states.push_back(Settings::GAME_AUTOSAVE_BEGIN_DAY);
if(conf.VideoMode().w == 640 && conf.VideoMode().h == 480)
states.push_back(Settings::GAME_USE_FADE);
#ifdef BUILD_RELEASE
states.push_back(Settings::GAME_SHOW_SDL_LOGO);
#endif
states.push_back(Settings::GAME_CONTINUE_AFTER_VICTORY);
states.push_back(Settings::WORLD_SHOW_VISITED_CONTENT);
states.push_back(Settings::WORLD_ABANDONED_MINE_RANDOM);
states.push_back(Settings::WORLD_SAVE_MONSTER_BATTLE);
states.push_back(Settings::WORLD_ALLOW_SET_GUARDIAN);
states.push_back(Settings::WORLD_GUARDIAN_TWO_DEFENSE);
states.push_back(Settings::WORLD_EXT_OBJECTS_CAPTURED);
states.push_back(Settings::WORLD_NOREQ_FOR_ARTIFACTS);
states.push_back(Settings::WORLD_SCOUTING_EXTENDED);
states.push_back(Settings::WORLD_ARTSPRING_SEPARATELY_VISIT);
states.push_back(Settings::WORLD_ARTIFACT_CRYSTAL_BALL);
states.push_back(Settings::WORLD_ONLY_FIRST_MONSTER_ATTACK);
states.push_back(Settings::WORLD_EYE_EAGLE_AS_SCHOLAR);
states.push_back(Settings::WORLD_BAN_WEEKOF);
states.push_back(Settings::WORLD_NEW_VERSION_WEEKOF);
states.push_back(Settings::WORLD_BAN_PLAGUES);
states.push_back(Settings::WORLD_BAN_MONTHOF_MONSTERS);
states.push_back(Settings::WORLD_STARTHERO_LOSSCOND4HUMANS);
states.push_back(Settings::WORLD_1HERO_HIRED_EVERY_WEEK);
states.push_back(Settings::CASTLE_1HERO_HIRED_EVERY_WEEK);
states.push_back(Settings::WORLD_DWELLING_ACCUMULATE_UNITS);
states.push_back(Settings::WORLD_USE_UNIQUE_ARTIFACTS_ML);
states.push_back(Settings::WORLD_USE_UNIQUE_ARTIFACTS_RS);
states.push_back(Settings::WORLD_USE_UNIQUE_ARTIFACTS_PS);
states.push_back(Settings::WORLD_USE_UNIQUE_ARTIFACTS_SS);
states.push_back(Settings::WORLD_DISABLE_BARROW_MOUNDS);
states.push_back(Settings::HEROES_BUY_BOOK_FROM_SHRINES);
states.push_back(Settings::HEROES_LEARN_SPELLS_WITH_DAY);
states.push_back(Settings::HEROES_COST_DEPENDED_FROM_LEVEL);
states.push_back(Settings::HEROES_REMEMBER_POINTS_RETREAT);
states.push_back(Settings::HEROES_SURRENDERING_GIVE_EXP);
states.push_back(Settings::HEROES_RECALCULATE_MOVEMENT);
states.push_back(Settings::HEROES_PATROL_ALLOW_PICKUP);
states.push_back(Settings::HEROES_AUTO_MOVE_BATTLE_DST);
states.push_back(Settings::HEROES_TRANSCRIBING_SCROLLS);
states.push_back(Settings::HEROES_ALLOW_BANNED_SECSKILLS);
states.push_back(Settings::HEROES_ARENA_ANY_SKILLS);
if(! conf.QVGA())
states.push_back(Settings::CASTLE_ALLOW_BUY_FROM_WELL);
states.push_back(Settings::CASTLE_ALLOW_GUARDIANS);
states.push_back(Settings::CASTLE_MAGEGUILD_POINTS_TURN);
states.push_back(Settings::CASTLE_ALLOW_RECRUITS_SPECIAL);
//.........这里部分代码省略.........
示例6: OpenMageGuild
void Castle::OpenMageGuild(void)
{
Display & display = Display::Get();
// cursor
Cursor & cursor = Cursor::Get();
cursor.Hide();
Dialog::FrameBorder frameborder;
frameborder.SetPosition((display.w() - 640 - BORDERWIDTH * 2) / 2, (display.h() - 480 - BORDERWIDTH * 2) / 2, 640, 480);
frameborder.Redraw();
const Point cur_pt(frameborder.GetArea().x, frameborder.GetArea().y);
Point dst_pt(cur_pt);
AGG::GetICN(ICN::STONEBAK, 0).Blit(dst_pt);
std::string message;
Text text;
// bar
dst_pt.x = cur_pt.x;
dst_pt.y = cur_pt.y + 461;
AGG::GetICN(ICN::WELLXTRA, 2).Blit(dst_pt);
// text bar
text.Set(_("The above spells have been added to your book."), Font::BIG);
dst_pt.x = cur_pt.x + 280 - text.w() / 2;
dst_pt.y = cur_pt.y + 461;
text.Blit(dst_pt);
const u8 level = GetLevelMageGuild();
// sprite
ICN::icn_t icn = ICN::UNKNOWN;
switch(race)
{
case Race::KNGT: icn = ICN::MAGEGLDK; break;
case Race::BARB: icn = ICN::MAGEGLDB; break;
case Race::SORC: icn = ICN::MAGEGLDS; break;
case Race::WRLK: icn = ICN::MAGEGLDW; break;
case Race::WZRD: icn = ICN::MAGEGLDZ; break;
case Race::NECR: icn = ICN::MAGEGLDN; break;
default: break;
}
const Sprite & sprite = AGG::GetICN(icn, level - 1);
dst_pt.x = cur_pt.x + 90 - sprite.w() / 2;
dst_pt.y = cur_pt.y + 290 - sprite.h();
sprite.Blit(dst_pt);
RowSpells spells5(Point(cur_pt.x + 250, cur_pt.y + 5), *this, 5);
RowSpells spells4(Point(cur_pt.x + 250, cur_pt.y + 95), *this, 4);
RowSpells spells3(Point(cur_pt.x + 250, cur_pt.y + 185), *this, 3);
RowSpells spells2(Point(cur_pt.x + 250, cur_pt.y + 275), *this, 2);
RowSpells spells1(Point(cur_pt.x + 250, cur_pt.y + 365), *this, 1);
spells1.Redraw();
spells2.Redraw();
spells3.Redraw();
spells4.Redraw();
spells5.Redraw();
// button exit
dst_pt.x = cur_pt.x + 578;
dst_pt.y = cur_pt.y + 461;
Button buttonExit(dst_pt, ICN::WELLXTRA, 0, 1);
buttonExit.Draw();
cursor.Show();
display.Flip();
LocalEvent & le = LocalEvent::Get();
// message loop
while(le.HandleEvents())
{
le.MousePressLeft(buttonExit) ? buttonExit.PressDraw() : buttonExit.ReleaseDraw();
if(le.MouseClickLeft(buttonExit) || HotKeyCloseWindow) break;
if(spells1.QueueEventProcessing() ||
spells2.QueueEventProcessing() ||
spells3.QueueEventProcessing() ||
spells4.QueueEventProcessing() ||
spells5.QueueEventProcessing());
}
}
示例7: MakeGiftResource
void Dialog::MakeGiftResource(void)
{
Cursor & cursor = Cursor::Get();
Display & display = Display::Get();
LocalEvent & le = LocalEvent::Get();
const Settings & conf = Settings::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 & box = frameborder.GetArea();
const Sprite & background = AGG::GetICN(ICN::STONEBAK, 0);
background.Blit(Rect(0, 0, window_w, window_h), box);
Kingdom & myKingdom = world.GetKingdom(conf.CurrentColor());
Funds funds1(myKingdom.GetFunds());
Funds funds2;
Text text;
text.Set("Select Recipients");
text.Blit(box.x + (box.w - text.w()) / 2, box.y + 5);
SelectRecipientsColors selector(Point(box.x + 65, box.y + 28));
selector.Redraw();
text.Set("Your Funds");
text.Blit(box.x + (box.w - text.w()) / 2, box.y + 55);
ResourceBar info1(funds1, box.x + 25, box.y + 80);
info1.Redraw();
text.Set("Planned Gift");
text.Blit(box.x + (box.w - text.w()) / 2, box.y + 125);
ResourceBar info2(funds2, box.x + 25, box.y + 150);
info2.Redraw();
ButtonGroups btnGroups(box, Dialog::OK|Dialog::CANCEL);
btnGroups.DisableButton1(true);
btnGroups.Draw();
cursor.Show();
display.Flip();
u8 count = Color::Count(selector.recipients);
// message loop
u16 result = Dialog::ZERO;
while(result == Dialog::ZERO && le.HandleEvents())
{
if(selector.QueueEventProcessing())
{
u8 new_count = Color::Count(selector.recipients);
cursor.Hide();
btnGroups.DisableButton1(0 == new_count || 0 == funds2.GetValidItems());
if(count != new_count)
{
funds1 = myKingdom.GetFunds();
funds2.Reset();
info1.Redraw();
info2.Redraw();
count = new_count;
}
btnGroups.Draw();
selector.Redraw();
cursor.Show();
display.Flip();
}
else
if(info2.QueueEventProcessing(funds1, count))
{
cursor.Hide();
btnGroups.DisableButton1(0 == Color::Count(selector.recipients) || 0 == funds2.GetValidItems());
info1.Redraw();
info2.Redraw();
btnGroups.Draw();
cursor.Show();
display.Flip();
}
result = btnGroups.QueueEventProcessing();
}
if(Dialog::OK == result)
{
EventDate event;
event.resource = funds2;
event.computer = true;
//.........这里部分代码省略.........
示例8: 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);
display.Blit(background, Rect(0, 0, window_w, window_h), dst_rt);
// portrait
display.Blit(AGG::GetICN(ICN::BRCREST, 6), dst_rt.x + 8, dst_rt.y);
display.Blit(hero.GetPortrait50x46(), dst_rt.x + 12, dst_rt.y + 4);
// 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);
display.Blit(backSprite, Rect(216, 51, ras.w, ras.h), ras);
message.clear();
String::AddInt(message, hero.GetAttack());
text.Set(message);
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);
display.Blit(backSprite, Rect(216, 84, rds.w, rds.h), rds);
message.clear();
String::AddInt(message, hero.GetDefense());
text.Set(message);
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);
display.Blit(backSprite, Rect(216, 117, rps.w, rps.h), rps);
message.clear();
String::AddInt(message, hero.GetPower());
text.Set(message);
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);
display.Blit(backSprite, Rect(216, 150, rks.w, rks.h), rks);
message.clear();
String::AddInt(message, hero.GetKnowledge());
text.Set(message);
text.Blit(dst_rt.x + 173 + (34 - text.w()) / 2, dst_rt.y + 47);
// sec skill
display.Blit(backSprite, 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);
sfb1.Blit(backSprite, rt1, 0, 0);
Surface sfc1(rt1.w, rt1.h - 10);
Cursor::DrawCursor(sfc1, 0xd6, true);
SelectArmyBar selectArmy;
//.........这里部分代码省略.........