summaryrefslogtreecommitdiffstats
path: root/ktuberling/playground.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-11 04:58:26 +0000
commit838baf3f99ec5ab81b063eb5449a3381d860f377 (patch)
treedd31abcfde08ca92e4623b8f50b3d762a87c997a /ktuberling/playground.cpp
parent2bf598bafa22fac4126fc8842df6b0119aadc0e9 (diff)
downloadtdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.tar.gz
tdegames-838baf3f99ec5ab81b063eb5449a3381d860f377.zip
TQt4 port kdegames
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegames@1236074 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktuberling/playground.cpp')
-rw-r--r--ktuberling/playground.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/ktuberling/playground.cpp b/ktuberling/playground.cpp
index 4488fe8d..760ad9b8 100644
--- a/ktuberling/playground.cpp
+++ b/ktuberling/playground.cpp
@@ -24,10 +24,10 @@
#define YMARGIN 5
// Constructor
-PlayGround::PlayGround(TopLevel *parent, const char *name, uint selectedGameboard)
- : TQWidget(parent, name)
+PlayGround::PlayGround(TopLevel *tqparent, const char *name, uint selectedGameboard)
+ : TQWidget(tqparent, name)
{
- topLevel = parent;
+ topLevel = tqparent;
textsLayout = objectsLayout = 0;
textsList = soundsList = 0;
@@ -38,10 +38,10 @@ PlayGround::PlayGround(TopLevel *parent, const char *name, uint selectedGameboar
setBackgroundColor(white);
- TQDomDocument layoutsDocument;
- bool ok = topLevel->loadLayout(layoutsDocument);
- if (ok) ok = registerPlayGrounds(layoutsDocument);
- if (ok) ok = loadPlayGround(layoutsDocument, selectedGameboard);
+ TQDomDocument tqlayoutsDocument;
+ bool ok = topLevel->loadLayout(tqlayoutsDocument);
+ if (ok) ok = registerPlayGrounds(tqlayoutsDocument);
+ if (ok) ok = loadPlayGround(tqlayoutsDocument, selectedGameboard);
if (!ok) loadFailure();
currentAction = 0;
@@ -71,9 +71,9 @@ void PlayGround::reset()
// Change the gameboard
void PlayGround::change(uint selectedGameboard)
{
- TQDomDocument layoutsDocument;
- bool ok = topLevel->loadLayout(layoutsDocument);
- if (ok) ok = loadPlayGround(layoutsDocument, selectedGameboard);
+ TQDomDocument tqlayoutsDocument;
+ bool ok = topLevel->loadLayout(tqlayoutsDocument);
+ if (ok) ok = loadPlayGround(tqlayoutsDocument, selectedGameboard);
if (!ok) loadFailure();
toDraw.clear();
@@ -86,7 +86,7 @@ void PlayGround::change(uint selectedGameboard)
}
// Repaint all the editable area
-void PlayGround::repaintAll()
+void PlayGround::tqrepaintAll()
{
TQRect dirtyArea
(editableArea.left() - 10,
@@ -94,7 +94,7 @@ void PlayGround::repaintAll()
editableArea.width() + 20,
editableArea.height() + 20);
- repaint(dirtyArea, false);
+ tqrepaint(dirtyArea, false);
}
// Undo last action
@@ -221,7 +221,7 @@ void PlayGround::drawGameboard( TQPainter &artist, const TQRect &area ) const
for (TQPtrListIterator<ToDraw> currentObject(toDraw);
currentObject.current();
++currentObject)
- currentObject.current()->draw(artist, area, objectsLayout, &gameboard, &masks);
+ currentObject.current()->draw(artist, area, objectsLayout, &gameboard, &tqmasks);
}
// Painting event
@@ -241,7 +241,7 @@ void PlayGround::paintEvent( TQPaintEvent *event )
drawGameboard(artist, area);
- bitBlt(this, destination, &cache, area, Qt::CopyROP);
+ bitBlt(this, destination, &cache, area, TQt::CopyROP);
}
// Mouse pressed event
@@ -255,10 +255,10 @@ void PlayGround::mousePressEvent( TQMouseEvent *event )
int draggedNumber = draggedObject.getNumber();
TQPixmap object(objectsLayout[draggedNumber].size());
- TQBitmap shape(objectsLayout[draggedNumber].size());
- bitBlt(&object, TQPoint(0, 0), &gameboard, objectsLayout[draggedNumber], Qt::CopyROP);
- bitBlt(&shape, TQPoint(0, 0), &masks, objectsLayout[draggedNumber], Qt::CopyROP);
- object.setMask(shape);
+ TQBitmap tqshape(objectsLayout[draggedNumber].size());
+ bitBlt(&object, TQPoint(0, 0), &gameboard, objectsLayout[draggedNumber], TQt::CopyROP);
+ bitBlt(&tqshape, TQPoint(0, 0), &tqmasks, objectsLayout[draggedNumber], TQt::CopyROP);
+ object.setMask(tqshape);
draggedCursor = new TQCursor(object, position.x(), position.y());
setCursor(*draggedCursor);
@@ -293,7 +293,7 @@ void PlayGround::mouseReleaseEvent( TQMouseEvent *event )
setCursor(arrow);
// If we are not moving the object to the editable area
- if (!dirtyArea.contains(event->pos()))
+ if (!dirtyArea.tqcontains(event->pos()))
{
// ... then register its deletion (if coming from the editable area), and return
if (draggedZOrder == -1) return;
@@ -320,18 +320,18 @@ void PlayGround::mouseReleaseEvent( TQMouseEvent *event )
// Repaint the editable area
position.moveBy(XMARGIN, YMARGIN);
- repaint(position, false);
+ tqrepaint(position, false);
}
// Register the various playgrounds
-bool PlayGround::registerPlayGrounds(TQDomDocument &layoutDocument)
+bool PlayGround::registerPlayGrounds(TQDomDocument &tqlayoutDocument)
{
TQDomNodeList playGroundsList, menuItemsList, labelsList;
TQDomElement playGroundElement, menuItemElement, labelElement;
TQDomAttr actionAttribute;
- playGroundsList = layoutDocument.elementsByTagName("playground");
+ playGroundsList = tqlayoutDocument.elementsByTagName("playground");
if (playGroundsList.count() < 1)
return false;
@@ -357,20 +357,20 @@ bool PlayGround::registerPlayGrounds(TQDomDocument &layoutDocument)
return true;
}
-// Load background and draggable objects masks
-bool PlayGround::loadPlayGround(TQDomDocument &layoutDocument, uint toLoad)
+// Load background and draggable objects tqmasks
+bool PlayGround::loadPlayGround(TQDomDocument &tqlayoutDocument, uint toLoad)
{
TQDomNodeList playGroundsList,
editableAreasList, categoriesList, objectsList,
- gameAreasList, maskAreasList, soundNamesList, labelsList;
+ gameAreasList, tqmaskAreasList, soundNamesList, labelsList;
TQDomElement playGroundElement,
editableAreaElement, categoryElement, objectElement,
- gameAreaElement, maskAreaElement, soundNameElement, labelElement;
- TQDomAttr gameboardAttribute, masksAttribute,
+ gameAreaElement, tqmaskAreaElement, soundNameElement, labelElement;
+ TQDomAttr gameboardAttribute, tqmasksAttribute,
leftAttribute, topAttribute, rightAttribute, bottomAttribute,
refAttribute;
- playGroundsList = layoutDocument.elementsByTagName("playground");
+ playGroundsList = tqlayoutDocument.elementsByTagName("playground");
if (toLoad >= playGroundsList.count())
return false;
@@ -380,8 +380,8 @@ bool PlayGround::loadPlayGround(TQDomDocument &layoutDocument, uint toLoad)
if (!gameboard.load(locate("data", "ktuberling/pics/" + gameboardAttribute.value())))
return false;
- masksAttribute = playGroundElement.attributeNode("masks");
- if (!masks.load(locate("data", "ktuberling/pics/" + masksAttribute.value())))
+ tqmasksAttribute = playGroundElement.attributeNode("tqmasks");
+ if (!tqmasks.load(locate("data", "ktuberling/pics/" + tqmasksAttribute.value())))
return false;
editableAreasList = playGroundElement.elementsByTagName("editablearea");
@@ -421,9 +421,9 @@ bool PlayGround::loadPlayGround(TQDomDocument &layoutDocument, uint toLoad)
return false;
delete[] textsLayout;
- textsLayout = new QRect[texts];
+ textsLayout = new TQRect[texts];
delete[] textsList;
- textsList = new QString[texts];
+ textsList = new TQString[texts];
for (int text = 0; text < texts; text++)
{
@@ -460,9 +460,9 @@ bool PlayGround::loadPlayGround(TQDomDocument &layoutDocument, uint toLoad)
return false;
delete[] objectsLayout;
- objectsLayout = new QRect[decorations];
+ objectsLayout = new TQRect[decorations];
delete[] soundsList;
- soundsList = new QString[decorations];
+ soundsList = new TQString[decorations];
for (int decoration = 0; decoration < decorations; decoration++)
{
@@ -506,7 +506,7 @@ void PlayGround::loadFailure()
exit(-1);
}
-// Set up play ground's geometry
+// Set up play ground's tqgeometry
void PlayGround::setupGeometry()
{
int width = gameboard.width() + 2 * XMARGIN,
@@ -524,7 +524,7 @@ bool PlayGround::zone(TQPoint &position)
int draggedNumber;
for (draggedNumber = 0;
draggedNumber < decorations;
- draggedNumber++) if (objectsLayout[draggedNumber].contains(position))
+ draggedNumber++) if (objectsLayout[draggedNumber].tqcontains(position))
{
position.setX(position.x() - objectsLayout[draggedNumber].x());
position.setY(position.y() - objectsLayout[draggedNumber].y());
@@ -541,21 +541,21 @@ bool PlayGround::zone(TQPoint &position)
for (draggedZOrder = toDraw.count()-1; draggedZOrder >= 0; draggedZOrder--)
{
currentObject = toDraw.at(draggedZOrder);
- if (!currentObject->getPosition().contains(position)) continue;
+ if (!currentObject->getPosition().tqcontains(position)) continue;
TQRect toUpdate(currentObject->getPosition());
draggedObject = *currentObject;
draggedNumber = draggedObject.getNumber();
- TQBitmap shape(objectsLayout[draggedNumber].size());
+ TQBitmap tqshape(objectsLayout[draggedNumber].size());
TQPoint relative(position.x() - toUpdate.x(),
position.y() - toUpdate.y());
- bitBlt(&shape, TQPoint(0, 0), &masks, objectsLayout[draggedNumber], Qt::CopyROP);
- if (!shape.convertToImage().pixelIndex(relative.x(), relative.y())) continue;
+ bitBlt(&tqshape, TQPoint(0, 0), &tqmasks, objectsLayout[draggedNumber], TQt::CopyROP);
+ if (!tqshape.convertToImage().pixelIndex(relative.x(), relative.y())) continue;
toDraw.remove(draggedZOrder);
toUpdate.moveBy(XMARGIN, YMARGIN);
- repaint(toUpdate, false);
+ tqrepaint(toUpdate, false);
position = relative;
@@ -563,7 +563,7 @@ bool PlayGround::zone(TQPoint &position)
}
// If we are on the gameboard itself, then play "tuberling" sound
- if (editableArea.contains(position))
+ if (editableArea.tqcontains(position))
topLevel->playSound(editableSound);
return false;