void MainWindow::connectSignals() { connect(startBtn, SIGNAL(clicked()), this, SLOT(on_startBtn_clicked())); connect(stopBtn, SIGNAL(clicked()), this, SLOT(on_stopBtn_clicked())); connect(exitBtn, SIGNAL(clicked()), this, SLOT(on_exitBtn_clicked())); connect(this, SIGNAL(_updateByState(char*)), this, SLOT(updateState(char*))); connect(this, SIGNAL(_updateImagePair(QImage*,QImage*)), this, SLOT(updateImagePair(QImage*,QImage*))); }
void MainWindow::on_playAgainBtn_clicked(){ health=100; score=0; mb->endScreen->hide(); mb->playAgainBtn->hide(); mb->scoreLabel->setText("Score: " + QString::number(score)); mb->scoreLabel->show(); mb->healthLabel->show(); mb->quitBtn->show(); cCat->cat->show(); backTimer->start(); midTimer->start(); frontTimer->start(); on_startBtn_clicked(); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); mb = new MovingBackground(this); connect(mb->startBtn, SIGNAL(clicked()), SLOT(on_startBtn_clicked())); connect(mb->quitBtn, SIGNAL(clicked()), SLOT(on_quitBtn_clicked())); connect(mb->playAgainBtn, SIGNAL(clicked()), SLOT(on_playAgainBtn_clicked())); //background timers backTimer = new QTimer(parent); backTimer->setInterval(70); connect(backTimer, SIGNAL(timeout()), this, SLOT(backTimerHit())); backTimer->start(); //bool active = mb->backTimer->isActive(); //this->backTimerHit(); midTimer = new QTimer(parent); midTimer->setInterval(40); connect(midTimer, SIGNAL(timeout()), this, SLOT(midTimerHit())); midTimer->start(); //this->midTimerHit(); frontTimer = new QTimer(parent); frontTimer->setInterval(10); connect(frontTimer, SIGNAL(timeout()), this, SLOT(frontTimerHit())); frontTimer->start(); //furballtimer furtime = new QTimer(this); furtime->setInterval(10); connect(furtime, SIGNAL(timeout()), this, SLOT(furTimeHit())); cCat = new CuriousCat(this); }