Snake/back-end/controller.cpp

28 lines
495 B
C++
Raw Normal View History

2018-09-11 20:10:37 +03:00
#include "controller.h"
2018-10-11 18:09:35 +03:00
#include <cmath>
#include <ctime>
2018-09-11 20:10:37 +03:00
2018-10-11 18:09:35 +03:00
Controller::Controller() {
srand(static_cast<unsigned int>(time(nullptr)));
}
2018-09-11 20:10:37 +03:00
2018-10-11 18:09:35 +03:00
void Controller::setDeviceSize(QPoint deviceSize) {
Global::deviceSize = deviceSize;
2018-09-11 20:10:37 +03:00
}
2018-10-30 21:23:41 +03:00
void Controller::update() {
timer = new QTimer();
timer->setInterval(33);
connect(timer, SIGNAL(timeout()), this, SLOT(setDeviceSize()));
}
void Controller::startTimer()
{
timer->start();
}
void Controller::stopTimer() {
timer->stop();
}