diff options
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 9 |
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; |
