void StateHandler::startGame() { if (state != uninitialized) return; state = menu; while (!exitGame()) { loopGame(); } window.close(); }
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*>))); }