summaryrefslogtreecommitdiffstats
path: root/pacman-c++/mainwidget.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
committermanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
commitce48af53646cd9e7ec762fc1ac176b3aa620b11d (patch)
treef8fbf2cae8c7d0cbac2696a8f4cf94410bfb4928 /pacman-c++/mainwidget.h
parente54ccad07e256ba877bd41d70bd358bd0085bd1e (diff)
downloadfoop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.gz
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.bz2
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.zip
- refactorized the whole project and made a few subprojects
- replaced tcp with enet - added connect dialog - some smaller bugfixes
Diffstat (limited to 'pacman-c++/mainwidget.h')
-rw-r--r--pacman-c++/mainwidget.h64
1 files changed, 0 insertions, 64 deletions
diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h
deleted file mode 100644
index d5695ed..0000000
--- a/pacman-c++/mainwidget.h
+++ /dev/null
@@ -1,64 +0,0 @@
1#ifndef MAINWIDGET_H
2#define MAINWIDGET_H
3
4#include "sceneholder.h"
5#include "constants.h"
6#include "audio.h"
7#include "pacman.pb.h"
8#include <QtGui>
9#include <QtCore>
10#include <QTcpSocket>
11
12class Actor;
13
14class MainWidget
15 : public QWidget
16{
17 Q_OBJECT
18
19public:
20 MainWidget(QWidget *parent = 0);
21 bool connected();
22 void setAmbientMuted(bool muted);
23
24protected:
25 /* handling of current key */
26 virtual void keyPressEvent(QKeyEvent *);
27 virtual void keyReleaseEvent(QKeyEvent *);
28
29private slots:
30 void startGame();
31 void stopGame();
32 void playerScoreClicked();
33 void tick();
34 void sendKeyUpdate();
35
36private:
37 void createGui();
38 void createMenu();
39 void updateScore(const ProtoBuf::MapUpdate&);
40 bool isRunning();
41 Color::Color connectToServer();
42
43 /* GUI elements needed in the progress of the game */
44 QList<QGridLayout*> m_playerScoreLayouts;
45
46 /* key currently pressed by user */
47 Transmission::field_t m_currentKey;
48
49 /* translate Qt::Key to our key format */
50 Transmission::field_t translateKey(int key);
51
52 /* game running */
53 bool m_running;
54 GaplessAudioPlayer *m_ambientPlayer;
55
56 QTcpSocket *m_socket;
57 SceneHolder *m_scene;
58 unsigned int m_maxplayers;
59
60 /* allocate as member variable as this packet is large and used often */
61 ProtoBuf::MapUpdate m_updatepacket;
62};
63
64#endif // MAINWIDGET_H