diff options
Diffstat (limited to 'pacman-c++')
| -rw-r--r-- | pacman-c++/actor.cpp | 4 | ||||
| -rw-r--r-- | pacman-c++/main.cpp | 9 | ||||
| -rw-r--r-- | pacman-c++/pacman.pro | 6 |
3 files changed, 14 insertions, 5 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index 576fded..860f490 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #include "actor.h" | 1 | #include "actor.h" |
| 2 | 2 | ||
| 3 | Actor::Actor(Type type) | 3 | Actor::Actor(Type type) |
| 4 | : PixmapItem("google-pacman-sprite"), m_type(type), m_direction(Actor::None) | 4 | : PixmapItem("google-pacman-sprite"), m_type(type), m_direction(Actor::None) |
| 5 | { | 5 | { |
| 6 | setSprite(2, 2, 16, 16); | 6 | setSprite(2, 2, 16, 16); |
| 7 | } | 7 | } |
diff --git a/pacman-c++/main.cpp b/pacman-c++/main.cpp index cceb8f5..4b88b44 100644 --- a/pacman-c++/main.cpp +++ b/pacman-c++/main.cpp | |||
| @@ -12,6 +12,7 @@ int main(int argc, char **argv) | |||
| 12 | 12 | ||
| 13 | Actor *actor1 = new Actor(Actor::Player1); | 13 | Actor *actor1 = new Actor(Actor::Player1); |
| 14 | scene.addItem(actor1); | 14 | scene.addItem(actor1); |
| 15 | actor1->setPos(100,100); | ||
| 15 | 16 | ||
| 16 | QGraphicsView window(&scene); | 17 | QGraphicsView window(&scene); |
| 17 | window.setFrameStyle(0); | 18 | window.setFrameStyle(0); |
| @@ -19,9 +20,11 @@ int main(int argc, char **argv) | |||
| 19 | window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 20 | window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 20 | window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | 21 | window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
| 21 | 22 | ||
| 22 | window.resize(300, 300); | 23 | QMainWindow mainWin; |
| 23 | window.show(); | 24 | mainWin.setCentralWidget(&window); |
| 24 | 25 | mainWin.resize(300, 300); | |
| 26 | mainWin.show(); | ||
| 27 | |||
| 25 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); | 28 | qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); |
| 26 | 29 | ||
| 27 | return app.exec(); | 30 | return app.exec(); |
diff --git a/pacman-c++/pacman.pro b/pacman-c++/pacman.pro index a94121d..6b705a8 100644 --- a/pacman-c++/pacman.pro +++ b/pacman-c++/pacman.pro | |||
| @@ -4,3 +4,9 @@ SOURCES += main.cpp \ | |||
| 4 | HEADERS += pixmapitem.h \ | 4 | HEADERS += pixmapitem.h \ |
| 5 | actor.h | 5 | actor.h |
| 6 | RESOURCES += pacman.qrc | 6 | RESOURCES += pacman.qrc |
| 7 | |||
| 8 | |||
| 9 | OBJECTS_DIR = .obj | ||
| 10 | MOC_DIR = .moc | ||
| 11 | |||
| 12 | |||
