diff options
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
| -rw-r--r-- | pacman-c++/mainwidget.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
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 | |||
| 6 | MainWidget::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 | |||
| 29 | void 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 | } | ||
