summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortotycro <totycro@unknown-horizons.org>2011-04-04 20:35:49 +0200
committertotycro <totycro@unknown-horizons.org>2011-04-04 20:35:49 +0200
commita5ea024b0119a4b0fea858ae9115d744a786d3af (patch)
tree99408cf77bad1596c9e2fcdf035a2294eff64cdd
parent0693d00da48d795c7ccb658e8b69fe17f4427337 (diff)
downloadfoop-a5ea024b0119a4b0fea858ae9115d744a786d3af.tar.gz
foop-a5ea024b0119a4b0fea858ae9115d744a786d3af.tar.bz2
foop-a5ea024b0119a4b0fea858ae9115d744a786d3af.zip
change project file:
use: qmake -config client or qmake -config main Added basic client gui infrastructure
-rw-r--r--pacman-c++/client.cpp20
-rw-r--r--pacman-c++/client.h18
-rw-r--r--pacman-c++/constants.h23
-rw-r--r--pacman-c++/mainwidget.cpp41
-rw-r--r--pacman-c++/mainwidget.h20
-rw-r--r--pacman-c++/pacman-c++.kdev43
-rw-r--r--pacman-c++/pacman.pro18
7 files changed, 141 insertions, 2 deletions
diff --git a/pacman-c++/client.cpp b/pacman-c++/client.cpp
new file mode 100644
index 0000000..416bd12
--- /dev/null
+++ b/pacman-c++/client.cpp
@@ -0,0 +1,20 @@
1#include "client.h"
2
3Client::Client()
4{
5 mainWidget = new MainWidget();
6 setCentralWidget(mainWidget);
7}
8
9
10int main(int argc, char ** argv) {
11 QApplication app(argc, argv);
12 app.setApplicationName("pacman-client");
13
14 qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
15
16 Client client;
17 client.show();
18
19 return app.exec();
20}
diff --git a/pacman-c++/client.h b/pacman-c++/client.h
new file mode 100644
index 0000000..2816ec2
--- /dev/null
+++ b/pacman-c++/client.h
@@ -0,0 +1,18 @@
1#ifndef CLIENT_H
2#define CLIENT_H
3
4#include <QtGui>
5
6#include "mainwidget.h"
7
8class Client
9 : public QMainWindow {
10 Q_OBJECT
11public:
12 Client();
13
14private:
15 MainWidget *mainWidget;
16};
17
18#endif // CLIENT_H \ No newline at end of file
diff --git a/pacman-c++/constants.h b/pacman-c++/constants.h
new file mode 100644
index 0000000..278f2b3
--- /dev/null
+++ b/pacman-c++/constants.h
@@ -0,0 +1,23 @@
1#ifndef CONSTANTS_H
2#define CONSTANTS_H
3
4const unsigned int map_size[2] = { 20, 20 };
5const unsigned int field_size[2] = { 16, 16 };
6
7// constants for data transmission to client
8namespace transmission {
9
10 typedef unsigned int field_t;
11 const field_t red = (1 << 0);
12 const field_t blue = (1 << 1);
13 const field_t green = (1 << 2);
14
15 const field_t box = (1 << 3);
16 const field_t foo = (1 << 4);
17
18 typedef field_t** map_t;
19}
20
21
22
23#endif // CONSTANTS_H \ No newline at end of file
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp
new file mode 100644
index 0000000..982c809
--- /dev/null
+++ b/pacman-c++/mainwidget.cpp
@@ -0,0 +1,41 @@
1#include "mainwidget.h"
2
3#include "actor.h"
4#include "block.h"
5
6MainWidget::MainWidget() {
7
8 QVBoxLayout *layout = new QVBoxLayout(this);
9
10 QLabel *lbl = new QLabel("da kommt da spielstand hin", this);
11 layout->addWidget(lbl);
12
13 scene = new QGraphicsScene(0, 0, 500, 500, this);
14 scene->setBackgroundBrush(Qt::black);
15
16 QGraphicsView *window = new QGraphicsView(scene, this);
17 window->setFrameStyle(0);
18 window->setAlignment(Qt::AlignLeft | Qt::AlignTop);
19 window->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
20 window->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
21 layout->addWidget(window);
22
23 setLayout(layout);
24 setWindowTitle("pacman client");
25
26 loadDummyMap();
27}
28
29void MainWidget::loadDummyMap()
30{
31 Actor *actor3 = new Actor(Actor::Player3);
32 scene->addItem(actor3);
33 actor3->setPos(140, 100);
34
35 for (unsigned int i=0; i<20; ++i) {
36 Block *b = new Block(Actor::Player1);
37 scene->addItem(b);
38 b->setPos( 100 + i*16, 200);
39 }
40
41}
diff --git a/pacman-c++/mainwidget.h b/pacman-c++/mainwidget.h
new file mode 100644
index 0000000..d1ec761
--- /dev/null
+++ b/pacman-c++/mainwidget.h
@@ -0,0 +1,20 @@
1#ifndef MAINWIDGET_H
2#define MAINWIDGET_H
3
4#include <QtGui>
5
6class MainWidget
7 : public QWidget
8{
9 Q_OBJECT
10
11public:
12 MainWidget();
13
14private:
15 void loadDummyMap();
16
17 QGraphicsScene *scene;
18};
19
20#endif // MAINWIDGET_H \ No newline at end of file
diff --git a/pacman-c++/pacman-c++.kdev4 b/pacman-c++/pacman-c++.kdev4
new file mode 100644
index 0000000..dbc9bc5
--- /dev/null
+++ b/pacman-c++/pacman-c++.kdev4
@@ -0,0 +1,3 @@
1[Project]
2Manager=KDevGenericManager
3Name=pacman-c++
diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro
index 2bb8629..f63612d 100644
--- a/pacman-c++/pacman.pro
+++ b/pacman-c++/pacman.pro
@@ -1,6 +1,5 @@
1QT += phonon 1QT += phonon
2SOURCES += main.cpp \ 2SOURCES += pixmapitem.cpp \
3 pixmapitem.cpp \
4 actor.cpp \ 3 actor.cpp \
5 animationmanager.cpp \ 4 animationmanager.cpp \
6 block.cpp 5 block.cpp
@@ -13,3 +12,18 @@ RESOURCES += pacman.qrc
13 12
14OBJECTS_DIR = .obj 13OBJECTS_DIR = .obj
15MOC_DIR = .moc 14MOC_DIR = .moc
15
16
17client {
18 SOURCES += client.cpp \
19 mainwidget.cpp
20 HEADERS += client.h \
21 mainwidget.h
22 TARGET = client
23}
24
25main {
26 SOURCES += main.cpp
27 TARGET = pacman
28}
29