void Simulator::Construct(Environment *e, Visualizer *v, long cycleTime) { this->environment = e; this->display = v; this->cycleTime = cycleTime; this->timer = new QTimer(); connect(this->timer, SIGNAL(timeout()), this, SLOT(TimerSlot())); }
//****************************************************************** void MainWindow::mediumButton() { if(game_state==not_started) { timer = new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(TimerSlot())); timer->start(200); game_state = started; gm_level = hard; points_for_fruit=20; } game_state=started; gm_level = medium; delete e_button; delete m_button; delete h_button; }
Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); //setting up main fields ui->question->setAlignment(Qt::AlignHCenter); ui->answer->setAlignment(Qt::AlignHCenter); //just putting my face in the corner QPixmap pixmap("resources/myface.png"); ui->myface->setPixmap(pixmap); //setting up timer timer = new QTimer(this); connect(timer,SIGNAL(timeout()),this,SLOT(TimerSlot())); timer->start(1000); }