43 #include <QtGui/qpixmap.h>
44 #include <QtGui/qbrush.h>
45 #include <QtGui/qpen.h>
46 #include <QtGui/qpolygon.h>
47 #include <QtGui/qscrollarea.h>
82 virtual void moveBy(
double dx,
double dy);
114 virtual void draw(QPainter&) = 0;
186 virtual QPolygon chunks()
const;
187 virtual void addToChunks();
188 virtual void removeFromChunks();
189 virtual void changeChunks();
199 double myx, myy, myz;
218 QtCanvas(QPixmap p,
int h,
int v,
int tilewidth,
int tileheight);
223 int tilewidth,
int tileheight);
230 virtual void setTile(
int x,
int y,
int tilenum);
232 return grid[x + y * htiles];
257 return QSize(awidth, aheight);
260 return QRect(0, 0, awidth, aheight);
263 return x >= 0 && y >= 0 && x < awidth && y < aheight;
269 return x >= 0 && y >= 0 && x < chwidth && y < chheight;
278 virtual void retune(
int chunksize,
int maxclusters = 100);
281 return x1 / chunksize == x2 / chunksize && y1 / chunksize == y2 / chunksize;
301 void drawArea(
const QRect&, QPainter* p,
bool double_buffer =
false);
331 void init(
int w,
int h,
int chunksze = 16,
int maxclust = 100);
336 QRect changeBounds();
341 int chwidth, chheight;
346 void initTiles(QPixmap p,
int h,
int v,
int tilewidth,
int tileheight);
354 QTimer* update_timer;
356 bool debug_redraw_areas;
391 virtual void drawContents(QPainter* p,
int cx,
int cy,
int cw,
int ch);
411 void updateContentsSize();
420 #ifndef QT_NO_IMAGEIO
441 void init(
const QImage&);
442 void init(
const QPixmap& pixmap,
int hx,
int hy);
450 QImage* collision_mask;
457 #ifndef QT_NO_IMAGEIO
463 #ifndef QT_NO_IMAGEIO
464 bool readPixmaps(
const QString& datafilenamepattern,
int framecount = 0);
473 return img ? img[i] : 0;
477 return (uint)framecount;
483 #ifndef QT_NO_IMAGEIO
484 bool readPixmaps(
const QString& datafilenamepattern,
int framecount,
bool maskonly);
510 return images->
count();
536 return images->
image(frm);
540 return images->
image(f);
551 void removeFromChunks();
609 void scanPolygon(
const QPolygon& pa,
int winding,
611 QPolygon chunks()
const;
641 return QRect(
int(
x()),
int(
y()), w, h);
709 return QPoint(x1, y1);
712 return QPoint(x2, y2);
771 class QtCanvasTextExtra;
809 void removeFromChunks();
818 QtCanvasTextExtra* extra;
QList< QtCanvasItem * > QtCanvasItemList
Definition: canvas_variant/qtcanvas.h:60
Definition: canvas_typed/qtcanvas.cpp:3477
Definition: canvas_typed/qtcanvas.cpp:284
Definition: canvas_typed/qtcanvas.cpp:56
Definition: canvas_typed/qtcanvas.h:730
static int RTTI
Definition: canvas_typed/qtcanvas.h:755
void setSize(int w, int h)
int angleLength() const
Definition: canvas_variant/qtcanvas.h:747
void setAngles(int start, int length)
QtCanvasEllipse(int width, int height, QtCanvas *canvas)
bool collidesWith(const QtCanvasItem *) const
QPolygon areaPoints() const
QtCanvasEllipse(QtCanvas *canvas)
QtCanvasEllipse(int width, int height, int startangle, int angle, QtCanvas *canvas)
int angleStart() const
Definition: canvas_variant/qtcanvas.h:744
int height() const
Definition: canvas_typed/qtcanvas.cpp:4269
int width() const
Definition: canvas_typed/qtcanvas.cpp:4262
void drawShape(QPainter &)
Definition: canvas_typed/qtcanvas.h:67
virtual bool collidesWith(const QtCanvasItem *) const =0
bool isEnabled() const
Definition: canvas_variant/qtcanvas.h:128
void move(double x, double y)
virtual void setEnabled(bool yes)
virtual QRect boundingRectAdvanced() const
void setX(double a)
Definition: canvas_variant/qtcanvas.h:84
virtual void advance(int stage)
void setY(double a)
Definition: canvas_variant/qtcanvas.h:87
double z() const
Definition: canvas_variant/qtcanvas.h:78
virtual QRect boundingRect() const =0
virtual void setActive(bool yes)
QtCanvasItem(QtCanvas *canvas)
QtCanvasItemList collisions(bool exact) const
bool active() const
Definition: canvas_variant/qtcanvas.h:144
bool selected() const
Definition: canvas_variant/qtcanvas.h:138
double yVelocity() const
Definition: canvas_typed/qtcanvas.cpp:1758
void setXVelocity(double vx)
Definition: canvas_variant/qtcanvas.h:98
void update()
Definition: canvas_variant/qtcanvas.h:171
virtual void moveBy(double dx, double dy)
virtual void setVelocity(double vx, double vy)
double xVelocity() const
Definition: canvas_typed/qtcanvas.cpp:1751
bool visible() const
Definition: canvas_variant/qtcanvas.h:135
double y() const
Definition: canvas_variant/qtcanvas.h:75
bool isVisible() const
Definition: canvas_variant/qtcanvas.h:120
bool isSelected() const
Definition: canvas_variant/qtcanvas.h:124
QtCanvas * canvas() const
Definition: canvas_typed/qtcanvas.h:166
void setZ(double a)
Definition: canvas_variant/qtcanvas.h:90
virtual void setAnimated(bool y)
virtual void setVisible(bool yes)
static int RTTI
Definition: canvas_typed/qtcanvas.h:161
RttiValues
Definition: canvas_typed/qtcanvas.h:148
@ Rtti_Spline
Definition: canvas_typed/qtcanvas.h:157
@ Rtti_PolygonalItem
Definition: canvas_typed/qtcanvas.h:151
@ Rtti_Item
Definition: canvas_typed/qtcanvas.h:149
@ Rtti_Ellipse
Definition: canvas_typed/qtcanvas.h:155
@ Rtti_Rectangle
Definition: canvas_typed/qtcanvas.h:154
@ Rtti_Polygon
Definition: canvas_typed/qtcanvas.h:153
@ Rtti_Text
Definition: canvas_typed/qtcanvas.h:152
@ Rtti_Line
Definition: canvas_typed/qtcanvas.h:156
@ Rtti_Sprite
Definition: canvas_typed/qtcanvas.h:150
double x() const
Definition: canvas_variant/qtcanvas.h:72
virtual void setVelocity(double vx, double vy)
Definition: canvas_typed/qtcanvas.cpp:1738
void setYVelocity(double vy)
Definition: canvas_variant/qtcanvas.h:101
virtual void draw(QPainter &)=0
bool isActive() const
Definition: canvas_variant/qtcanvas.h:132
virtual void setCanvas(QtCanvas *)
virtual void setSelected(bool yes)
bool enabled() const
Definition: canvas_variant/qtcanvas.h:141
Definition: canvas_typed/qtcanvas.h:702
static int RTTI
Definition: canvas_typed/qtcanvas.h:716
QtCanvasLine(QtCanvas *canvas)
QPolygon areaPoints() const
QPoint endPoint() const
Definition: canvas_variant/qtcanvas.h:711
void drawShape(QPainter &)
void moveBy(double dx, double dy)
QPoint startPoint() const
Definition: canvas_variant/qtcanvas.h:708
void setPoints(int x1, int y1, int x2, int y2)
Definition: canvas_typed/qtcanvas.h:454
bool readPixmaps(const QString &datafilenamepattern, int framecount=0)
QtCanvasPixmapArray(const QList< QPixmap > &pixmaps, const QPolygon &hotspots=QPolygon())
QtCanvasPixmap * image(int i) const
Definition: canvas_variant/qtcanvas.h:472
void setImage(int i, QtCanvasPixmap *p)
bool readCollisionMasks(const QString &filenamepattern)
uint count() const
Definition: canvas_variant/qtcanvas.h:476
QtCanvasPixmapArray(const QString &datafilenamepattern, int framecount=0)
Definition: canvas_typed/qtcanvas.h:418
QtCanvasPixmap(const QString &datafilename)
QtCanvasPixmap(const QImage &image)
int offsetY() const
Definition: canvas_variant/qtcanvas.h:430
void setOffset(int x, int y)
Definition: canvas_variant/qtcanvas.h:433
int offsetX() const
Definition: canvas_variant/qtcanvas.h:427
friend bool qt_testCollision(const QtCanvasSprite *s1, const QtCanvasSprite *s2)
Definition: canvas_typed/qtcanvas.cpp:1950
QtCanvasPixmap(const QPixmap &, const QPoint &hotspot)
Definition: canvas_typed/qtcanvas.h:664
QtCanvasPolygon(QtCanvas *canvas)
void drawShape(QPainter &)
void moveBy(double dx, double dy)
QPolygon areaPoints() const
static int RTTI
Definition: canvas_typed/qtcanvas.h:675
QPolygon poly
Definition: canvas_typed/qtcanvas.h:679
Definition: canvas_typed/qtcanvas.h:572
virtual void setPen(QPen p)
static int RTTI
Definition: canvas_typed/qtcanvas.h:594
QBrush brush() const
Definition: canvas_variant/qtcanvas.h:585
virtual QPolygon areaPoints() const =0
QPen pen() const
Definition: canvas_variant/qtcanvas.h:582
QtCanvasPolygonalItem(QtCanvas *canvas)
QRect boundingRect() const
virtual void drawShape(QPainter &)=0
bool isValid() const
Definition: canvas_variant/qtcanvas.h:604
virtual void setBrush(QBrush b)
virtual ~QtCanvasPolygonalItem()
virtual QPolygon areaPointsAdvanced() const
bool collidesWith(const QtCanvasItem *) const
Definition: canvas_typed/qtcanvas.h:625
void drawShape(QPainter &)
QPolygon areaPoints() const
void setSize(int w, int h)
static int RTTI
Definition: canvas_typed/qtcanvas.h:647
int height() const
Definition: canvas_typed/qtcanvas.cpp:4125
bool collidesWith(const QtCanvasItem *) const
QtCanvasRectangle(const QRect &, QtCanvas *canvas)
QtCanvasRectangle(int x, int y, int width, int height, QtCanvas *canvas)
QSize size() const
Definition: canvas_variant/qtcanvas.h:636
int width() const
Definition: canvas_typed/qtcanvas.cpp:4118
QRect rect() const
Definition: canvas_variant/qtcanvas.h:640
QtCanvasRectangle(QtCanvas *canvas)
Definition: canvas_typed/qtcanvas.h:683
QtCanvasSpline(QtCanvas *canvas)
static int RTTI
Definition: canvas_typed/qtcanvas.h:693
bool closed() const
Definition: canvas_typed/qtcanvas.cpp:3875
void setControlPoints(QPolygon, bool closed=true)
QPolygon controlPoints() const
Definition: canvas_typed/qtcanvas.h:493
virtual ~QtCanvasSprite()
int leftEdge(int nx) const
int frame() const
Definition: canvas_typed/qtcanvas.h:506
int bottomEdge(int ny) const
int rightEdge(int nx) const
bool collidesWith(const QtCanvasItem *) const
QtCanvasPixmap * image(int f) const
Definition: canvas_variant/qtcanvas.h:539
int topEdge(int ny) const
int frameCount() const
Definition: canvas_variant/qtcanvas.h:509
QtCanvasPixmap * image() const
Definition: canvas_variant/qtcanvas.h:535
QRect boundingRect() const
virtual void advance(int stage)
void draw(QPainter &painter)
static int RTTI
Definition: canvas_typed/qtcanvas.h:514
FrameAnimationType
Definition: canvas_typed/qtcanvas.h:504
@ Cycle
Definition: canvas_typed/qtcanvas.h:504
@ Oscillate
Definition: canvas_typed/qtcanvas.h:504
virtual void move(double x, double y, int frame)
virtual void setFrameAnimation(FrameAnimationType=Cycle, int step=1, int state=0)
QtCanvasSprite(QtCanvasPixmapArray *array, QtCanvas *canvas)
void move(double x, double y)
virtual QtCanvasPixmap * imageAdvanced() const
friend bool qt_testCollision(const QtCanvasSprite *s1, const QtCanvasSprite *s2)
Definition: canvas_typed/qtcanvas.cpp:1950
void setSequence(QtCanvasPixmapArray *seq)
Definition: canvas_typed/qtcanvas.h:773
QtCanvasText(QtCanvas *canvas)
void setColor(const QColor &)
QtCanvasText(const QString &, QFont, QtCanvas *canvas)
void moveBy(double dx, double dy)
int textFlags() const
Definition: canvas_variant/qtcanvas.h:790
QtCanvasText(const QString &, QtCanvas *canvas)
static int RTTI
Definition: canvas_typed/qtcanvas.h:800
void setFont(const QFont &)
void setText(const QString &)
virtual void draw(QPainter &)
bool collidesWith(const QtCanvasItem *) const
QRect boundingRect() const
Definition: canvas_typed/qtcanvas.cpp:66
Definition: canvas_typed/qtcanvas.h:365
virtual void contentsMouseMoveEvent(QMouseEvent *)
virtual void drawContents(QPainter *p, int cx, int cy, int cw, int ch)
Definition: canvas_typed/qtcanvas.cpp:3296
virtual void contentsDropEvent(QDropEvent *)
void setHighQualityRendering(bool enable)
Definition: canvas_typed/qtcanvas.cpp:3162
virtual void contentsDragEnterEvent(QDragEnterEvent *)
const QMatrix & worldMatrix() const
virtual void contentsMouseDoubleClickEvent(QMouseEvent *)
virtual void contentsDragMoveEvent(QDragMoveEvent *)
bool highQualityRendering() const
bool setWorldMatrix(const QMatrix &)
QtCanvasView(QtCanvas *viewing, QWidget *parent=0)
QtCanvasView(QWidget *parent=0)
const QMatrix & inverseWorldMatrix() const
virtual void contentsDragLeaveEvent(QDragLeaveEvent *)
virtual void drawContents(QPainter *p, int cx, int cy, int cw, int ch)
virtual void contentsMouseReleaseEvent(QMouseEvent *)
virtual void contentsContextMenuEvent(QContextMenuEvent *)
virtual void contentsMousePressEvent(QMouseEvent *)
virtual void contentsWheelEvent(QWheelEvent *)
virtual QSize sizeHint() const
QtCanvas * canvas() const
Definition: canvas_variant/qtcanvas.h:374
bool highQualityRendering
Definition: canvas_typed/qtcanvas.h:367
void setCanvas(QtCanvas *v)
Definition: canvas_typed/qtcanvas.h:213
void addItemToChunkContaining(QtCanvasItem *, int x, int y)
virtual void setBackgroundPixmap(const QPixmap &p)
virtual void addItem(QtCanvasItem *)
virtual void retune(int chunksize, int maxclusters=100)
bool onCanvas(const QPoint &p) const
Definition: canvas_variant/qtcanvas.h:265
bool sameChunk(int x1, int y1, int x2, int y2) const
Definition: canvas_variant/qtcanvas.h:280
QtCanvas(QObject *parent=0)
virtual void removeAnimation(QtCanvasItem *)
int width() const
Definition: canvas_typed/qtcanvas.h:250
void removeItemFromChunk(QtCanvasItem *, int i, int j)
virtual void setAdvancePeriod(int ms)
virtual void setUpdatePeriod(int ms)
QColor backgroundColor() const
QRect rect() const
Definition: canvas_variant/qtcanvas.h:259
void drawViewArea(QtCanvasView *view, QPainter *p, const QRect &r, bool dbuf)
QtCanvasItemList collisions(const QRect &) const
void drawArea(const QRect &, QPainter *p, bool double_buffer=false)
friend void qt_unview(QtCanvas *c)
int height() const
Definition: canvas_typed/qtcanvas.h:253
int chunkSize() const
Definition: canvas_variant/qtcanvas.h:275
void addItemToChunk(QtCanvasItem *, int i, int j)
virtual void addAnimation(QtCanvasItem *)
virtual void addView(QtCanvasView *)
bool validChunk(int x, int y) const
Definition: canvas_variant/qtcanvas.h:268
virtual void setAllChanged()
virtual void setChangedChunkContaining(int x, int y)
void removeItemFromChunkContaining(QtCanvasItem *, int x, int y)
bool onCanvas(int x, int y) const
Definition: canvas_variant/qtcanvas.h:262
virtual void setBackgroundColor(const QColor &c)
int tilesHorizontally() const
Definition: canvas_variant/qtcanvas.h:235
virtual void drawBackground(QPainter &, const QRect &area)
virtual void resize(int width, int height)
virtual void removeItem(QtCanvasItem *)
QtCanvasItemList collisions(const QPolygon &pa, const QtCanvasItem *item, bool exact) const
virtual void removeView(QtCanvasView *)
int tileHeight() const
Definition: canvas_variant/qtcanvas.h:245
bool validChunk(const QPoint &p) const
Definition: canvas_variant/qtcanvas.h:271
QtCanvasItemList collisions(const QPoint &) const
virtual void setChangedChunk(int i, int j)
virtual void drawForeground(QPainter &, const QRect &area)
QSize size() const
Definition: canvas_variant/qtcanvas.h:256
virtual void setTile(int x, int y, int tilenum)
QtCanvasItemList allItems()
int tileWidth() const
Definition: canvas_variant/qtcanvas.h:242
virtual void setTiles(QPixmap tiles, int h, int v, int tilewidth, int tileheight)
virtual void setUnchanged(const QRect &area)
int tile(int x, int y) const
Definition: canvas_variant/qtcanvas.h:231
void drawCanvasArea(const QRect &, QPainter *p=0, bool double_buffer=true)
QtCanvas(QPixmap p, int h, int v, int tilewidth, int tileheight)
virtual void setChanged(const QRect &area)
int tilesVertically() const
Definition: canvas_variant/qtcanvas.h:238
QPixmap backgroundPixmap() const