summaryrefslogtreecommitdiffstats
path: root/kbounce/game.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kbounce/game.cpp')
-rw-r--r--kbounce/game.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/kbounce/game.cpp b/kbounce/game.cpp
index 853a645d..0c5f1e2d 100644
--- a/kbounce/game.cpp
+++ b/kbounce/game.cpp
@@ -18,11 +18,11 @@
#include <stdlib.h>
-#include <qtimer.h>
+#include <tqtimer.h>
#include <kstandarddirs.h>
#include <kapplication.h>
#include <kdebug.h>
-#include <qimage.h>
+#include <tqimage.h>
#include <kglobalsettings.h>
#include "game.h"
@@ -47,13 +47,13 @@
#if HAVE_ARTS
SimpleSoundServer *JezzGame::m_artsServer = 0;
#endif
-QString JezzGame::m_soundPath;
+TQString JezzGame::m_soundPath;
bool JezzGame::m_sound = true;
#define MS2TICKS( ms ) ((ms)/GAME_DELAY)
-Ball::Ball(QCanvasPixmapArray* array, QCanvas* canvas)
- : QCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 )
+Ball::Ball(TQCanvasPixmapArray* array, TQCanvas* canvas)
+ : TQCanvasSprite( array, canvas ), m_animDelay( 0 ), m_soundDelay( MS2TICKS(BALL_ANIM_DELAY)/2 )
{
}
@@ -90,7 +90,7 @@ void Ball::advance(int stage)
if ( !reflectX && !reflectY && collide(xVelocity(), yVelocity()) ) reflectX = reflectY = true;
// emit collision
- QRect r = boundingRect();
+ TQRect r = boundingRect();
r.moveBy( xVelocity(), yVelocity() );
JezzField* field = (JezzField *)canvas();
@@ -117,12 +117,12 @@ void Ball::advance(int stage)
// update field
update();
- QCanvasSprite::advance( stage );
+ TQCanvasSprite::advance( stage );
}
bool Ball::collide( double dx, double dy )
{
- QRect r = boundingRect();
+ TQRect r = boundingRect();
r.moveBy( dx, dy );
JezzField* field = (JezzField *)canvas();
@@ -136,8 +136,8 @@ bool Ball::collide( double dx, double dy )
/*************************************************************************/
-Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, QObject *parent, const char *name )
- : QObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ),
+Wall::Wall( JezzField *field, int x, int y, Direction dir, int tile, TQObject *parent, const char *name )
+ : TQObject( parent, name ), m_dir( dir ), m_field( field ), m_startX( x ), m_startY( y ),
m_tile( tile ), m_delay( MS2TICKS(WALL_DELAY)/2 ), m_active( true )
{
//kdDebug(12008) << "Wall::Wall" << endl;
@@ -169,7 +169,7 @@ bool Wall::isFree( int x, int y )
if ( m_field->tile(x, y)==TILE_FREE )
{
// check whether there is a ball at the moment
- QCanvasItemList cols = m_field->collisions( QRect(x*TILE_SIZE, y*TILE_SIZE,
+ TQCanvasItemList cols = m_field->collisions( TQRect(x*TILE_SIZE, y*TILE_SIZE,
TILE_SIZE, TILE_SIZE) );
if ( cols.count()==0 )
return true;
@@ -236,8 +236,8 @@ void Wall::fill( bool black )
/*************************************************************************/
-JezzField::JezzField( const QPixmap &tiles, const QPixmap &background, QObject* parent, const char* name )
- : QCanvas( parent, name ), m_tiles( tiles )
+JezzField::JezzField( const TQPixmap &tiles, const TQPixmap &background, TQObject* parent, const char* name )
+ : TQCanvas( parent, name ), m_tiles( tiles )
{
setPixmaps( tiles, background );
}
@@ -250,7 +250,7 @@ void JezzField::setGameTile( int x, int y, bool black )
setTile( x, y, black ? TILE_BORDER : TILE_FREE );
}
-void JezzField::setBackground( const QPixmap &background )
+void JezzField::setBackground( const TQPixmap &background )
{
// copy current field into buffer
int backup[FIELD_WIDTH][FIELD_HEIGHT];
@@ -287,18 +287,18 @@ void JezzField::setBackground( const QPixmap &background )
setTile( x, FIELD_HEIGHT-1, TILE_BORDER );
}
-void JezzField::setPixmaps( const QPixmap &tiles, const QPixmap &background )
+void JezzField::setPixmaps( const TQPixmap &tiles, const TQPixmap &background )
{
// create new tiles
- QPixmap allTiles( TILE_SIZE*(FIELD_WIDTH-2), TILE_SIZE*(FIELD_HEIGHT-1) );
+ TQPixmap allTiles( TILE_SIZE*(FIELD_WIDTH-2), TILE_SIZE*(FIELD_HEIGHT-1) );
if ( background.width()==0 || background.height()==0 ) {
m_background = false;
} else {
// handle background
m_background = true;
- QImage img = background.convertToImage();
- QPixmap scalledBackground( img.smoothScale( TILE_SIZE*(FIELD_WIDTH-2),
+ TQImage img = background.convertToImage();
+ TQPixmap scalledBackground( img.smoothScale( TILE_SIZE*(FIELD_WIDTH-2),
TILE_SIZE*(FIELD_HEIGHT-2) ) );
bitBlt( &allTiles, 0, 0, &scalledBackground, 0, 0, scalledBackground.width(), scalledBackground.height() );
}
@@ -314,8 +314,8 @@ void JezzField::setPixmaps( const QPixmap &tiles, const QPixmap &background )
/*************************************************************************/
-JezzView::JezzView(QCanvas* viewing, QWidget* parent, const char* name, WFlags f)
- : QCanvasView( viewing, parent, name, f ), m_vertical( false )
+JezzView::JezzView(TQCanvas* viewing, TQWidget* parent, const char* name, WFlags f)
+ : TQCanvasView( viewing, parent, name, f ), m_vertical( false )
{
setResizePolicy( AutoOne );
setHScrollBarMode( AlwaysOff );
@@ -324,7 +324,7 @@ JezzView::JezzView(QCanvas* viewing, QWidget* parent, const char* name, WFlags f
setCursor( sizeHorCursor );
}
-void JezzView::viewportMouseReleaseEvent( QMouseEvent *ev )
+void JezzView::viewportMouseReleaseEvent( TQMouseEvent *ev )
{
if ( ev->button() & RightButton )
{
@@ -340,17 +340,17 @@ void JezzView::viewportMouseReleaseEvent( QMouseEvent *ev )
/*************************************************************************/
-JezzGame::JezzGame( const QPixmap &background, int ballNum, QWidget *parent, const char *name )
- : QWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
+JezzGame::JezzGame( const TQPixmap &background, int ballNum, TQWidget *parent, const char *name )
+ : TQWidget( parent, name ), m_wall1( 0 ), m_wall2( 0 ),
m_text( 0 ), m_running( false ), m_percent( 0 ), m_pictured( false )
{
- QString path = kapp->dirs()->findResourceDir( "data", "kbounce/pics/ball0000.png" ) + "kbounce/pics/";
+ TQString path = kapp->dirs()->findResourceDir( "data", "kbounce/pics/ball0000.png" ) + "kbounce/pics/";
// load gfx
- m_ballPixmaps = new QCanvasPixmapArray( path + "ball%1.png", 25 );
+ m_ballPixmaps = new TQCanvasPixmapArray( path + "ball%1.png", 25 );
for ( unsigned n=0; n<m_ballPixmaps->count(); n++ )
m_ballPixmaps->image(n)->setOffset( 0, 0 );
- QPixmap tiles( path + "tiles.png" );
+ TQPixmap tiles( path + "tiles.png" );
// setup arts
#if HAVE_ARTS
@@ -378,13 +378,13 @@ JezzGame::JezzGame( const QPixmap &background, int ballNum, QWidget *parent, con
for ( int x=0; x<FIELD_WIDTH; x++ )
m_field->setTile( x, FIELD_HEIGHT-1, TILE_BORDER );
- connect( m_field, SIGNAL(ballCollision(Ball *, int, int, int)), this, SLOT(ballCollision(Ball *, int, int, int)) );
+ connect( m_field, TQT_SIGNAL(ballCollision(Ball *, int, int, int)), this, TQT_SLOT(ballCollision(Ball *, int, int, int)) );
// create view
m_view = new JezzView( m_field, this, "m_view" );
m_view->move( 0, 0 );
m_view->adjustSize();
- connect( m_view, SIGNAL(buildWall(int, int, bool)), this, SLOT(buildWall(int, int, bool)) );
+ connect( m_view, TQT_SIGNAL(buildWall(int, int, bool)), this, TQT_SLOT(buildWall(int, int, bool)) );
// create balls
for ( int n=0; n<ballNum; n++ )
@@ -399,11 +399,11 @@ JezzGame::JezzGame( const QPixmap &background, int ballNum, QWidget *parent, con
}
// create text label
- m_text = new QCanvasText( m_field );
+ m_text = new TQCanvasText( m_field );
// create game clock
- m_clock = new QTimer( this );
- connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) );
+ m_clock = new TQTimer( this );
+ connect( m_clock, TQT_SIGNAL(timeout()), this, TQT_SLOT(tick()) );
m_clock->start( GAME_DELAY );
// setup geometry
@@ -422,20 +422,20 @@ JezzGame::~JezzGame()
}
-void JezzGame::display( const QString &text, int size )
+void JezzGame::display( const TQString &text, int size )
{
qDebug("This function \"display\" shouldn't be called!!!");
if ( !text.isEmpty() )
{
//kdDebug(12008) << "text = " << text << endl;
- QFont font = KGlobalSettings::generalFont();
+ TQFont font = KGlobalSettings::generalFont();
font.setBold(true);
font.setPointSize(size);
m_text->setFont( font );
m_text->setText( text );
- QRect size = m_text->boundingRect();
+ TQRect size = m_text->boundingRect();
m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
@@ -446,12 +446,12 @@ void JezzGame::display( const QString &text, int size )
}
}
-void JezzGame::playSound( const QString &name )
+void JezzGame::playSound( const TQString &name )
{
#if HAVE_ARTS
if( !m_artsServer->isNull() && m_sound)
{
- QString path = m_soundPath + name;
+ TQString path = m_soundPath + name;
m_artsServer->play( path.latin1() );
}
#else
@@ -459,7 +459,7 @@ void JezzGame::playSound( const QString &name )
#endif
}
-void JezzGame::setBackground( const QPixmap &background )
+void JezzGame::setBackground( const TQPixmap &background )
{
m_field->setBackground( background );
}
@@ -603,7 +603,7 @@ void JezzGame::buildWall( int x, int y, bool vertical )
playSound( "wallstart.au" );
// check whether there is a ball at the moment
- QCanvasItemList cols = m_field->collisions( QRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE) );
+ TQCanvasItemList cols = m_field->collisions( TQRect(x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE) );
if ( cols.count()>0 )
{
kdDebug(12008) << "Direct collision" << endl;
@@ -618,8 +618,8 @@ void JezzGame::buildWall( int x, int y, bool vertical )
vertical? Wall::Up : Wall::Left,
vertical? TILE_WALLUP : TILE_WALLLEFT,
this, "m_wall1" );
- connect( m_wall1, SIGNAL(finished(Wall *, int)),
- this, SLOT(wallFinished(Wall *, int)) ); }
+ connect( m_wall1, TQT_SIGNAL(finished(Wall *, int)),
+ this, TQT_SLOT(wallFinished(Wall *, int)) ); }
if ( !m_wall2 )
{
@@ -627,8 +627,8 @@ void JezzGame::buildWall( int x, int y, bool vertical )
vertical? Wall::Down: Wall::Right,
vertical? TILE_WALLDOWN : TILE_WALLRIGHT,
this, "m_wall2" );
- connect( m_wall2, SIGNAL(finished(Wall *, int)),
- this, SLOT(wallFinished(Wall *, int)) );
+ connect( m_wall2, TQT_SIGNAL(finished(Wall *, int)),
+ this, TQT_SLOT(wallFinished(Wall *, int)) );
}
}
}