File indexing completed on 2021-12-21 12:50:22

0001 /*
0002  *  ksokoban - a Sokoban game by KDE
0003  *  Copyright (C) 1998  Anders Widell  <d95-awi@nada.kth.se>
0004  *
0005  *  This program is free software; you can redistribute it and/or modify
0006  *  it under the terms of the GNU General Public License as published by
0007  *  the Free Software Foundation; either version 2 of the License, or
0008  *  (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU General Public License
0016  *  along with this program; if not, write to the Free Software
0017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0018  */
0019 
0020 #include <assert.h>
0021 #include "StaticImage.h"
0022 
0023 #include "images/data.c"
0024 
0025 const unsigned char *const
0026 imageData[NO_OF_IMAGES] = {
0027   halfstone_1_data_,
0028   halfstone_2_data_,
0029   halfstone_3_data_,
0030   halfstone_4_data_,
0031 
0032   stone_1_data_,
0033   stone_2_data_,
0034   stone_3_data_,
0035   stone_4_data_,
0036   stone_5_data_,
0037   stone_6_data_,
0038 
0039   object_data_,
0040   treasure_data_,
0041   goal_data_,
0042   man_data_,
0043   saveman_data_,
0044 };
0045 
0046 const unsigned
0047 imageSize[NO_OF_IMAGES] = {
0048   sizeof halfstone_1_data_,
0049   sizeof halfstone_2_data_,
0050   sizeof halfstone_3_data_,
0051   sizeof halfstone_4_data_,
0052 
0053   sizeof stone_1_data_,
0054   sizeof stone_2_data_,
0055   sizeof stone_3_data_,
0056   sizeof stone_4_data_,
0057   sizeof stone_5_data_,
0058   sizeof stone_6_data_,
0059 
0060   sizeof object_data_,
0061   sizeof treasure_data_,
0062   sizeof goal_data_,
0063   sizeof man_data_,
0064   sizeof saveman_data_,
0065 };
0066 
0067 StaticImage::StaticImage () {
0068   bool valid = background_.loadFromData((const uchar *) starfield_data_,
0069                     (uint) sizeof (starfield_data_));
0070 
0071   if (!valid) {
0072     background_ = background_.copy(0, 0, 128, 128);
0073     background_.fill(Qt::black);
0074   }
0075 
0076   for (int i=0; i<NO_OF_IMAGES; i++) {
0077     images_[i].loadFromData((const uchar *) imageData[i], (uint) imageSize[i]);
0078   }
0079 
0080   //resize(32,32);
0081 }
0082 
0083 StaticImage::~StaticImage () {
0084 }