Diffstat (limited to 'noncore/games/zsame/StoneWidget.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/games/zsame/StoneWidget.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/noncore/games/zsame/StoneWidget.cpp b/noncore/games/zsame/StoneWidget.cpp index 5dd0252..f370714 100644 --- a/noncore/games/zsame/StoneWidget.cpp +++ b/noncore/games/zsame/StoneWidget.cpp | |||
@@ -1,70 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | * ksame 0.4 - simple Game | 2 | * ksame 0.4 - simple Game |
3 | * Copyright (C) 1997,1998 Marcus Kreutzberger | 3 | * Copyright (C) 1997,1998 Marcus Kreutzberger |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify | 5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or | 7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. | 8 | * (at your option) any later version. |
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. |
14 | * | 14 | * |
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License |
16 | * along with this program; if not, write to the Free Software | 16 | * along with this program; if not, write to the Free Software |
17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | * | 18 | * |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <stdio.h> | 21 | #include <opie2/oresource.h> |
22 | #include <stdlib.h> | ||
23 | 22 | ||
24 | 23 | #include <qbitmap.h> | |
25 | |||
26 | #include <qpe/resource.h> | ||
27 | 24 | ||
28 | #include <time.h> | 25 | #include <time.h> |
29 | #include <assert.h> | 26 | #include <assert.h> |
30 | 27 | ||
31 | #include "StoneWidget.h" | 28 | #include "StoneWidget.h" |
32 | 29 | ||
33 | 30 | ||
34 | 31 | ||
35 | struct StoneSlice { | 32 | struct StoneSlice { |
36 | QPixmap stone; | 33 | QPixmap stone; |
37 | }; | 34 | }; |
38 | 35 | ||
39 | 36 | ||
40 | StoneWidget::StoneWidget( QWidget *parent, int x, int y ) | 37 | StoneWidget::StoneWidget( QWidget *parent, int x, int y ) |
41 | : QWidget(parent,"StoneWidget"), stonefield(x,y) | 38 | : QWidget(parent,"StoneWidget"), stonefield(x,y) |
42 | { | 39 | { |
43 | // setBackgroundPixmap(QPixmap(locate("wallpaper", "Time-For-Lunch-2.jpg"))); | 40 | QPixmap stonemap = Opie::Core::OResource::loadPixmap( "zsame/stones" ); |
44 | // QPixmap stonemap(locate("appdata", "stones.png")); | ||
45 | |||
46 | QPixmap stonemap = Resource::loadPixmap("zsame/stones" ); | ||
47 | assert(!stonemap.isNull()); | 41 | assert(!stonemap.isNull()); |
48 | 42 | ||
49 | slice=0; | 43 | slice=0; |
50 | maxslices=30; | 44 | maxslices=30; |
51 | maxcolors=4; | 45 | maxcolors=4; |
52 | 46 | ||
53 | sizex=x; | 47 | sizex=x; |
54 | sizey=y; | 48 | sizey=y; |
55 | 49 | ||
56 | stone_width=stonemap.width()/(maxslices+1); | 50 | stone_width=stonemap.width()/(maxslices+1); |
57 | stone_height=stonemap.height()/maxcolors; | 51 | stone_height=stonemap.height()/maxcolors; |
58 | 52 | ||
59 | map = new StoneSlice*[maxcolors]; | 53 | map = new StoneSlice*[maxcolors]; |
60 | QBitmap mask; | 54 | QBitmap mask; |
61 | for (int c = 0; c < maxcolors; c++) { | 55 | for (int c = 0; c < maxcolors; c++) { |
62 | map[c] = new StoneSlice[maxslices]; | 56 | map[c] = new StoneSlice[maxslices]; |
63 | 57 | ||
64 | for (int s = 0; s < maxslices; s++) { | 58 | for (int s = 0; s < maxslices; s++) { |
65 | map[c][s].stone.resize(stone_width, stone_height); | 59 | map[c][s].stone.resize(stone_width, stone_height); |
66 | assert(!map[c][s].stone.isNull()); | 60 | assert(!map[c][s].stone.isNull()); |
67 | bitBlt(&map[c][s].stone, 0, 0, | 61 | bitBlt(&map[c][s].stone, 0, 0, |
68 | &stonemap, stone_width * s, | 62 | &stonemap, stone_width * s, |
69 | c*stone_height, | 63 | c*stone_height, |
70 | stone_width,stone_height,CopyROP,false); | 64 | stone_width,stone_height,CopyROP,false); |