• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kgoldrunner

kgrtheme.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                          kgrtheme.h  -  description
00003                              -------------------
00004     begin                : Wed Jan 23 2002
00005     Copyright 2002 Marco Krüger <grisuji@gmx.de>
00006     Copyright 2002 Ian Wadham <ianw2@optusnet.com.au>
00007     Copyright 2007 Luciano Montanaro <mikelima@cirulla.net>
00008 ***************************************************************************/
00009 
00010 /***************************************************************************
00011  *                                                                         *
00012  *   This program is free software; you can redistribute it and/or modify  *
00013  *   it under the terms of the GNU General Public License as published by  *
00014  *   the Free Software Foundation; either version 2 of the License, or     *
00015  *   (at your option) any later version.                                   *
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     // Each KSvgRenderer loads a single .svg file. multiple SVG files make a
00145     // single theme.
00146     KSvgRenderer svgSet;                //< Tiles in here
00147     KSvgRenderer svgActors;             //< Everything else?
00148     
00149     QColor m_borderColor, m_textColor;  // Border colours.
00150 
00151     QString themeDataDir;
00152     QString m_themeFilepath;
00153     short themeDrawBorder;
00154 
00155     QList< QPixmap > namedTiles (QList< QString > names, unsigned int size);
00156     
00157     // Thomi - 31/01/2008
00158     // This private method will load the given item from SVG, if it exists, and
00159     // will automatically handle inserting and removing files from the pixmap
00160     // cache.
00161     QPixmap loadGraphic(const QSize &size, const QString &strName, KSvgRenderer &Svg, double boundsAdjust=0.5);
00162 
00163     // utility method - create the pixCache pointer below given a theme file
00164     // path.
00165     void createPixCache();
00166     
00167     int numBackgrounds;
00168 
00169     int counts[TileTypeCount];
00170     int offsets[TileTypeCount];
00171 
00172     // Thomi Richards - 25/01/2008
00173     //
00174     // Use a KPixmapCache to store rendered pixmaps in, so we don't need to
00175     // render from SVG every time:
00176     KPixmapCache *pixCache;
00177 };
00178 
00179 #endif // KGRTHEME_H

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal