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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
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 <tqcursor.h>
#include <tqcanvas.h>
#include <tqlabel.h>
#include <tqimage.h>
#include <tqpainter.h>
class KGrCanvas : public QCanvasView
{
Q_OBJECT
public:
KGrCanvas (TQWidget * parent = 0, const char *name = 0);
virtual ~KGrCanvas();
void changeLandscape (const TQString & name);
TQPoint getMousePos ();
void setMousePos (int, int);
bool changeSize (int);
void setBaseScale ();
void updateCanvas ();
void paintCell (int, int, char, int offset = 0);
void setTitle (TQString);
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();
TQPixmap getPixmap (char type);
signals:
void mouseClick (int);
void mouseLetGo (int);
protected:
void contentsMousePressEvent (TQMouseEvent *);
void contentsMouseReleaseEvent (TQMouseEvent *);
private:
TQCursor * m;
TQCanvas * field;
TQCanvasView * 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.
TQColor borderColor, textColor; // Border colours.
TQLabel * title; // Title and top part of border.
TQCanvasRectangle * borderB; // Bottom part of border.
TQCanvasRectangle * borderL; // Left-hand part of border.
TQCanvasRectangle * borderR; // Right-hand part of border.
int freebg, nuggetbg, polebg, ladderbg, hladderbg;
int edherobg, edenemybg, betonbg, brickbg, fbrickbg;
int bgw, bgh, bgd;
TQPixmap bgPix;
TQCanvasPixmapArray * heroArray;
TQCanvasPixmapArray * enemyArray;
int goldEnemy;
TQCanvasSprite * heroSprite;
#ifdef QT3
TQPtrList<TQCanvasSprite> * enemySprites;
#else
QList<TQCanvasSprite> * enemySprites;
#endif
void initView();
void makeTiles();
void makeBorder();
void makeTitle();
TQColor colour;
TQCanvasRectangle * drawRectangle (int, int, int, int, int);
void changeColours (const char * colours []);
void recolourObject (const char * object [], const char * colours []);
};
#endif // KGRCANVAS_H
|