summaryrefslogtreecommitdiffstats
path: root/pacman-c++/mainwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
-rw-r--r--pacman-c++/mainwidget.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp
index 9c53513..bdc2da1 100644
--- a/pacman-c++/mainwidget.cpp
+++ b/pacman-c++/mainwidget.cpp
@@ -10,23 +10,27 @@ MainWidget::MainWidget(QWidget *parent)
10: SceneHolder(parent), m_currentKey(0), m_running(false) 10: SceneHolder(parent), m_currentKey(0), m_running(false)
11{ 11{
12 createGui(); 12 createGui();
13 updateMap(Util::createDemoMap());
14 13
15 Color::Color myColor = connectToServer(); 14 m_color = connectToServer();
16 if (myColor == Color::none) 15 if (m_color == Color::none)
17 { 16 {
18 QMessageBox::critical(this, "Error", "Failed to connect to server, falling back to local test mode"); 17 QMessageBox::critical(this, "Error", "Failed to connect to server, falling back to local test mode");
19 // TODO: quit application here or sth 18 // TODO: quit application here or sth
20 m_socket = NULL; 19 m_socket = NULL;
20 m_color = Color::red;
21 QTimer *timer = new QTimer(this); 21 QTimer *timer = new QTimer(this);
22 connect(timer, SIGNAL(timeout()), this, SLOT(tick())); 22 connect(timer, SIGNAL(timeout()), this, SLOT(tick()));
23 timer->start(Constants::tick); 23 timer->start(Constants::tick);
24 } 24 }
25 else 25
26 /* call updateMap after m_color ist set! */
27 updateMap(Util::createDemoMap());
28
29 if (m_socket != NULL)
26 connect(m_socket, SIGNAL(readyRead()), this, SLOT(tick())); 30 connect(m_socket, SIGNAL(readyRead()), this, SLOT(tick()));
27 31
28 // TODO: use mycolor 32 // TODO: use mycolor
29 qDebug() << "mycolor=" << myColor; 33 qDebug() << "mycolor=" << m_color;
30 34
31 //TODO: play intro as soon as there are enough players 35 //TODO: play intro as soon as there are enough players
32 //connect(AudioPlayer::self(), SIGNAL(finished()), this, SLOT(startGame())); 36 //connect(AudioPlayer::self(), SIGNAL(finished()), this, SLOT(startGame()));