summaryrefslogtreecommitdiff
authorimm <imm>2002-08-31 22:42:59 (UTC)
committer imm <imm>2002-08-31 22:42:59 (UTC)
commit754ba2082e46197a5b5c7b0885f36ed42785631a (patch) (unidiff)
tree64bbcccb27725f84fad86f0b25ceb1eba5d47e46
parent89587f7c6ae60715644d06a60c16bc5c88075e29 (diff)
downloadopie-754ba2082e46197a5b5c7b0885f36ed42785631a.zip
opie-754ba2082e46197a5b5c7b0885f36ed42785631a.tar.gz
opie-754ba2082e46197a5b5c7b0885f36ed42785631a.tar.bz2
zbounce -> bounce
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/bounce/bounce.pro26
-rw-r--r--noncore/games/bounce/game.cpp (renamed from noncore/games/zbounce/game.cpp)2
-rw-r--r--noncore/games/bounce/game.h (renamed from noncore/games/zbounce/game.h)0
-rw-r--r--noncore/games/bounce/kbounce.cpp4
-rw-r--r--noncore/games/bounce/kbounce.h (renamed from noncore/games/zbounce/kbounce.h)0
-rw-r--r--noncore/games/bounce/main.cpp (renamed from noncore/games/zbounce/main.cpp)0
-rw-r--r--noncore/games/bounce/opie-bounce.control20
-rw-r--r--noncore/games/zbounce/kbounce.cpp302
-rw-r--r--noncore/games/zbounce/opie-zbounce.control20
-rw-r--r--noncore/games/zbounce/zbounce.pro26
10 files changed, 49 insertions, 351 deletions
diff --git a/noncore/games/bounce/bounce.pro b/noncore/games/bounce/bounce.pro
new file mode 100644
index 0000000..7be1fb5
--- a/dev/null
+++ b/noncore/games/bounce/bounce.pro
@@ -0,0 +1,26 @@
1 TEMPLATE= app
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4 HEADERS = game.h kbounce.h
5 SOURCES = game.cpp kbounce.cpp main.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe
9DESTDIR = $(OPIEDIR)/bin
10 TARGET = bounce
11
12TRANSLATIONS = ../../../i18n/de/bounce.ts \
13 ../../../i18n/en/bounce.ts \
14 ../../../i18n/es/bounce.ts \
15 ../../../i18n/fr/bounce.ts \
16 ../../../i18n/hu/bounce.ts \
17 ../../../i18n/ja/bounce.ts \
18 ../../../i18n/ko/bounce.ts \
19 ../../../i18n/no/bounce.ts \
20 ../../../i18n/pl/bounce.ts \
21 ../../../i18n/pt/bounce.ts \
22 ../../../i18n/pt_BR/bounce.ts \
23 ../../../i18n/sl/bounce.ts \
24 ../../../i18n/zh_CN/bounce.ts \
25 ../../../i18n/zh_TW/bounce.ts \
26 ../../../i18n/it/bounce.ts
diff --git a/noncore/games/zbounce/game.cpp b/noncore/games/bounce/game.cpp
index 7a1a3cd..6ded218 100644
--- a/noncore/games/zbounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -293,7 +293,7 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
293 : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ), 293 : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
294 m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false ) 294 m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
295{ 295{
296 QString path = QPEApplication::qpeDir()+"pics/zbounce/"; 296 QString path = QPEApplication::qpeDir()+"pics/bounce/";
297 297
298 // load gfx 298 // load gfx
299 m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 ); 299 m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 );
diff --git a/noncore/games/zbounce/game.h b/noncore/games/bounce/game.h
index 656fba3..656fba3 100644
--- a/noncore/games/zbounce/game.h
+++ b/noncore/games/bounce/game.h
diff --git a/noncore/games/bounce/kbounce.cpp b/noncore/games/bounce/kbounce.cpp
index c1c0f70..f703f74 100644
--- a/noncore/games/bounce/kbounce.cpp
+++ b/noncore/games/bounce/kbounce.cpp
@@ -29,7 +29,7 @@
29 29
30KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 ) 30KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 )
31{ 31{
32 setCaption(tr("ZBounce")); 32 setCaption(tr("Bounce"));
33 // setup variables 33 // setup variables
34 m_game.level = 1; 34 m_game.level = 1;
35 m_game.score = 0; 35 m_game.score = 0;
@@ -100,7 +100,7 @@ void KJezzball::newGame()
100 m_game.level = 1; 100 m_game.level = 1;
101 m_game.score = 0; 101 m_game.score = 0;
102 102
103 setCaption(tr("ZBounce Level %1").arg(m_game.level)); 103 setCaption(tr("Bounce Level %1").arg(m_game.level));
104 ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) ); 104 ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) );
105 105
106 // start new game 106 // start new game
diff --git a/noncore/games/zbounce/kbounce.h b/noncore/games/bounce/kbounce.h
index de41710..de41710 100644
--- a/noncore/games/zbounce/kbounce.h
+++ b/noncore/games/bounce/kbounce.h
diff --git a/noncore/games/zbounce/main.cpp b/noncore/games/bounce/main.cpp
index a6b7c1a..a6b7c1a 100644
--- a/noncore/games/zbounce/main.cpp
+++ b/noncore/games/bounce/main.cpp
diff --git a/noncore/games/bounce/opie-bounce.control b/noncore/games/bounce/opie-bounce.control
new file mode 100644
index 0000000..b3d3cf9
--- a/dev/null
+++ b/noncore/games/bounce/opie-bounce.control
@@ -0,0 +1,20 @@
1Files: bin/bounce apps/Games/bounce.desktop pics/bounce/bounce.png \
2pics/bounce/arrow0000.png pics/bounce/ball0008.png pics/bounce/ball0018.png \
3pics/bounce/arrow0001.png pics/bounce/ball0009.png pics/bounce/ball0019.png \
4pics/bounce/ball0000.png pics/bounce/ball0010.png pics/bounce/ball0020.png \
5pics/bounce/ball0001.png pics/bounce/ball0011.png pics/bounce/ball0021.png \
6pics/bounce/ball0002.png pics/bounce/ball0012.png pics/bounce/ball0022.png \
7pics/bounce/ball0003.png pics/bounce/ball0013.png pics/bounce/ball0023.png \
8pics/bounce/ball0004.png pics/bounce/ball0014.png pics/bounce/ball0024.png \
9pics/bounce/ball0005.png pics/bounce/ball0015.png pics/bounce/tiles.png \
10pics/bounce/ball0006.png pics/bounce/ball0016.png \
11pics/bounce/ball0007.png pics/bounce/ball0017.png \
12Version: 0.6
13Depends: opie-base ($QPE_VERSION)
14Priority: optional
15Section: opie/games
16Maintainer: Martin Imobersteg <imm@gmx.ch>
17Architecture: arm
18License: GPL
19Description: bounce
20 A JezzGame like game for Qtopia.
diff --git a/noncore/games/zbounce/kbounce.cpp b/noncore/games/zbounce/kbounce.cpp
deleted file mode 100644
index c1c0f70..0000000
--- a/noncore/games/zbounce/kbounce.cpp
+++ b/dev/null
@@ -1,302 +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,Life 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#include <qlayout.h>
20#include <qtimer.h>
21#include <qlcdnumber.h>
22#include <qmessagebox.h>
23#include <qmainwindow.h>
24#include <qpe/qpeapplication.h>
25
26#include "kbounce.h"
27#include "game.h"
28#include <qlabel.h>
29
30KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 )
31{
32 setCaption(tr("ZBounce"));
33 // setup variables
34 m_game.level = 1;
35 m_game.score = 0;
36 m_state = Idle;
37
38
39 menu = menuBar();
40 game = new QPopupMenu;
41 game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N );
42 game->insertItem(tr("&Pause game"), this, SLOT(pauseGame()), Key_P );
43 game->insertSeparator();
44 game->insertItem(tr("&About"), this, SLOT(about()));
45 menu->insertItem( tr("&Game"), game );
46
47 // create widgets
48 m_view = new QWidget( this, "m_view" );
49 setCentralWidget( m_view );
50
51 m_layout = new QGridLayout( m_view );
52 m_layout->setSpacing( 0 );
53 m_layout->setMargin( 0 );
54
55 ScoreLabel = new QLabel( m_view, "ScoreLabel" );
56 ScoreLabel->setText( tr( "Score: 00" ) );
57 ScoreLabel->setAlignment( int( QLabel::AlignCenter ) );
58
59 m_layout->addWidget( ScoreLabel, 1, 0 );
60
61 LivesLabel = new QLabel( m_view, "LivesLabel" );
62 LivesLabel->setText( tr( "Lives: 0%" ) );
63 LivesLabel->setAlignment( int( QLabel::AlignCenter ) );
64
65 m_layout->addWidget( LivesLabel, 1, 2 );
66
67 FilledLabel = new QLabel( m_view, "FilledLabel" );
68 FilledLabel->setText( tr( "Filled: 00%" ) );
69 FilledLabel->setAlignment( int( QLabel::AlignCenter ) );
70
71 m_layout->addWidget( FilledLabel, 1, 1 );
72
73 TimeLabel = new QLabel( m_view, "TimeLabel" );
74 TimeLabel->setText( tr( "Time: 00" ) );
75 TimeLabel->setAlignment( int( QLabel::AlignCenter ) );
76
77 m_layout->addWidget( TimeLabel, 1, 3 );
78
79 // create timers
80 m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" );
81 connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) );
82
83 m_gameOverTimer = new QTimer( this, "m_gameOverTimer" );
84 connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) );
85
86 m_timer = new QTimer( this, "m_timer" );
87 connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) );
88
89 // create demo game
90 createLevel( 1 );
91}
92
93void KJezzball::newGame()
94{
95 // Check for running game
96 closeGame();
97 if ( m_state==Idle )
98 {
99 // update displays
100 m_game.level = 1;
101 m_game.score = 0;
102
103 setCaption(tr("ZBounce Level %1").arg(m_game.level));
104 ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) );
105
106 // start new game
107 m_state = Running;
108
109 createLevel( m_game.level );
110 startLevel();
111 }
112}
113
114void KJezzball::about()
115{
116 QMessageBox::information( this, "About", "Written by: Stefan Schimanski\nPorted by: Martin Imobersteg\n\nThis program is distributed under\nthe terms of the GPL v2." );
117}
118
119void KJezzball::closeGame()
120{
121 if ( m_state!=Idle )
122 {
123 stopLevel();
124 m_state = Idle;
125 }
126}
127
128void KJezzball::pauseGame()
129{
130 switch ( m_state )
131 {
132 case Running:
133 m_state = Paused;
134 m_gameWidget->display( tr("Game paused.\nPress P to continue!") );
135 stopLevel();
136 break;
137
138 case Paused:
139 case Suspend:
140 m_state = Running;
141 m_gameWidget->display( QString::null );
142 startLevel();
143 break;
144
145 case Idle:
146 break;
147 }
148}
149
150void KJezzball::gameOver()
151{
152 stopLevel();
153 m_gameOverTimer->start( 100, TRUE );
154}
155
156
157void KJezzball::gameOverNow()
158{
159 m_state = Idle;
160
161 QString score;
162 score.setNum( m_game.score );
163 QMessageBox::information( this, "Game Over", tr("Game Over!\nScore: %1").arg(score) );
164}
165
166void KJezzball::focusOutEvent( QFocusEvent *ev )
167{
168 if ( m_state==Running )
169 {
170 stopLevel();
171 m_state = Suspend;
172 }
173
174 QMainWindow::focusOutEvent( ev );
175}
176
177void KJezzball::focusInEvent ( QFocusEvent *ev )
178{
179 if ( m_state==Suspend )
180 {
181 startLevel();
182 m_state = Running;
183 }
184
185 QMainWindow::focusInEvent( ev );
186}
187
188void KJezzball::second()
189{
190 m_level.time--;
191 TimeLabel->setText( tr( "Time: %1" ).arg(m_level.time) );
192 if ( m_level.time<=0 )
193 {
194 gameOver();
195 }
196}
197
198void KJezzball::died()
199{
200 m_level.lifes--;
201 LivesLabel->setText( tr( "Lives: %1" ).arg(m_level.lifes) );
202 if ( m_level.lifes==0 ) gameOver();
203}
204
205void KJezzball::newPercent( int percent )
206{
207 FilledLabel->setText( tr( "Filled: %1%" ).arg(percent) );
208 if ( percent>=75 )
209 {
210 m_level.score = m_level.lifes*15 + (percent-75)*2*(m_game.level+5);
211 nextLevel();
212 }
213}
214
215void KJezzball::createLevel( int level )
216{
217 // destroy old game
218 if ( m_gameWidget ) delete m_gameWidget;
219
220 m_gameWidget = new JezzGame( level+1, m_view, "m_gameWidget" );
221
222 m_gameWidget->show();
223 m_layout->addMultiCellWidget( m_gameWidget, 0, 0, 0, 3 );
224 connect( m_gameWidget, SIGNAL(died()), this, SLOT(died()) );
225 connect( m_gameWidget, SIGNAL(newPercent(int)), this, SLOT(newPercent(int)) );
226
227 // update displays
228 m_level.lifes = level+1;
229 LivesLabel->setText( tr( "Lives: %1" ).arg(m_level.lifes) );
230 FilledLabel->setText( tr( "Filled: 0%" ) );
231
232 m_level.time = (level+2)*30;
233 TimeLabel->setText( tr( "Time: %1" ).arg(m_level.time) );
234
235 m_level.score = 0;
236}
237
238void KJezzball::startLevel()
239{
240 if ( m_gameWidget )
241 {
242 m_timer->start( 1000 );
243 m_gameWidget->start();
244 }
245}
246
247void KJezzball::stopLevel()
248{
249 if ( m_gameWidget )
250 {
251 m_gameWidget->stop();
252 m_timer->stop();
253 }
254}
255
256void KJezzball::nextLevel()
257{
258 stopLevel();
259 m_nextLevelTimer->start( 100, TRUE );
260}
261
262void KJezzball::switchLevel()
263{
264 m_game.score += m_level.score;
265 ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) );
266
267 QString score;
268 score.setNum( m_level.score );
269
270 QString level;
271 level.setNum( m_game.level );
272
273 QString foo = QString(
274 tr("Successfully cleared more than 75%.\n") +
275 tr("%1 points: 15 points per life\n").arg(m_level.lifes*15) +
276 tr("%1 points: Bonus\n").arg((m_gameWidget->percent()-75)*2*(m_game.level+5)) +
277 tr("%1 points: Total score\n").arg(score) +
278 tr("On to level %1.\nYou get %2 lives this time!")).arg(m_game.level+1).arg(m_game.level+2);
279
280 QMessageBox::information( this, "Success", foo );
281
282 m_game.level++;
283
284 createLevel( m_game.level );
285 startLevel();
286}
287
288void KJezzball::keyPressEvent( QKeyEvent *ev )
289{
290 if ( ev->key() == Key_Space ||
291 ev->key() == Key_Up ||
292 ev->key() == Key_Down ||
293 ev->key() == Key_Right ||
294 ev->key() == Key_Left )
295 {
296 m_gameWidget->changeCursor();
297 }
298 else
299 {
300 ev->ignore();
301 }
302}
diff --git a/noncore/games/zbounce/opie-zbounce.control b/noncore/games/zbounce/opie-zbounce.control
deleted file mode 100644
index d419eaf..0000000
--- a/noncore/games/zbounce/opie-zbounce.control
+++ b/dev/null
@@ -1,20 +0,0 @@
1Files: bin/zbounce apps/Games/zbounce.desktop pics/zbounce/zbounce.png \
2pics/zbounce/arrow0000.png pics/zbounce/ball0008.png pics/zbounce/ball0018.png \
3pics/zbounce/arrow0001.png pics/zbounce/ball0009.png pics/zbounce/ball0019.png \
4pics/zbounce/ball0000.png pics/zbounce/ball0010.png pics/zbounce/ball0020.png \
5pics/zbounce/ball0001.png pics/zbounce/ball0011.png pics/zbounce/ball0021.png \
6pics/zbounce/ball0002.png pics/zbounce/ball0012.png pics/zbounce/ball0022.png \
7pics/zbounce/ball0003.png pics/zbounce/ball0013.png pics/zbounce/ball0023.png \
8pics/zbounce/ball0004.png pics/zbounce/ball0014.png pics/zbounce/ball0024.png \
9pics/zbounce/ball0005.png pics/zbounce/ball0015.png pics/zbounce/tiles.png \
10pics/zbounce/ball0006.png pics/zbounce/ball0016.png \
11pics/zbounce/ball0007.png pics/zbounce/ball0017.png \
12Version: 0.6
13Depends: opie-base ($QPE_VERSION)
14Priority: optional
15Section: opie/games
16Maintainer: Martin Imobersteg <imm@gmx.ch>
17Architecture: arm
18License: GPL
19Description: ZBounce
20 A JezzGame like game for Qtopia.
diff --git a/noncore/games/zbounce/zbounce.pro b/noncore/games/zbounce/zbounce.pro
deleted file mode 100644
index 9852f04..0000000
--- a/noncore/games/zbounce/zbounce.pro
+++ b/dev/null
@@ -1,26 +0,0 @@
1 TEMPLATE= app
2 #CONFIG = qt warn_on debug
3 CONFIG = qt warn_on release
4 HEADERS = game.h kbounce.h
5 SOURCES = game.cpp kbounce.cpp main.cpp
6 INCLUDEPATH+= $(OPIEDIR)/include
7 DEPENDPATH+= $(OPIEDIR)/include
8LIBS += -lqpe
9DESTDIR = $(OPIEDIR)/bin
10 TARGET = zbounce
11
12TRANSLATIONS = ../../../i18n/de/zbounce.ts \
13 ../../../i18n/en/zbounce.ts \
14 ../../../i18n/es/zbounce.ts \
15 ../../../i18n/fr/zbounce.ts \
16 ../../../i18n/hu/zbounce.ts \
17 ../../../i18n/ja/zbounce.ts \
18 ../../../i18n/ko/zbounce.ts \
19 ../../../i18n/no/zbounce.ts \
20 ../../../i18n/pl/zbounce.ts \
21 ../../../i18n/pt/zbounce.ts \
22 ../../../i18n/pt_BR/zbounce.ts \
23 ../../../i18n/sl/zbounce.ts \
24 ../../../i18n/zh_CN/zbounce.ts \
25 ../../../i18n/zh_TW/zbounce.ts \
26 ../../../i18n/it/zbounce.ts