int VideoDevices::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: btn_ok(); break; default: ; } _id -= 1; } return _id; }
void Battle2::DialogBattleSettings(void) { Display & display = Display::Get(); Cursor & cursor = Cursor::Get(); LocalEvent & le = LocalEvent::Get(); Settings & conf = Settings::Get(); cursor.Hide(); const Sprite & dialog = AGG::GetICN((conf.EvilInterface() ? ICN::CSPANBKE : ICN::CSPANBKG), 0); Rect pos_rt; pos_rt.x = (display.w() - dialog.w()) / 2; pos_rt.y = (display.h() - dialog.h()) / 2; pos_rt.w = dialog.w(); pos_rt.h = dialog.h(); Background back(pos_rt); back.Save(); display.FillRect(0x00, 0x00, 0x00, back.GetRect()); display.Blit(dialog, pos_rt.x, pos_rt.y); Button btn_ok(pos_rt.x + 113, pos_rt.y + 252, (conf.EvilInterface() ? ICN::CSPANBTE : ICN::CSPANBTN), 0, 1); Button opt_grid(pos_rt.x + 36, pos_rt.y + 157, ICN::CSPANEL, 8, 9); Button opt_shadow_movement(pos_rt.x + 128, pos_rt.y + 157, ICN::CSPANEL, 10, 11); Button opt_shadow_cursor(pos_rt.x + 220, pos_rt.y + 157, ICN::CSPANEL, 12, 13); btn_ok.Draw(); if(conf.ExtBattleShowGrid()) opt_grid.Press(); if(conf.ExtBattleShowMoveShadow()) opt_shadow_movement.Press(); if(conf.ExtBattleShowMouseShadow()) opt_shadow_cursor.Press(); opt_grid.Draw(); opt_shadow_movement.Draw(); opt_shadow_cursor.Draw(); cursor.Show(); display.Flip(); while(le.HandleEvents()) { le.MousePressLeft(btn_ok) ? btn_ok.PressDraw() : btn_ok.ReleaseDraw(); if(le.MouseClickLeft(opt_grid)) { conf.SetBattleGrid(!conf.ExtBattleShowGrid()); cursor.Hide(); opt_grid.isPressed() ? opt_grid.Release() : opt_grid.Press(); opt_grid.Draw(); cursor.Show(); display.Flip(); } if(le.MouseClickLeft(opt_shadow_movement)) { conf.SetBattleMovementShaded(!conf.ExtBattleShowMoveShadow()); cursor.Hide(); opt_shadow_movement.isPressed() ? opt_shadow_movement.Release() : opt_shadow_movement.Press(); opt_shadow_movement.Draw(); cursor.Show(); display.Flip(); } if(le.MouseClickLeft(opt_shadow_cursor)) { conf.SetBattleMouseShaded(!conf.ExtBattleShowMouseShadow()); cursor.Hide(); opt_shadow_cursor.isPressed() ? opt_shadow_cursor.Release() : opt_shadow_cursor.Press(); opt_shadow_cursor.Draw(); cursor.Show(); display.Flip(); } // exit if(le.KeyPress(KEY_ESCAPE) || le.MouseClickLeft(btn_ok)) break; } // restore background cursor.Hide(); back.Restore(); cursor.Show(); display.Flip(); }
void Battle2::Arena::DialogBattleSummary(const Result & res) const { Display & display = Display::Get(); Cursor & cursor = Cursor::Get(); LocalEvent & le = LocalEvent::Get(); Settings & conf = Settings::Get(); Army::army_t killed1; army1.BattleExportKilled(killed1); Army::army_t killed2; army2.BattleExportKilled(killed2); cursor.Hide(); cursor.SetThemes(Cursor::POINTER); std::string msg; ICN::icn_t icn_anim = ICN::UNKNOWN; if((res.army1 & RESULT_WINS) && army1.GetCommander() && Game::AI != army1.GetCommander()->GetControl()) { GetSummaryParams(res.army1, res.army2, army1.GetCommander()->GetName(), res.exp, icn_anim, msg); if(conf.Music()) AGG::PlayMusic(MUS::BATTLEWIN, false); } else if((res.army2 & RESULT_WINS) && army2.GetCommander() && Game::AI != army2.GetCommander()->GetControl()) { GetSummaryParams(res.army2, res.army1, army2.GetCommander()->GetName(), res.exp, icn_anim, msg); if(conf.Music()) AGG::PlayMusic(MUS::BATTLEWIN, false); } else if(army1.GetCommander() && Game::AI != army1.GetCommander()->GetControl()) { GetSummaryParams(res.army1, res.army2, army1.GetCommander()->GetName(), res.exp, icn_anim, msg); if(conf.Music()) AGG::PlayMusic(MUS::BATTLELOSE, false); } else if(army2.GetCommander() && Game::AI != army2.GetCommander()->GetControl()) { GetSummaryParams(res.army2, res.army1, army2.GetCommander()->GetName(), res.exp, icn_anim, msg); if(conf.Music()) AGG::PlayMusic(MUS::BATTLELOSE, false); } else // AI move if(army1.GetCommander() && Game::AI == army1.GetCommander()->GetControl()) { // AI wins if(res.army1 & RESULT_WINS) { icn_anim = ICN::CMBTLOS3; msg.append(_("Your force suffer a bitter defeat.")); } else // Human wins if(res.army2 & RESULT_WINS) { icn_anim = ICN::WINCMBT; msg.append(_("A glorious victory!")); } } const Sprite & dialog = AGG::GetICN((conf.EvilInterface() ? ICN::WINLOSEE : ICN::WINLOSE), 0); Rect pos_rt; pos_rt.x = (display.w() - dialog.w()) / 2; pos_rt.y = (display.h() - (conf.QVGA() ? 224 : dialog.h())) / 2; pos_rt.w = dialog.w(); pos_rt.h = conf.QVGA() ? 224 : dialog.h(); Background back(pos_rt); back.Save(); if(conf.QVGA()) { display.Blit(dialog, Rect(0, 232, pos_rt.w, 224), pos_rt.x, pos_rt.y); display.Blit(dialog, Rect(0, 0, pos_rt.w, 30), pos_rt.x, pos_rt.y); } else display.Blit(dialog, pos_rt.x, pos_rt.y); const u8 anime_ox = 47; const u8 anime_oy = 36; if(!conf.QVGA()) { const Sprite & sprite1 = AGG::GetICN(icn_anim, 0); const Sprite & sprite2 = AGG::GetICN(icn_anim, 1); display.Blit(sprite1, pos_rt.x + anime_ox + sprite1.x(), pos_rt.y + anime_oy + sprite1.y()); display.Blit(sprite2, pos_rt.x + anime_ox + sprite2.x(), pos_rt.y + anime_oy + sprite2.y()); } Button btn_ok(pos_rt.x + 121, pos_rt.y + (conf.QVGA() ? 176 : 410), (conf.EvilInterface() ? ICN::WINCMBBE : ICN::WINCMBTB), 0, 1); TextBox box(msg, Font::BIG, 270); box.Blit(pos_rt.x + 25, pos_rt.y + (conf.QVGA() ? 20 : 175)); // battlefield casualties Text text(_("Battlefield Casualties"), Font::SMALL); text.Blit(pos_rt.x + (pos_rt.w - text.w()) / 2, pos_rt.y + (conf.QVGA() ? 58 : 270)); // attacker text.Set(_("Attacker"), Font::SMALL); text.Blit(pos_rt.x + (pos_rt.w - text.w()) / 2, pos_rt.y + (conf.QVGA() ? 70 : 285)); if(killed1.isValid()) killed1.DrawMons32Line(pos_rt.x + 25, pos_rt.y + (conf.QVGA() ? 83 : 303), 270); else { text.Set("None", Font::SMALL); text.Blit(pos_rt.x + (pos_rt.w - text.w()) / 2, pos_rt.y + (conf.QVGA() ? 80 : 300)); } // defender text.Set(_("Defender"), Font::SMALL); text.Blit(pos_rt.x + (pos_rt.w - text.w()) / 2, pos_rt.y + (conf.QVGA() ? 120 : 345)); if(killed2.isValid()) killed2.DrawMons32Line(pos_rt.x + 25, pos_rt.y + (conf.QVGA() ? 138 : 363), 270); else { text.Set("None", Font::SMALL); text.Blit(pos_rt.x + (pos_rt.w - text.w()) / 2, pos_rt.y + (conf.QVGA() ? 135 : 360)); } btn_ok.Draw(); cursor.Show(); display.Flip(); u32 frame = 0; u32 ticket = 0; while(le.HandleEvents()) { le.MousePressLeft(btn_ok) ? btn_ok.PressDraw() : btn_ok.ReleaseDraw(); // exit if(le.KeyPress(KEY_ESCAPE) || le.KeyPress(KEY_RETURN) || le.MouseClickLeft(btn_ok)) break; // animation if(!conf.QVGA() && Game::ShouldAnimateInfrequent(ticket, 6)) { const Sprite & sprite1 = AGG::GetICN(icn_anim, 0); const Sprite & sprite2 = AGG::GetICN(icn_anim, ICN::AnimationFrame(icn_anim, 1, frame)); cursor.Hide(); display.Blit(sprite1, pos_rt.x + anime_ox + sprite1.x(), pos_rt.y + anime_oy + sprite1.y()); display.Blit(sprite2, pos_rt.x + anime_ox + sprite2.x(), pos_rt.y + anime_oy + sprite2.y()); cursor.Show(); display.Flip(); ++frame; } ++ticket; } // restore background cursor.Hide(); back.Restore(); cursor.Show(); display.Flip(); }
void PowerlinePrompt::init() { connect(ui->but_cancel, SIGNAL(clicked()), this, SLOT(btn_cancel())); connect(ui->but_ok, SIGNAL(clicked()), this, SLOT(btn_ok())); }