summaryrefslogtreecommitdiffstats
path: root/pacman-c++/pixmapitem.cpp
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
committermanuel <manuel@mausz.at>2011-05-05 00:57:07 +0200
commitce48af53646cd9e7ec762fc1ac176b3aa620b11d (patch)
treef8fbf2cae8c7d0cbac2696a8f4cf94410bfb4928 /pacman-c++/pixmapitem.cpp
parente54ccad07e256ba877bd41d70bd358bd0085bd1e (diff)
downloadfoop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.gz
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.tar.bz2
foop-ce48af53646cd9e7ec762fc1ac176b3aa620b11d.zip
- refactorized the whole project and made a few subprojects
- replaced tcp with enet - added connect dialog - some smaller bugfixes
Diffstat (limited to 'pacman-c++/pixmapitem.cpp')
-rw-r--r--pacman-c++/pixmapitem.cpp77
1 files changed, 0 insertions, 77 deletions
diff --git a/pacman-c++/pixmapitem.cpp b/pacman-c++/pixmapitem.cpp
deleted file mode 100644
index 1ceeec1..0000000
--- a/pacman-c++/pixmapitem.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
1#include "pixmapitem.h"
2#include <QPainter>
3
4PixmapItem::PixmapItem(QGraphicsItem *parent)
5 : QGraphicsObject(parent), m_x(0), m_y(0)
6{
7}
8
9PixmapItem::PixmapItem(const QString &fileName, QGraphicsItem *parent)
10 : QGraphicsObject(parent), m_x(0), m_y(0)
11{
12 m_pix = ":/" + fileName;
13 m_width = m_pix.width();
14 m_height = m_pix.height();
15}
16
17PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene)
18 : QGraphicsObject(), m_x(0), m_y(0)
19{
20 m_pix = ":/" + fileName;
21 m_width = m_pix.width();
22 m_height = m_pix.height();
23 scene->addItem(this);
24}
25
26PixmapItem::PixmapItem(const QPixmap &pix, QGraphicsItem *parent)
27 : QGraphicsObject(parent), m_pix(pix), m_x(0), m_y(0)
28{
29 m_width = m_pix.width();
30 m_height = m_pix.height();
31}
32
33PixmapItem::PixmapItem(const QPixmap &pix, QGraphicsScene *scene)
34 : QGraphicsObject(), m_pix(pix), m_x(0), m_y(0)
35{
36 m_width = m_pix.width();
37 m_height = m_pix.height();
38 scene->addItem(this);
39}
40
41void PixmapItem::setPixmap(const QPixmap &pix)
42{
43 m_pix = pix;
44 m_width = m_pix.width();
45 m_height = m_pix.height();
46}
47
48void PixmapItem::setSprite(int x, int y, int width, int height)
49{
50 m_x = x;
51 m_y = y;
52 m_width = width;
53 m_height = height;
54}
55
56QSizeF PixmapItem::size() const
57{
58 return QSizeF(m_width, m_height);
59}
60
61QRectF PixmapItem::boundingRect() const
62{
63 return QRectF(QPointF(0, 0), size());
64}
65
66QPainterPath PixmapItem::shape() const
67{
68 QPainterPath path;
69 path.addRect(boundingRect());
70 return path;
71}
72
73void PixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
74{
75 painter->drawPixmap(QPoint(0, 0), m_pix, QRect(m_x, m_y, m_width, m_height));
76}
77