/** * Kill player */ void RollingballApplet::killPlayer(bool outside) { mTmrCoinLife->stop(); mCoinVisible = false; mDead = true; mLives--; if(mLives > 0) { QSound::play(ROLLINGBALL_SND_OOPS); // Died from going out of the board if(outside) { mTmrCoinCycle->stop(); QTimer::singleShot( 1500, this, SLOT( respawn() ) ); QTimer::singleShot( 2000, this, SLOT( addCoin() ) ); } else { mDead = false; } } else { QSound::play(ROLLINGBALL_SND_GAMEOVER); stopGame(); QTimer::singleShot( 5000, this, SLOT( startGame() ) ); } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow), currentColor(QColor("#000")), game(new GameWidget(this)) { ui->setupUi(this); QPixmap icon(16, 16); icon.fill(currentColor); ui->colorButton->setIcon( QIcon(icon) ); connect(ui->startButton, SIGNAL(clicked()), game,SLOT(startGame())); connect(ui->stopButton, SIGNAL(clicked()), game,SLOT(stopGame())); connect(ui->clearButton, SIGNAL(clicked()), game,SLOT(clear())); connect(ui->iterInterval, SIGNAL(valueChanged(int)), game, SLOT(setInterval(int))); connect(ui->cellsControl, SIGNAL(valueChanged(int)), game, SLOT(setCellNumber(int))); connect(ui->colorButton, SIGNAL(clicked()), this, SLOT(selectMasterColor())); connect(ui->saveButton, SIGNAL(clicked()), this, SLOT(saveGame())); connect(ui->loadButton, SIGNAL(clicked()), this, SLOT(loadGame())); ui->mainLayout->setStretchFactor(ui->gameLayout, 8); ui->mainLayout->setStretchFactor(ui->setLayout, 2); ui->gameLayout->addWidget(game); }
Game::Game(QGraphicsScene *scene, QGraphicsView *view) { m_scene = scene; m_view = view; m_man = new Man(scene, view, this); Bubble *b = new Bubble(scene); m_text = new QGraphicsTextItem(); m_scene->addItem(m_text); m_arrow = new QGraphicsTextItem(); m_scene->addItem(m_arrow); m_timer = new QTimer(); connect(m_timer, SIGNAL(timeout()), SLOT(stopGame())); m_timer->start(50000); m_count = 50000; m_countdown = new QTimer(); connect(m_countdown, SIGNAL(timeout()), SLOT(countTime())); m_countdown->start(10); m_text->setPos(2,2); m_text->setDefaultTextColor(Qt::red); m_arrow->setPos(200,2); m_arrow->setDefaultTextColor(Qt::blue); m_num_arrow = 10; m_arrow->setPlainText("Arrows: " + QString::number(m_num_arrow)); }
void HelloWorld::BeginContact(b2Contact *contact){ if(contact->GetFixtureA()->GetBody()->GetUserData() == mBird || contact->GetFixtureB()->GetBody()->GetUserData() == mBird){ stopGame(); CCMessageBox("Game Over!", "Game Over!"); } }
void KBlocksWin::startGame() { qsrand(time(0)); mpGameLogic->setGameSeed(qrand()); if (mpGameLogic->startGame(mGameCount)) { mpPlayManager->startGame(); mpGameScene->createGameItemGroups(mGameCount, false); mpGameScene->startGame(); int levelUpTime = 0; switch ((int) Kg::difficultyLevel()) { case KgDifficultyLevel::Medium: levelUpTime = 5; break; case KgDifficultyLevel::Hard: levelUpTime = 10; break; } mpGameLogic->levelUpGame(levelUpTime); Kg::difficulty()->setGameRunning(true); } else { stopGame(); startGame(); } mScore->setText(i18n("Points: %1 - Lines: %2 - Level: %3", 0, 0, 0)); m_pauseAction->setEnabled(true); m_pauseAction->setChecked(false); }
void Window::dealMenu(void) { QMenuBar * MenuBar = new QMenuBar(this); QMenu * GameMenu = new QMenu(tr("GAME"), MenuBar); QMenu * HelpMenu = new QMenu(tr("Help"), MenuBar); QAction * StartGame = new QAction(tr("Start"), GameMenu); QAction * StopGame = new QAction(tr("End"), GameMenu); QAction * QuitGame = new QAction(tr("Quit"), GameMenu); GameMenu->addAction(StartGame); GameMenu->addAction(StopGame); GameMenu->addAction(QuitGame); MenuBar->addMenu(GameMenu); connect(StartGame, SIGNAL(triggered()), this, SLOT(startGame())); connect(StopGame, SIGNAL(triggered()), this, SLOT(stopGame())); connect(QuitGame, SIGNAL(triggered()), this, SLOT(close())); QAction * About = new QAction(tr("About"), HelpMenu); HelpMenu->addAction(About); MenuBar->addMenu(HelpMenu); connect(About, SIGNAL(triggered()), this, SLOT(showAbout())); setMenuBar(MenuBar); }
void Game::checkCollision() { if (snake->head().rect.bottom() >= 400 || snake->head().rect.top() <= 0 || snake->head().rect.left() <= 0 || snake->head().rect.right() >= 300) stopGame(); if ((snake->head().rect).intersects(food->getRect())) { food->setDestroyed(true); food = new Food((1+(rand()%6))*40+27, (1+(rand()%30))*10+47); snake->growBy(1); score += 1; } Snake::SegmentIterator iter; for (iter = ++snake->segments.begin(); iter != snake->segments.end(); ++iter) if (iter->x == snake->head().x && iter->y == snake->head().y) stopGame(); }
void Game::countArrows(){ if(m_num_arrow>0){ m_num_arrow-=1; }else{ stopGame(); } m_arrow->setPlainText("Arrows: " + QString::number(m_num_arrow)); }
void GameClass::mousePress(int x, int y) { if (startButton->getEnabled() && Util::pointInRect(x, y, startButton)) startGame(); else if (stopButton->getEnabled() && Util::pointInRect(x, y, stopButton)) stopGame(); Graphics::redraw(); }
void GameStopService::OnUpdate() { if( inputManager->wasClicked(Keys::PauseKey)){ if( isPaused_ == false ){ stopGame(); } else { startGame(); } } }
void GameScene::on_menuExit() { // ask confirmation menu->hide(); if (dconfirm->exec(tr("Are you sure you want to quit JAG?"))) { stopGame(); qApp->quit(); } menu->showNormal(); }
void kMancalaMain::historyShow(int currentRow) { if ( currentRow == -1 ) return; _manageToolbarItems(); if ( _historyListWidget->count() == 1 ) { _historyListWidget->setCurrentRow(-1); return; } qDebug("Restoring board ... to item: %d", currentRow); kMancalaHistoryItem *i = _historyListWidget->getState(currentRow); player **p = i->getPlayers(); int currentPlayer = i->getPlayerOnTurn(); _board = new board(i->getBoard()); _players[0] = new player(p[0]); _players[1] = new player(p[1]); _controller->setCurrentPlayer(i->getPlayerOnTurn()); emit playersUpdated(_players, currentPlayer); emit updateBoard(_board); emit clearGameOver(); if ( !_controller->gameOn(_board) ) { // if ( _gameOver ) return; int winner = _controller->winner(_board); player *p_winner = NULL; qDebug("Winner is %d", winner); if ( winner != -1 ) p_winner = _players[winner]; qDebug("History Game Over"); _guiBoard->play(); qDebug("Emitting gameOver"); emit gameOver(p_winner); stopGame(); qDebug("historyShow done"); } else { qDebug("Not game over ..."); _gameOver = false; _gamePaused = false; pauseGame(); } }
void GameWidget::newGeneration() { if(generations < 0) generations++; int notChanged=0; for(int k=1; k <= universeSize; k++) { for(int j=1; j <= universeSize; j++) { next[k*universeSize + j] = isAlive(k, j); if(next[k*universeSize + j] == universe[k*universeSize + j]) notChanged++; } } if(notChanged == universeSize*universeSize) { QMessageBox::information(this, tr("Game lost sense"), tr("The End. Now game finished because all the next generations will be the same."), QMessageBox::Ok); stopGame(); gameEnds(true); return; } for(int k=1; k <= universeSize; k++) { for(int j=1; j <= universeSize; j++) { universe[k*universeSize + j] = next[k*universeSize + j]; } } update(); generations--; if(generations == 0) { stopGame(); gameEnds(true); QMessageBox::information(this, tr("Game finished."), tr("Iterations finished."), QMessageBox::Ok, QMessageBox::Cancel); } }
void GameClass::update() { static int stopTimer = 0; if (stopping) { stopTimer += MS_PER_FRAME; for (int i = 0; i < STRIPES_NUMBER; ++i) { if (stripesSpeeds[i] > 0.0f) { if (stopTimer >= 300 && abs((int)offsets[i]) < OFFSET_EPS) { stripesSpeeds[i] = 0.0f; stopTimer = 0; } break; } else if (i == STRIPES_NUMBER - 1 && stopping) { // everything's been stopped stopping = false; stopped = true; startButton->setEnabled(true); calculateResult(); } } } else { startTimer += MS_PER_FRAME; if (!stopped && startTimer >= gameTime) stopGame(); } // updating stripes stripeHeight = stripeWidth * scaleFactorY; for (int i = 0; i < STRIPES_NUMBER; ++i) { offsets[i] -= stripesSpeeds[i]; if (offsets[i] < -stripeHeight) { offsets[i] += stripeHeight; for (int j = SQUARES_NUMBER; j >= 1; --j) stripes[i][j] = stripes[i][j - 1]; stripes[i][0] = rand() % items.size(); } } Graphics::redraw(); }
// doMove() is called from QTimer void Tron::doMove() { if (Settings::gameType() == Settings::EnumGameType::Snake) { players[0]->movePlayer(); modMoves++; if (modMoves == 20) { modMoves = 0; newObstacle(); } updatePixmap(); update(); if (!players[0]->isAlive()) { stopGame(); showWinner(); } } else { if (players[0]->isAccelerated() || players[1]->isAccelerated()) { movementHelper(true); } if (!gameEnded) { // Player 0 is never a computer nowadays... if (players[1]->isComputer()) { intelligence.think(1); } movementHelper(false); } } if (gameEnded) { //this is for waiting 1s before starting next game gameBlocked = true; QTimer::singleShot(1000, this, SLOT(unblockGame())); } }
void HoldLine::checkCrossLine(){ for(int i = 0; i < enemyList.size(); i++){ if(enemyList[i]->getRect().bottom() > 600){ enemyList[i]->setDir(0,10); if(enemyList[i]->getRect().top() > 700 && !enemyList[i]->isDestroyed()){ enemyList[i]->setDestroyed(true); enemyList[i]->resetState(); enemyCount++; crossedLine++; if(enemyCount == MAXENEMIES) stopGame(); } } } }
//-- destructor Spielfeld::~Spielfeld() { stopGame(); for(int y = 0 ; y < FELD_HEIGHT ; y++) { for(int x = 0 ; x < FELD_WIDTH ; x++) { if ( feld[x][y] != NULL ) { delete( feld[x][y] ); } } } }
void HelloWorld::BeginContact(b2Contact* contact) { if (contact->GetFixtureA()->GetBody()->GetUserData() == worm || contact->GetFixtureB()->GetBody()->GetUserData() == worm ) { stopGame(); isContact = true; //add message menu } }
int Breakout::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: scoreChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: levelChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: startGame(); break; case 3: pauseGame(); break; case 4: stopGame(); break; default: ; } _id -= 5; } return _id; }
void Tron::movementHelper(bool onlyAcceleratedPlayers) { if (!onlyAcceleratedPlayers || players[0]->isAccelerated()) { players[0]->movePlayer(); } if (!onlyAcceleratedPlayers || players[1]->isAccelerated()) { players[1]->movePlayer(); } /* player collision check */ if (!players[1]->isAlive()) { checkHeadToHeadCollission(); } updatePixmap(); update(); // crashtest if (!players[0]->isAlive() || !players[1]->isAlive()) { stopGame(); if (!players[0]->isAlive() && !players[1]->isAlive()) { // Don't award points when both players die //players[0]->addScore(1); //players[1]->addScore(1); } else if (!players[0]->isAlive()) { players[1]->addScore(1); } else if (!players[1]->isAlive()) { players[0]->addScore(1); } showWinner(); } }
/** * Start the game */ void RollingballApplet::startGame() { // dirty hack to prevent missing event if( !this->isVisible() ) { stopGame(); return; } // init game variables mGameOver = false; mScore = 0; mLives = 3; mLcd->display( mScore ); mCoinCoeff = 1.0; mCoinVisible = false; this->respawn(); QTimer::singleShot( 1000, this, SLOT( addCoin() ) ); }
int getTimer(){ int time = startTime - timer.getTicks(); string str; stringstream ss; stringstream ss2; ss << time; timeStr = ss.str(); int ret = atoi(timeStr.c_str()) / 10000; if (ret < 0){ createSound(5); ret = 0; is_gameover = true; ball.setXVel(0.0f); ball.setYVel(0.0f); stopGame(); //createSound(5); } return ret; }
void KBlocksWin::startGame() { if (mFirstInit) { mFirstInit = false; return; } srand(time(0)); mpGameLogic->setGameSeed(rand()); if (mpGameLogic->startGame(mGameCount)) { mpPlayManager->startGame(); mpGameScene->createGameItemGroups(mGameCount, false); mpGameScene->startGame(); int levelUpTime = 0; switch ((int) Kg::difficultyLevel()) { case KgDifficultyLevel::Medium: levelUpTime = 5; break; case KgDifficultyLevel::Hard: levelUpTime = 10; break; } mpGameLogic->levelUpGame(levelUpTime); Kg::difficulty()->setGameRunning(true); } else { stopGame(); startGame(); } statusBar()->changeItem( i18n("Points: %1 - Lines: %2 - Level: %3", 0, 0, 0), 0 ); }
void GameBoard::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_Right && !moveL) { moveR=true; } else if(event->key() == Qt::Key_Left && !moveR) { moveL=true; } else if(event->key() == Qt::Key_Space && intersect()) { isJumping=true; } else if (event->key() == Qt::Key_Escape ) { stopGame(); qApp->exit(); } else event->ignore(); }
void logout(int socket, struct sockaddr_in *addr) { userNode *reader = userList.next; while(reader != &userList && (reader->socket != socket || reader->addr.sin_addr.s_addr != addr->sin_addr.s_addr)) reader = reader->next; if(reader == &userList) return; if(reader->board != NULL) stopGame(socket, &(reader->addr)); if(reader->conType == TCP_CON) { reader->nextTCP->prevTCP = reader->prevTCP; reader->prevTCP->nextTCP = reader->nextTCP; } else { reader->nextUDP->prevUDP = reader->prevUDP; reader->prevUDP->nextUDP = reader->nextUDP; } reader->socket = -1; }
TcpServer::TcpServer(int _maxConnections, QObject *parent) : QTcpServer(parent) { game = new Game; this->isInit = false; this->order = 0; this->flag = -1; this->maxConnections = _maxConnections; colors.append(qMakePair(QString("PURPLE"),FREE)); colors.append(qMakePair(QString("BLUE"),FREE)); levels.insert("Low",300); levels.insert("Medium",250); levels.insert("High",150); timer = new QTimer(this); connect(timer, SIGNAL(timeout()),game,SLOT(loopGame())); connect(game, SIGNAL(stop(QString,QString)),this,SLOT(stopGame(QString,QString))); connect(game, SIGNAL(sendData(QList<QPair<QString,Snake*> >,QList<Food*>)), this, SIGNAL(sendData(QList<QPair<QString,Snake*> >,QList<Food*>))); }
void Tron::reset() { gamePaused = false; stopGame(); players[0]->reset(); players[1]->reset(); if (Settings::gameType() == Settings::EnumGameType::Snake) { players[0]->resetScore(); players[1]->resetScore(); } setVelocity( lineSpeed() ); modMoves = 0; pf.initialize(); // set start coordinates players[0]->setStartPosition(); if (Settings::gameType() != Settings::EnumGameType::Snake) { players[1]->setStartPosition(); } updatePixmap(); update(); setFocus(); emit gameReset(); emit updatedScore(); }
/* This method checks for collisions between the player and zomzoms or zomzom bullets and between zomzoms and player bullets, and then calls the appropriate collision methods. */ void ZomZomAttack::checkCollision() { for (int i = 0; i < zomzom.size(); i++) { if ((player->getRect()).intersects(zomzom[i]->getRect())) { zomzom[i]->collision(points, health); } else { for (int j = 0; j < pBullets.size(); j++) { if ((zomzom[i]->getRect()).intersects(pBullets[j]->getRect())) { zomzom[i]->bulletCollision(points); delete pBullets[j]; pBullets.erase(pBullets.begin() + j); } } } } for (int i = 0; i < zBullets.size(); i++) { if ((player->getRect()).intersects(zBullets[i]->getRect())) { health -= 10; delete zBullets[i]; zBullets.erase(zBullets.begin() + i); } else { for (int j = 0; j < pBullets.size(); j++) { if ((pBullets[j]->getRect()).intersects(zBullets[i]->getRect())) { delete pBullets[j]; pBullets.erase(pBullets.begin() + j); delete zBullets[i]; zBullets.erase(zBullets.begin() + i); } } } } if (health < 1) { health = 0; stopGame(); } }
void physics(Game *g) { g->mouseThrustOn=false; //ball collision if(gameStarted){ ball.setYVel(ball.getYVel()); ball.setXVel(ball.getXVel()); obstacle->setYVel(obstacle->getYVel()); bool is_ball_hit_edge = ball.checkCollision(xres, yres); if (is_ball_hit_edge){ lastPaddleHit = 'N'; } } //paddle collision bool isLeftHit = paddle1.checkCollision(yres, ball); if (isLeftHit){ lastPaddleHit = 'L'; } bool isRightHit = paddle2.checkCollision(yres, ball); if (isRightHit){ lastPaddleHit = 'R'; } if(level == 2){ obstacle->checkCollision(xres, yres, ball, p1); } //paddle1 movement paddle1.setYVel(paddle1YVel); //paddle2 movement paddle2.setYVel(paddle2YVel); if (level == 1 && hud->isPaused()==false){ //SET BOMBS POSITION: bomb_theta = bomb_theta + speed_theta; if (fabs(bomb_theta) >= 2*PI){ bomb_theta=0; speed_theta *= -1; } bomb_posx=(int)(xres/2 + bomb_radius*cos(bomb_theta - PI/2) - bomb_width/2); bomb_posy=(int)(yres/2 + bomb_radius*sin(bomb_theta - PI/2) - bomb_height/2); //CHECK LEFT COLLISION WITH BOMB: if ((beginSmallLeftPaddle + smallLeftPaddleTime) < time(NULL)){ paddle1.setHeight(100.0f); bool isBallBetweenX = (ball.getXPos() > bomb_posx) && (ball.getXPos() < (bomb_posx + bomb_width)); bool isBallBetweenY = (ball.getYPos() > bomb_posy) && (ball.getYPos() < (bomb_posy + bomb_height)); if (lastPaddleHit == 'L' && (isBallBetweenX && isBallBetweenY)){ bombBegin = time(NULL); createSound(8); createSound(9); //set to half normal height: paddle1.setHeight(60.0f); if (hud->getPlayer1Health()>0){ hud->setPlayer1Health(hud->getPlayer1Health()-10*(1+random(8))); //GAMEOVER: if (hud->getPlayer1Health() <= 0){ createSound(5); is_gameover = true; ball.setXVel(0.0f); ball.setYVel(0.0f); stopGame(); } } beginSmallLeftPaddle = time(NULL); } } //CHECK RIGHT COLLISION WITH BOMB: if ((beginSmallRightPaddle + smallRightPaddleTime) < time(NULL)){ paddle2.setHeight(100.0f); //is_bomb_visible = true; bool isBallBetweenX = (ball.getXPos() > bomb_posx) && (ball.getXPos() < (bomb_posx + bomb_width)); bool isBallBetweenY = (ball.getYPos() > bomb_posy) && (ball.getYPos() < (bomb_posy + bomb_height)); if (lastPaddleHit == 'R' && (isBallBetweenX && isBallBetweenY)){ bombBegin = time(NULL); createSound(8); createSound(9); //is_bomb_visible = false; //set to half normal height: paddle2.setHeight(60.0f); if (hud->getPlayer2Health()>0){ hud->setPlayer2Health(hud->getPlayer2Health()- 10*(1+random(8))); //GAMEOVER: if (hud->getPlayer2Health() <= 0){ createSound(5); is_gameover = true; ball.setXVel(0.0f); ball.setYVel(0.0f); stopGame(); } } beginSmallRightPaddle = time(NULL); } } if(ball.getXPos() >= (xres/2)){ portal1.checkCollision(ball, portal0); } else { portal0.checkCollision(ball, portal1); } }//end if level 1 and not paused }
MainWindow::MainWindow(QWidget *parent){ nulls = 0; addMode = false; QLabel* lbl1 = new QLabel("Map Colors"); QLabel* lbl2 = new QLabel("Object Colors"); spinBox1 = new QSpinBox; spinBox2 = new QSpinBox; spinBox3 = new QSpinBox; spinBox4 = new QSpinBox; spinBox5 = new QSpinBox; spinBox6 = new QSpinBox; spinBox1->setMaximum(10); spinBox1->setMinimum(0); spinBox1->setValue(0); spinBox2->setMaximum(10); spinBox2->setMinimum(0);spinBox2->setValue(3); spinBox3->setMaximum(10); spinBox3->setMinimum(0);spinBox3->setValue(10); spinBox4->setMaximum(10); spinBox4->setMinimum(0);spinBox4->setValue(0); spinBox5->setMaximum(10); spinBox5->setMinimum(0);spinBox5->setValue(8); spinBox6->setMaximum(10); spinBox6->setMinimum(0);spinBox6->setValue(8); scene = new Scene; QHBoxLayout* layout1 = new QHBoxLayout; QVBoxLayout* layout2 = new QVBoxLayout; QHBoxLayout* layout3 = new QHBoxLayout; QVBoxLayout* layout4 = new QVBoxLayout; QHBoxLayout* layout5 = new QHBoxLayout; QHBoxLayout* layout6 = new QHBoxLayout; pbtn1 = new QPushButton("Start"); pbtn1->setFixedSize(40,25); pbtn2 = new QPushButton("Prev"); pbtn2->setFixedSize(40,25); pbtn3 = new QPushButton("Next"); pbtn3->setFixedSize(40,25); pbtn4 = new QPushButton("Stop"); pbtn4->setFixedSize(40,25); pbtn4->setEnabled(false); pbtn6 = new QPushButton("Map+");pbtn6->setFixedSize(40,25); pbtn7 = new QPushButton("Map-");pbtn7->setFixedSize(40,25); pbtn8 = new QPushButton("+"); pbtn8->setFixedSize(40,25); pbtn9 = new QPushButton("-"); pbtn9->setFixedSize(40,25); pbtn11 = new QPushButton("Set"); pbtn11->setFixedSize(40,25); pbtn12 = new QPushButton("View"); pbtn12->setFixedSize(40,25); pbtn12->setEnabled(false); pbtn10 = new QPushButton("Clear"); pbtn10->setFixedSize(40,25); layout3->addWidget(pbtn1); layout3->addWidget(pbtn2); layout3->addWidget(pbtn3); layout3->addWidget(pbtn4); layout3->addWidget(pbtn6); layout3->addWidget(pbtn7); layout3->addWidget(pbtn9); layout3->addWidget(pbtn8); layout3->addWidget(pbtn11); layout3->addWidget(pbtn12); layout3->addWidget(pbtn10); layout3->addStretch(); layout5->addWidget(lbl1); layout5->addWidget(spinBox1); layout5->addWidget(spinBox2); layout5->addWidget(spinBox3); layout6->addWidget(lbl2); layout6->addWidget(spinBox4); layout6->addWidget(spinBox5); layout6->addWidget(spinBox6); layout4->addLayout(layout5); layout4->addLayout(layout6); layout2->addWidget(scene); layout2->addLayout(layout3); layout1->addLayout(layout2); layout1->addLayout(layout4); setLayout(layout1); connect(pbtn1,SIGNAL(clicked()),this,SLOT(startGame())); connect(pbtn3,SIGNAL(clicked()),this,SLOT(nextStep())); connect(pbtn4,SIGNAL(clicked()),this,SLOT(stopGame())); connect(pbtn6,SIGNAL(clicked()),this,SLOT(mapPlus())); connect(pbtn7,SIGNAL(clicked()),this,SLOT(mapMinus())); connect(pbtn8,SIGNAL(clicked()),this,SLOT(increaseSize())); connect(pbtn9,SIGNAL(clicked()),this,SLOT(reduceSize())); connect(pbtn10,SIGNAL(clicked()),this,SLOT(clearMap())); connect(pbtn11,SIGNAL(clicked()),this,SLOT(setTrueAddMode())); connect(pbtn12,SIGNAL(clicked()),this,SLOT(setFalseAddMode())); connect(pbtn2, SIGNAL(clicked()),this, SLOT(prevStep())); QTimer *timer = new QTimer(this); timer->setInterval(42); connect(timer, SIGNAL(timeout()), this, SLOT(view())); timer->start(); }