From 3cdc77bc7d1da312a0c7ae9c734f6a33f1c49ecf Mon Sep 17 00:00:00 2001 From: totycro Date: Tue, 5 Apr 2011 18:19:03 +0200 Subject: added key handling --- pacman-c++/mainwidget.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pacman-c++/mainwidget.h') diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h index dc20d75..f7113a5 100644 --- a/pacman-c++/mainwidget.h +++ b/pacman-c++/mainwidget.h @@ -3,6 +3,7 @@ #include "constants.h" #include +#include class Actor; @@ -14,6 +15,11 @@ class MainWidget public: MainWidget(); +protected: + // handling of current key + virtual void keyPressEvent(QKeyEvent* ); + virtual void keyReleaseEvent(QKeyEvent* ); + private: void loadDummyMap(); @@ -22,10 +28,18 @@ private: // data conversion QPoint mapPositionToCoord(unsigned int x, unsigned int y); + // GUI elements needed in the progress of the game QList m_playerScoreLayouts; QGraphicsScene *m_scene; + // map of actors in order to keep track of those instances QMap m_actors; + + // key currently pressed by user + transmission::field_t currentKey; + + // translate Qt::Key to our key format + transmission::field_t translateKey(int); }; #endif // MAINWIDGET_H -- cgit v1.2.3