blob: 982c809bcb5c168d5590e988f9073c3b972ddbce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#include "mainwidget.h"
#include "actor.h"
#include "block.h"
MainWidget::MainWidget() {
QVBoxLayout *layout = new QVBoxLayout(this);
QLabel *lbl = new QLabel("da kommt da spielstand hin", this);
layout->addWidget(lbl);
scene = new QGraphicsScene(0, 0, 500, 500, this);
scene->setBackgroundBrush(Qt::black);
QGraphicsView *window = new QGraphicsView(scene, this);
window->setFrameStyle(0);
window->setAlignment(Qt::AlignLeft | Qt::AlignTop);
window->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
window->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
layout->addWidget(window);
setLayout(layout);
setWindowTitle("pacman client");
loadDummyMap();
}
void MainWidget::loadDummyMap()
{
Actor *actor3 = new Actor(Actor::Player3);
scene->addItem(actor3);
actor3->setPos(140, 100);
for (unsigned int i=0; i<20; ++i) {
Block *b = new Block(Actor::Player1);
scene->addItem(b);
b->setPos( 100 + i*16, 200);
}
}
|