From 65195fdab6262d31056c74f922376de3b009943c Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 17 Apr 2011 19:19:56 +0200 Subject: 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 --- pacman-c++/mainwidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'pacman-c++/mainwidget.cpp') 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) tick(); connect(m_socket, SIGNAL(readyRead()), this, SLOT(tick())); - - QTimer *sendTimer = new QTimer(this); - connect(sendTimer, SIGNAL(timeout()), this, SLOT(sendKeyUpdate())); - sendTimer->start(Constants::tick); - qDebug() << "[Connect] mycolor=" << m_scene->color(); //TODO: play intro as soon as there are enough players @@ -172,6 +167,8 @@ void MainWidget::keyPressEvent(QKeyEvent* event) { if (!m_running) return; + if (event->isAutoRepeat()) + return; QWidget::keyPressEvent(event); Transmission::field_t newKey = translateKey(event->key()); @@ -199,6 +196,8 @@ void MainWidget::keyReleaseEvent(QKeyEvent* event) { if (!m_running) return; + if (event->isAutoRepeat()) + return; QWidget::keyReleaseEvent(event); m_currentKey = Transmission::none; -- cgit v1.2.3