Diffstat (limited to 'noncore/games/zbounce/game.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/zbounce/game.h | 181 |
1 files changed, 0 insertions, 181 deletions
diff --git a/noncore/games/zbounce/game.h b/noncore/games/zbounce/game.h deleted file mode 100644 index 656fba3..0000000 --- a/noncore/games/zbounce/game.h +++ b/dev/null | |||
@@ -1,181 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU Library General Public | ||
6 | * License as published by the Free Software Foundation; either | ||
7 | * version 2 of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Library General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the Free | ||
16 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
17 | */ | ||
18 | |||
19 | #ifndef GAME_H_INCLUDED | ||
20 | #define GAME_H_INCLUDED | ||
21 | |||
22 | #include <qwidget.h> | ||
23 | #include <qcanvas.h> | ||
24 | |||
25 | class QTimer; | ||
26 | class JezzField; | ||
27 | |||
28 | #define FIELD_WIDTH 26 | ||
29 | #define FIELD_HEIGHT 26 | ||
30 | |||
31 | class Arrow : public QCanvasSprite | ||
32 | { | ||
33 | public: | ||
34 | Arrow(QCanvasPixmapArray* array, QCanvas* canvas); | ||
35 | |||
36 | void update(); | ||
37 | void changeDirection(); | ||
38 | |||
39 | protected: | ||
40 | bool m_vertical; | ||
41 | }; | ||
42 | |||
43 | class Ball : public QCanvasSprite | ||
44 | { | ||
45 | public: | ||
46 | Ball(QCanvasPixmapArray* array, QCanvas* canvas); | ||
47 | |||
48 | void update(); | ||
49 | void advance(int stage); | ||
50 | bool collide( double dx=0, double dy=0 ); | ||
51 | |||
52 | protected: | ||
53 | int m_animDelay; | ||
54 | int m_soundDelay; | ||
55 | }; | ||
56 | |||
57 | |||
58 | class Wall : public QObject | ||
59 | { | ||
60 | Q_OBJECT | ||
61 | public: | ||
62 | enum Direction { Up, Down, Left, Right }; | ||
63 | |||
64 | Wall( JezzField *field, int x, int y, Direction dir, int tile, | ||
65 | QObject *parent=0, const char *name=0 ); | ||
66 | |||
67 | void finish(); | ||
68 | void fill( bool black ); | ||
69 | |||
70 | signals: | ||
71 | void finished( Wall *wall, int tile ); | ||
72 | |||
73 | public slots: | ||
74 | void advance(); | ||
75 | void update(); | ||
76 | |||
77 | private: | ||
78 | bool isFree( int x, int y ); | ||
79 | |||
80 | Direction m_dir; | ||
81 | JezzField *m_field; | ||
82 | int m_dx, m_dy; | ||
83 | int m_x, m_y; | ||
84 | int m_startX, m_startY; | ||
85 | int m_tile; | ||
86 | int m_delay; | ||
87 | bool m_active; | ||
88 | }; | ||
89 | |||
90 | |||
91 | class JezzField : public QCanvas | ||
92 | { | ||
93 | Q_OBJECT | ||
94 | public: | ||
95 | JezzField( QPixmap tiles, QObject* parent = 0, const char* name = 0 ); | ||
96 | |||
97 | void setGameTile( int x, int y, bool black ); | ||
98 | |||
99 | signals: | ||
100 | void ballCollision( Ball *ball, int x, int y, int tile ); | ||
101 | |||
102 | private: | ||
103 | friend class Ball; | ||
104 | QPixmap m_tiles; | ||
105 | |||
106 | void setPixmaps( QPixmap tiles ); | ||
107 | void emitBallCollisiton( Ball *ball, int x, int y, int tile ) | ||
108 | { emit ballCollision( ball, x, y, tile ); }; | ||
109 | |||
110 | }; | ||
111 | |||
112 | |||
113 | class JezzView : public QCanvasView | ||
114 | { | ||
115 | Q_OBJECT | ||
116 | public: | ||
117 | JezzView(QCanvas* viewing=0, QWidget* parent=0, const char* name=0, WFlags f=0); | ||
118 | void changeCursor(); | ||
119 | |||
120 | signals: | ||
121 | void buildWall( int x, int y, bool vertical ); | ||
122 | |||
123 | protected: | ||
124 | void viewportMouseReleaseEvent( QMouseEvent * ); | ||
125 | |||
126 | private: | ||
127 | bool m_vertical; | ||
128 | }; | ||
129 | |||
130 | |||
131 | class JezzGame : public QWidget | ||
132 | { | ||
133 | Q_OBJECT | ||
134 | |||
135 | public: | ||
136 | JezzGame( int ballNum, QWidget *parent=0, const char *name=0 ); | ||
137 | ~JezzGame(); | ||
138 | |||
139 | int percent(); | ||
140 | void display( QString text, int size=20 ); | ||
141 | void changeCursor(); | ||
142 | |||
143 | signals: | ||
144 | void died(); | ||
145 | void newPercent( int percent ); | ||
146 | |||
147 | public slots: | ||
148 | void start(); | ||
149 | void stop(); | ||
150 | |||
151 | protected slots: | ||
152 | void tick(); | ||
153 | void buildWall( int x, int y, bool vertical ); | ||
154 | void wallFinished( Wall *wall, int tile ); | ||
155 | void ballCollision( Ball *ball, int x, int y, int tile ); | ||
156 | |||
157 | protected: | ||
158 | void makeBlack(); | ||
159 | void fill( int x, int y ); | ||
160 | void fillLeft( int x, int y ); | ||
161 | int m_buf[FIELD_WIDTH][FIELD_HEIGHT]; | ||
162 | |||
163 | JezzField *m_field; | ||
164 | JezzView *m_view; | ||
165 | |||
166 | Wall *m_wall1, *m_wall2; | ||
167 | |||
168 | QList<Ball> m_balls; | ||
169 | QCanvasPixmapArray *m_ballPixmaps; | ||
170 | QCanvasPixmapArray *m_arrowPixmaps; | ||
171 | QCanvasText *m_text; | ||
172 | Arrow *arrow; | ||
173 | |||
174 | QTimer *m_clock; | ||
175 | bool m_running; | ||
176 | int m_percent; | ||
177 | bool m_pictured; | ||
178 | |||
179 | }; | ||
180 | |||
181 | #endif | ||