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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
#ifndef PAINTER_H
#define PAINTER_H
#include <kapp.h>
#include <tdelocale.h>
#include <ntqpixmap.h>
#include <ntqbitmap.h>
#include <ntqlabel.h>
#include <ntqcolor.h>
#include <ntqstrlist.h>
#include <ntqregexp.h>
#include "board.h"
#include "bitfont.h"
#include "colors.h"
enum PixMap { PacmanPix, DyingPix, MonsterPix, EyesPix, FruitPix,
PointPix, EnergizerPix, WallPix, PrisonPix,
FruitScorePix, MonsterScorePix };
enum DrawWidget { Widget, RoomPix, BackPix };
class Painter
{
public:
Painter (Board *, TQWidget *parent=0, int scheme=-1, int mode=-1,Bitfont *font=0);
TQPixmap levelPix() { return roomPix; }
void setScheme(int scheme=-1, int mode=-1, Bitfont *font=0);
void setLevel(int level=0);
TQRect rect(int pos, PixMap pix, uint i = 0);
TQRect rect(int pos, TQString str, int align = TQLabel::AlignCenter );
TQRect rect(TQRect r1, TQRect r2);
void draw(TQPoint point, DrawWidget where, TQPixmap pix);
void draw(TQRect rect, DrawWidget where, TQPixmap pix);
void draw(int pos, DrawWidget where, PixMap pix, uint i = 0);
TQPixmap draw(int pos, DrawWidget where, TQString str,
TQColor fg, TQColor bg = TQColor(), int align = TQLabel::AlignCenter);
TQRect draw(int col, int row, DrawWidget where, TQString str,
TQColor fg, TQColor bg = TQColor(), int align = TQLabel::AlignCenter);
void drawBrick(int pos);
void drawPrison(int pos);
void drawPoint(int pos);
void erase(int pos, PixMap pix, uint i = 0);
int maxPixmaps(PixMap pix);
protected:
TQString decodeHexOctString(TQString str);
void fillScoreString(TQStrList &, TQArray<int> &);
void fillArray(TQArray<int> &, TQString, int);
void fillStrList(TQStrList &, TQString, int);
void fillPixmapName(TQStrList &);
void confScheme();
void confLevels(bool defGroup=TRUE);
void confMisc(bool defGroup=TRUE);
void confScoring(bool defGroup=TRUE);
void initPixmaps();
void initRoomPixmap();
void initbackPixmaps();
private:
TQWidget *w;
Board *board;
Bitfont *bitfont;
int BlockWidth;
int BlockHeight;
TQArray<int> fruitScore;
TQStrList fruitScoreString;
TQArray<int> monsterScore;
TQStrList monsterScoreString;
TQString pixmapDirectory;
TQStrList pointPixmapName;
TQStrList wallPixmapName;
TQStrList prisonPixmapName;
TQStrList energizerPixmapName;
TQStrList fruitPixmapName;
TQStrList pacmanPixmapName;
TQStrList dyingPixmapName;
TQStrList eyesPixmapName;
TQStrList monsterPixmapName;
TQStrList fruitScorePixmapName;
TQStrList monsterScorePixmapName;
TQString lastPointPixmapName;
TQString lastWallPixmapName;
TQString lastPrisonPixmapName;
TQString lastEnergizerPixmapName;
TQString lastFruitPixmapName;
TQString lastPacmanPixmapName;
TQString lastDyingPixmapName;
TQString lastEyesPixmapName;
TQString lastMonsterPixmapName;
TQString lastFruitScorePixmapName;
TQString lastMonsterScorePixmapName;
TQPtrList<TQPixmap> *loadPixmap(TQWidget *parent, TQString pixmapName,
TQPtrList<TQPixmap> *pixmaps=0);
TQPtrList<TQPixmap> *textPixmap(TQStrList &, TQPtrList<TQPixmap> *pixmaps=0,
TQColor fg = BLACK, TQColor bg = TQColor());
TQPtrList<TQPixmap> *textPixmap(TQString str, TQPtrList<TQPixmap> *pixmaps=0,
TQColor fg = BLACK, TQColor bg = TQColor());
TQPoint point(int pos);
int checkRange(int value, int max, int min=0);
TQPtrList<TQPixmap> *wallPix;
TQPtrList<TQPixmap> *prisonPix;
TQPtrList<TQPixmap> *pointPix;
TQPtrList<TQPixmap> *energizerPix;
TQPtrList<TQPixmap> *fruitPix;
TQPtrList<TQPixmap> *pacmanPix;
TQPtrList<TQPixmap> *dyingPix;
TQPtrList<TQPixmap> *eyesPix;
TQPtrList<TQPixmap> *monsterPix;
TQPtrList<TQPixmap> *fruitScorePix;
TQPtrList<TQPixmap> *monsterScorePix;
TQPixmap roomPix;
TQPixmap backPix;
bool plainColor;
TQColor backgroundColor;
int maxLevel;
int level;
int scheme;
int mode;
};
#endif // PAINTER_H
|