diff options
author | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
---|---|---|
committer | toma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2009-11-25 17:56:58 +0000 |
commit | c90c389a8a8d9d8661e9772ec4144c5cf2039f23 (patch) | |
tree | 6d8391395bce9eaea4ad78958617edb20c6a7573 /ksokoban/ImageData.h | |
download | tdegames-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 'ksokoban/ImageData.h')
-rw-r--r-- | ksokoban/ImageData.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/ksokoban/ImageData.h b/ksokoban/ImageData.h new file mode 100644 index 00000000..4e57bc7d --- /dev/null +++ b/ksokoban/ImageData.h @@ -0,0 +1,87 @@ +/* + * ksokoban - a Sokoban game for KDE + * Copyright (C) 1998 Anders Widell <[email protected]> + * + * 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef IMAGEDATA_H +#define IMAGEDATA_H + +#include <qimage.h> +#include <qpixmap.h> +#include <qcstring.h> + +#include <krandomsequence.h> + +class QPainter; + +#define SMALL_STONES 4 +#define LARGE_STONES 6 +#define OTHER_IMAGES 5 +#define NO_OF_IMAGES (SMALL_STONES + LARGE_STONES + OTHER_IMAGES) + +class +ImageData { +public: + virtual ~ImageData(); + + int resize(int size); + int size() { return size_; } + + void wall(QPainter &p, int x, int y, int index, bool left, bool right); + void floor(QPainter &p, int x, int y); + void goal(QPainter &p, int x, int y); + void man(QPainter &p, int x, int y); + void object(QPainter &p, int x, int y); + void saveman(QPainter &p, int x, int y); + void treasure(QPainter &p, int x, int y); + void brightObject(QPainter &p, int x, int y); + void brightTreasure(QPainter &p, int x, int y); + + const QPixmap &background() { return background_; } + const QImage& objectImg() const { return objectImg_; } + +protected: + ImageData(); + + void expandIndex(int size); + void image2pixmap(QImage img, QPixmap& xpm, bool diffuse=true); + void brighten(QImage& img); + + const QPixmap &upperLarge(int index); + const QPixmap &lowerLarge(int index); + const QPixmap &leftSmall(int index); + const QPixmap &rightSmall(int index); + + QImage images_[NO_OF_IMAGES]; + + QPixmap smallStone_xpm_[SMALL_STONES]; + QPixmap largeStone_xpm_[LARGE_STONES]; + QPixmap otherPixmaps_[OTHER_IMAGES]; + QPixmap background_, brightObject_, brightTreasure_; + QImage objectImg_; + + int indexSize_; + QByteArray upperLargeIndex_; + QByteArray lowerLargeIndex_; + QByteArray leftSmallIndex_; + QByteArray rightSmallIndex_; + + int size_, halfSize_; + KRandomSequence random; +}; + +#endif /* IMAGEDATA_H */ |