blob: 88770d2856bb6402d603749a35f676832181e778 (
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
|
#ifndef PIXMAPITEM__H
#define PIXMAPITEM__H
#include <QtGui/QGraphicsObject>
#include <QtGui/QGraphicsScene>
#include "gameentity.h"
class PixmapItem
: public QGraphicsObject, GameEntity
{
public:
PixmapItem(QGraphicsItem *parent = 0);
PixmapItem(const QString &fileName, QGraphicsItem *parent = 0);
PixmapItem(const QString &fileName, QGraphicsScene *scene);
PixmapItem(const QPixmap &pix, QGraphicsItem *parent = 0);
PixmapItem(const QPixmap &pix, QGraphicsScene *scene);
virtual ~PixmapItem()
{};
void setPixmap(const QPixmap &pix);
void setSprite(int x, int y, int width, int height);
QSizeF size() const;
QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
virtual bool checkEnter(Actor *actor) { Q_UNUSED(actor); return true; } // default to true
virtual void enter(Actor *actor) { Q_UNUSED(actor); } // default to no action
private:
QPixmap m_pix;
int m_x, m_y;
int m_width, m_height;
};
#endif
|