1,16 → 1,10 |
#include "mainwindow.h" |
#include "ui_mainwindow.h" |
|
MainWindow::MainWindow(QWidget *parent) : |
QMainWindow(parent), |
ui(new Ui::MainWindow) |
QGLWidget(parent) |
{ |
ui->setupUi(this); |
this->setFixedSize(800, 600); |
|
this->setMinimumSize(800, 600); |
this->resize(800, 600); |
this->setMaximumSize(800, 600); |
|
server = new QTcpServer(this); |
connect(server, SIGNAL(newConnection()), this, SLOT(newConnection())); |
server->listen(QHostAddress::Any, 4567); |
24,7 → 18,6 |
|
MainWindow::~MainWindow() |
{ |
delete ui; |
delete server; |
} |
|
36,24 → 29,12 |
} |
} |
|
void MainWindow::changeEvent(QEvent *e) |
{ |
QMainWindow::changeEvent(e); |
switch (e->type()) { |
case QEvent::LanguageChange: |
ui->retranslateUi(this); |
break; |
default: |
break; |
} |
} |
|
void MainWindow::paintEvent(QPaintEvent *e) |
{ |
e->accept(); |
QPainter painter(this); |
|
painter.setRenderHint(QPainter::Antialiasing, true); |
painter.fillRect(0, 0, 800, 600, Qt::white); |
|
bool ready = true; |
for (int i = 0; i < bikes.count(); i++) |
70,16 → 51,18 |
{ |
if (bikes[i]->show) |
{ |
bikes[i]->hasHadGo = false; |
bikes[i]->run(bikes); |
bikes[i]->hasHadGo = false; |
bikes[i]->run(bikes); |
bikes[i]->draw(&painter); |
} |
} |
Bike *bike; |
foreach(bike,bikes){ |
while(!bike->hasHadGo){ |
} |
} |
Bike *bike; |
foreach(bike,bikes) |
{ |
while(!bike->hasHadGo) |
{ |
} |
} |
} |
|
checkClients(); |