/* Display the game menu */ int btnMenu(struct pgEvent *evt) { switch (pgMenuFromString("New Game...|Restart Level...|Show Solution|About...")) { case 1: menuNewGame(); break; case 2: menuRestartLevel(); break; case 3: menuShowSolution(); break; case 4: menuAbout(); break; } }
GameScene::GameScene(QWidget *parent) : QGraphicsScene(parent), myLock(false) { inputDisabled = true; dconfirm = new ConfirmDialog(); addWidget(dconfirm, Qt::FramelessWindowHint); dconfirm->hide(); menu = new MenuWidget(); addWidget(menu); menu->activate(); connect(menu, SIGNAL(menuNew()), this, SLOT(on_menuNew())); connect(menu, SIGNAL(menuContinue()), this, SLOT(on_menuContinue())); connect(menu, SIGNAL(menuExit()), this, SLOT(on_menuExit())); connect(menu, SIGNAL(menuPauseBack()), this, SLOT(on_menuPauseBack())); connect(menu, SIGNAL(menuRestartLevel()), this, SLOT(on_menuRestartLevel())); connect(menu, SIGNAL(menuAbandonGame()), this, SLOT(on_menuAbandonGame())); connect(menu, SIGNAL(menuThemeChanged()), this, SLOT(on_menuThemeChanged())); connect(menu, SIGNAL(menuGameStart()), this, SLOT(on_menuGameStart())); connect(menu, SIGNAL(menuLevelPack()), this, SLOT(on_menuLevelPack())); stat = new StatInfo(); connect(gameProfile, SIGNAL(profileChanged()), this, SLOT(initProfile())); rows = cols = 0; xoff = 20; yoff = 10; advanceTimer = new QTimer(this); advanceTimer->setInterval(30); connect(advanceTimer, SIGNAL(timeout()), this, SLOT(nextCycle())); timeTimer = new QTimer(this); timeTimer->setInterval(1000); connect(timeTimer, SIGNAL(timeout()), this, SLOT(countTime())); bonusTimer = new QTimer(this); bonusTimer->setInterval(500); connect(bonusTimer, SIGNAL(timeout()), this, SLOT(countBonusTime())); hintTimer = new QTimer(this); hintTimer->setInterval(10000); connect(hintTimer, SIGNAL(timeout()), this, SLOT(hintAvailableMoves())); // init components GameStock::init(); toolset = new ToolSet(); gameBonus = new GameBonus(); setSceneRect(0,0, WIDTH, HEIGHT); // set background gameBackground = new GameBackground(); setBackgroundBrush(Qt::black); setDefaultGameCursor(); // update max level for current pack max_level = gameProfile->levelPackCount(gameProfile->currentLevelPack()); // very first initialization initGame(); }
void MenuWidget::on_bPauseRestart_clicked() { emit menuRestartLevel(); }