summaryrefslogtreecommitdiffstats
path: root/pacman-c++/mainwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pacman-c++/mainwidget.cpp')
-rw-r--r--pacman-c++/mainwidget.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/pacman-c++/mainwidget.cpp b/pacman-c++/mainwidget.cpp
index fe1ba9c..bf049f2 100644
--- a/pacman-c++/mainwidget.cpp
+++ b/pacman-c++/mainwidget.cpp
@@ -39,17 +39,17 @@ Transmission::map_t createDummyMap()
39 map[2][1] |= Color::none ^ Transmission::block; 39 map[2][1] |= Color::none ^ Transmission::block;
40 40
41 map[4][3] |= Color::green ^ Transmission::block; 41 map[4][3] |= Color::green ^ Transmission::block;
42 42
43 map[5][3] |= Color::none ^ Transmission::block; 43 map[5][3] |= Color::none ^ Transmission::block;
44 map[6][3] |= Color::none ^ Transmission::block; 44 map[6][3] |= Color::none ^ Transmission::block;
45 map[7][3] |= Color::red ^ Transmission::block; 45 map[7][3] |= Color::red ^ Transmission::block;
46 46
47 map[7][5] |= Transmission::bonuspoint; 47 map[7][5] |= Transmission::bonuspoint;
48 48
49 map[5][5] |= Color::blue; 49 map[5][5] |= Color::blue;
50 map[5][5] |= Transmission::pacman; 50 map[5][5] |= Transmission::pacman;
51 map[5][5] |= Transmission::direction_left; 51 map[5][5] |= Transmission::direction_left;
52 52
53 return map; 53 return map;
54} 54}
55 55
@@ -63,7 +63,7 @@ MainWidget::MainWidget()
63void MainWidget::createGui() 63void MainWidget::createGui()
64{ 64{
65 setFocusPolicy(Qt::StrongFocus); 65 setFocusPolicy(Qt::StrongFocus);
66 66
67 QVBoxLayout *layout = new QVBoxLayout(this); 67 QVBoxLayout *layout = new QVBoxLayout(this);
68 QHBoxLayout *m_scoreLayout = new QHBoxLayout(); 68 QHBoxLayout *m_scoreLayout = new QHBoxLayout();
69 69
@@ -71,28 +71,28 @@ void MainWidget::createGui()
71 { 71 {
72 QGroupBox *scoreBoxI = new QGroupBox(QString("Spieler %1").arg(i), this); 72 QGroupBox *scoreBoxI = new QGroupBox(QString("Spieler %1").arg(i), this);
73 m_scoreLayout->addWidget(scoreBoxI); 73 m_scoreLayout->addWidget(scoreBoxI);
74 74
75 QGridLayout *playerLayout = new QGridLayout(); 75 QGridLayout *playerLayout = new QGridLayout();
76 scoreBoxI->setLayout(playerLayout); 76 scoreBoxI->setLayout(playerLayout);
77 77
78 playerLayout->addWidget(new QLabel("Rundenpunkte:", this), 0, 0); 78 playerLayout->addWidget(new QLabel("Rundenpunkte:", this), 0, 0);
79 playerLayout->addWidget(new QLabel("Gesamtpunkte:", this), 1, 0); 79 playerLayout->addWidget(new QLabel("Gesamtpunkte:", this), 1, 0);
80 80
81 playerLayout->addWidget(new QLabel("", this), 0, 1); 81 playerLayout->addWidget(new QLabel("", this), 0, 1);
82 playerLayout->addWidget(new QLabel("", this), 1, 1); 82 playerLayout->addWidget(new QLabel("", this), 1, 1);
83 83
84 m_playerScoreLayouts.append(playerLayout); 84 m_playerScoreLayouts.append(playerLayout);
85 } 85 }
86 86
87 m_scene = new QGraphicsScene(0, 0, Constants::map_size_pixel.width, Constants::map_size_pixel.height, this); 87 m_scene = new QGraphicsScene(0, 0, Constants::map_size_pixel.width, Constants::map_size_pixel.height, this);
88 m_scene->setBackgroundBrush(Qt::black); 88 m_scene->setBackgroundBrush(Qt::black);
89 89
90 QGraphicsView *window = new QGraphicsView(m_scene, this); 90 QGraphicsView *window = new QGraphicsView(m_scene, this);
91 window->setFrameStyle(0); 91 window->setFrameStyle(0);
92 window->setAlignment(Qt::AlignLeft | Qt::AlignTop); 92 window->setAlignment(Qt::AlignLeft | Qt::AlignTop);
93 //window->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 93 //window->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
94 //window->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); 94 //window->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
95 95
96 layout->addLayout(m_scoreLayout); 96 layout->addLayout(m_scoreLayout);
97 layout->addWidget(window); 97 layout->addWidget(window);
98 98
@@ -119,7 +119,6 @@ void MainWidget::updateScore()
119 } 119 }
120} 120}
121 121
122
123void MainWidget::updateMap(const Transmission::map_t& map) 122void MainWidget::updateMap(const Transmission::map_t& map)
124{ 123{
125 for (unsigned int x = 0; x < Constants::map_size.width; ++x) 124 for (unsigned int x = 0; x < Constants::map_size.width; ++x)
@@ -130,7 +129,7 @@ void MainWidget::updateMap(const Transmission::map_t& map)
130 if (cur == 0) 129 if (cur == 0)
131 continue; 130 continue;
132 qDebug() << "not 0 at x=" << x << ", y=" << y << ", val=" << cur; 131 qDebug() << "not 0 at x=" << x << ", y=" << y << ", val=" << cur;
133 132
134 Color::Color color = static_cast<Color::Color>(cur & Transmission::color_mask); 133 Color::Color color = static_cast<Color::Color>(cur & Transmission::color_mask);
135 qDebug() << "col=" << color; 134 qDebug() << "col=" << color;
136 135
@@ -240,6 +239,6 @@ void MainWidget::keyReleaseEvent(QKeyEvent* event)
240 // current key got released 239 // current key got released
241 // if this is false, a key got released which has already 240 // if this is false, a key got released which has already
242 // been replaced by a different key, so this case is disregarded 241 // been replaced by a different key, so this case is disregarded
243 currentKey = 0; 242 currentKey = 0;
244 } 243 }
245} 244}