diff options
Diffstat (limited to 'asciiquarium/src/screen.cpp')
-rw-r--r-- | asciiquarium/src/screen.cpp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/asciiquarium/src/screen.cpp b/asciiquarium/src/screen.cpp index 240502ff..20f57d13 100644 --- a/asciiquarium/src/screen.cpp +++ b/asciiquarium/src/screen.cpp @@ -25,12 +25,12 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include <qcolor.h> -#include <qfontmetrics.h> -#include <qpainter.h> -#include <qpixmap.h> -#include <qtimer.h> -#include <qwidget.h> +#include <ntqcolor.h> +#include <ntqfontmetrics.h> +#include <ntqpainter.h> +#include <ntqpixmap.h> +#include <ntqtimer.h> +#include <ntqwidget.h> #include <kglobalsettings.h> @@ -40,7 +40,7 @@ Screen::Screen(AASaver* widget): m_widget(widget) { - QFontMetrics fm(KGlobalSettings::fixedFont()); + TQFontMetrics fm(KGlobalSettings::fixedFont()); // Compute cell geometries. m_cellW = fm.maxWidth(); @@ -55,13 +55,13 @@ Screen::Screen(AASaver* widget): m_widget(widget) m_offY = (widget->height() - m_height * m_cellH) / 2; // Create double buffer. - m_backBuffer = QPixmap(m_widget->size()); + m_backBuffer = TQPixmap(m_widget->size()); m_backBuffer.fill(black); // FIXME: handle resizing! // Setup animation timer. - QTimer* timer = new QTimer(this); + TQTimer* timer = new TQTimer(this); connect(timer, SIGNAL(timeout()), SLOT(doAnimate())); timer->start(msPerTick()); @@ -76,36 +76,36 @@ Screen::~Screen() { } -void Screen::updateSpan(int x, int y, const QPixmap &updatePixmap) +void Screen::updateSpan(int x, int y, const TQPixmap &updatePixmap) { if (y < 0 || y >= m_height) return; - QPoint upperLeft(m_offX + x * m_cellW, m_offY + y * m_cellH); - bitBlt(&m_backBuffer, upperLeft, &updatePixmap, updatePixmap.rect(), Qt::CopyROP); - m_widget->update(QRect(upperLeft, updatePixmap.size())); + TQPoint upperLeft(m_offX + x * m_cellW, m_offY + y * m_cellH); + bitBlt(&m_backBuffer, upperLeft, &updatePixmap, updatePixmap.rect(), TQt::CopyROP); + m_widget->update(TQRect(upperLeft, updatePixmap.size())); } -void Screen::clearSpan(int x, int y, const QPixmap &clearPixmap) +void Screen::clearSpan(int x, int y, const TQPixmap &clearPixmap) { if (y < 0 || y >= m_height) return; - QPoint upperLeft(m_offX + x * m_cellW, m_offY + y * m_cellH); - bitBlt(&m_backBuffer, upperLeft, &clearPixmap, clearPixmap.rect(), Qt::CopyROP); - m_widget->update(QRect(upperLeft, clearPixmap.size())); + TQPoint upperLeft(m_offX + x * m_cellW, m_offY + y * m_cellH); + bitBlt(&m_backBuffer, upperLeft, &clearPixmap, clearPixmap.rect(), TQt::CopyROP); + m_widget->update(TQRect(upperLeft, clearPixmap.size())); } //Actually paints the region on the widget. -void Screen::paint(QRegion r) +void Screen::paint(TQRegion r) { - QPainter p(m_widget); - QMemArray<QRect> rects = r.rects(); + TQPainter p(m_widget); + TQMemArray<TQRect> rects = r.rects(); for (int r = 0; r < rects.size(); ++r) { //Determine the grid locations described by the rect - QRect bound = rects[r]; + TQRect bound = rects[r]; - bitBlt(m_widget, bound.topLeft(), &m_backBuffer, bound, Qt::CopyROP); + bitBlt(m_widget, bound.topLeft(), &m_backBuffer, bound, TQt::CopyROP); } //for rect in region }; @@ -141,10 +141,10 @@ struct ZKey void Screen::doAnimate() { //First, rebuild a new list of sprites, and build a dirty region - QRegion dirtyRegion; + TQRegion dirtyRegion; - QValueVector<Sprite*> sprites; - QValueVector<Sprite*> colliders; + TQValueVector<Sprite*> sprites; + TQValueVector<Sprite*> colliders; // Look for sprites that can suffer a collision. for (unsigned pos = 0; pos < m_sprites.size(); ++pos) @@ -169,7 +169,7 @@ void Screen::doAnimate() for (int pos = 0; pos < m_sprites.size(); ++pos) { Sprite* sprite = m_sprites[pos]; - QRect oldRect = sprite->geom(); + TQRect oldRect = sprite->geom(); if (!sprite->isKilled()) { bool dirty = sprite->tickUpdate(); @@ -199,8 +199,8 @@ void Screen::doAnimate() //Compute the list of sprites affected. Note that this is //done iteratively until fixed point. - QValueVector<Sprite*> paintSprites; - QValueVector<Sprite*> remSprites; + TQValueVector<Sprite*> paintSprites; + TQValueVector<Sprite*> remSprites; bool changed; do @@ -229,20 +229,20 @@ void Screen::doAnimate() while (changed); //Z-sort the items. - QMap<ZKey, Sprite* > sorted; + TQMap<ZKey, Sprite* > sorted; for (int pos = 0; pos < paintSprites.size(); ++pos) sorted[ZKey(paintSprites[pos])] = paintSprites[pos]; //Paint, in Z-order - for (QMapIterator<ZKey, Sprite*> i = sorted.begin(); + for (TQMapIterator<ZKey, Sprite*> i = sorted.begin(); i != sorted.end(); ++i) i.data()->paint(); // Make sure black strip at edge is still present. if(!paintSprites.isEmpty()) { - QPainter p(&m_backBuffer); - p.fillRect(m_backBuffer.width() - m_offX, 0, m_offX, m_backBuffer.height(), Qt::black); + TQPainter p(&m_backBuffer); + p.fillRect(m_backBuffer.width() - m_offX, 0, m_offX, m_backBuffer.height(), TQt::black); } } |