summaryrefslogtreecommitdiffstats
path: root/pacman-c++/mainwidget.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-17 19:19:56 +0200
committermanuel <manuel@mausz.at>2011-04-17 19:19:56 +0200
commit65195fdab6262d31056c74f922376de3b009943c (patch)
treee76a6141ae0603494dab0830baa41ec29a55f74e /pacman-c++/mainwidget.cpp
parent8187d48b30defcb11c61ba5365fe974151849e38 (diff)
downloadfoop-65195fdab6262d31056c74f922376de3b009943c.tar.gz
foop-65195fdab6262d31056c74f922376de3b009943c.tar.bz2
foop-65195fdab6262d31056c74f922376de3b009943c.zip
a bigger commit again:
- fix pacman movement. now more like real pacman (again). e.g. if you press a direction-key again: the pacman will move in that direction as soon as possible and no repeated keypress is needed - add random colorized blocks (without dieing yet) - add cmdline-option: --nocolorblocks to disable that
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
-rw-r--r--pacman-c++/mainwidget.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp
index 705a3ca..c674c55 100644
--- a/pacman-c++/mainwidget.cpp
+++ b/pacman-c++/mainwidget.cpp
@@ -33,11 +33,6 @@ MainWidget::MainWidget(QWidget *parent)
33 tick(); 33 tick();
34 34
35 connect(m_socket, SIGNAL(readyRead()), this, SLOT(tick())); 35 connect(m_socket, SIGNAL(readyRead()), this, SLOT(tick()));
36
37 QTimer *sendTimer = new QTimer(this);
38 connect(sendTimer, SIGNAL(timeout()), this, SLOT(sendKeyUpdate()));
39 sendTimer->start(Constants::tick);
40
41 qDebug() << "[Connect] mycolor=" << m_scene->color(); 36 qDebug() << "[Connect] mycolor=" << m_scene->color();
42 37
43 //TODO: play intro as soon as there are enough players 38 //TODO: play intro as soon as there are enough players
@@ -172,6 +167,8 @@ void MainWidget::keyPressEvent(QKeyEvent* event)
172{ 167{
173 if (!m_running) 168 if (!m_running)
174 return; 169 return;
170 if (event->isAutoRepeat())
171 return;
175 172
176 QWidget::keyPressEvent(event); 173 QWidget::keyPressEvent(event);
177 Transmission::field_t newKey = translateKey(event->key()); 174 Transmission::field_t newKey = translateKey(event->key());
@@ -199,6 +196,8 @@ void MainWidget::keyReleaseEvent(QKeyEvent* event)
199{ 196{
200 if (!m_running) 197 if (!m_running)
201 return; 198 return;
199 if (event->isAutoRepeat())
200 return;
202 201
203 QWidget::keyReleaseEvent(event); 202 QWidget::keyReleaseEvent(event);
204 m_currentKey = Transmission::none; 203 m_currentKey = Transmission::none;