kgoldrunner
kgrtheme.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KGRTHEME_H
00020 #define KGRTHEME_H
00021
00022 #include <QString>
00023 #include <QColor>
00024 #include <QImage>
00025 #include <KSvgRenderer>
00026 #include <KPixmapCache>
00027
00031 class KGrTheme
00032 {
00033 public:
00034 enum TileType {
00035 EmptyTile = 0,
00036 HiddenLadderTile,
00037 FalseBrickTile,
00038 HeroTile,
00039 EnemyTile,
00040 GoldTile,
00041 BarTile,
00042 LadderTile,
00043 ConcreteTile,
00044 BrickTile,
00045 BrickAnimation1Tile,
00046 BrickAnimation2Tile,
00047 BrickAnimation3Tile,
00048 BrickAnimation4Tile,
00049 BrickAnimation5Tile,
00050 BrickAnimation6Tile,
00051 BrickAnimation7Tile,
00052 BrickAnimation8Tile,
00053 BrickAnimation9Tile,
00054 TileTypeCount
00055 };
00061 KGrTheme (const QString &systemDataDir);
00062
00066 ~KGrTheme();
00067
00071 bool load (const QString & themeFilepath);
00072
00077 QList<QPixmap> tiles (unsigned int size);
00078
00083 QList<QPixmap> hero (unsigned int size);
00084
00089 QList<QPixmap> enemy (unsigned int size);
00090
00099 QPixmap background (unsigned int width, unsigned int height,
00100 unsigned int variant);
00101
00108 QList<QPixmap> frameTiles (unsigned int size);
00109
00117 QList<QPixmap> displayTiles (unsigned int size);
00118
00123 bool isBorderRequired() const { return themeDrawBorder; }
00124
00128 int backgroundCount() { return numBackgrounds; }
00129
00130 int tileCount(TileType t) { return counts[t]; }
00131 int firstTile(TileType t) { return offsets[t]; }
00132
00136 QColor borderColor() { return m_borderColor; }
00137
00141 QColor textColor() { return m_textColor; }
00142
00143 private:
00144
00145
00146 KSvgRenderer svgSet;
00147 KSvgRenderer svgActors;
00148
00149 QColor m_borderColor, m_textColor;
00150
00151 QString themeDataDir;
00152 QString m_themeFilepath;
00153 short themeDrawBorder;
00154
00155 QList< QPixmap > namedTiles (QList< QString > names, unsigned int size);
00156
00157
00158
00159
00160
00161 QPixmap loadGraphic(const QSize &size, const QString &strName, KSvgRenderer &Svg, double boundsAdjust=0.5);
00162
00163
00164
00165 void createPixCache();
00166
00167 int numBackgrounds;
00168
00169 int counts[TileTypeCount];
00170 int offsets[TileTypeCount];
00171
00172
00173
00174
00175
00176 KPixmapCache *pixCache;
00177 };
00178
00179 #endif // KGRTHEME_H