summaryrefslogtreecommitdiffstats
path: root/kolf/ball.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kolf/ball.cpp')
-rw-r--r--kolf/ball.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/kolf/ball.cpp b/kolf/ball.cpp
index 8adaa8cb..9ac849bc 100644
--- a/kolf/ball.cpp
+++ b/kolf/ball.cpp
@@ -1,6 +1,6 @@
-#include <qcanvas.h>
-#include <qcolor.h>
-#include <qpen.h>
+#include <tqcanvas.h>
+#include <tqcolor.h>
+#include <tqpen.h>
#include <kapplication.h>
#include <kdebug.h>
@@ -15,8 +15,8 @@
#include "game.h"
#include "ball.h"
-Ball::Ball(QCanvas *canvas)
- : QCanvasEllipse(canvas)
+Ball::Ball(TQCanvas *canvas)
+ : TQCanvasEllipse(canvas)
{
m_doDetect = true;
m_collisionLock = false;
@@ -29,9 +29,9 @@ Ball::Ball(QCanvas *canvas)
m_placeOnGround = false;
m_forceStillGoing = false;
frictionMultiplier = 1.0;
- QFont font(kapp->font());
+ TQFont font(kapp->font());
//font.setPixelSize(10);
- label = new QCanvasText("", font, canvas);
+ label = new TQCanvasText("", font, canvas);
label->setColor(white);
label->setVisible(false);
@@ -98,7 +98,7 @@ void Ball::friction()
void Ball::setVelocity(double vx, double vy)
{
- QCanvasEllipse::setVelocity(vx, vy);
+ TQCanvasEllipse::setVelocity(vx, vy);
if (vx == 0 && vy == 0)
{
@@ -123,7 +123,7 @@ void Ball::setVector(const Vector &newVector)
return;
}
- QCanvasEllipse::setVelocity(cos(newVector.direction()) * newVector.magnitude(), -sin(newVector.direction()) * newVector.magnitude());
+ TQCanvasEllipse::setVelocity(cos(newVector.direction()) * newVector.magnitude(), -sin(newVector.direction()) * newVector.magnitude());
}
void Ball::moveBy(double dx, double dy)
@@ -132,7 +132,7 @@ void Ball::moveBy(double dx, double dy)
double oldy;
oldx = x();
oldy = y();
- QCanvasEllipse::moveBy(dx, dy);
+ TQCanvasEllipse::moveBy(dx, dy);
if (game && !game->isPaused())
collisionDetect(oldx, oldy);
@@ -145,7 +145,7 @@ void Ball::moveBy(double dx, double dy)
void Ball::doAdvance()
{
- QCanvasEllipse::advance(1);
+ TQCanvasEllipse::advance(1);
}
namespace Lines
@@ -221,17 +221,17 @@ void Ball::collisionDetect(double oldx, double oldy)
const double minSpeed = .06;
- QCanvasItemList m_list = collisions(true);
+ TQCanvasItemList m_list = collisions(true);
- // please don't ask why QCanvas doesn't actually sort its list;
+ // please don't ask why TQCanvas doesn't actually sort its list;
// it just doesn't.
m_list.sort();
this->m_list = m_list;
- for (QCanvasItemList::Iterator it = m_list.begin(); it != m_list.end(); ++it)
+ for (TQCanvasItemList::Iterator it = m_list.begin(); it != m_list.end(); ++it)
{
- QCanvasItem *item = *it;
+ TQCanvasItem *item = *it;
if (item->rtti() == Rtti_NoCollision || item->rtti() == Rtti_Putter)
continue;
@@ -258,7 +258,7 @@ void Ball::collisionDetect(double oldx, double oldy)
Vector bvector = oball->curVector();
m_vector -= bvector;
- Vector unit1 = Vector(QPoint(x(), y()), QPoint(oball->x(), oball->y()));
+ Vector unit1 = Vector(TQPoint(x(), y()), TQPoint(oball->x(), oball->y()));
unit1 = unit1.unit();
Vector unit2 = m_vector.unit();
@@ -286,8 +286,8 @@ void Ball::collisionDetect(double oldx, double oldy)
{
//kdDebug(12007) << "collided with WallPoint\n";
// iterate through the rst
- QPtrList<WallPoint> points;
- for (QCanvasItemList::Iterator pit = it; pit != m_list.end(); ++pit)
+ TQPtrList<WallPoint> points;
+ for (TQCanvasItemList::Iterator pit = it; pit != m_list.end(); ++pit)
{
if ((*pit)->rtti() == Rtti_WallPoint)
{
@@ -309,9 +309,9 @@ void Ball::collisionDetect(double oldx, double oldy)
{
//kdDebug(12007) << "-----\n";
const Wall *parentWall = iterpoint->parentWall();
- const QPoint qp(iterpoint->x() + parentWall->x(), iterpoint->y() + parentWall->y());
+ const TQPoint qp(iterpoint->x() + parentWall->x(), iterpoint->y() + parentWall->y());
const Point p(qp.x(), qp.y());
- const QPoint qother = QPoint(parentWall->startPoint() == qp? parentWall->endPoint() : parentWall->startPoint()) + QPoint(parentWall->x(), parentWall->y());
+ const TQPoint qother = TQPoint(parentWall->startPoint() == qp? parentWall->endPoint() : parentWall->startPoint()) + TQPoint(parentWall->x(), parentWall->y());
const Point other(qother.x(), qother.y());
// vector of wall
@@ -371,7 +371,7 @@ void Ball::collisionDetect(double oldx, double oldy)
}
}
- for (QCanvasItemList::Iterator it = m_list.begin(); it != m_list.end(); ++it)
+ for (TQCanvasItemList::Iterator it = m_list.begin(); it != m_list.end(); ++it)
{
CanvasItem *citem = dynamic_cast<CanvasItem *>(*it);
if (citem && citem->terrainCollisions())
@@ -393,15 +393,15 @@ void Ball::collisionDetect(double oldx, double oldy)
wallCheck:
{ // check if I went through a wall
- QCanvasItemList items;
+ TQCanvasItemList items;
if (game)
items = game->canvas()->allItems();
- for (QCanvasItemList::Iterator i = items.begin(); i != items.end(); ++i)
+ for (TQCanvasItemList::Iterator i = items.begin(); i != items.end(); ++i)
{
if ((*i)->rtti() != Rtti_Wall)
continue;
- QCanvasItem *item = (*i);
+ TQCanvasItem *item = (*i);
Wall *wall = dynamic_cast<Wall*>(item);
if (!wall || !wall->isVisible())
continue;
@@ -446,20 +446,20 @@ void Ball::hideInfo()
label->setVisible(false);
}
-void Ball::setName(const QString &name)
+void Ball::setName(const TQString &name)
{
label->setText(name);
}
-void Ball::setCanvas(QCanvas *c)
+void Ball::setCanvas(TQCanvas *c)
{
- QCanvasEllipse::setCanvas(c);
+ TQCanvasEllipse::setCanvas(c);
label->setCanvas(c);
}
void Ball::setVisible(bool yes)
{
- QCanvasEllipse::setVisible(yes);
+ TQCanvasEllipse::setVisible(yes);
label->setVisible(yes && game && game->isInfoShowing());
}