From 5480580d5c2fa40787a70dfdb68b52216917c58b Mon Sep 17 00:00:00 2001 From: manuel Date: Sun, 3 Apr 2011 17:32:48 +0200 Subject: fix intend --- pacman-c++/actor.cpp | 4 ++-- pacman-c++/actor.h | 32 ++++++++++++++++---------------- pacman-c++/main.cpp | 28 ++++++++++++++-------------- pacman-c++/pixmapitem.cpp | 32 ++++++++++++++++---------------- pacman-c++/pixmapitem.h | 20 ++++++++++---------- 5 files changed, 58 insertions(+), 58 deletions(-) (limited to 'pacman-c++') diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index 860f490..576fded 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp @@ -1,7 +1,7 @@ #include "actor.h" Actor::Actor(Type type) - : PixmapItem("google-pacman-sprite"), m_type(type), m_direction(Actor::None) + : PixmapItem("google-pacman-sprite"), m_type(type), m_direction(Actor::None) { - setSprite(2, 2, 16, 16); + setSprite(2, 2, 16, 16); } diff --git a/pacman-c++/actor.h b/pacman-c++/actor.h index 753c920..5f68f8f 100644 --- a/pacman-c++/actor.h +++ b/pacman-c++/actor.h @@ -4,27 +4,27 @@ #include "pixmapitem.h" class Actor - : public PixmapItem + : public PixmapItem { public: - enum Movement { - None = 0, - Left, - Right, - Up, - Down - }; + enum Movement { + None = 0, + Left, + Right, + Up, + Down + }; - enum Type { - Player1 = 1, - Player2, - Player3, - }; + enum Type { + Player1 = 1, + Player2, + Player3, + }; - Actor(Type type); + Actor(Type type); private: - Type m_type; - Movement m_direction; + Type m_type; + Movement m_direction; }; #endif // ACTOR_H diff --git a/pacman-c++/main.cpp b/pacman-c++/main.cpp index 0756684..cceb8f5 100644 --- a/pacman-c++/main.cpp +++ b/pacman-c++/main.cpp @@ -5,24 +5,24 @@ int main(int argc, char **argv) { - QApplication app(argc, argv); + QApplication app(argc, argv); - QGraphicsScene scene(0, 0, 300, 300); - scene.setBackgroundBrush(Qt::black); + QGraphicsScene scene(0, 0, 300, 300); + scene.setBackgroundBrush(Qt::black); - Actor *actor1 = new Actor(Actor::Player1); - scene.addItem(actor1); + Actor *actor1 = new Actor(Actor::Player1); + scene.addItem(actor1); - QGraphicsView window(&scene); - window.setFrameStyle(0); - window.setAlignment(Qt::AlignLeft | Qt::AlignTop); - window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + QGraphicsView window(&scene); + window.setFrameStyle(0); + window.setAlignment(Qt::AlignLeft | Qt::AlignTop); + window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - window.resize(300, 300); - window.show(); + window.resize(300, 300); + window.show(); - qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); + qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); - return app.exec(); + return app.exec(); } diff --git a/pacman-c++/pixmapitem.cpp b/pacman-c++/pixmapitem.cpp index 64ac594..9c2f941 100644 --- a/pacman-c++/pixmapitem.cpp +++ b/pacman-c++/pixmapitem.cpp @@ -2,43 +2,43 @@ #include PixmapItem::PixmapItem(const QString &fileName, QGraphicsItem *parent) - : QGraphicsObject(parent), m_x(0), m_y(0) + : QGraphicsObject(parent), m_x(0), m_y(0) { - m_pix = ":/" + fileName; - m_width = m_pix.width(); - m_height = m_pix.height(); + m_pix = ":/" + fileName; + m_width = m_pix.width(); + m_height = m_pix.height(); } PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene) - : QGraphicsObject(), m_x(0), m_y(0) + : QGraphicsObject(), m_x(0), m_y(0) { - m_pix = ":/" + fileName; - m_width = m_pix.width(); - m_height = m_pix.height(); - scene->addItem(this); + m_pix = ":/" + fileName; + m_width = m_pix.width(); + m_height = m_pix.height(); + scene->addItem(this); } void PixmapItem::setSprite(int x, int y, int width, int height) { - m_x = x; - m_y = y; - m_width = width; - m_height = height; + m_x = x; + m_y = y; + m_width = width; + m_height = height; } QSizeF PixmapItem::size() const { - return QSizeF(m_width, m_height); + return QSizeF(m_width, m_height); } QRectF PixmapItem::boundingRect() const { - return QRectF(QPointF(0, 0), size()); + return QRectF(QPointF(0, 0), size()); } void PixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *) { - painter->drawPixmap(0, 0, m_pix, m_x, m_y, m_width, m_height); + painter->drawPixmap(0, 0, m_pix, m_x, m_y, m_width, m_height); } diff --git a/pacman-c++/pixmapitem.h b/pacman-c++/pixmapitem.h index a94c251..853604d 100644 --- a/pacman-c++/pixmapitem.h +++ b/pacman-c++/pixmapitem.h @@ -5,19 +5,19 @@ #include class PixmapItem - : public QGraphicsObject + : public QGraphicsObject { public: - PixmapItem(const QString &fileName, QGraphicsItem *parent = 0); - PixmapItem(const QString &fileName, QGraphicsScene *scene); - void setSprite(int x, int y, int width, int height); - QSizeF size() const; - QRectF boundingRect() const; - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); + PixmapItem(const QString &fileName, QGraphicsItem *parent = 0); + PixmapItem(const QString &fileName, QGraphicsScene *scene); + void setSprite(int x, int y, int width, int height); + QSizeF size() const; + QRectF boundingRect() const; + void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); private: - QPixmap m_pix; - int m_x, m_y; - int m_width, m_height; + QPixmap m_pix; + int m_x, m_y; + int m_width, m_height; }; #endif -- cgit v1.2.3