summaryrefslogtreecommitdiffstats
path: root/knights/board_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'knights/board_2d.cpp')
-rw-r--r--knights/board_2d.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/knights/board_2d.cpp b/knights/board_2d.cpp
index f3a9b49..4e8e0dd 100644
--- a/knights/board_2d.cpp
+++ b/knights/board_2d.cpp
@@ -20,12 +20,12 @@
#include "logic.h"
#include "knightspixcache.h"
#include <kiconeffect.h>
-#include <qpainter.h>
-#include <qtimer.h>
+#include <tqpainter.h>
+#include <tqtimer.h>
static int MAX_STEPS = 18;
-board_2d::board_2d(QWidget *parent, const char *name, resource *Rsrc, logic *Lgc ) : board_base(parent,name,Rsrc,Lgc)
+board_2d::board_2d(TQWidget *tqparent, const char *name, resource *Rsrc, logic *Lgc ) : board_base(tqparent,name,Rsrc,Lgc)
{
updateX1 = updateY1 = 4000;
updateX2 = updateY2 = -4000;
@@ -39,12 +39,12 @@ board_2d::board_2d(QWidget *parent, const char *name, resource *Rsrc, logic *Lgc
sprites.setAutoDelete( TRUE );
/* Setup Pixmaps */
- myself.setOptimization( QPixmap::BestOptim );
+ myself.setOptimization( TQPixmap::BestOptim );
myself.resize( myResource->ThemeSize * size, myResource->ThemeSize * size);
myself.fill();
/* Setup self */
- setBackgroundMode( Qt::NoBackground );
+ setBackgroundMode( TQt::NoBackground );
show();
}
board_2d::~board_2d()
@@ -55,9 +55,9 @@ board_2d::~board_2d()
// board_2d::coords
//
///////////////////////////////////////
-QPoint board_2d::coords( const int &rank, const int &file )
+TQPoint board_2d::coords( const int &rank, const int &file )
{
- QPoint tmp;
+ TQPoint tmp;
if( orientation == 0 )
{
tmp.setX( myResource->ThemeSize * file );
@@ -80,11 +80,11 @@ QPoint board_2d::coords( const int &rank, const int &file )
// board_2d::position
//
///////////////////////////////////////
-int board_2d::position( const QPoint &_point )
+int board_2d::position( const TQPoint &_point )
{
int file, rank;
int themeSize = myResource->ThemeSize;
- QPoint point( _point );
+ TQPoint point( _point );
if( myResource->ThemeBorder )
{
@@ -145,7 +145,7 @@ void board_2d::drawMove( const ChessMove &chessMove, const bool &reverse )
/* Show Animation */
if( myResource->OPTION_Animate_Moves && !lastMoveWasDrag && isVisible() )
{
- QTimer::singleShot( 0, this, SLOT( updateSprites() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( updateSprites() ) );
sprite *spritePtr = new sprite;
spritePtr->Steps = 1;
spritePtr->Restore = FALSE;
@@ -180,15 +180,15 @@ void board_2d::drawMove( const ChessMove &chessMove, const bool &reverse )
/* Draw the originating position */
drawPosition( fromPtr );
- if( QString( chessMove.SAN ).contains( "o-o", FALSE ) )
+ if( TQString( chessMove.SAN ).tqcontains( "o-o", FALSE ) )
{
/* This is a castle */
ChessMove newMove;
- strcpy( newMove.SAN, QString( "no" ).latin1() );
+ strcpy( newMove.SAN, TQString( "no" ).latin1() );
newMove.fromRank = chessMove.fromRank;
newMove.toRank = chessMove.toRank;
newMove.ManTaken = Null;
- if( QString( chessMove.SAN ).contains( "o-o-o", FALSE ) )
+ if( TQString( chessMove.SAN ).tqcontains( "o-o-o", FALSE ) )
{
/* Queenside */
newMove.fromFile = 0;
@@ -206,7 +206,7 @@ void board_2d::drawMove( const ChessMove &chessMove, const bool &reverse )
}
///////////////////////////////////////
//
-// board_2d::resizeBoard( SLOT )
+// board_2d::resizeBoard( TQT_SLOT )
//
///////////////////////////////////////
void board_2d::resizeBoard( void )
@@ -237,7 +237,7 @@ void board_2d::redrawAll( void )
if( init )
return;
- /* Set Orientation */
+ /* Set Qt::Orientation */
orientation = myResource->OPTION_Board_Orientation;
if( localArmy != WHITE )
orientation = !orientation;
@@ -249,7 +249,7 @@ void board_2d::redrawAll( void )
{
if( orientation )
{
- QWMatrix matrix;
+ TQWMatrix matrix;
matrix.rotate( 180.0 );
myself = cache->Border.xForm( matrix );
}
@@ -262,7 +262,7 @@ void board_2d::redrawAll( void )
drawPosition( tmp++ );
redrawLights();
- /* Make sure everything is repainted */
+ /* Make sure everything is tqrepainted */
updateX1 = updateY1 = 0;
updateX2 = updateY2 = IMAGE_MAX * 9;
@@ -276,7 +276,7 @@ void board_2d::redrawAll( void )
void board_2d::redrawLights( void )
{
int half, four;
- QPoint black, white;
+ TQPoint black, white;
if( myResource->ThemeBorder )
{
half = myResource->ThemeSize >> 1;
@@ -297,13 +297,13 @@ void board_2d::redrawLights( void )
}
if( myLogic->OnMove != WHITE )
{
- myBlit( black, &cache->BorderLightOn, cache->BorderLightOn.rect() );
- myBlit( white, &cache->BorderLightOff, cache->BorderLightOff.rect() );
+ myBlit( black, TQT_TQPAINTDEVICE(&cache->BorderLightOn), cache->BorderLightOn.rect() );
+ myBlit( white, TQT_TQPAINTDEVICE(&cache->BorderLightOff), cache->BorderLightOff.rect() );
}
else
{
- myBlit( black, &cache->BorderLightOff, cache->BorderLightOff.rect() );
- myBlit( white, &cache->BorderLightOn, cache->BorderLightOn.rect() );
+ myBlit( black, TQT_TQPAINTDEVICE(&cache->BorderLightOff), cache->BorderLightOff.rect() );
+ myBlit( white, TQT_TQPAINTDEVICE(&cache->BorderLightOn), cache->BorderLightOn.rect() );
}
}
}
@@ -316,9 +316,9 @@ void board_2d::drawPosition( const int &pos )
{
int rank = pos >> 3;
int file = pos % 8;
- QPixmap buffer;
- QString cacheName = QString::number( myResource->ThemeSize );
- QImage tempImage;
+ TQPixmap buffer;
+ TQString cacheName = TQString::number( myResource->ThemeSize );
+ TQImage tempImage;
if( ( pos < 0 ) || ( pos > 63 ) ) return;
/*
@@ -383,14 +383,14 @@ void board_2d::drawPosition( const int &pos )
}
else
cacheName += " ";
- if( cache->find( cacheName, buffer ) )
+ if( cache->tqfind( cacheName, buffer ) )
{
/*
Cache Hit... no need to redraw
*/
if( myResource->OPTION_Show_Coord )
drawCoords( &buffer, pos );
- myBlit( coords( rank, file ), &buffer, buffer.rect() );
+ myBlit( coords( rank, file ), TQT_TQPAINTDEVICE(&buffer), buffer.rect() );
return;
}
@@ -407,41 +407,41 @@ void board_2d::drawPosition( const int &pos )
{
case NOTE_HIGHLIGHT: // Fall Through
case NOTE_SELECT:
- bitBlt( &buffer, 0, 0, &cache->HighlightSelect, 0, 0, -1, -1, Qt::CopyROP, FALSE);
+ bitBlt( TQT_TQPAINTDEVICE(&buffer), 0, 0, TQT_TQPAINTDEVICE(&cache->HighlightSelect), 0, 0, -1, -1, TQt::CopyROP, FALSE);
break;
case NOTE_MOVE: // Fall Through
case NOTE_CASTLE: // Fall Through
case NOTE_PAWN_DOUBLE:
- bitBlt( &buffer, 0, 0, &cache->HighlightMove, 0, 0, -1, -1, Qt::CopyROP, FALSE);
+ bitBlt( TQT_TQPAINTDEVICE(&buffer), 0, 0, TQT_TQPAINTDEVICE(&cache->HighlightMove), 0, 0, -1, -1, TQt::CopyROP, FALSE);
break;
case NOTE_ATTACK: // Fall Through
case NOTE_ENPASSANT:
- bitBlt( &buffer, 0, 0, &cache->HighlightAttack, 0, 0, -1, -1, Qt::CopyROP, FALSE);
+ bitBlt( TQT_TQPAINTDEVICE(&buffer), 0, 0, TQT_TQPAINTDEVICE(&cache->HighlightAttack), 0, 0, -1, -1, TQt::CopyROP, FALSE);
break;
default:
break;
}
if( !isSprite(pos) )
{
- QPixmap chessman = getChessman( pos );
- bitBlt( &buffer, 0, 0, &chessman, 0, 0, -1, -1, Qt::CopyROP, FALSE);
+ TQPixmap chessman = getChessman( pos );
+ bitBlt( TQT_TQPAINTDEVICE(&buffer), 0, 0, TQT_TQPAINTDEVICE(&chessman), 0, 0, -1, -1, TQt::CopyROP, FALSE);
}
/* Now add this pixmap to the cache */
cache->add( cacheName, buffer );
/* */
if( myResource->OPTION_Show_Coord )
drawCoords( &buffer, pos );
- myBlit( coords( rank, file ), &buffer, buffer.rect() );
+ myBlit( coords( rank, file ), TQT_TQPAINTDEVICE(&buffer), buffer.rect() );
}
///////////////////////////////////////
//
// board_2d::drawCoords
//
///////////////////////////////////////
-void board_2d::drawCoords( QPixmap *pic, const int &pos )
+void board_2d::drawCoords( TQPixmap *pic, const int &pos )
{
- QPainter painter;
- QString letter;
+ TQPainter painter;
+ TQString letter;
int themeSize = myResource->ThemeSize - 4;
int targetRank, targetFile;
@@ -458,29 +458,29 @@ void board_2d::drawCoords( QPixmap *pic, const int &pos )
/* Draw Rank */
if( ( pos >> 3 ) == targetRank )
{
- letter = QString( QString("abcdefgh").at( pos % 8 ) );
+ letter = TQString( TQString("abcdefgh").at( pos % 8 ) );
painter.begin( pic );
painter.setFont( myResource->FONT_Standard );
painter.setPen( myResource->COLOR_Notation_Shadow );
painter.drawText( 3, 3, themeSize, themeSize,
- Qt::AlignRight | Qt::AlignBottom, letter );
+ TQt::AlignRight | TQt::AlignBottom, letter );
painter.setPen( myResource->COLOR_Notation );
painter.drawText( 2, 2, themeSize, themeSize,
- Qt::AlignRight | Qt::AlignBottom, letter );
+ TQt::AlignRight | TQt::AlignBottom, letter );
painter.end();
}
/* Draw File */
if( ( pos % 8 ) == targetFile )
{
- letter = QString( QString("12345678").at( pos >> 3 ) );
+ letter = TQString( TQString("12345678").at( pos >> 3 ) );
painter.begin( pic );
painter.setFont( myResource->FONT_Standard );
painter.setPen( myResource->COLOR_Black );
painter.drawText( 3, 3, themeSize, themeSize,
- Qt::AlignLeft | Qt::AlignTop, letter );
+ TQt::AlignLeft | TQt::AlignTop, letter );
painter.setPen( myResource->COLOR_White );
painter.drawText( 2, 2, themeSize, themeSize,
- Qt::AlignLeft | Qt::AlignTop, letter );
+ TQt::AlignLeft | TQt::AlignTop, letter );
painter.end();
}
}
@@ -489,7 +489,7 @@ void board_2d::drawCoords( QPixmap *pic, const int &pos )
// board_2d::mouseReleaseEvent
//
///////////////////////////////////////
-void board_2d::mouseReleaseEvent( QMouseEvent *event )
+void board_2d::mouseReleaseEvent( TQMouseEvent *event )
{
event->accept();
@@ -498,7 +498,7 @@ void board_2d::mouseReleaseEvent( QMouseEvent *event )
/* Destroy any sprites being dragged */
int tmp = DragSprite->POSITION_Origin;
myBlit( DragSprite->POINT_LastUpdate,
- &DragSprite->PIXMAP_FlipFrame,
+ TQT_TQPAINTDEVICE(&DragSprite->PIXMAP_FlipFrame),
DragSprite->PIXMAP_FlipFrame.rect() );
sprites.removeRef( DragSprite );
DragSprite = NULL;
@@ -521,7 +521,7 @@ void board_2d::mouseReleaseEvent( QMouseEvent *event )
// board_2d::mousePressEvent
//
///////////////////////////////////////
-void board_2d::mousePressEvent( QMouseEvent *event )
+void board_2d::mousePressEvent( TQMouseEvent *event )
{
pressPoint = event->pos();
event->accept();
@@ -531,7 +531,7 @@ void board_2d::mousePressEvent( QMouseEvent *event )
// board_2d::mouseMoveEvent
//
///////////////////////////////////////
-void board_2d::mouseMoveEvent( QMouseEvent *event )
+void board_2d::mouseMoveEvent( TQMouseEvent *event )
{
event->accept();
if( DragSprite == NULL )
@@ -580,9 +580,9 @@ void board_2d::mouseMoveEvent( QMouseEvent *event )
// board_2d::getChessman
//
///////////////////////////////////////
-QPixmap board_2d::getChessman( const int &pos )
+TQPixmap board_2d::getChessman( const int &pos )
{
- QPixmap tmp;
+ TQPixmap tmp;
register char type, army;
if( pos == premoveTo )
@@ -668,7 +668,7 @@ void board_2d::setPremovePositions( const int &posF, const int &posT )
void board_2d::commit( void )
{
drawSprites();
- bitBlt( this, updateX1, updateY1, &myself, updateX1, updateY1, updateX2, updateY2, Qt::CopyROP );
+ bitBlt( this, updateX1, updateY1, &myself, updateX1, updateY1, updateX2, updateY2, TQt::CopyROP );
updateX1 = updateY1 = 4000;
updateX2 = updateY2 = -4000;
}
@@ -677,10 +677,10 @@ void board_2d::commit( void )
// board_2d::paintEvent
//
///////////////////////////////////////
-void board_2d::paintEvent( QPaintEvent *event )
+void board_2d::paintEvent( TQPaintEvent *event )
{
/* Paint the Widget */
- bitBlt( this, event->rect().topLeft(), &myself, event->rect(), Qt::CopyROP );
+ bitBlt( this, event->rect().topLeft(), &myself, event->rect(), TQt::CopyROP );
}
///////////////////////////////////////
//
@@ -703,7 +703,7 @@ void board_2d::drawSprites( void )
else
{
myBlit( spritePtr->POINT_LastUpdate,
- &spritePtr->PIXMAP_FlipFrame,
+ TQT_TQPAINTDEVICE(&spritePtr->PIXMAP_FlipFrame),
spritePtr->PIXMAP_FlipFrame.rect() );
}
}
@@ -723,9 +723,9 @@ void board_2d::drawSprites( void )
spritePtr->POINT_Current.y(),
spritePtr->PIXMAP_FlipFrame.width(),
spritePtr->PIXMAP_FlipFrame.height(),
- Qt::CopyROP );
+ TQt::CopyROP );
myBlit( spritePtr->POINT_Current,
- &spritePtr->PIXMAP_Sprite,
+ TQT_TQPAINTDEVICE(&spritePtr->PIXMAP_Sprite),
spritePtr->PIXMAP_Sprite.rect() );
spritePtr->POINT_LastUpdate = spritePtr->POINT_Current;
}
@@ -758,13 +758,13 @@ void board_2d::updateSprites( void )
if( spritePtr == DragSprite )
continue;
- QTimer::singleShot( 0, this, SLOT( updateSprites() ) );
+ TQTimer::singleShot( 0, this, TQT_SLOT( updateSprites() ) );
if( spritePtr->Steps < MAX_STEPS )
{
double factor = ( 1.0 / (double)MAX_STEPS ) * (double)spritePtr->Steps;
int newX = (int)( ( spritePtr->POINT_Destination.x() - spritePtr->POINT_Origin.x() ) * factor );
int newY = (int)( ( spritePtr->POINT_Destination.y() - spritePtr->POINT_Origin.y() ) * factor );
- spritePtr->POINT_Current = spritePtr->POINT_Origin + QPoint( newX, newY );
+ spritePtr->POINT_Current = spritePtr->POINT_Origin + TQPoint( newX, newY );
spritePtr->Steps += sprites.count();
}
}
@@ -793,9 +793,9 @@ bool board_2d::isSprite( const int &pos )
// board_2d::myBlit
//
///////////////////////////////////////
-void board_2d::myBlit( const QPoint &dp, const QPaintDevice *src, const QRect &sr )
+void board_2d::myBlit( const TQPoint &dp, const TQPaintDevice *src, const TQRect &sr )
{
- bitBlt( &myself, dp.x(), dp.y(), src, sr.x(), sr.y(), sr.width(), sr.height(), Qt::CopyROP );
+ bitBlt( &myself, dp.x(), dp.y(), src, sr.x(), sr.y(), sr.width(), sr.height(), TQt::CopyROP );
if( dp.x() < updateX1 )
updateX1 = dp.x();
if( dp.y() < updateY1 )