void Board::resumeGame() { m_paused = false; if (m_flash_frame > -1) { m_flash_timer->start(); } else { m_shift_timer->start(); } emit hideMessage(); update(); setCursor(Qt::BlankCursor); emit pauseAvailable(true); }
void Board::pauseGame() { m_paused = true; if (m_flash_frame > -1) { m_flash_timer->stop(); } else { m_shift_timer->stop(); } update(); emit showMessage(tr("<big><b>Paused</b></big><br>Click to resume playing.")); unsetCursor(); emit pauseAvailable(false); }
void Board::newGame() { if (!endGame()) { return; } m_flash_timer->stop(); m_shift_timer->stop(); delete m_piece; m_piece = 0; emit hideMessage(); m_started = true; m_done = false; m_paused = false; m_removed_lines = 0; m_level = 1; m_score = 0; m_shift_timer->setInterval(m_shiftTime); m_next_piece = (rand() % 7) + 1; m_topCellY = 19; m_difficultyLevel = FirstLevel; m_shiftTime = m_firstLevelShiftTime; for (int i = 0; i < 4; ++i) m_full_lines[i] = -1; for (int col = 0; col < 10; ++col) { for (int row = 0; row < 20; ++row) { m_cells[col][row] = 0; } } emit pauseAvailable(true); emit levelUpdated(m_level); emit linesRemovedUpdated(m_removed_lines); emit scoreUpdated(m_score); emit gameStarted(); setCursor(Qt::BlankCursor); createPiece(); }
int Board::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: pauseChecked((*reinterpret_cast< bool(*)>(_a[1]))); break; case 1: pauseAvailable((*reinterpret_cast< bool(*)>(_a[1]))); break; case 2: finished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3])),(*reinterpret_cast< int(*)>(_a[4]))); break; case 3: newGame(); break; case 4: loadGame(); break; case 5: saveGame(); break; case 6: pauseGame((*reinterpret_cast< bool(*)>(_a[1]))); break; case 7: loadSettings(); break; case 8: focusChanged(); break; case 9: updateStatusMessage(); break; case 10: move(); break; default: ; } _id -= 11; } return _id; }