summaryrefslogtreecommitdiffstats
path: root/kgoldrunner/src/kgrcanvas.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitc90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch)
tree6d8391395bce9eaea4ad78958617edb20c6a7573 /kgoldrunner/src/kgrcanvas.h
downloadtdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.tar.gz
tdegames-c90c389a8a8d9d8661e9772ec4144c5cf2039f23.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kgoldrunner/src/kgrcanvas.h')
-rw-r--r--kgoldrunner/src/kgrcanvas.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/kgoldrunner/src/kgrcanvas.h b/kgoldrunner/src/kgrcanvas.h
new file mode 100644
index 00000000..02b89bed
--- /dev/null
+++ b/kgoldrunner/src/kgrcanvas.h
@@ -0,0 +1,111 @@
+/***************************************************************************
+ kgrcanvas.h - description
+ -------------------
+ begin : Wed Jan 23 2002
+ copyright : (C) 2002 by Marco Krüger and Ian Wadham
+ email : See menu "Help, About KGoldrunner"
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef KGRCANVAS_H
+#define KGRCANVAS_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qcursor.h>
+#include <qcanvas.h>
+#include <qlabel.h>
+#include <qimage.h>
+#include <qpainter.h>
+
+class KGrCanvas : public QCanvasView
+{
+ Q_OBJECT
+public:
+ KGrCanvas (QWidget * parent = 0, const char *name = 0);
+ virtual ~KGrCanvas();
+
+ void changeLandscape (const QString & name);
+
+ QPoint getMousePos ();
+ void setMousePos (int, int);
+
+ bool changeSize (int);
+ void setBaseScale ();
+
+ void updateCanvas ();
+ void paintCell (int, int, char, int offset = 0);
+ void setTitle (QString);
+
+ void makeHeroSprite (int, int, int);
+ void setHeroVisible (bool);
+ void moveHero (int, int, int);
+
+ void makeEnemySprite (int, int, int);
+ void moveEnemy (int, int, int, int, int);
+ void deleteEnemySprites();
+
+ QPixmap getPixmap (char type);
+
+signals:
+ void mouseClick (int);
+ void mouseLetGo (int);
+
+protected:
+ void contentsMousePressEvent (QMouseEvent *);
+ void contentsMouseReleaseEvent (QMouseEvent *);
+
+private:
+ QCursor * m;
+
+ QCanvas * field;
+ QCanvasView * fieldView;
+ int scaleStep; // Current scale-factor of canvas.
+ int baseScale; // Starting scale-factor of canvas.
+ int baseFontSize;
+
+ int border; // Number of tiles allowed for border.
+ int cw, bw, lw, mw; // Dimensions (in pixels) of the border.
+ QColor borderColor, textColor; // Border colours.
+ QLabel * title; // Title and top part of border.
+ QCanvasRectangle * borderB; // Bottom part of border.
+ QCanvasRectangle * borderL; // Left-hand part of border.
+ QCanvasRectangle * borderR; // Right-hand part of border.
+
+ int freebg, nuggetbg, polebg, ladderbg, hladderbg;
+ int edherobg, edenemybg, betonbg, brickbg, fbrickbg;
+ int bgw, bgh, bgd;
+ QPixmap bgPix;
+
+ QCanvasPixmapArray * heroArray;
+ QCanvasPixmapArray * enemyArray;
+ int goldEnemy;
+
+ QCanvasSprite * heroSprite;
+#ifdef QT3
+ QPtrList<QCanvasSprite> * enemySprites;
+#else
+ QList<QCanvasSprite> * enemySprites;
+#endif
+
+ void initView();
+ void makeTiles();
+ void makeBorder();
+ void makeTitle();
+ QColor colour;
+ QCanvasRectangle * drawRectangle (int, int, int, int, int);
+ void changeColours (const char * colours []);
+ void recolourObject (const char * object [], const char * colours []);
+};
+
+#endif // KGRCANVAS_H