summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-03-05 19:03:08 (UTC)
committer harlekin <harlekin>2002-03-05 19:03:08 (UTC)
commit3ccfa79645d8bd99c7b559f9fa315d028db2c75d (patch) (unidiff)
tree54f422c70dd85e16d10d98696c7cdd9ddc8b916f
parent7f0e92c12b41207fa75c82bc0b6f30fc57e7e77d (diff)
downloadopie-3ccfa79645d8bd99c7b559f9fa315d028db2c75d.zip
opie-3ccfa79645d8bd99c7b559f9fa315d028db2c75d.tar.gz
opie-3ccfa79645d8bd99c7b559f9fa315d028db2c75d.tar.bz2
the launch key on ipaq is now the fire button
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/qasteroids/toplevel.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/noncore/games/qasteroids/toplevel.cpp b/noncore/games/qasteroids/toplevel.cpp
index 57242a0..090099f 100644
--- a/noncore/games/qasteroids/toplevel.cpp
+++ b/noncore/games/qasteroids/toplevel.cpp
@@ -22,32 +22,34 @@
22 * Part of the KDE project 22 * Part of the KDE project
23 */ 23 */
24 //--- toplevel.cpp --- 24 //--- toplevel.cpp ---
25 25
26#include "toplevel.h" 26#include "toplevel.h"
27#include "ledmeter.h" 27#include "ledmeter.h"
28 28
29#include <qpe/qpeapplication.h> 29#include <qpe/qpeapplication.h>
30#include <qpe/resource.h> 30#include <qpe/resource.h>
31 31
32#include <qaccel.h> 32#include <qaccel.h>
33#include <qlabel.h> 33#include <qlabel.h>
34#include <qlayout.h> 34#include <qlayout.h>
35#include <qlcdnumber.h> 35#include <qlcdnumber.h>
36#include <qpushbutton.h> 36#include <qpushbutton.h>
37 37
38#include <sys/utsname.h>
39
38 40
39 #define SB_SCORE1 41 #define SB_SCORE1
40 #define SB_LEVEL2 42 #define SB_LEVEL2
41 #define SB_SHIPS3 43 #define SB_SHIPS3
42 44
43struct SLevel 45struct SLevel
44{ 46{
45 int nrocks; 47 int nrocks;
46 double rockSpeed; 48 double rockSpeed;
47}; 49};
48 50
49 #define MAX_LEVELS16 51 #define MAX_LEVELS16
50 52
51SLevel levels[MAX_LEVELS] = 53SLevel levels[MAX_LEVELS] =
52{ 54{
53 { 1, 0.4 }, 55 { 1, 0.4 },
@@ -240,35 +242,51 @@ KAstTopLevel::KAstTopLevel( QWidget *parent, const char *name )
240 powerMeter->addColorRange( 70, darkGreen ); 242 powerMeter->addColorRange( 70, darkGreen );
241 powerMeter->setCount( 15 ); 243 powerMeter->setCount( 15 );
242 powerMeter->setPalette( pal ); 244 powerMeter->setPalette( pal );
243 powerMeter->setFixedSize( 60, 12 ); 245 powerMeter->setFixedSize( 60, 12 );
244 hbd->addWidget( powerMeter ); 246 hbd->addWidget( powerMeter );
245 247
246 shipsRemain = 3; 248 shipsRemain = 3;
247 showHiscores = FALSE; 249 showHiscores = FALSE;
248 250
249 actions.insert( Qt::Key_Up, Thrust ); 251 actions.insert( Qt::Key_Up, Thrust );
250 actions.insert( Qt::Key_Left, RotateLeft ); 252 actions.insert( Qt::Key_Left, RotateLeft );
251 actions.insert( Qt::Key_Right, RotateRight ); 253 actions.insert( Qt::Key_Right, RotateRight );
252 actions.insert( Qt::Key_Enter, Shoot ); 254 actions.insert( Qt::Key_Enter, Shoot );
253 actions.insert( Qt::Key_Z, Teleport ); 255 actions.insert( Qt::Key_Z, Teleport );
254 actions.insert( Qt::Key_Down, Brake ); 256 actions.insert( Qt::Key_Down, Brake );
255 actions.insert( Qt::Key_P, Pause ); 257 actions.insert( Qt::Key_P, Pause );
256 actions.insert( Key_F12, Launch ); 258
257 actions.insert( Key_F11, Shield ); 259
258 actions.insert( Key_F9, NewGame ); 260 struct utsname name; /* check for embedix kernel running on the zaurus, if
261 lineo change string, this break
262 */
263 if (uname(&name) != -1) {
264 QString release=name.release;
265 if(release.find("embedix",0,TRUE) !=-1) {
266 actions.insert( Key_F12, Launch );
267 actions.insert( Key_F11, Shield );
268 actions.insert( Key_F9, NewGame );
269 } else {
270 // ipaq
271 actions.insert( Key_F12, Shoot );
272 actions.insert( Key_F11, Shield );
273 actions.insert( Key_F10, Launch );
274 actions.insert( Key_F9, NewGame );
275 }
276 }
259 277
260// actions.insert( Qt::Key_S, Shield ); 278// actions.insert( Qt::Key_S, Shield );
261// actions.insert( Qt::Key_X, Brake ); 279// actions.insert( Qt::Key_X, Brake );
262// actions.insert( Qt::Key_L, Launch ); 280// actions.insert( Qt::Key_L, Launch );
263 actions.insert( Qt::Key_Space, Shoot ); 281 actions.insert( Qt::Key_Space, Shoot );
264 282
265 view->showText( tr( "Press Calendar to start playing" ), yellow ); 283 view->showText( tr( "Press Calendar to start playing" ), yellow );
266 284
267 setFocusPolicy( StrongFocus ); 285 setFocusPolicy( StrongFocus );
268 286
269 slotNewGame(); 287 slotNewGame();
270} 288}
271 289
272KAstTopLevel::~KAstTopLevel() 290KAstTopLevel::~KAstTopLevel()
273{ 291{
274} 292}
@@ -438,33 +456,33 @@ void KAstTopLevel::slotNewGame()
438 view->newShip(); 456 view->newShip();
439 waitShip = FALSE; 457 waitShip = FALSE;
440 view->hideText(); 458 view->hideText();
441 isPaused = FALSE; 459 isPaused = FALSE;
442} 460}
443 461
444void KAstTopLevel::slotShipKilled() 462void KAstTopLevel::slotShipKilled()
445{ 463{
446 shipsRemain--; 464 shipsRemain--;
447 shipsLCD->display( shipsRemain-1 ); 465 shipsLCD->display( shipsRemain-1 );
448 466
449 playSound( "ShipDestroyed" ); 467 playSound( "ShipDestroyed" );
450 468
451 if ( shipsRemain > 0 ) 469 if ( shipsRemain > 0 )
452 { 470 {
453 waitShip = TRUE; 471 waitShip = TRUE;
454 view->showText( tr( "Ship Destroyed.\nPress Launch/Home key."), yellow ); 472 view->showText( tr( "Ship Destroyed.\nPress Contacts/Home key."), yellow );
455 } 473 }
456 else 474 else
457 { 475 {
458 view->endGame(); 476 view->endGame();
459 doStats(); 477 doStats();
460 } 478 }
461} 479}
462 480
463void KAstTopLevel::slotRockHit( int size ) 481void KAstTopLevel::slotRockHit( int size )
464{ 482{
465 switch ( size ) 483 switch ( size )
466 { 484 {
467 case 0: 485 case 0:
468 score += 10; 486 score += 10;
469 break; 487 break;
470 488