summaryrefslogtreecommitdiffstats
path: root/pacman-c++/pixmapitem.h
blob: 4e58a5239ec00268b059c281b60b047358109e29 (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
#ifndef PIXMAPITEM__H
#define PIXMAPITEM__H

#include <QtGui/QGraphicsObject>
#include <QtGui/QGraphicsScene>

#include "gameentity.h"

class PixmapItem
  : public QGraphicsObject, public 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 *);

private:
  QPixmap m_pix;
  int m_x, m_y;
  int m_width, m_height;
};

#endif