#ifndef MAINWIDGET_H #define MAINWIDGET_H #include "constants.h" #include "pixmapitem.h" #include #include #include class Actor; class MainWidget : public QWidget { Q_OBJECT public: MainWidget(); protected: // handling of current key virtual void keyPressEvent(QKeyEvent* ); virtual void keyReleaseEvent(QKeyEvent* ); private: void createGui(); void updateMap(const Transmission::map_t& map); void updateScore(); bool isRunning(); private slots: void startGame(); void playerScoreClicked(); void tick(); private: QVector< QVector > visualMap; // 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 m_currentKey; // translate Qt::Key to our key format Transmission::field_t translateKey(int); // game running bool m_running; }; #endif // MAINWIDGET_H