2
Copyright 2007-2008 Fela Winkelmolen <fela.kde@gmail.com>
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 2 of the License, or
7
(at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include <KGameCanvas>
26
// all items (balls, bricks, ...) inerit from this class
27
// initially svg and the abstract canvas are set to 0, before calling the
28
// constructor setSvgRenderer() and setCanvasAbstract() should be called!!!
29
// TODO: should be and abstract class???
30
class Item : public QObject, private KGameCanvasPixmap
37
static void setCanvas(KGameCanvasWidget *);
39
static qreal scale() {return m_scale;}
40
static int borderLeft() {return m_borderLeft;}
42
// make superclass functions accessible
43
using KGameCanvasPixmap::hide;
44
using KGameCanvasPixmap::show;
45
using KGameCanvasPixmap::raise;
46
//using KGameCanvasPixmap::visible;
47
using KGameCanvasPixmap::setPixmap;
48
//void hide() {KGameCanvasPixmap::hide();}
49
//void show() {KGameCanvasPixmap::show();}
50
bool isVisible() {return KGameCanvasItem::visible();}
51
//void setPixmap(const QPixmap &p) {KGameCanvasPixmap::setPixmap(p);}
53
void setType(const QString &type);
54
QString type() const {return elementId;}
56
void setRect(const QRectF &newBoundingRect);
58
//rect() const is virtual so DON'T use that name!!!
59
QRect getRect() const;
60
QPoint position() const {return m_position.toPoint();}
62
void moveTo(qreal x, qreal y);
63
//void moveTo(int x, int y);
64
void moveTo(const QPointF &point);
65
void moveBy(qreal dx, qreal dy);
69
// load or reloads the sprite
70
virtual void loadSprite();
73
static void updateScale();
75
// canvas container of all Items
76
static KGameCanvasWidget *canvas;
78
// TODO: rename to m_scaleRatio
80
static int m_borderLeft;
81
static int m_borderTop;