#ifndef MAINWIDGET_H #define MAINWIDGET_H #include "sceneholder.h" #include "constants.h" #include "audio.h" #include "pacman.pb.h" #include #include #include class Actor; class MainWidget : public QWidget { Q_OBJECT public: MainWidget(QWidget *parent = 0); bool connected(); void setAmbientMuted(bool muted); protected: /* handling of current key */ virtual void keyPressEvent(QKeyEvent *); virtual void keyReleaseEvent(QKeyEvent *); private slots: void startGame(); void playerScoreClicked(); void tick(); void sendKeyUpdate(); private: void createGui(); void createMenu(); void updateScore(const ProtoBuf::MapUpdate&); bool isRunning(); Color::Color connectToServer(); /* GUI elements needed in the progress of the game */ QList m_playerScoreLayouts; /* key currently pressed by user */ Transmission::field_t m_currentKey; /* translate Qt::Key to our key format */ Transmission::field_t translateKey(int key); /* game running */ bool m_running; GaplessAudioPlayer *m_ambientPlayer; QTcpSocket *m_socket; SceneHolder *m_scene; unsigned int m_maxplayers; /* allocate as member variable as this packet is large and used often */ ProtoBuf::MapUpdate m_updatepacket; }; #endif // MAINWIDGET_H