author | imm <imm> | 2002-08-31 22:42:59 (UTC) |
---|---|---|
committer | imm <imm> | 2002-08-31 22:42:59 (UTC) |
commit | 754ba2082e46197a5b5c7b0885f36ed42785631a (patch) (side-by-side diff) | |
tree | 64bbcccb27725f84fad86f0b25ceb1eba5d47e46 | |
parent | 89587f7c6ae60715644d06a60c16bc5c88075e29 (diff) | |
download | opie-754ba2082e46197a5b5c7b0885f36ed42785631a.zip opie-754ba2082e46197a5b5c7b0885f36ed42785631a.tar.gz opie-754ba2082e46197a5b5c7b0885f36ed42785631a.tar.bz2 |
zbounce -> bounce
-rw-r--r-- | noncore/games/bounce/bounce.pro | 26 | ||||
-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.cpp | 4 | ||||
-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.control | 20 | ||||
-rw-r--r-- | noncore/games/zbounce/kbounce.cpp | 302 | ||||
-rw-r--r-- | noncore/games/zbounce/opie-zbounce.control | 20 | ||||
-rw-r--r-- | noncore/games/zbounce/zbounce.pro | 26 |
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 @@ +TEMPLATE = app +#CONFIG = qt warn_on debug +CONFIG = qt warn_on release +HEADERS = game.h kbounce.h +SOURCES = game.cpp kbounce.cpp main.cpp +INCLUDEPATH += $(OPIEDIR)/include +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe +DESTDIR = $(OPIEDIR)/bin +TARGET = bounce + +TRANSLATIONS = ../../../i18n/de/bounce.ts \ + ../../../i18n/en/bounce.ts \ + ../../../i18n/es/bounce.ts \ + ../../../i18n/fr/bounce.ts \ + ../../../i18n/hu/bounce.ts \ + ../../../i18n/ja/bounce.ts \ + ../../../i18n/ko/bounce.ts \ + ../../../i18n/no/bounce.ts \ + ../../../i18n/pl/bounce.ts \ + ../../../i18n/pt/bounce.ts \ + ../../../i18n/pt_BR/bounce.ts \ + ../../../i18n/sl/bounce.ts \ + ../../../i18n/zh_CN/bounce.ts \ + ../../../i18n/zh_TW/bounce.ts \ + ../../../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 @@ -272,49 +272,49 @@ void JezzView::viewportMouseReleaseEvent( QMouseEvent *ev ) { emit buildWall( ev->x()/TILE_SIZE, ev->y()/TILE_SIZE, m_vertical ); } } void JezzView::changeCursor() { m_vertical = !m_vertical; if ( m_vertical ) { setCursor( sizeVerCursor ); } else { setCursor( sizeHorCursor ); } } /*************************************************************************/ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name ) : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ), m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false ) { - QString path = QPEApplication::qpeDir()+"pics/zbounce/"; + QString path = QPEApplication::qpeDir()+"pics/bounce/"; // load gfx m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 ); for ( unsigned n=0; n < m_ballPixmaps->count(); n++ ) m_ballPixmaps->image(n)->setOffset( 0, 0 ); m_arrowPixmaps = new QCanvasPixmapArray( path + "arrow%1.png", 2 ); for ( unsigned n=0; n < m_arrowPixmaps->count(); n++ ) m_arrowPixmaps->image(n)->setOffset( 0, 0 ); QPixmap tiles( path + "tiles.png" ); // create field m_field = new JezzField( tiles, this, "m_field" ); m_field->resize( TILE_SIZE*FIELD_WIDTH, TILE_SIZE*FIELD_HEIGHT ); for ( int x=0; x<FIELD_WIDTH; x++ ) m_field->setTile( x, 0, TILE_BORDER ); for ( int y=1; y<FIELD_HEIGHT-1; y++ ) { m_field->setTile( 0, y, TILE_BORDER ); for ( int x=1; x<FIELD_WIDTH-1; x++ ) m_field->setTile( x, y, TILE_FREE ); m_field->setTile( FIELD_WIDTH-1, y, TILE_BORDER ); 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 @@ -8,49 +8,49 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <qlayout.h> #include <qtimer.h> #include <qlcdnumber.h> #include <qmessagebox.h> #include <qmainwindow.h> #include <qpe/qpeapplication.h> #include "kbounce.h" #include "game.h" #include <qlabel.h> KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 ) { - setCaption(tr("ZBounce")); + setCaption(tr("Bounce")); // setup variables m_game.level = 1; m_game.score = 0; m_state = Idle; menu = menuBar(); game = new QPopupMenu; game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N ); game->insertItem(tr("&Pause game"), this, SLOT(pauseGame()), Key_P ); game->insertSeparator(); game->insertItem(tr("&About"), this, SLOT(about())); menu->insertItem( tr("&Game"), game ); // create widgets m_view = new QWidget( this, "m_view" ); setCentralWidget( m_view ); m_layout = new QGridLayout( m_view ); m_layout->setSpacing( 0 ); m_layout->setMargin( 0 ); ScoreLabel = new QLabel( m_view, "ScoreLabel" ); ScoreLabel->setText( tr( "Score: 00" ) ); @@ -79,49 +79,49 @@ KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 ) // create timers m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" ); connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) ); m_gameOverTimer = new QTimer( this, "m_gameOverTimer" ); connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) ); m_timer = new QTimer( this, "m_timer" ); connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) ); // create demo game createLevel( 1 ); } void KJezzball::newGame() { // Check for running game closeGame(); if ( m_state==Idle ) { // update displays m_game.level = 1; m_game.score = 0; - setCaption(tr("ZBounce Level %1").arg(m_game.level)); + setCaption(tr("Bounce Level %1").arg(m_game.level)); ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) ); // start new game m_state = Running; createLevel( m_game.level ); startLevel(); } } void KJezzball::about() { QMessageBox::information( this, "About", "Written by: Stefan Schimanski\nPorted by: Martin Imobersteg\n\nThis program is distributed under\nthe terms of the GPL v2." ); } void KJezzball::closeGame() { if ( m_state!=Idle ) { stopLevel(); m_state = Idle; } } 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 @@ +Files: bin/bounce apps/Games/bounce.desktop pics/bounce/bounce.png \ +pics/bounce/arrow0000.png pics/bounce/ball0008.png pics/bounce/ball0018.png \ +pics/bounce/arrow0001.png pics/bounce/ball0009.png pics/bounce/ball0019.png \ +pics/bounce/ball0000.png pics/bounce/ball0010.png pics/bounce/ball0020.png \ +pics/bounce/ball0001.png pics/bounce/ball0011.png pics/bounce/ball0021.png \ +pics/bounce/ball0002.png pics/bounce/ball0012.png pics/bounce/ball0022.png \ +pics/bounce/ball0003.png pics/bounce/ball0013.png pics/bounce/ball0023.png \ +pics/bounce/ball0004.png pics/bounce/ball0014.png pics/bounce/ball0024.png \ +pics/bounce/ball0005.png pics/bounce/ball0015.png pics/bounce/tiles.png \ +pics/bounce/ball0006.png pics/bounce/ball0016.png \ +pics/bounce/ball0007.png pics/bounce/ball0017.png \ +Version: 0.6 +Depends: opie-base ($QPE_VERSION) +Priority: optional +Section: opie/games +Maintainer: Martin Imobersteg <imm@gmx.ch> +Architecture: arm +License: GPL +Description: bounce + 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 @@ -/* - * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License,Life or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free - * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include <qlayout.h> -#include <qtimer.h> -#include <qlcdnumber.h> -#include <qmessagebox.h> -#include <qmainwindow.h> -#include <qpe/qpeapplication.h> - -#include "kbounce.h" -#include "game.h" -#include <qlabel.h> - -KJezzball::KJezzball() : QMainWindow(0), m_gameWidget( 0 ) -{ - setCaption(tr("ZBounce")); - // setup variables - m_game.level = 1; - m_game.score = 0; - m_state = Idle; - - - menu = menuBar(); - game = new QPopupMenu; - game->insertItem(tr("&New game"), this, SLOT(newGame()), Key_N ); - game->insertItem(tr("&Pause game"), this, SLOT(pauseGame()), Key_P ); - game->insertSeparator(); - game->insertItem(tr("&About"), this, SLOT(about())); - menu->insertItem( tr("&Game"), game ); - - // create widgets - m_view = new QWidget( this, "m_view" ); - setCentralWidget( m_view ); - - m_layout = new QGridLayout( m_view ); - m_layout->setSpacing( 0 ); - m_layout->setMargin( 0 ); - - ScoreLabel = new QLabel( m_view, "ScoreLabel" ); - ScoreLabel->setText( tr( "Score: 00" ) ); - ScoreLabel->setAlignment( int( QLabel::AlignCenter ) ); - - m_layout->addWidget( ScoreLabel, 1, 0 ); - - LivesLabel = new QLabel( m_view, "LivesLabel" ); - LivesLabel->setText( tr( "Lives: 0%" ) ); - LivesLabel->setAlignment( int( QLabel::AlignCenter ) ); - - m_layout->addWidget( LivesLabel, 1, 2 ); - - FilledLabel = new QLabel( m_view, "FilledLabel" ); - FilledLabel->setText( tr( "Filled: 00%" ) ); - FilledLabel->setAlignment( int( QLabel::AlignCenter ) ); - - m_layout->addWidget( FilledLabel, 1, 1 ); - - TimeLabel = new QLabel( m_view, "TimeLabel" ); - TimeLabel->setText( tr( "Time: 00" ) ); - TimeLabel->setAlignment( int( QLabel::AlignCenter ) ); - - m_layout->addWidget( TimeLabel, 1, 3 ); - - // create timers - m_nextLevelTimer = new QTimer( this, "m_nextLevelTimer" ); - connect( m_nextLevelTimer, SIGNAL(timeout()), this, SLOT(switchLevel()) ); - - m_gameOverTimer = new QTimer( this, "m_gameOverTimer" ); - connect( m_gameOverTimer, SIGNAL(timeout()), this, SLOT(gameOverNow()) ); - - m_timer = new QTimer( this, "m_timer" ); - connect( m_timer, SIGNAL(timeout()), this, SLOT(second()) ); - - // create demo game - createLevel( 1 ); -} - -void KJezzball::newGame() -{ - // Check for running game - closeGame(); - if ( m_state==Idle ) - { - // update displays - m_game.level = 1; - m_game.score = 0; - - setCaption(tr("ZBounce Level %1").arg(m_game.level)); - ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) ); - - // start new game - m_state = Running; - - createLevel( m_game.level ); - startLevel(); - } -} - -void KJezzball::about() -{ - QMessageBox::information( this, "About", "Written by: Stefan Schimanski\nPorted by: Martin Imobersteg\n\nThis program is distributed under\nthe terms of the GPL v2." ); -} - -void KJezzball::closeGame() -{ - if ( m_state!=Idle ) - { - stopLevel(); - m_state = Idle; - } -} - -void KJezzball::pauseGame() -{ - switch ( m_state ) - { - case Running: - m_state = Paused; - m_gameWidget->display( tr("Game paused.\nPress P to continue!") ); - stopLevel(); - break; - - case Paused: - case Suspend: - m_state = Running; - m_gameWidget->display( QString::null ); - startLevel(); - break; - - case Idle: - break; - } -} - -void KJezzball::gameOver() -{ - stopLevel(); - m_gameOverTimer->start( 100, TRUE ); -} - - -void KJezzball::gameOverNow() -{ - m_state = Idle; - - QString score; - score.setNum( m_game.score ); - QMessageBox::information( this, "Game Over", tr("Game Over!\nScore: %1").arg(score) ); -} - -void KJezzball::focusOutEvent( QFocusEvent *ev ) -{ - if ( m_state==Running ) - { - stopLevel(); - m_state = Suspend; - } - - QMainWindow::focusOutEvent( ev ); -} - -void KJezzball::focusInEvent ( QFocusEvent *ev ) -{ - if ( m_state==Suspend ) - { - startLevel(); - m_state = Running; - } - - QMainWindow::focusInEvent( ev ); -} - -void KJezzball::second() -{ - m_level.time--; - TimeLabel->setText( tr( "Time: %1" ).arg(m_level.time) ); - if ( m_level.time<=0 ) - { - gameOver(); - } -} - -void KJezzball::died() -{ - m_level.lifes--; - LivesLabel->setText( tr( "Lives: %1" ).arg(m_level.lifes) ); - if ( m_level.lifes==0 ) gameOver(); -} - -void KJezzball::newPercent( int percent ) -{ - FilledLabel->setText( tr( "Filled: %1%" ).arg(percent) ); - if ( percent>=75 ) - { - m_level.score = m_level.lifes*15 + (percent-75)*2*(m_game.level+5); - nextLevel(); - } -} - -void KJezzball::createLevel( int level ) -{ - // destroy old game - if ( m_gameWidget ) delete m_gameWidget; - - m_gameWidget = new JezzGame( level+1, m_view, "m_gameWidget" ); - - m_gameWidget->show(); - m_layout->addMultiCellWidget( m_gameWidget, 0, 0, 0, 3 ); - connect( m_gameWidget, SIGNAL(died()), this, SLOT(died()) ); - connect( m_gameWidget, SIGNAL(newPercent(int)), this, SLOT(newPercent(int)) ); - - // update displays - m_level.lifes = level+1; - LivesLabel->setText( tr( "Lives: %1" ).arg(m_level.lifes) ); - FilledLabel->setText( tr( "Filled: 0%" ) ); - - m_level.time = (level+2)*30; - TimeLabel->setText( tr( "Time: %1" ).arg(m_level.time) ); - - m_level.score = 0; -} - -void KJezzball::startLevel() -{ - if ( m_gameWidget ) - { - m_timer->start( 1000 ); - m_gameWidget->start(); - } -} - -void KJezzball::stopLevel() -{ - if ( m_gameWidget ) - { - m_gameWidget->stop(); - m_timer->stop(); - } -} - -void KJezzball::nextLevel() -{ - stopLevel(); - m_nextLevelTimer->start( 100, TRUE ); -} - -void KJezzball::switchLevel() -{ - m_game.score += m_level.score; - ScoreLabel->setText( tr( "Score: %1" ).arg(m_game.score) ); - - QString score; - score.setNum( m_level.score ); - - QString level; - level.setNum( m_game.level ); - - QString foo = QString( - tr("Successfully cleared more than 75%.\n") + - tr("%1 points: 15 points per life\n").arg(m_level.lifes*15) + - tr("%1 points: Bonus\n").arg((m_gameWidget->percent()-75)*2*(m_game.level+5)) + - tr("%1 points: Total score\n").arg(score) + - tr("On to level %1.\nYou get %2 lives this time!")).arg(m_game.level+1).arg(m_game.level+2); - - QMessageBox::information( this, "Success", foo ); - - m_game.level++; - - createLevel( m_game.level ); - startLevel(); -} - -void KJezzball::keyPressEvent( QKeyEvent *ev ) -{ - if ( ev->key() == Key_Space || - ev->key() == Key_Up || - ev->key() == Key_Down || - ev->key() == Key_Right || - ev->key() == Key_Left ) - { - m_gameWidget->changeCursor(); - } - else - { - ev->ignore(); - } -} 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 @@ -Files: bin/zbounce apps/Games/zbounce.desktop pics/zbounce/zbounce.png \ -pics/zbounce/arrow0000.png pics/zbounce/ball0008.png pics/zbounce/ball0018.png \ -pics/zbounce/arrow0001.png pics/zbounce/ball0009.png pics/zbounce/ball0019.png \ -pics/zbounce/ball0000.png pics/zbounce/ball0010.png pics/zbounce/ball0020.png \ -pics/zbounce/ball0001.png pics/zbounce/ball0011.png pics/zbounce/ball0021.png \ -pics/zbounce/ball0002.png pics/zbounce/ball0012.png pics/zbounce/ball0022.png \ -pics/zbounce/ball0003.png pics/zbounce/ball0013.png pics/zbounce/ball0023.png \ -pics/zbounce/ball0004.png pics/zbounce/ball0014.png pics/zbounce/ball0024.png \ -pics/zbounce/ball0005.png pics/zbounce/ball0015.png pics/zbounce/tiles.png \ -pics/zbounce/ball0006.png pics/zbounce/ball0016.png \ -pics/zbounce/ball0007.png pics/zbounce/ball0017.png \ -Version: 0.6 -Depends: opie-base ($QPE_VERSION) -Priority: optional -Section: opie/games -Maintainer: Martin Imobersteg <imm@gmx.ch> -Architecture: arm -License: GPL -Description: ZBounce - 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 @@ -TEMPLATE = app -#CONFIG = qt warn_on debug -CONFIG = qt warn_on release -HEADERS = game.h kbounce.h -SOURCES = game.cpp kbounce.cpp main.cpp -INCLUDEPATH += $(OPIEDIR)/include -DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -DESTDIR = $(OPIEDIR)/bin -TARGET = zbounce - -TRANSLATIONS = ../../../i18n/de/zbounce.ts \ - ../../../i18n/en/zbounce.ts \ - ../../../i18n/es/zbounce.ts \ - ../../../i18n/fr/zbounce.ts \ - ../../../i18n/hu/zbounce.ts \ - ../../../i18n/ja/zbounce.ts \ - ../../../i18n/ko/zbounce.ts \ - ../../../i18n/no/zbounce.ts \ - ../../../i18n/pl/zbounce.ts \ - ../../../i18n/pt/zbounce.ts \ - ../../../i18n/pt_BR/zbounce.ts \ - ../../../i18n/sl/zbounce.ts \ - ../../../i18n/zh_CN/zbounce.ts \ - ../../../i18n/zh_TW/zbounce.ts \ - ../../../i18n/it/zbounce.ts |