summaryrefslogtreecommitdiffstats
path: root/examples/demo/qasteroids
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-08 12:31:36 -0600
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2011-11-08 12:31:36 -0600
commitd796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch)
tree6e3dcca4f77e20ec8966c666aac7c35bd4704053 /examples/demo/qasteroids
downloadtqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz
tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'examples/demo/qasteroids')
-rw-r--r--examples/demo/qasteroids/bg.pngbin0 -> 4011 bytes
-rw-r--r--examples/demo/qasteroids/ledmeter.cpp117
-rw-r--r--examples/demo/qasteroids/ledmeter.h53
-rw-r--r--examples/demo/qasteroids/sounds/Explosion.wavbin0 -> 18427 bytes
-rw-r--r--examples/demo/qasteroids/sprites.h129
-rw-r--r--examples/demo/qasteroids/sprites/.pbm0
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits.ini9
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits.pov31
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0000.pngbin0 -> 215 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0001.pngbin0 -> 236 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0002.pngbin0 -> 244 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0003.pngbin0 -> 277 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0004.pngbin0 -> 259 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0005.pngbin0 -> 251 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0006.pngbin0 -> 214 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0007.pngbin0 -> 177 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0008.pngbin0 -> 175 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0009.pngbin0 -> 221 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0010.pngbin0 -> 243 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0011.pngbin0 -> 272 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0012.pngbin0 -> 265 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0013.pngbin0 -> 253 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0014.pngbin0 -> 214 bytes
-rw-r--r--examples/demo/qasteroids/sprites/bits/bits0015.pngbin0 -> 196 bytes
-rw-r--r--examples/demo/qasteroids/sprites/exhaust/exhaust.pngbin0 -> 121 bytes
-rw-r--r--examples/demo/qasteroids/sprites/missile/missile.pngbin0 -> 117 bytes
-rw-r--r--examples/demo/qasteroids/sprites/powerups/brake.pngbin0 -> 179 bytes
-rw-r--r--examples/demo/qasteroids/sprites/powerups/energy.pngbin0 -> 169 bytes
-rw-r--r--examples/demo/qasteroids/sprites/powerups/shield.pngbin0 -> 196 bytes
-rw-r--r--examples/demo/qasteroids/sprites/powerups/shoot.pngbin0 -> 250 bytes
-rw-r--r--examples/demo/qasteroids/sprites/powerups/teleport.pngbin0 -> 196 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock1.ini9
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock1.pov26
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10000.pngbin0 -> 2635 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10001.pngbin0 -> 2599 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10002.pngbin0 -> 2629 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10003.pngbin0 -> 2594 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10004.pngbin0 -> 2560 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10005.pngbin0 -> 2530 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10006.pngbin0 -> 2532 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10007.pngbin0 -> 2530 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10008.pngbin0 -> 2447 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10009.pngbin0 -> 2355 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10010.pngbin0 -> 2333 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10011.pngbin0 -> 2297 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10012.pngbin0 -> 2320 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10013.pngbin0 -> 2360 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10014.pngbin0 -> 2404 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10015.pngbin0 -> 2460 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10016.pngbin0 -> 2552 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10017.pngbin0 -> 2587 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10018.pngbin0 -> 2601 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10019.pngbin0 -> 2661 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10020.pngbin0 -> 2654 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10021.pngbin0 -> 2656 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10022.pngbin0 -> 2623 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10023.pngbin0 -> 2566 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10024.pngbin0 -> 2547 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10025.pngbin0 -> 2544 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10026.pngbin0 -> 2544 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10027.pngbin0 -> 2620 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10028.pngbin0 -> 2646 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10029.pngbin0 -> 2613 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10030.pngbin0 -> 2688 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock1/rock10031.pngbin0 -> 2664 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock2.ini9
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock2.pov26
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20000.pngbin0 -> 1338 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20001.pngbin0 -> 1376 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20002.pngbin0 -> 1391 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20003.pngbin0 -> 1389 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20004.pngbin0 -> 1372 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20005.pngbin0 -> 1401 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20006.pngbin0 -> 1361 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20007.pngbin0 -> 1369 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20008.pngbin0 -> 1368 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20009.pngbin0 -> 1313 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20010.pngbin0 -> 1340 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20011.pngbin0 -> 1324 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20012.pngbin0 -> 1350 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20013.pngbin0 -> 1337 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20014.pngbin0 -> 1341 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20015.pngbin0 -> 1375 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20016.pngbin0 -> 1371 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20017.pngbin0 -> 1354 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20018.pngbin0 -> 1333 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20019.pngbin0 -> 1362 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20020.pngbin0 -> 1379 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20021.pngbin0 -> 1402 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20022.pngbin0 -> 1420 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20023.pngbin0 -> 1403 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20024.pngbin0 -> 1450 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20025.pngbin0 -> 1376 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20026.pngbin0 -> 1376 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20027.pngbin0 -> 1332 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20028.pngbin0 -> 1353 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20029.pngbin0 -> 1376 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20030.pngbin0 -> 1307 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock2/rock20031.pngbin0 -> 1326 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock3.ini9
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock3.pov26
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30000.pngbin0 -> 738 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30001.pngbin0 -> 730 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30002.pngbin0 -> 770 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30003.pngbin0 -> 766 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30004.pngbin0 -> 770 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30005.pngbin0 -> 757 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30006.pngbin0 -> 761 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30007.pngbin0 -> 750 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30008.pngbin0 -> 748 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30009.pngbin0 -> 753 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30010.pngbin0 -> 727 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30011.pngbin0 -> 737 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30012.pngbin0 -> 724 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30013.pngbin0 -> 751 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30014.pngbin0 -> 720 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30015.pngbin0 -> 742 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30016.pngbin0 -> 723 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30017.pngbin0 -> 722 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30018.pngbin0 -> 716 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30019.pngbin0 -> 735 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30020.pngbin0 -> 735 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30021.pngbin0 -> 731 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30022.pngbin0 -> 735 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30023.pngbin0 -> 732 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30024.pngbin0 -> 727 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30025.pngbin0 -> 721 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30026.pngbin0 -> 716 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30027.pngbin0 -> 721 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30028.pngbin0 -> 739 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30029.pngbin0 -> 740 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30030.pngbin0 -> 727 bytes
-rw-r--r--examples/demo/qasteroids/sprites/rock3/rock30031.pngbin0 -> 715 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0000.pngbin0 -> 1744 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0001.pngbin0 -> 1771 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0002.pngbin0 -> 1891 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0003.pngbin0 -> 1938 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0004.pngbin0 -> 1789 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0005.pngbin0 -> 1948 bytes
-rw-r--r--examples/demo/qasteroids/sprites/shield/shield0006.pngbin0 -> 1954 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship.ini9
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship.pov128
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0000.pngbin0 -> 1819 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0001.pngbin0 -> 1949 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0002.pngbin0 -> 1962 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0003.pngbin0 -> 1974 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0004.pngbin0 -> 2058 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0005.pngbin0 -> 2103 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0006.pngbin0 -> 2055 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0007.pngbin0 -> 1961 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0008.pngbin0 -> 1861 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0009.pngbin0 -> 1976 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0010.pngbin0 -> 2023 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0011.pngbin0 -> 2086 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0012.pngbin0 -> 2024 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0013.pngbin0 -> 1997 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0014.pngbin0 -> 1951 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0015.pngbin0 -> 1883 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0016.pngbin0 -> 1827 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0017.pngbin0 -> 1932 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0018.pngbin0 -> 1998 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0019.pngbin0 -> 2025 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0020.pngbin0 -> 2083 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0021.pngbin0 -> 2090 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0022.pngbin0 -> 2026 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0023.pngbin0 -> 1937 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0024.pngbin0 -> 1811 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0025.pngbin0 -> 1958 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0026.pngbin0 -> 2033 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0027.pngbin0 -> 2066 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0028.pngbin0 -> 2069 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0029.pngbin0 -> 2077 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0030.pngbin0 -> 2054 bytes
-rw-r--r--examples/demo/qasteroids/sprites/ship/ship0031.pngbin0 -> 1948 bytes
-rw-r--r--examples/demo/qasteroids/toplevel.cpp494
-rw-r--r--examples/demo/qasteroids/toplevel.h79
-rw-r--r--examples/demo/qasteroids/view.cpp908
-rw-r--r--examples/demo/qasteroids/view.h138
178 files changed, 2200 insertions, 0 deletions
diff --git a/examples/demo/qasteroids/bg.png b/examples/demo/qasteroids/bg.png
new file mode 100644
index 000000000..33cdc48c1
--- /dev/null
+++ b/examples/demo/qasteroids/bg.png
Binary files differ
diff --git a/examples/demo/qasteroids/ledmeter.cpp b/examples/demo/qasteroids/ledmeter.cpp
new file mode 100644
index 000000000..de75852a9
--- /dev/null
+++ b/examples/demo/qasteroids/ledmeter.cpp
@@ -0,0 +1,117 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#include <qpainter.h>
+#include "ledmeter.h"
+
+KALedMeter::KALedMeter( TQWidget *parent ) : TQFrame( parent )
+{
+ mCRanges.setAutoDelete( TRUE );
+ mRange = 100;
+ mCount = 20;
+ mCurrentCount = 0;
+ mValue = 0;
+ setMinimumWidth( mCount * 2 + frameWidth() );
+}
+
+void KALedMeter::setRange( int r )
+{
+ mRange = r;
+ if ( mRange < 1 )
+ mRange = 1;
+ setValue( mValue );
+ update();
+}
+
+void KALedMeter::setCount( int c )
+{
+ mCount = c;
+ if ( mCount < 1 )
+ mCount = 1;
+ setMinimumWidth( mCount * 2 + frameWidth() );
+ calcColorRanges();
+ setValue( mValue );
+ update();
+}
+
+void KALedMeter::setValue( int v )
+{
+ mValue = v;
+ if ( mValue > mRange )
+ mValue = mRange;
+ else if ( mValue < 0 )
+ mValue = 0;
+ int c = ( mValue + mRange / mCount - 1 ) * mCount / mRange;
+ if ( c != mCurrentCount )
+ {
+ mCurrentCount = c;
+ update();
+ }
+}
+
+void KALedMeter::addColorRange( int pc, const TQColor &c )
+{
+ ColorRange *cr = new ColorRange;
+ cr->mPc = pc;
+ cr->mColor = c;
+ mCRanges.append( cr );
+ calcColorRanges();
+}
+
+void KALedMeter::resizeEvent( TQResizeEvent *e )
+{
+ TQFrame::resizeEvent( e );
+ int w = ( width() - frameWidth() - 2 ) / mCount * mCount;
+ w += frameWidth() + 2;
+ setFrameRect( TQRect( 0, 0, w, height() ) );
+}
+
+void KALedMeter::drawContents( TQPainter *p )
+{
+ TQRect b = contentsRect();
+
+ unsigned cidx = 0;
+ int ncol = mCount;
+ TQColor col = colorGroup().foreground();
+
+ if ( !mCRanges.isEmpty() )
+ {
+ col = mCRanges.at( cidx )->mColor;
+ ncol = mCRanges.at( cidx )->mValue;
+ }
+ p->setBrush( col );
+ p->setPen( col );
+
+ int lw = b.width() / mCount;
+ int lx = b.left() + 1;
+ for ( int i = 0; i < mCurrentCount; i++, lx += lw )
+ {
+ if ( i > ncol )
+ {
+ if ( ++cidx < mCRanges.count() )
+ {
+ col = mCRanges.at( cidx )->mColor;
+ ncol = mCRanges.at( cidx )->mValue;
+ p->setBrush( col );
+ p->setPen( col );
+ }
+ }
+
+ p->drawRect( lx, b.top() + 1, lw - 1, b.height() - 2 );
+ }
+}
+
+void KALedMeter::calcColorRanges()
+{
+ int prev = 0;
+ ColorRange *cr;
+ for ( cr = mCRanges.first(); cr; cr = mCRanges.next() )
+ {
+ cr->mValue = prev + cr->mPc * mCount / 100;
+ prev = cr->mValue;
+ }
+}
+
diff --git a/examples/demo/qasteroids/ledmeter.h b/examples/demo/qasteroids/ledmeter.h
new file mode 100644
index 000000000..8018c72df
--- /dev/null
+++ b/examples/demo/qasteroids/ledmeter.h
@@ -0,0 +1,53 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __LEDMETER_H__
+#define __LEDMETER_H__
+
+#include <qframe.h>
+#include <qptrlist.h>
+
+
+class KALedMeter : public TQFrame
+{
+ Q_OBJECT
+public:
+ KALedMeter( TQWidget *parent );
+
+ int range() const { return mRange; }
+ void setRange( int r );
+
+ int count() const { return mCount; }
+ void setCount( int c );
+
+ int value () const { return mValue; }
+
+ void addColorRange( int pc, const TQColor &c );
+
+public slots:
+ void setValue( int v );
+
+protected:
+ virtual void resizeEvent( TQResizeEvent * );
+ virtual void drawContents( TQPainter * );
+ void calcColorRanges();
+
+protected:
+ struct ColorRange
+ {
+ int mPc;
+ int mValue;
+ TQColor mColor;
+ };
+
+ int mRange;
+ int mCount;
+ int mCurrentCount;
+ int mValue;
+ TQPtrList<ColorRange> mCRanges;
+};
+
+#endif
diff --git a/examples/demo/qasteroids/sounds/Explosion.wav b/examples/demo/qasteroids/sounds/Explosion.wav
new file mode 100644
index 000000000..7b140b1c6
--- /dev/null
+++ b/examples/demo/qasteroids/sounds/Explosion.wav
Binary files differ
diff --git a/examples/demo/qasteroids/sprites.h b/examples/demo/qasteroids/sprites.h
new file mode 100644
index 000000000..361bd0e2b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites.h
@@ -0,0 +1,129 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __SPRITES_H__
+#define __SPRITES_H__
+
+#include <qcanvas.h>
+
+#define ID_ROCK_LARGE 1024
+#define ID_ROCK_MEDIUM 1025
+#define ID_ROCK_SMALL 1026
+
+#define ID_MISSILE 1030
+
+#define ID_BIT 1040
+#define ID_EXHAUST 1041
+
+#define ID_ENERGY_POWERUP 1310
+#define ID_TELEPORT_POWERUP 1311
+#define ID_BRAKE_POWERUP 1312
+#define ID_SHIELD_POWERUP 1313
+#define ID_SHOOT_POWERUP 1314
+
+#define ID_SHIP 1350
+#define ID_SHIELD 1351
+
+#define MAX_SHIELD_AGE 350
+#define MAX_POWERUP_AGE 500
+#define MAX_MISSILE_AGE 40
+
+class KMissile : public TQCanvasSprite
+{
+public:
+ KMissile( TQCanvasPixmapArray *s, TQCanvas *c ) : TQCanvasSprite( s, c )
+ { myAge = 0; }
+
+ virtual int rtti() const { return ID_MISSILE; }
+
+ void growOlder() { myAge++; }
+ bool expired() { return myAge > MAX_MISSILE_AGE; }
+
+private:
+ int myAge;
+};
+
+class KBit : public TQCanvasSprite
+{
+public:
+ KBit( TQCanvasPixmapArray *s, TQCanvas *c ) : TQCanvasSprite( s, c )
+ { death = 7; }
+
+ virtual int rtti() const { return ID_BIT; }
+
+ void setDeath( int d ) { death = d; }
+ void growOlder() { death--; }
+ bool expired() { return death <= 0; }
+
+private:
+ int death;
+};
+
+class KExhaust : public TQCanvasSprite
+{
+public:
+ KExhaust( TQCanvasPixmapArray *s, TQCanvas *c ) : TQCanvasSprite( s, c )
+ { death = 1; }
+
+ virtual int rtti() const { return ID_EXHAUST; }
+
+ void setDeath( int d ) { death = d; }
+ void growOlder() { death--; }
+ bool expired() { return death <= 0; }
+
+private:
+ int death;
+};
+
+class KPowerup : public TQCanvasSprite
+{
+public:
+ KPowerup( TQCanvasPixmapArray *s, TQCanvas *c, int t ) : TQCanvasSprite( s, c ),
+ myAge( 0 ), type(t) { }
+
+ virtual int rtti() const { return type; }
+
+ void growOlder() { myAge++; }
+ bool expired() const { return myAge > MAX_POWERUP_AGE; }
+
+protected:
+ int myAge;
+ int type;
+};
+
+class KRock : public TQCanvasSprite
+{
+public:
+ KRock (TQCanvasPixmapArray *s, TQCanvas *c, int t, int sk, int st) : TQCanvasSprite( s, c )
+ { type = t; skip = cskip = sk; step = st; }
+
+ void nextFrame()
+ {
+ if (cskip-- <= 0) {
+ setFrame( (frame()+step+frameCount())%frameCount() );
+ cskip = TQABS(skip);
+ }
+ }
+
+ virtual int rtti() const { return type; }
+
+private:
+ int type;
+ int skip;
+ int cskip;
+ int step;
+};
+
+class KShield : public TQCanvasSprite
+{
+public:
+ KShield( TQCanvasPixmapArray *s, TQCanvas *c )
+ : TQCanvasSprite( s, c ) {}
+
+ virtual int rtti() const { return ID_SHIELD; }
+};
+
+#endif
diff --git a/examples/demo/qasteroids/sprites/.pbm b/examples/demo/qasteroids/sprites/.pbm
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/.pbm
diff --git a/examples/demo/qasteroids/sprites/bits/bits.ini b/examples/demo/qasteroids/sprites/bits/bits.ini
new file mode 100644
index 000000000..cb2976f88
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=12
+Height=12
+Final_frame=16 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=bits.pov
diff --git a/examples/demo/qasteroids/sprites/bits/bits.pov b/examples/demo/qasteroids/sprites/bits/bits.pov
new file mode 100644
index 000000000..9be7ccb67
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits.pov
@@ -0,0 +1,31 @@
+
+#version 3.0
+global_settings { assumed_gamma 2.0 }
+
+#include "colors.inc"
+#include "textures.inc"
+#include "metals.inc"
+
+camera {
+ location <15, -15, -100>
+ look_at <0, 0, 0>
+}
+
+light_source { <50, 50, -50> colour White }
+light_source { <0, 0, -50> colour White }
+
+prism {
+ linear_sweep
+ linear_spline
+ 0,
+ 0.2,
+ 5,
+ <2, 0>, <0, 2>, <-1, 1>, <0, -3>, <2, 0>
+ texture { T_Silver_2A }
+
+ rotate <360*clock, 50, 30>
+ scale <20, 20, 20>
+}
+
+
+
diff --git a/examples/demo/qasteroids/sprites/bits/bits0000.png b/examples/demo/qasteroids/sprites/bits/bits0000.png
new file mode 100644
index 000000000..5ec9d0294
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0000.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0001.png b/examples/demo/qasteroids/sprites/bits/bits0001.png
new file mode 100644
index 000000000..07b401233
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0001.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0002.png b/examples/demo/qasteroids/sprites/bits/bits0002.png
new file mode 100644
index 000000000..833379229
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0002.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0003.png b/examples/demo/qasteroids/sprites/bits/bits0003.png
new file mode 100644
index 000000000..9f1fc0283
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0003.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0004.png b/examples/demo/qasteroids/sprites/bits/bits0004.png
new file mode 100644
index 000000000..eb1cc090c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0004.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0005.png b/examples/demo/qasteroids/sprites/bits/bits0005.png
new file mode 100644
index 000000000..149be63c1
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0005.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0006.png b/examples/demo/qasteroids/sprites/bits/bits0006.png
new file mode 100644
index 000000000..4ac75c8ed
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0006.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0007.png b/examples/demo/qasteroids/sprites/bits/bits0007.png
new file mode 100644
index 000000000..907241dd7
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0007.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0008.png b/examples/demo/qasteroids/sprites/bits/bits0008.png
new file mode 100644
index 000000000..15332684f
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0008.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0009.png b/examples/demo/qasteroids/sprites/bits/bits0009.png
new file mode 100644
index 000000000..05402ba9e
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0009.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0010.png b/examples/demo/qasteroids/sprites/bits/bits0010.png
new file mode 100644
index 000000000..ca4f2297a
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0010.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0011.png b/examples/demo/qasteroids/sprites/bits/bits0011.png
new file mode 100644
index 000000000..91913c032
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0011.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0012.png b/examples/demo/qasteroids/sprites/bits/bits0012.png
new file mode 100644
index 000000000..e55d4399a
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0012.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0013.png b/examples/demo/qasteroids/sprites/bits/bits0013.png
new file mode 100644
index 000000000..9c7343600
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0013.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0014.png b/examples/demo/qasteroids/sprites/bits/bits0014.png
new file mode 100644
index 000000000..f0463a2a9
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0014.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/bits/bits0015.png b/examples/demo/qasteroids/sprites/bits/bits0015.png
new file mode 100644
index 000000000..bce35aac5
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/bits/bits0015.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/exhaust/exhaust.png b/examples/demo/qasteroids/sprites/exhaust/exhaust.png
new file mode 100644
index 000000000..a17ee71cf
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/exhaust/exhaust.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/missile/missile.png b/examples/demo/qasteroids/sprites/missile/missile.png
new file mode 100644
index 000000000..4283c6709
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/missile/missile.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/powerups/brake.png b/examples/demo/qasteroids/sprites/powerups/brake.png
new file mode 100644
index 000000000..75cd649cc
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/powerups/brake.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/powerups/energy.png b/examples/demo/qasteroids/sprites/powerups/energy.png
new file mode 100644
index 000000000..2d97ac1ed
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/powerups/energy.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/powerups/shield.png b/examples/demo/qasteroids/sprites/powerups/shield.png
new file mode 100644
index 000000000..bd6055582
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/powerups/shield.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/powerups/shoot.png b/examples/demo/qasteroids/sprites/powerups/shoot.png
new file mode 100644
index 000000000..4b2b3e335
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/powerups/shoot.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/powerups/teleport.png b/examples/demo/qasteroids/sprites/powerups/teleport.png
new file mode 100644
index 000000000..121ec9cde
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/powerups/teleport.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock1.ini b/examples/demo/qasteroids/sprites/rock1/rock1.ini
new file mode 100644
index 000000000..e42fc7662
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock1.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=48
+Height=48
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=rock1.pov
diff --git a/examples/demo/qasteroids/sprites/rock1/rock1.pov b/examples/demo/qasteroids/sprites/rock1/rock1.pov
new file mode 100644
index 000000000..58298c050
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock1.pov
@@ -0,0 +1,26 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+// #include "stones.inc"
+
+camera {
+ location <2,2,-6>
+ up <0, 1, 0>
+// right <4/3, 0, 0>
+ look_at <0,0,0>
+}
+
+object { light_source { <10, 5, -5> color red 1.1 green 1.1 blue 1.0 } }
+
+#declare Rock =
+mesh {
+ #include "rock.inc" /* collection of triangle or smooth_triangle data */
+}
+
+object {
+ Rock
+ texture { pigment {White} }
+ scale 1.9
+ rotate <60, 45, 360*clock>
+}
+
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10000.png b/examples/demo/qasteroids/sprites/rock1/rock10000.png
new file mode 100644
index 000000000..2e3ff9322
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10000.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10001.png b/examples/demo/qasteroids/sprites/rock1/rock10001.png
new file mode 100644
index 000000000..ba70d2404
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10001.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10002.png b/examples/demo/qasteroids/sprites/rock1/rock10002.png
new file mode 100644
index 000000000..88d776e43
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10002.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10003.png b/examples/demo/qasteroids/sprites/rock1/rock10003.png
new file mode 100644
index 000000000..9db197d4c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10003.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10004.png b/examples/demo/qasteroids/sprites/rock1/rock10004.png
new file mode 100644
index 000000000..9b92d55c3
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10004.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10005.png b/examples/demo/qasteroids/sprites/rock1/rock10005.png
new file mode 100644
index 000000000..9cdddf5ab
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10005.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10006.png b/examples/demo/qasteroids/sprites/rock1/rock10006.png
new file mode 100644
index 000000000..0c421a009
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10006.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10007.png b/examples/demo/qasteroids/sprites/rock1/rock10007.png
new file mode 100644
index 000000000..2339c8367
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10007.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10008.png b/examples/demo/qasteroids/sprites/rock1/rock10008.png
new file mode 100644
index 000000000..d1eb8aaf9
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10008.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10009.png b/examples/demo/qasteroids/sprites/rock1/rock10009.png
new file mode 100644
index 000000000..47ada4278
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10009.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10010.png b/examples/demo/qasteroids/sprites/rock1/rock10010.png
new file mode 100644
index 000000000..1a2eba02e
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10010.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10011.png b/examples/demo/qasteroids/sprites/rock1/rock10011.png
new file mode 100644
index 000000000..ec213e1c8
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10011.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10012.png b/examples/demo/qasteroids/sprites/rock1/rock10012.png
new file mode 100644
index 000000000..3bdb39b61
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10012.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10013.png b/examples/demo/qasteroids/sprites/rock1/rock10013.png
new file mode 100644
index 000000000..08de9a088
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10013.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10014.png b/examples/demo/qasteroids/sprites/rock1/rock10014.png
new file mode 100644
index 000000000..3b6ce6084
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10014.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10015.png b/examples/demo/qasteroids/sprites/rock1/rock10015.png
new file mode 100644
index 000000000..01216dce4
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10015.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10016.png b/examples/demo/qasteroids/sprites/rock1/rock10016.png
new file mode 100644
index 000000000..efb612d44
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10016.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10017.png b/examples/demo/qasteroids/sprites/rock1/rock10017.png
new file mode 100644
index 000000000..97bbfce88
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10017.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10018.png b/examples/demo/qasteroids/sprites/rock1/rock10018.png
new file mode 100644
index 000000000..29862676c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10018.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10019.png b/examples/demo/qasteroids/sprites/rock1/rock10019.png
new file mode 100644
index 000000000..80eab6df8
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10019.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10020.png b/examples/demo/qasteroids/sprites/rock1/rock10020.png
new file mode 100644
index 000000000..78023e088
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10020.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10021.png b/examples/demo/qasteroids/sprites/rock1/rock10021.png
new file mode 100644
index 000000000..076a33848
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10021.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10022.png b/examples/demo/qasteroids/sprites/rock1/rock10022.png
new file mode 100644
index 000000000..4f8f5edcb
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10022.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10023.png b/examples/demo/qasteroids/sprites/rock1/rock10023.png
new file mode 100644
index 000000000..4e6ba042a
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10023.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10024.png b/examples/demo/qasteroids/sprites/rock1/rock10024.png
new file mode 100644
index 000000000..1a15fc3b7
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10024.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10025.png b/examples/demo/qasteroids/sprites/rock1/rock10025.png
new file mode 100644
index 000000000..b627d537d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10025.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10026.png b/examples/demo/qasteroids/sprites/rock1/rock10026.png
new file mode 100644
index 000000000..7df23b167
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10026.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10027.png b/examples/demo/qasteroids/sprites/rock1/rock10027.png
new file mode 100644
index 000000000..d2cb5d3f8
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10027.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10028.png b/examples/demo/qasteroids/sprites/rock1/rock10028.png
new file mode 100644
index 000000000..68611a679
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10028.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10029.png b/examples/demo/qasteroids/sprites/rock1/rock10029.png
new file mode 100644
index 000000000..44d6a30bb
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10029.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10030.png b/examples/demo/qasteroids/sprites/rock1/rock10030.png
new file mode 100644
index 000000000..9dca7db1d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10030.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock1/rock10031.png b/examples/demo/qasteroids/sprites/rock1/rock10031.png
new file mode 100644
index 000000000..10beae6ab
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock1/rock10031.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock2.ini b/examples/demo/qasteroids/sprites/rock2/rock2.ini
new file mode 100644
index 000000000..d50e6fada
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock2.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=32
+Height=32
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=rock2.pov
diff --git a/examples/demo/qasteroids/sprites/rock2/rock2.pov b/examples/demo/qasteroids/sprites/rock2/rock2.pov
new file mode 100644
index 000000000..2f37a2062
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock2.pov
@@ -0,0 +1,26 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+// #include "stones.inc"
+
+camera {
+ location <2,2,-6>
+ up <0, 1, 0>
+// right <4/3, 0, 0>
+ look_at <0,0,0>
+}
+
+object { light_source { <10, 5, -5> color red 1.1 green 1.1 blue 1.0 } }
+
+#declare Rock =
+mesh {
+ #include "rock.inc" /* collection of triangle or smooth_triangle data */
+}
+
+object {
+ Rock
+ texture { pigment {White} }
+ scale 1.9
+ rotate <60, 30, 360*clock>
+}
+
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20000.png b/examples/demo/qasteroids/sprites/rock2/rock20000.png
new file mode 100644
index 000000000..5cb52bb81
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20000.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20001.png b/examples/demo/qasteroids/sprites/rock2/rock20001.png
new file mode 100644
index 000000000..c4c85eb59
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20001.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20002.png b/examples/demo/qasteroids/sprites/rock2/rock20002.png
new file mode 100644
index 000000000..dea49d7e8
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20002.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20003.png b/examples/demo/qasteroids/sprites/rock2/rock20003.png
new file mode 100644
index 000000000..39772b8aa
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20003.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20004.png b/examples/demo/qasteroids/sprites/rock2/rock20004.png
new file mode 100644
index 000000000..fb02ee48e
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20004.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20005.png b/examples/demo/qasteroids/sprites/rock2/rock20005.png
new file mode 100644
index 000000000..a81c5ac7d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20005.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20006.png b/examples/demo/qasteroids/sprites/rock2/rock20006.png
new file mode 100644
index 000000000..cf5c2f4c4
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20006.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20007.png b/examples/demo/qasteroids/sprites/rock2/rock20007.png
new file mode 100644
index 000000000..479c21d27
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20007.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20008.png b/examples/demo/qasteroids/sprites/rock2/rock20008.png
new file mode 100644
index 000000000..871abca06
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20008.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20009.png b/examples/demo/qasteroids/sprites/rock2/rock20009.png
new file mode 100644
index 000000000..d5d786081
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20009.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20010.png b/examples/demo/qasteroids/sprites/rock2/rock20010.png
new file mode 100644
index 000000000..1da995334
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20010.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20011.png b/examples/demo/qasteroids/sprites/rock2/rock20011.png
new file mode 100644
index 000000000..29886585e
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20011.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20012.png b/examples/demo/qasteroids/sprites/rock2/rock20012.png
new file mode 100644
index 000000000..d104ff954
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20012.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20013.png b/examples/demo/qasteroids/sprites/rock2/rock20013.png
new file mode 100644
index 000000000..e12943df9
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20013.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20014.png b/examples/demo/qasteroids/sprites/rock2/rock20014.png
new file mode 100644
index 000000000..dc7529cfd
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20014.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20015.png b/examples/demo/qasteroids/sprites/rock2/rock20015.png
new file mode 100644
index 000000000..3d9d3185e
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20015.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20016.png b/examples/demo/qasteroids/sprites/rock2/rock20016.png
new file mode 100644
index 000000000..6314f03b8
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20016.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20017.png b/examples/demo/qasteroids/sprites/rock2/rock20017.png
new file mode 100644
index 000000000..5a8aeef21
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20017.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20018.png b/examples/demo/qasteroids/sprites/rock2/rock20018.png
new file mode 100644
index 000000000..f0e5b088d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20018.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20019.png b/examples/demo/qasteroids/sprites/rock2/rock20019.png
new file mode 100644
index 000000000..d731950d0
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20019.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20020.png b/examples/demo/qasteroids/sprites/rock2/rock20020.png
new file mode 100644
index 000000000..8bc7e20fe
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20020.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20021.png b/examples/demo/qasteroids/sprites/rock2/rock20021.png
new file mode 100644
index 000000000..b2854b25d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20021.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20022.png b/examples/demo/qasteroids/sprites/rock2/rock20022.png
new file mode 100644
index 000000000..781d620a0
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20022.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20023.png b/examples/demo/qasteroids/sprites/rock2/rock20023.png
new file mode 100644
index 000000000..1f64b02c2
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20023.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20024.png b/examples/demo/qasteroids/sprites/rock2/rock20024.png
new file mode 100644
index 000000000..bd19e7444
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20024.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20025.png b/examples/demo/qasteroids/sprites/rock2/rock20025.png
new file mode 100644
index 000000000..180f5b65c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20025.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20026.png b/examples/demo/qasteroids/sprites/rock2/rock20026.png
new file mode 100644
index 000000000..f2681d46f
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20026.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20027.png b/examples/demo/qasteroids/sprites/rock2/rock20027.png
new file mode 100644
index 000000000..5bc1add09
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20027.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20028.png b/examples/demo/qasteroids/sprites/rock2/rock20028.png
new file mode 100644
index 000000000..5621b4d6d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20028.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20029.png b/examples/demo/qasteroids/sprites/rock2/rock20029.png
new file mode 100644
index 000000000..aec4a3474
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20029.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20030.png b/examples/demo/qasteroids/sprites/rock2/rock20030.png
new file mode 100644
index 000000000..121b70eea
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20030.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock2/rock20031.png b/examples/demo/qasteroids/sprites/rock2/rock20031.png
new file mode 100644
index 000000000..661b18e7c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock2/rock20031.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock3.ini b/examples/demo/qasteroids/sprites/rock3/rock3.ini
new file mode 100644
index 000000000..26a3cf969
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock3.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=20
+Height=20
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=rock3.pov
diff --git a/examples/demo/qasteroids/sprites/rock3/rock3.pov b/examples/demo/qasteroids/sprites/rock3/rock3.pov
new file mode 100644
index 000000000..2f37a2062
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock3.pov
@@ -0,0 +1,26 @@
+#include "colors.inc"
+#include "shapes.inc"
+#include "textures.inc"
+// #include "stones.inc"
+
+camera {
+ location <2,2,-6>
+ up <0, 1, 0>
+// right <4/3, 0, 0>
+ look_at <0,0,0>
+}
+
+object { light_source { <10, 5, -5> color red 1.1 green 1.1 blue 1.0 } }
+
+#declare Rock =
+mesh {
+ #include "rock.inc" /* collection of triangle or smooth_triangle data */
+}
+
+object {
+ Rock
+ texture { pigment {White} }
+ scale 1.9
+ rotate <60, 30, 360*clock>
+}
+
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30000.png b/examples/demo/qasteroids/sprites/rock3/rock30000.png
new file mode 100644
index 000000000..de1205a88
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30000.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30001.png b/examples/demo/qasteroids/sprites/rock3/rock30001.png
new file mode 100644
index 000000000..12ebc0031
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30001.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30002.png b/examples/demo/qasteroids/sprites/rock3/rock30002.png
new file mode 100644
index 000000000..265c381bc
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30002.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30003.png b/examples/demo/qasteroids/sprites/rock3/rock30003.png
new file mode 100644
index 000000000..1ff7a0675
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30003.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30004.png b/examples/demo/qasteroids/sprites/rock3/rock30004.png
new file mode 100644
index 000000000..5b505bf10
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30004.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30005.png b/examples/demo/qasteroids/sprites/rock3/rock30005.png
new file mode 100644
index 000000000..204c9697b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30005.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30006.png b/examples/demo/qasteroids/sprites/rock3/rock30006.png
new file mode 100644
index 000000000..32140cffb
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30006.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30007.png b/examples/demo/qasteroids/sprites/rock3/rock30007.png
new file mode 100644
index 000000000..f01baa6b3
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30007.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30008.png b/examples/demo/qasteroids/sprites/rock3/rock30008.png
new file mode 100644
index 000000000..eee458e5a
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30008.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30009.png b/examples/demo/qasteroids/sprites/rock3/rock30009.png
new file mode 100644
index 000000000..14412d4e1
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30009.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30010.png b/examples/demo/qasteroids/sprites/rock3/rock30010.png
new file mode 100644
index 000000000..bb61d549b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30010.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30011.png b/examples/demo/qasteroids/sprites/rock3/rock30011.png
new file mode 100644
index 000000000..8486e5a45
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30011.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30012.png b/examples/demo/qasteroids/sprites/rock3/rock30012.png
new file mode 100644
index 000000000..d9ae4191e
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30012.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30013.png b/examples/demo/qasteroids/sprites/rock3/rock30013.png
new file mode 100644
index 000000000..ce694002a
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30013.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30014.png b/examples/demo/qasteroids/sprites/rock3/rock30014.png
new file mode 100644
index 000000000..981e92c13
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30014.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30015.png b/examples/demo/qasteroids/sprites/rock3/rock30015.png
new file mode 100644
index 000000000..63f0a69d8
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30015.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30016.png b/examples/demo/qasteroids/sprites/rock3/rock30016.png
new file mode 100644
index 000000000..72bc42fc7
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30016.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30017.png b/examples/demo/qasteroids/sprites/rock3/rock30017.png
new file mode 100644
index 000000000..c89f358ce
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30017.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30018.png b/examples/demo/qasteroids/sprites/rock3/rock30018.png
new file mode 100644
index 000000000..e1ba724d4
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30018.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30019.png b/examples/demo/qasteroids/sprites/rock3/rock30019.png
new file mode 100644
index 000000000..5f004a766
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30019.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30020.png b/examples/demo/qasteroids/sprites/rock3/rock30020.png
new file mode 100644
index 000000000..58009bf92
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30020.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30021.png b/examples/demo/qasteroids/sprites/rock3/rock30021.png
new file mode 100644
index 000000000..8d9549c85
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30021.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30022.png b/examples/demo/qasteroids/sprites/rock3/rock30022.png
new file mode 100644
index 000000000..1e8a1c233
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30022.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30023.png b/examples/demo/qasteroids/sprites/rock3/rock30023.png
new file mode 100644
index 000000000..9b960d669
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30023.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30024.png b/examples/demo/qasteroids/sprites/rock3/rock30024.png
new file mode 100644
index 000000000..6c15f2b89
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30024.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30025.png b/examples/demo/qasteroids/sprites/rock3/rock30025.png
new file mode 100644
index 000000000..12b05da54
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30025.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30026.png b/examples/demo/qasteroids/sprites/rock3/rock30026.png
new file mode 100644
index 000000000..16190e944
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30026.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30027.png b/examples/demo/qasteroids/sprites/rock3/rock30027.png
new file mode 100644
index 000000000..a8625015d
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30027.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30028.png b/examples/demo/qasteroids/sprites/rock3/rock30028.png
new file mode 100644
index 000000000..e3e0c1806
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30028.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30029.png b/examples/demo/qasteroids/sprites/rock3/rock30029.png
new file mode 100644
index 000000000..ec70b8443
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30029.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30030.png b/examples/demo/qasteroids/sprites/rock3/rock30030.png
new file mode 100644
index 000000000..0b060d038
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30030.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/rock3/rock30031.png b/examples/demo/qasteroids/sprites/rock3/rock30031.png
new file mode 100644
index 000000000..c1dc1b92f
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/rock3/rock30031.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0000.png b/examples/demo/qasteroids/sprites/shield/shield0000.png
new file mode 100644
index 000000000..e3434e623
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0000.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0001.png b/examples/demo/qasteroids/sprites/shield/shield0001.png
new file mode 100644
index 000000000..038cf5dbd
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0001.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0002.png b/examples/demo/qasteroids/sprites/shield/shield0002.png
new file mode 100644
index 000000000..1cf0da0ad
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0002.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0003.png b/examples/demo/qasteroids/sprites/shield/shield0003.png
new file mode 100644
index 000000000..40c725655
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0003.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0004.png b/examples/demo/qasteroids/sprites/shield/shield0004.png
new file mode 100644
index 000000000..4ee43bae0
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0004.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0005.png b/examples/demo/qasteroids/sprites/shield/shield0005.png
new file mode 100644
index 000000000..0122e14ea
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0005.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/shield/shield0006.png b/examples/demo/qasteroids/sprites/shield/shield0006.png
new file mode 100644
index 000000000..dc5bea344
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/shield/shield0006.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship.ini b/examples/demo/qasteroids/sprites/ship/ship.ini
new file mode 100644
index 000000000..479cc20ea
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship.ini
@@ -0,0 +1,9 @@
+Cyclic_Animation=On
+Width=42
+Height=42
+Final_frame=32 ;; NR_ROTS
+Antialias=On
+Output_Alpha=On
+Output_to_File=On
+Output_File_Type=n
+Input_File_Name=ship.pov
diff --git a/examples/demo/qasteroids/sprites/ship/ship.pov b/examples/demo/qasteroids/sprites/ship/ship.pov
new file mode 100644
index 000000000..8f185cd7b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship.pov
@@ -0,0 +1,128 @@
+
+#version 3.0
+global_settings { assumed_gamma 2.0 }
+
+#include "colors.inc"
+#include "textures.inc"
+#include "metals.inc"
+
+camera {
+ orthographic
+ up <0, 130, 0>
+ right <130, 0, 0>
+ location <0, 0, -130>
+ look_at <0, 0, 0>
+}
+
+light_source { <50, 25, -25> colour White }
+light_source { <0, 0, -100> colour Gray80 }
+
+#declare ShipColor = color red 1.0 green 1.0 blue 0.9
+
+#declare BaseTexture =
+texture {
+ pigment { ShipColor }
+}
+
+#declare Grubby =
+texture {
+ pigment {
+ bozo
+ color_map {
+ [0.0 color rgbt <1, 1, 1, 1>]
+ [0.8 color rgbt <0.9, 0.9, 0.9, 0.5>]
+ [1.0 color rgbt <0.8, 0.8, 0.8, 0.5>]
+ }
+ turbulence 2.0
+ scale 3
+ }
+}
+
+#declare ShipTexture =
+texture { BaseTexture }
+texture { Grubby }
+
+union {
+ cone {
+ <12, 0, 0>, 0.5
+ <11, 0, 0>, 1.0
+ texture { ShipTexture }
+ }
+ cone {
+ <11, 0, 0>, 1.0
+ <8, 0, 0>, 2.0
+ texture { ShipTexture }
+ }
+ cone {
+ <8, 0, 0>, 2.0
+ <3.5, 0, 0>, 3.8
+ texture { ShipTexture }
+ }
+ difference {
+ cone {
+ <8, 0, -0.01>, 2.0
+ <3.5, 0, -0.01>, 3.8
+ pigment { color Gray20 }
+ }
+ box {
+ <9, -4.0, -3.7>,
+ <2, 4.0, 10>
+ rotate <0, -18, 0>
+ }
+ box {
+ <6.5, -4.0, -8>,
+ <10, 4.0, 8>
+ }
+ box {
+ <2, -4.0, -8>,
+ <4.5, 4.0, 8>
+ }
+ }
+ cone {
+ <3.5, 0, 0>, 3.8
+ <2, 0, 0>, 4.0
+ texture { ShipTexture }
+ }
+ cylinder {
+ <2, 0, 0>,
+ <-9, 0, 0>,
+ 4.0
+ texture { ShipTexture }
+ }
+ cone {
+ <-9, 0, 0>, 4.0
+ <-10, 0, 0>, 3.5
+ texture { ShipTexture }
+ }
+ prism {
+ linear_sweep
+ linear_spline
+ 0,
+ 0.5,
+ 4,
+ <7.5, 0>, <-7.5, 10>, <-7.5, -10>, <7.5, 0>
+ rotate <90, 0, 0>
+ texture { T_Silver_2A }
+ texture { ShipTexture }
+ }
+ prism {
+ linear_sweep
+ linear_spline
+ -0.5,
+ 0.5,
+ 4,
+ <4, 0>, <-7.5, 5>, <-7.5, -5>, <4, 0>
+ pigment { color White }
+ }
+ cone {
+ <-12, 0, 0>, 3.0
+ <-10, 0, 0>, 2.0
+ texture { T_Silver_2A }
+ pigment { color Gray60 }
+ }
+
+ rotate <0, 0,-360*clock>
+ scale <5, 5, 5>
+}
+
+
diff --git a/examples/demo/qasteroids/sprites/ship/ship0000.png b/examples/demo/qasteroids/sprites/ship/ship0000.png
new file mode 100644
index 000000000..1d73a6e2c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0000.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0001.png b/examples/demo/qasteroids/sprites/ship/ship0001.png
new file mode 100644
index 000000000..d3f4b3f3b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0001.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0002.png b/examples/demo/qasteroids/sprites/ship/ship0002.png
new file mode 100644
index 000000000..c5f40fa20
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0002.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0003.png b/examples/demo/qasteroids/sprites/ship/ship0003.png
new file mode 100644
index 000000000..a1c8c2590
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0003.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0004.png b/examples/demo/qasteroids/sprites/ship/ship0004.png
new file mode 100644
index 000000000..8d3b6d9cc
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0004.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0005.png b/examples/demo/qasteroids/sprites/ship/ship0005.png
new file mode 100644
index 000000000..15843ddef
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0005.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0006.png b/examples/demo/qasteroids/sprites/ship/ship0006.png
new file mode 100644
index 000000000..380509ac7
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0006.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0007.png b/examples/demo/qasteroids/sprites/ship/ship0007.png
new file mode 100644
index 000000000..633f5629f
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0007.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0008.png b/examples/demo/qasteroids/sprites/ship/ship0008.png
new file mode 100644
index 000000000..e40ad04d6
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0008.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0009.png b/examples/demo/qasteroids/sprites/ship/ship0009.png
new file mode 100644
index 000000000..19f3436e3
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0009.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0010.png b/examples/demo/qasteroids/sprites/ship/ship0010.png
new file mode 100644
index 000000000..b1142f4eb
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0010.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0011.png b/examples/demo/qasteroids/sprites/ship/ship0011.png
new file mode 100644
index 000000000..b8acd629b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0011.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0012.png b/examples/demo/qasteroids/sprites/ship/ship0012.png
new file mode 100644
index 000000000..06ac9eb5b
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0012.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0013.png b/examples/demo/qasteroids/sprites/ship/ship0013.png
new file mode 100644
index 000000000..71cf38c0c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0013.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0014.png b/examples/demo/qasteroids/sprites/ship/ship0014.png
new file mode 100644
index 000000000..988a77f78
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0014.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0015.png b/examples/demo/qasteroids/sprites/ship/ship0015.png
new file mode 100644
index 000000000..1ad219304
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0015.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0016.png b/examples/demo/qasteroids/sprites/ship/ship0016.png
new file mode 100644
index 000000000..c4f712504
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0016.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0017.png b/examples/demo/qasteroids/sprites/ship/ship0017.png
new file mode 100644
index 000000000..09e226e7c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0017.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0018.png b/examples/demo/qasteroids/sprites/ship/ship0018.png
new file mode 100644
index 000000000..56b6190bb
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0018.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0019.png b/examples/demo/qasteroids/sprites/ship/ship0019.png
new file mode 100644
index 000000000..473340a63
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0019.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0020.png b/examples/demo/qasteroids/sprites/ship/ship0020.png
new file mode 100644
index 000000000..dcfaa9879
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0020.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0021.png b/examples/demo/qasteroids/sprites/ship/ship0021.png
new file mode 100644
index 000000000..f5718a2aa
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0021.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0022.png b/examples/demo/qasteroids/sprites/ship/ship0022.png
new file mode 100644
index 000000000..d59ca3208
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0022.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0023.png b/examples/demo/qasteroids/sprites/ship/ship0023.png
new file mode 100644
index 000000000..8f2492710
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0023.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0024.png b/examples/demo/qasteroids/sprites/ship/ship0024.png
new file mode 100644
index 000000000..0cae4978f
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0024.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0025.png b/examples/demo/qasteroids/sprites/ship/ship0025.png
new file mode 100644
index 000000000..bc7c5db22
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0025.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0026.png b/examples/demo/qasteroids/sprites/ship/ship0026.png
new file mode 100644
index 000000000..386a9c7ce
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0026.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0027.png b/examples/demo/qasteroids/sprites/ship/ship0027.png
new file mode 100644
index 000000000..ad9677988
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0027.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0028.png b/examples/demo/qasteroids/sprites/ship/ship0028.png
new file mode 100644
index 000000000..117420f07
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0028.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0029.png b/examples/demo/qasteroids/sprites/ship/ship0029.png
new file mode 100644
index 000000000..0677ce19f
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0029.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0030.png b/examples/demo/qasteroids/sprites/ship/ship0030.png
new file mode 100644
index 000000000..576625cb5
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0030.png
Binary files differ
diff --git a/examples/demo/qasteroids/sprites/ship/ship0031.png b/examples/demo/qasteroids/sprites/ship/ship0031.png
new file mode 100644
index 000000000..ba876908c
--- /dev/null
+++ b/examples/demo/qasteroids/sprites/ship/ship0031.png
Binary files differ
diff --git a/examples/demo/qasteroids/toplevel.cpp b/examples/demo/qasteroids/toplevel.cpp
new file mode 100644
index 000000000..fbec2ec28
--- /dev/null
+++ b/examples/demo/qasteroids/toplevel.cpp
@@ -0,0 +1,494 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+// --- toplevel.cpp ---
+#include <qaccel.h>
+#include <qlabel.h>
+#include <qlayout.h>
+#include <qlcdnumber.h>
+#include <qpushbutton.h>
+
+#include <qapplication.h>
+
+#include "toplevel.h"
+#include "ledmeter.h"
+
+
+#define SB_SCORE 1
+#define SB_LEVEL 2
+#define SB_SHIPS 3
+
+struct SLevel
+{
+ int nrocks;
+ double rockSpeed;
+};
+
+#define MAX_LEVELS 16
+
+SLevel levels[MAX_LEVELS] =
+{
+ { 1, 0.4 },
+ { 1, 0.6 },
+ { 2, 0.5 },
+ { 2, 0.7 },
+ { 2, 0.8 },
+ { 3, 0.6 },
+ { 3, 0.7 },
+ { 3, 0.8 },
+ { 4, 0.6 },
+ { 4, 0.7 },
+ { 4, 0.8 },
+ { 5, 0.7 },
+ { 5, 0.8 },
+ { 5, 0.9 },
+ { 5, 1.0 }
+};
+
+const char *soundEvents[] =
+{
+ "ShipDestroyed",
+ "RockDestroyed",
+ 0
+};
+
+const char *soundDefaults[] =
+{
+ "Explosion.wav",
+ "ploop.wav",
+ 0
+};
+
+
+KAstTopLevel::KAstTopLevel( TQWidget *parent, const char *name )
+ : TQMainWindow( parent, name, 0 )
+{
+ TQWidget *border = new TQWidget( this );
+ border->setBackgroundColor( black );
+ setCentralWidget( border );
+
+ TQVBoxLayout *borderLayout = new TQVBoxLayout( border );
+ borderLayout->addStretch( 1 );
+
+ TQWidget *mainWin = new TQWidget( border );
+ mainWin->setFixedSize(640, 480);
+ borderLayout->addWidget( mainWin, 0, AlignHCenter );
+
+ borderLayout->addStretch( 1 );
+
+ view = new KAsteroidsView( mainWin );
+ view->setFocusPolicy( StrongFocus );
+ connect( view, SIGNAL( shipKilled() ), SLOT( slotShipKilled() ) );
+ connect( view, SIGNAL( rockHit(int) ), SLOT( slotRockHit(int) ) );
+ connect( view, SIGNAL( rocksRemoved() ), SLOT( slotRocksRemoved() ) );
+ connect( view, SIGNAL( updateVitals() ), SLOT( slotUpdateVitals() ) );
+
+ TQVBoxLayout *vb = new TQVBoxLayout( mainWin );
+ TQHBoxLayout *hb = new TQHBoxLayout;
+ TQHBoxLayout *hbd = new TQHBoxLayout;
+ vb->addLayout( hb );
+
+ TQFont labelFont( "helvetica", 24 );
+ TQColorGroup grp( darkGreen, black, TQColor( 128, 128, 128 ),
+ TQColor( 64, 64, 64 ), black, darkGreen, black );
+ TQPalette pal( grp, grp, grp );
+
+ mainWin->setPalette( pal );
+
+ hb->addSpacing( 10 );
+
+ TQLabel *label;
+ label = new TQLabel( tr("Score"), mainWin );
+ label->setFont( labelFont );
+ label->setPalette( pal );
+ label->setFixedWidth( label->sizeHint().width() );
+ hb->addWidget( label );
+
+ scoreLCD = new TQLCDNumber( 6, mainWin );
+ scoreLCD->setFrameStyle( TQFrame::NoFrame );
+ scoreLCD->setSegmentStyle( TQLCDNumber::Flat );
+ scoreLCD->setFixedWidth( 150 );
+ scoreLCD->setPalette( pal );
+ hb->addWidget( scoreLCD );
+ hb->addStretch( 10 );
+
+ label = new TQLabel( tr("Level"), mainWin );
+ label->setFont( labelFont );
+ label->setPalette( pal );
+ label->setFixedWidth( label->sizeHint().width() );
+ hb->addWidget( label );
+
+ levelLCD = new TQLCDNumber( 2, mainWin );
+ levelLCD->setFrameStyle( TQFrame::NoFrame );
+ levelLCD->setSegmentStyle( TQLCDNumber::Flat );
+ levelLCD->setFixedWidth( 70 );
+ levelLCD->setPalette( pal );
+ hb->addWidget( levelLCD );
+ hb->addStretch( 10 );
+
+ label = new TQLabel( tr("Ships"), mainWin );
+ label->setFont( labelFont );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hb->addWidget( label );
+
+ shipsLCD = new TQLCDNumber( 1, mainWin );
+ shipsLCD->setFrameStyle( TQFrame::NoFrame );
+ shipsLCD->setSegmentStyle( TQLCDNumber::Flat );
+ shipsLCD->setFixedWidth( 40 );
+ shipsLCD->setPalette( pal );
+ hb->addWidget( shipsLCD );
+
+ hb->addStrut( 30 );
+
+ vb->addWidget( view, 10 );
+
+// -- bottom layout:
+ vb->addLayout( hbd );
+
+ TQFont smallFont( "helvetica", 14 );
+ hbd->addSpacing( 10 );
+
+ TQString sprites_prefix = "qasteroids/sprites/";
+/*
+ label = new TQLabel( tr( "T" ), mainWin );
+ label->setFont( smallFont );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ teleportsLCD = new TQLCDNumber( 1, mainWin );
+ teleportsLCD->setFrameStyle( TQFrame::NoFrame );
+ teleportsLCD->setSegmentStyle( TQLCDNumber::Flat );
+ teleportsLCD->setPalette( pal );
+ teleportsLCD->setFixedHeight( 20 );
+ hbd->addWidget( teleportsLCD );
+
+ hbd->addSpacing( 10 );
+*/
+ TQPixmap pm( sprites_prefix + "powerups/brake.png" );
+ label = new TQLabel( mainWin );
+ label->setPixmap( pm );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ brakesLCD = new TQLCDNumber( 1, mainWin );
+ brakesLCD->setFrameStyle( TQFrame::NoFrame );
+ brakesLCD->setSegmentStyle( TQLCDNumber::Flat );
+ brakesLCD->setPalette( pal );
+ brakesLCD->setFixedHeight( 20 );
+ hbd->addWidget( brakesLCD );
+
+ hbd->addSpacing( 10 );
+
+ pm.load( sprites_prefix + "powerups/shield.png" );
+ label = new TQLabel( mainWin );
+ label->setPixmap( pm );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ shieldLCD = new TQLCDNumber( 1, mainWin );
+ shieldLCD->setFrameStyle( TQFrame::NoFrame );
+ shieldLCD->setSegmentStyle( TQLCDNumber::Flat );
+ shieldLCD->setPalette( pal );
+ shieldLCD->setFixedHeight( 20 );
+ hbd->addWidget( shieldLCD );
+
+ hbd->addSpacing( 10 );
+
+ pm.load( sprites_prefix + "powerups/shoot.png" );
+ label = new TQLabel( mainWin );
+ label->setPixmap( pm );
+ label->setFixedWidth( label->sizeHint().width() );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ shootLCD = new TQLCDNumber( 1, mainWin );
+ shootLCD->setFrameStyle( TQFrame::NoFrame );
+ shootLCD->setSegmentStyle( TQLCDNumber::Flat );
+ shootLCD->setPalette( pal );
+ shootLCD->setFixedHeight( 20 );
+ hbd->addWidget( shootLCD );
+
+ hbd->addStretch( 1 );
+
+ label = new TQLabel( tr( "Fuel" ), mainWin );
+ label->setFont( smallFont );
+ label->setFixedWidth( label->sizeHint().width() + 10 );
+ label->setPalette( pal );
+ hbd->addWidget( label );
+
+ powerMeter = new KALedMeter( mainWin );
+ powerMeter->setFrameStyle( TQFrame::Box | TQFrame::Plain );
+ powerMeter->setRange( MAX_POWER_LEVEL );
+ powerMeter->addColorRange( 10, darkRed );
+ powerMeter->addColorRange( 20, TQColor(160, 96, 0) );
+ powerMeter->addColorRange( 70, darkGreen );
+ powerMeter->setCount( 40 );
+ powerMeter->setPalette( pal );
+ powerMeter->setFixedSize( 200, 12 );
+ hbd->addWidget( powerMeter );
+
+ shipsRemain = 3;
+ showHiscores = FALSE;
+
+ actions.insert( TQt::Key_Up, Thrust );
+ actions.insert( TQt::Key_Left, RotateLeft );
+ actions.insert( TQt::Key_Right, RotateRight );
+ actions.insert( TQt::Key_Space, Shoot );
+ actions.insert( TQt::Key_Z, Teleport );
+ actions.insert( TQt::Key_X, Brake );
+ actions.insert( TQt::Key_S, Shield );
+ actions.insert( TQt::Key_P, Pause );
+ actions.insert( TQt::Key_L, Launch );
+ actions.insert( TQt::Key_N, NewGame );
+
+ view->showText( tr( "Press N to start playing" ), yellow );
+}
+
+KAstTopLevel::~KAstTopLevel()
+{
+}
+
+void KAstTopLevel::playSound( const char * )
+{
+}
+
+void KAstTopLevel::keyPressEvent( TQKeyEvent *event )
+{
+ if ( event->isAutoRepeat() || !actions.contains( event->key() ) )
+ {
+ event->ignore();
+ return;
+ }
+
+ Action a = actions[ event->key() ];
+
+ switch ( a )
+ {
+ case RotateLeft:
+ view->rotateLeft( TRUE );
+ break;
+
+ case RotateRight:
+ view->rotateRight( TRUE );
+ break;
+
+ case Thrust:
+ view->thrust( TRUE );
+ break;
+
+ case Shoot:
+ view->shoot( TRUE );
+ break;
+
+ case Shield:
+ view->setShield( TRUE );
+ break;
+
+ case Teleport:
+ view->teleport( TRUE );
+ break;
+
+ case Brake:
+ view->brake( TRUE );
+ break;
+
+ default:
+ event->ignore();
+ return;
+ }
+ event->accept();
+}
+
+void KAstTopLevel::keyReleaseEvent( TQKeyEvent *event )
+{
+ if ( event->isAutoRepeat() || !actions.contains( event->key() ) )
+ {
+ event->ignore();
+ return;
+ }
+
+ Action a = actions[ event->key() ];
+
+ switch ( a )
+ {
+ case RotateLeft:
+ view->rotateLeft( FALSE );
+ break;
+
+ case RotateRight:
+ view->rotateRight( FALSE );
+ break;
+
+ case Thrust:
+ view->thrust( FALSE );
+ break;
+
+ case Shoot:
+ view->shoot( FALSE );
+ break;
+
+ case Brake:
+ view->brake( FALSE );
+ break;
+
+ case Shield:
+ view->setShield( FALSE );
+ break;
+
+ case Teleport:
+ view->teleport( FALSE );
+ break;
+
+ case Launch:
+ if ( waitShip )
+ {
+ view->newShip();
+ waitShip = FALSE;
+ view->hideText();
+ }
+ else
+ {
+ event->ignore();
+ return;
+ }
+ break;
+
+ case NewGame:
+ slotNewGame();
+ break;
+/*
+ case Pause:
+ {
+ view->pause( TRUE );
+ TQMessageBox::information( this,
+ tr("KAsteroids is paused"),
+ tr("Paused") );
+ view->pause( FALSE );
+ }
+ break;
+*/
+ default:
+ event->ignore();
+ return;
+ }
+
+ event->accept();
+}
+
+void KAstTopLevel::showEvent( TQShowEvent *e )
+{
+ TQMainWindow::showEvent( e );
+ view->pause( FALSE );
+ view->setFocus();
+}
+
+void KAstTopLevel::hideEvent( TQHideEvent *e )
+{
+ TQMainWindow::hideEvent( e );
+ view->pause( TRUE );
+}
+
+void KAstTopLevel::slotNewGame()
+{
+ score = 0;
+ shipsRemain = SB_SHIPS;
+ scoreLCD->display( 0 );
+ level = 0;
+ levelLCD->display( level+1 );
+ shipsLCD->display( shipsRemain-1 );
+ view->newGame();
+ view->setRockSpeed( levels[0].rockSpeed );
+ view->addRocks( levels[0].nrocks );
+// view->showText( tr( "Press L to launch." ), yellow );
+ view->newShip();
+ waitShip = FALSE;
+ view->hideText();
+ isPaused = FALSE;
+}
+
+void KAstTopLevel::slotShipKilled()
+{
+ shipsRemain--;
+ shipsLCD->display( shipsRemain-1 );
+
+ playSound( "ShipDestroyed" );
+
+ if ( shipsRemain )
+ {
+ waitShip = TRUE;
+ view->showText( tr( "Ship Destroyed. Press L to launch."), yellow );
+ }
+ else
+ {
+ view->showText( tr("Game Over!"), red );
+ view->endGame();
+ doStats();
+// highscore->addEntry( score, level, showHiscores );
+ }
+}
+
+void KAstTopLevel::slotRockHit( int size )
+{
+ switch ( size )
+ {
+ case 0:
+ score += 10;
+ break;
+
+ case 1:
+ score += 20;
+ break;
+
+ default:
+ score += 40;
+ }
+
+ playSound( "RockDestroyed" );
+
+ scoreLCD->display( score );
+}
+
+void KAstTopLevel::slotRocksRemoved()
+{
+ level++;
+
+ if ( level >= MAX_LEVELS )
+ level = MAX_LEVELS - 1;
+
+ view->setRockSpeed( levels[level-1].rockSpeed );
+ view->addRocks( levels[level-1].nrocks );
+
+ levelLCD->display( level+1 );
+}
+
+void KAstTopLevel::doStats()
+{
+ TQString r( "0.00" );
+ if ( view->shots() )
+ r = TQString::number( (double)view->hits() / view->shots() * 100.0,
+ 'g', 2 );
+
+/* multi-line text broken in TQt 3
+ TQString s = tr( "Game Over\n\nShots fired:\t%1\n Hit:\t%2\n Missed:\t%3\nHit ratio:\t%4 %\n\nPress N for a new game" )
+ .arg(view->shots()).arg(view->hits())
+ .arg(view->shots() - view->hits())
+ .arg(r);
+*/
+
+ view->showText( "Game Over. Press N for a new game.", yellow, FALSE );
+}
+
+void KAstTopLevel::slotUpdateVitals()
+{
+ brakesLCD->display( view->brakeCount() );
+ shieldLCD->display( view->shieldCount() );
+ shootLCD->display( view->shootCount() );
+// teleportsLCD->display( view->teleportCount() );
+ powerMeter->setValue( view->power() );
+}
diff --git a/examples/demo/qasteroids/toplevel.h b/examples/demo/qasteroids/toplevel.h
new file mode 100644
index 000000000..158363b08
--- /dev/null
+++ b/examples/demo/qasteroids/toplevel.h
@@ -0,0 +1,79 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __KAST_TOPLEVEL_H__
+#define __KAST_TOPLEVEL_H__
+
+#include <qmainwindow.h>
+#include <qdict.h>
+#include <qmap.h>
+
+#include "view.h"
+
+
+class KALedMeter;
+class TQLCDNumber;
+
+class KAstTopLevel : public TQMainWindow
+{
+ Q_OBJECT
+public:
+ KAstTopLevel( TQWidget *parent=0, const char *name=0 );
+ virtual ~KAstTopLevel();
+
+private:
+ void playSound( const char *snd );
+ void readSoundMapping();
+ void doStats();
+
+protected:
+ virtual void showEvent( TQShowEvent * );
+ virtual void hideEvent( TQHideEvent * );
+ virtual void keyPressEvent( TQKeyEvent *event );
+ virtual void keyReleaseEvent( TQKeyEvent *event );
+
+private slots:
+ void slotNewGame();
+
+ void slotShipKilled();
+ void slotRockHit( int size );
+ void slotRocksRemoved();
+
+ void slotUpdateVitals();
+
+private:
+ KAsteroidsView *view;
+ TQLCDNumber *scoreLCD;
+ TQLCDNumber *levelLCD;
+ TQLCDNumber *shipsLCD;
+
+ TQLCDNumber *teleportsLCD;
+// TQLCDNumber *bombsLCD;
+ TQLCDNumber *brakesLCD;
+ TQLCDNumber *shieldLCD;
+ TQLCDNumber *shootLCD;
+ KALedMeter *powerMeter;
+
+ bool sound;
+ TQDict<TQString> soundDict;
+
+ // waiting for user to press Enter to launch a ship
+ bool waitShip;
+ bool isPaused;
+
+ int shipsRemain;
+ int score;
+ int level;
+ bool showHiscores;
+
+ enum Action { Launch, Thrust, RotateLeft, RotateRight, Shoot, Teleport,
+ Brake, Shield, Pause, NewGame };
+
+ TQMap<int,Action> actions;
+};
+
+#endif
+
diff --git a/examples/demo/qasteroids/view.cpp b/examples/demo/qasteroids/view.cpp
new file mode 100644
index 000000000..99acca1ff
--- /dev/null
+++ b/examples/demo/qasteroids/view.cpp
@@ -0,0 +1,908 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#include <stdlib.h>
+#include <math.h>
+#include <qapplication.h>
+#include <qkeycode.h>
+#include <qaccel.h>
+#include <qmessagebox.h>
+
+#include "view.h"
+
+#define IMG_BACKGROUND "qasteroids/bg.png"
+
+#define REFRESH_DELAY 33
+#define SHIP_SPEED 0.3
+#define MISSILE_SPEED 10.0
+#define SHIP_STEPS 64
+#define ROTATE_RATE 2
+#define SHIELD_ON_COST 1
+#define SHIELD_HIT_COST 30
+#define BRAKE_ON_COST 4
+
+#define MAX_ROCK_SPEED 2.5
+#define MAX_POWERUP_SPEED 1.5
+#define MAX_SHIP_SPEED 12
+#define MAX_BRAKES 5
+#define MAX_SHIELDS 5
+#define MAX_FIREPOWER 5
+
+#define TEXT_SPEED 4
+
+#define PI_X_2 6.283185307
+#ifndef M_PI
+#define M_PI 3.141592654
+#endif
+
+static struct
+{
+ int id;
+ const char *path;
+ int frames;
+}
+kas_animations [] =
+{
+ { ID_ROCK_LARGE, "rock1/rock1%1.png", 32 },
+ { ID_ROCK_MEDIUM, "rock2/rock2%1.png", 32 },
+ { ID_ROCK_SMALL, "rock3/rock3%1.png", 32 },
+ { ID_SHIP, "ship/ship%1.png", 32 },
+ { ID_MISSILE, "missile/missile.png", 1 },
+ { ID_BIT, "bits/bits%1.png", 16 },
+ { ID_EXHAUST, "exhaust/exhaust.png", 1 },
+ { ID_ENERGY_POWERUP, "powerups/energy.png", 1 },
+// { ID_TELEPORT_POWERUP, "powerups/teleport%1.png", 12 },
+ { ID_BRAKE_POWERUP, "powerups/brake.png", 1 },
+ { ID_SHIELD_POWERUP, "powerups/shield.png", 1 },
+ { ID_SHOOT_POWERUP, "powerups/shoot.png", 1 },
+ { ID_SHIELD, "shield/shield%1.png", 6 },
+ { 0, 0, 0 }
+};
+
+
+
+KAsteroidsView::KAsteroidsView( TQWidget *parent, const char *name )
+ : TQWidget( parent, name ),
+ field(640, 440),
+ view(&field,this)
+{
+ view.setVScrollBarMode( TQScrollView::AlwaysOff );
+ view.setHScrollBarMode( TQScrollView::AlwaysOff );
+ view.viewport()->setFocusProxy( this );
+ rocks.setAutoDelete( TRUE );
+ missiles.setAutoDelete( TRUE );
+ bits.setAutoDelete( TRUE );
+ powerups.setAutoDelete( TRUE );
+ exhaust.setAutoDelete( TRUE );
+
+ field.setBackgroundColor( black );
+ TQPixmap pm( IMG_BACKGROUND );
+ field.setBackgroundPixmap( pm );
+
+ textSprite = new TQCanvasText( &field );
+ TQFont font( "helvetica", 18 );
+ textSprite->setFont( font );
+
+ shield = 0;
+ shieldOn = FALSE;
+ refreshRate = REFRESH_DELAY;
+
+ initialized = readSprites();
+
+ shieldTimer = new TQTimer( this );
+ connect( shieldTimer, SIGNAL(timeout()), this, SLOT(hideShield()) );
+ mTimerId = -1;
+
+ shipPower = MAX_POWER_LEVEL;
+ vitalsChanged = TRUE;
+ can_destroy_powerups = FALSE;
+
+ mPaused = TRUE;
+
+ if ( !initialized ) {
+ textSprite->setText( tr("Error: Cannot read sprite images") );
+ textSprite->setColor( red );
+ textSprite->move( (field.width()-textSprite->boundingRect().width()) / 2,
+ (field.height()-textSprite->boundingRect().height()) / 2 );
+ textSprite->show();
+ }
+}
+
+// - - -
+
+KAsteroidsView::~KAsteroidsView()
+{
+}
+
+// - - -
+
+void KAsteroidsView::reset()
+{
+ if ( !initialized )
+ return;
+ rocks.clear();
+ missiles.clear();
+ bits.clear();
+ powerups.clear();
+ exhaust.clear();
+
+ shotsFired = 0;
+ shotsHit = 0;
+
+ rockSpeed = 1.0;
+ powerupSpeed = 1.0;
+ mFrameNum = 0;
+ mPaused = FALSE;
+
+ ship->hide();
+ shield->hide();
+/*
+ if ( mTimerId >= 0 ) {
+ killTimer( mTimerId );
+ mTimerId = -1;
+ }
+*/
+}
+
+// - --
+
+void KAsteroidsView::newGame()
+{
+ if ( !initialized )
+ return;
+ if ( shieldOn )
+ {
+ shield->hide();
+ shieldOn = FALSE;
+ }
+ reset();
+ if ( mTimerId < 0 )
+ mTimerId = startTimer( REFRESH_DELAY );
+ emit updateVitals();
+}
+
+// - - -
+
+void KAsteroidsView::endGame()
+{
+}
+
+void KAsteroidsView::pause( bool p )
+{
+ if ( !initialized )
+ return;
+ if ( !mPaused && p ) {
+ if ( mTimerId >= 0 ) {
+ killTimer( mTimerId );
+ mTimerId = -1;
+ }
+ } else if ( mPaused && !p )
+ mTimerId = startTimer( REFRESH_DELAY );
+ mPaused = p;
+}
+
+// - - -
+
+void KAsteroidsView::newShip()
+{
+ if ( !initialized )
+ return;
+ ship->move( width()/2, height()/2, 0 );
+ shield->move( width()/2, height()/2, 0 );
+ ship->setVelocity( 0.0, 0.0 );
+ shipDx = 0;
+ shipDy = 0;
+ shipAngle = 0;
+ rotateL = FALSE;
+ rotateR = FALSE;
+ thrustShip = FALSE;
+ shootShip = FALSE;
+ brakeShip = FALSE;
+ teleportShip = FALSE;
+ shieldOn = TRUE;
+ shootDelay = 0;
+ shipPower = MAX_POWER_LEVEL;
+ rotateRate = ROTATE_RATE;
+ rotateSlow = 0;
+
+ mBrakeCount = 0;
+ mTeleportCount = 0;
+ mShootCount = 0;
+
+ ship->show();
+ shield->show();
+ mShieldCount = 1; // just in case the ship appears on a rock.
+ shieldTimer->start( 1000, TRUE );
+}
+
+void KAsteroidsView::setShield( bool s )
+{
+ if ( !initialized )
+ return;
+ if ( shieldTimer->isActive() && !s ) {
+ shieldTimer->stop();
+ hideShield();
+ } else {
+ shieldOn = s && mShieldCount;
+ }
+}
+
+void KAsteroidsView::brake( bool b )
+{
+ if ( !initialized )
+ return;
+ if ( mBrakeCount )
+ {
+ if ( brakeShip && !b )
+ {
+ rotateL = FALSE;
+ rotateR = FALSE;
+ thrustShip = FALSE;
+ rotateRate = ROTATE_RATE;
+ }
+
+ brakeShip = b;
+ }
+}
+
+// - - -
+
+bool KAsteroidsView::readSprites()
+{
+ TQString sprites_prefix = "qasteroids/sprites/";
+
+ int i = 0;
+ while ( kas_animations[i].id )
+ {
+ TQCanvasPixmapArray *anim =
+ new TQCanvasPixmapArray( sprites_prefix + kas_animations[i].path,
+ kas_animations[i].frames );
+ if ( !anim->isValid() )
+ return FALSE;
+ animation.insert( kas_animations[i].id, anim );
+ i++;
+ }
+
+ ship = new TQCanvasSprite( animation[ID_SHIP], &field );
+ ship->hide();
+
+ shield = new KShield( animation[ID_SHIELD], &field );
+ shield->hide();
+
+ return (ship->image(0) && shield->image(0));
+}
+
+// - - -
+
+void KAsteroidsView::addRocks( int num )
+{
+ if ( !initialized )
+ return;
+ for ( int i = 0; i < num; i++ )
+ {
+ KRock *rock = new KRock( animation[ID_ROCK_LARGE], &field,
+ ID_ROCK_LARGE, randInt(2), randInt(2) ? -1 : 1 );
+ double dx = (2.0 - randDouble()*4.0) * rockSpeed;
+ double dy = (2.0 - randDouble()*4.0) * rockSpeed;
+ rock->setVelocity( dx, dy );
+ rock->setFrame( randInt( rock->frameCount() ) );
+ if ( dx > 0 )
+ {
+ if ( dy > 0 )
+ rock->move( 5, 5, 0 );
+ else
+ rock->move( 5, field.height() - 25, 0 );
+ }
+ else
+ {
+ if ( dy > 0 )
+ rock->move( field.width() - 25, 5, 0 );
+ else
+ rock->move( field.width() - 25, field.height() - 25, 0 );
+ }
+ rock->show( );
+ rocks.append( rock );
+ }
+}
+
+// - - -
+
+void KAsteroidsView::showText( const TQString &text, const TQColor &color, bool scroll )
+{
+ if ( !initialized )
+ return;
+ textSprite->setText( text );
+ textSprite->setColor( color );
+
+ if ( scroll ) {
+ textSprite->move( (field.width()-textSprite->boundingRect().width()) / 2,
+ -textSprite->boundingRect().height() );
+ textDy = TEXT_SPEED;
+ } else {
+ textSprite->move( (field.width()-textSprite->boundingRect().width()) / 2,
+ (field.height()-textSprite->boundingRect().height()) / 2 );
+ textDy = 0;
+ }
+ textSprite->show();
+}
+
+// - - -
+
+void KAsteroidsView::hideText()
+{
+ textDy = -TEXT_SPEED;
+}
+
+// - - -
+
+void KAsteroidsView::resizeEvent(TQResizeEvent* event)
+{
+ TQWidget::resizeEvent(event);
+ field.resize(width()-4, height()-4);
+ view.resize(width(),height());
+}
+
+// - - -
+
+void KAsteroidsView::timerEvent( TQTimerEvent * )
+{
+ field.advance();
+
+ TQCanvasSprite *rock;
+
+ // move rocks forward
+ for ( rock = rocks.first(); rock; rock = rocks.next() ) {
+ ((KRock *)rock)->nextFrame();
+ wrapSprite( rock );
+ }
+
+ wrapSprite( ship );
+
+ // check for missile collision with rocks.
+ processMissiles();
+
+ // these are generated when a ship explodes
+ for ( KBit *bit = bits.first(); bit; bit = bits.next() )
+ {
+ if ( bit->expired() )
+ {
+ bits.removeRef( bit );
+ }
+ else
+ {
+ bit->growOlder();
+ bit->setFrame( ( bit->frame()+1 ) % bit->frameCount() );
+ }
+ }
+
+ for ( KExhaust *e = exhaust.first(); e; e = exhaust.next() )
+ exhaust.removeRef( e );
+
+ // move / rotate ship.
+ // check for collision with a rock.
+ processShip();
+
+ // move powerups and check for collision with player and missiles
+ processPowerups();
+
+ if ( textSprite->isVisible() )
+ {
+ if ( textDy < 0 &&
+ textSprite->boundingRect().y() <= -textSprite->boundingRect().height() ) {
+ textSprite->hide();
+ } else {
+ textSprite->moveBy( 0, textDy );
+ }
+ if ( textSprite->boundingRect().y() > (field.height()-textSprite->boundingRect().height())/2 )
+ textDy = 0;
+ }
+
+ if ( vitalsChanged && !(mFrameNum % 10) ) {
+ emit updateVitals();
+ vitalsChanged = FALSE;
+ }
+
+ mFrameNum++;
+}
+
+void KAsteroidsView::wrapSprite( TQCanvasItem *s )
+{
+ int x = int(s->x() + s->boundingRect().width() / 2);
+ int y = int(s->y() + s->boundingRect().height() / 2);
+
+ if ( x > field.width() )
+ s->move( s->x() - field.width(), s->y() );
+ else if ( x < 0 )
+ s->move( field.width() + s->x(), s->y() );
+
+ if ( y > field.height() )
+ s->move( s->x(), s->y() - field.height() );
+ else if ( y < 0 )
+ s->move( s->x(), field.height() + s->y() );
+}
+
+// - - -
+
+void KAsteroidsView::rockHit( TQCanvasItem *hit )
+{
+ KPowerup *nPup = 0;
+ int rnd = int(randDouble()*30.0) % 30;
+ switch( rnd )
+ {
+ case 4:
+ case 5:
+ nPup = new KPowerup( animation[ID_ENERGY_POWERUP], &field,
+ ID_ENERGY_POWERUP );
+ break;
+ case 10:
+// nPup = new KPowerup( animation[ID_TELEPORT_POWERUP], &field,
+// ID_TELEPORT_POWERUP );
+ break;
+ case 15:
+ nPup = new KPowerup( animation[ID_BRAKE_POWERUP], &field,
+ ID_BRAKE_POWERUP );
+ break;
+ case 20:
+ nPup = new KPowerup( animation[ID_SHIELD_POWERUP], &field,
+ ID_SHIELD_POWERUP );
+ break;
+ case 24:
+ case 25:
+ nPup = new KPowerup( animation[ID_SHOOT_POWERUP], &field,
+ ID_SHOOT_POWERUP );
+ break;
+ }
+ if ( nPup )
+ {
+ double r = 0.5 - randDouble();
+ nPup->move( hit->x(), hit->y(), 0 );
+ nPup->setVelocity( hit->xVelocity() + r, hit->yVelocity() + r );
+ nPup->show( );
+ powerups.append( nPup );
+ }
+
+ if ( hit->rtti() == ID_ROCK_LARGE || hit->rtti() == ID_ROCK_MEDIUM )
+ {
+ // break into smaller rocks
+ double addx[4] = { 1.0, 1.0, -1.0, -1.0 };
+ double addy[4] = { -1.0, 1.0, -1.0, 1.0 };
+
+ double dx = hit->xVelocity();
+ double dy = hit->yVelocity();
+
+ double maxRockSpeed = MAX_ROCK_SPEED * rockSpeed;
+ if ( dx > maxRockSpeed )
+ dx = maxRockSpeed;
+ else if ( dx < -maxRockSpeed )
+ dx = -maxRockSpeed;
+ if ( dy > maxRockSpeed )
+ dy = maxRockSpeed;
+ else if ( dy < -maxRockSpeed )
+ dy = -maxRockSpeed;
+
+ TQCanvasSprite *nrock;
+
+ for ( int i = 0; i < 4; i++ )
+ {
+ double r = rockSpeed/2 - randDouble()*rockSpeed;
+ if ( hit->rtti() == ID_ROCK_LARGE )
+ {
+ nrock = new KRock( animation[ID_ROCK_MEDIUM], &field,
+ ID_ROCK_MEDIUM, randInt(2), randInt(2) ? -1 : 1 );
+ emit rockHit( 0 );
+ }
+ else
+ {
+ nrock = new KRock( animation[ID_ROCK_SMALL], &field,
+ ID_ROCK_SMALL, randInt(2), randInt(2) ? -1 : 1 );
+ emit rockHit( 1 );
+ }
+
+ nrock->move( hit->x(), hit->y(), 0 );
+ nrock->setVelocity( dx+addx[i]*rockSpeed+r, dy+addy[i]*rockSpeed+r );
+ nrock->setFrame( randInt( nrock->frameCount() ) );
+ nrock->show( );
+ rocks.append( nrock );
+ }
+ }
+ else if ( hit->rtti() == ID_ROCK_SMALL )
+ emit rockHit( 2 );
+ rocks.removeRef( (TQCanvasSprite *)hit );
+ if ( rocks.count() == 0 )
+ emit rocksRemoved();
+}
+
+void KAsteroidsView::reducePower( int val )
+{
+ shipPower -= val;
+ if ( shipPower <= 0 )
+ {
+ shipPower = 0;
+ thrustShip = FALSE;
+ if ( shieldOn )
+ {
+ shieldOn = FALSE;
+ shield->hide();
+ }
+ }
+ vitalsChanged = TRUE;
+}
+
+void KAsteroidsView::addExhaust( double x, double y, double dx,
+ double dy, int count )
+{
+ for ( int i = 0; i < count; i++ )
+ {
+ KExhaust *e = new KExhaust( animation[ID_EXHAUST], &field );
+ e->move( x + 2 - randDouble()*4, y + 2 - randDouble()*4 );
+ e->setVelocity( dx, dy );
+ e->show( );
+ exhaust.append( e );
+ }
+}
+
+void KAsteroidsView::processMissiles()
+{
+ KMissile *missile;
+
+ // if a missile has hit a rock, remove missile and break rock into smaller
+ // rocks or remove completely.
+ TQPtrListIterator<KMissile> it(missiles);
+
+ for ( ; it.current(); ++it )
+ {
+ missile = it.current();
+ missile->growOlder();
+
+ if ( missile->expired() )
+ {
+ missiles.removeRef( missile );
+ continue;
+ }
+
+ wrapSprite( missile );
+
+ TQCanvasItemList hits = missile->collisions( TRUE );
+ TQCanvasItemList::Iterator hit;
+ for ( hit = hits.begin(); hit != hits.end(); ++hit )
+ {
+ if ( (*hit)->rtti() >= ID_ROCK_LARGE &&
+ (*hit)->rtti() <= ID_ROCK_SMALL )
+ {
+ shotsHit++;
+ rockHit( *hit );
+ missiles.removeRef( missile );
+ break;
+ }
+ }
+ }
+}
+
+// - - -
+
+void KAsteroidsView::processShip()
+{
+ if ( ship->isVisible() )
+ {
+ if ( shieldOn )
+ {
+ shield->show();
+ reducePower( SHIELD_ON_COST );
+ static int sf = 0;
+ sf++;
+
+ if ( sf % 2 )
+ shield->setFrame( (shield->frame()+1) % shield->frameCount() );
+ shield->move( ship->x() - 9, ship->y() - 9 );
+
+ TQCanvasItemList hits = shield->collisions( TRUE );
+ TQCanvasItemList::Iterator it;
+ for ( it = hits.begin(); it != hits.end(); ++it )
+ {
+ if ( (*it)->rtti() >= ID_ROCK_LARGE &&
+ (*it)->rtti() <= ID_ROCK_SMALL )
+ {
+ int factor;
+ switch ( (*it)->rtti() )
+ {
+ case ID_ROCK_LARGE:
+ factor = 3;
+ break;
+
+ case ID_ROCK_MEDIUM:
+ factor = 2;
+ break;
+
+ default:
+ factor = 1;
+ }
+
+ if ( factor > mShieldCount )
+ {
+ // shield not strong enough
+ shieldOn = FALSE;
+ break;
+ }
+ rockHit( *it );
+ // the more shields we have the less costly
+ reducePower( factor * (SHIELD_HIT_COST - mShieldCount*2) );
+ }
+ }
+ }
+
+ if ( !shieldOn )
+ {
+ shield->hide();
+ TQCanvasItemList hits = ship->collisions( TRUE );
+ TQCanvasItemList::Iterator it;
+ for ( it = hits.begin(); it != hits.end(); ++it )
+ {
+ if ( (*it)->rtti() >= ID_ROCK_LARGE &&
+ (*it)->rtti() <= ID_ROCK_SMALL )
+ {
+ KBit *bit;
+ for ( int i = 0; i < 12; i++ )
+ {
+ bit = new KBit( animation[ID_BIT], &field );
+ bit->move( ship->x() + 5 - randDouble() * 10,
+ ship->y() + 5 - randDouble() * 10,
+ randInt(bit->frameCount()) );
+ bit->setVelocity( 1-randDouble()*2,
+ 1-randDouble()*2 );
+ bit->setDeath( 60 + randInt(60) );
+ bit->show( );
+ bits.append( bit );
+ }
+ ship->hide();
+ shield->hide();
+ emit shipKilled();
+ break;
+ }
+ }
+ }
+
+
+ if ( rotateSlow )
+ rotateSlow--;
+
+ if ( rotateL )
+ {
+ shipAngle -= rotateSlow ? 1 : rotateRate;
+ if ( shipAngle < 0 )
+ shipAngle += SHIP_STEPS;
+ }
+
+ if ( rotateR )
+ {
+ shipAngle += rotateSlow ? 1 : rotateRate;
+ if ( shipAngle >= SHIP_STEPS )
+ shipAngle -= SHIP_STEPS;
+ }
+
+ double angle = shipAngle * PI_X_2 / SHIP_STEPS;
+ double cosangle = cos( angle );
+ double sinangle = sin( angle );
+
+ if ( brakeShip )
+ {
+ thrustShip = FALSE;
+ rotateL = FALSE;
+ rotateR = FALSE;
+ rotateRate = ROTATE_RATE;
+ if ( fabs(shipDx) < 2.5 && fabs(shipDy) < 2.5 )
+ {
+ shipDx = 0.0;
+ shipDy = 0.0;
+ ship->setVelocity( shipDx, shipDy );
+ brakeShip = FALSE;
+ }
+ else
+ {
+ double motionAngle = atan2( -shipDy, -shipDx );
+ if ( angle > M_PI )
+ angle -= PI_X_2;
+ double angleDiff = angle - motionAngle;
+ if ( angleDiff > M_PI )
+ angleDiff = PI_X_2 - angleDiff;
+ else if ( angleDiff < -M_PI )
+ angleDiff = PI_X_2 + angleDiff;
+ double fdiff = fabs( angleDiff );
+ if ( fdiff > 0.08 )
+ {
+ if ( angleDiff > 0 )
+ rotateL = TRUE;
+ else if ( angleDiff < 0 )
+ rotateR = TRUE;
+ if ( fdiff > 0.6 )
+ rotateRate = mBrakeCount + 1;
+ else if ( fdiff > 0.4 )
+ rotateRate = 2;
+ else
+ rotateRate = 1;
+
+ if ( rotateRate > 5 )
+ rotateRate = 5;
+ }
+ else if ( fabs(shipDx) > 1 || fabs(shipDy) > 1 )
+ {
+ thrustShip = TRUE;
+ // we'll make braking a bit faster
+ shipDx += cosangle/6 * (mBrakeCount - 1);
+ shipDy += sinangle/6 * (mBrakeCount - 1);
+ reducePower( BRAKE_ON_COST );
+ addExhaust( ship->x() + 20 - cosangle*22,
+ ship->y() + 20 - sinangle*22,
+ shipDx-cosangle, shipDy-sinangle,
+ mBrakeCount+1 );
+ }
+ }
+ }
+
+ if ( thrustShip )
+ {
+ // The ship has a terminal velocity, but trying to go faster
+ // still uses fuel (can go faster diagonally - don't care).
+ double thrustx = cosangle/4;
+ double thrusty = sinangle/4;
+ if ( fabs(shipDx + thrustx) < MAX_SHIP_SPEED )
+ shipDx += thrustx;
+ if ( fabs(shipDy + thrusty) < MAX_SHIP_SPEED )
+ shipDy += thrusty;
+ ship->setVelocity( shipDx, shipDy );
+ reducePower( 1 );
+ addExhaust( ship->x() + 20 - cosangle*20,
+ ship->y() + 20 - sinangle*20,
+ shipDx-cosangle, shipDy-sinangle, 3 );
+ }
+
+ ship->setFrame( shipAngle >> 1 );
+
+ if ( shootShip )
+ {
+ if ( !shootDelay && (int)missiles.count() < mShootCount + 2 )
+ {
+ KMissile *missile = new KMissile( animation[ID_MISSILE], &field );
+ missile->move( 21+ship->x()+cosangle*21,
+ 21+ship->y()+sinangle*21, 0 );
+ missile->setVelocity( shipDx + cosangle*MISSILE_SPEED,
+ shipDy + sinangle*MISSILE_SPEED );
+ missile->show( );
+ missiles.append( missile );
+ shotsFired++;
+ reducePower( 1 );
+
+ shootDelay = 5;
+ }
+
+ if ( shootDelay )
+ shootDelay--;
+ }
+
+ if ( teleportShip )
+ {
+ int ra = rand() % 10;
+ if( ra == 0 )
+ ra += rand() % 20;
+ int xra = ra * 60 + ( (rand() % 20) * (rand() % 20) );
+ int yra = ra * 50 - ( (rand() % 20) * (rand() % 20) );
+ ship->move( xra, yra );
+ }
+
+ vitalsChanged = TRUE;
+ }
+}
+
+// - - -
+
+void KAsteroidsView::processPowerups()
+{
+ if ( !powerups.isEmpty() )
+ {
+ // if player gets the powerup remove it from the screen, if option
+ // "Can destroy powerups" is enabled and a missile hits the powerup
+ // destroy it
+
+ KPowerup *pup;
+ TQPtrListIterator<KPowerup> it( powerups );
+
+ for( ; it.current(); ++it )
+ {
+ pup = it.current();
+ pup->growOlder();
+
+ if( pup->expired() )
+ {
+ powerups.removeRef( pup );
+ continue;
+ }
+
+ wrapSprite( pup );
+
+ TQCanvasItemList hits = pup->collisions( TRUE );
+ TQCanvasItemList::Iterator it;
+ for ( it = hits.begin(); it != hits.end(); ++it )
+ {
+ if ( (*it) == ship )
+ {
+ switch( pup->rtti() )
+ {
+ case ID_ENERGY_POWERUP:
+ shipPower += 150;
+ if ( shipPower > MAX_POWER_LEVEL )
+ shipPower = MAX_POWER_LEVEL;
+ break;
+ case ID_TELEPORT_POWERUP:
+ mTeleportCount++;
+ break;
+ case ID_BRAKE_POWERUP:
+ if ( mBrakeCount < MAX_BRAKES )
+ mBrakeCount++;
+ break;
+ case ID_SHIELD_POWERUP:
+ if ( mShieldCount < MAX_SHIELDS )
+ mShieldCount++;
+ break;
+ case ID_SHOOT_POWERUP:
+ if ( mShootCount < MAX_FIREPOWER )
+ mShootCount++;
+ break;
+ }
+
+ powerups.removeRef( pup );
+ vitalsChanged = TRUE;
+ }
+ else if ( (*it) == shield )
+ {
+ powerups.removeRef( pup );
+ }
+ else if ( (*it)->rtti() == ID_MISSILE )
+ {
+ if ( can_destroy_powerups )
+ {
+ powerups.removeRef( pup );
+ }
+ }
+ }
+ }
+ } // -- if( powerups.isEmpty() )
+}
+
+// - - -
+
+void KAsteroidsView::hideShield()
+{
+ shield->hide();
+ mShieldCount = 0;
+ shieldOn = FALSE;
+}
+
+double KAsteroidsView::randDouble()
+{
+ int v = rand();
+ return (double)v / (double)RAND_MAX;
+}
+
+int KAsteroidsView::randInt( int range )
+{
+ return rand() % range;
+}
+
+void KAsteroidsView::showEvent( TQShowEvent *e )
+{
+#if defined( QT_LICENSE_PROFESSIONAL )
+ static bool wasThere = FALSE;
+
+ if ( !wasThere ) {
+ wasThere = TRUE;
+ TQMessageBox::information( this, tr("TQCanvas demo"),
+ tr("This game has been implemented using the TQCanvas class.\n"
+ "The TQCanvas class is not part of the Professional Edition. Please \n"
+ "contact Trolltech if you want to upgrade to the Enterprise Edition.") );
+ }
+#endif
+
+ TQWidget::showEvent( e );
+}
diff --git a/examples/demo/qasteroids/view.h b/examples/demo/qasteroids/view.h
new file mode 100644
index 000000000..2f2c53b28
--- /dev/null
+++ b/examples/demo/qasteroids/view.h
@@ -0,0 +1,138 @@
+/*
+ * KAsteroids - Copyright (c) Martin R. Jones 1997
+ *
+ * Part of the KDE project
+ */
+
+#ifndef __AST_VIEW_H__
+#define __AST_VIEW_H__
+
+#include <qwidget.h>
+#include <qptrlist.h>
+#include <qintdict.h>
+#include <qtimer.h>
+#include <qcanvas.h>
+#include "sprites.h"
+
+#define MAX_POWER_LEVEL 1000
+
+class KAsteroidsView : public TQWidget
+{
+ Q_OBJECT
+public:
+ KAsteroidsView( TQWidget *parent = 0, const char *name = 0 );
+ virtual ~KAsteroidsView();
+
+ int refreshRate;
+
+ void reset();
+ void setRockSpeed( double rs ) { rockSpeed = rs; }
+ void addRocks( int num );
+ void newGame();
+ void endGame();
+ void newShip();
+
+ void rotateLeft( bool r ) { rotateL = r; rotateSlow = 5; }
+ void rotateRight( bool r ) { rotateR = r; rotateSlow = 5; }
+ void thrust( bool t ) { thrustShip = t && shipPower > 0; }
+ void shoot( bool s ) { shootShip = s; shootDelay = 0; }
+ void setShield( bool s );
+ void teleport( bool te) { teleportShip = te && mTeleportCount; }
+ void brake( bool b );
+ void pause( bool p);
+
+ void showText( const TQString &text, const TQColor &color, bool scroll=TRUE );
+ void hideText();
+
+ int shots() const { return shotsFired; }
+ int hits() const { return shotsHit; }
+ int power() const { return shipPower; }
+
+ int teleportCount() const { return mTeleportCount; }
+ int brakeCount() const { return mBrakeCount; }
+ int shieldCount() const { return mShieldCount; }
+ int shootCount() const { return mShootCount; }
+
+signals:
+ void shipKilled();
+ void rockHit( int size );
+ void rocksRemoved();
+ void updateVitals();
+
+private slots:
+ void hideShield();
+
+protected:
+ bool readSprites();
+ void wrapSprite( TQCanvasItem * );
+ void rockHit( TQCanvasItem * );
+ void reducePower( int val );
+ void addExhaust( double x, double y, double dx, double dy, int count );
+ void processMissiles();
+ void processShip();
+ void processPowerups();
+ void processShield();
+ double randDouble();
+ int randInt( int range );
+
+ virtual void resizeEvent( TQResizeEvent *event );
+ virtual void timerEvent( TQTimerEvent * );
+
+ void showEvent( TQShowEvent * );
+
+private:
+ TQCanvas field;
+ TQCanvasView view;
+ TQIntDict<TQCanvasPixmapArray> animation;
+ TQPtrList<TQCanvasSprite> rocks;
+ TQPtrList<KMissile> missiles;
+ TQPtrList<KBit> bits;
+ TQPtrList<KExhaust> exhaust;
+ TQPtrList<KPowerup> powerups;
+ KShield *shield;
+ TQCanvasSprite *ship;
+ TQCanvasText *textSprite;
+
+ bool rotateL;
+ bool rotateR;
+ bool thrustShip;
+ bool shootShip;
+ bool teleportShip;
+ bool brakeShip;
+ bool pauseShip;
+ bool shieldOn;
+
+ bool vitalsChanged;
+
+ int shipAngle;
+ int rotateSlow;
+ int rotateRate;
+ int shipPower;
+
+ int shotsFired;
+ int shotsHit;
+ int shootDelay;
+
+ int mBrakeCount;
+ int mShieldCount;
+ int mTeleportCount;
+ int mShootCount;
+
+ double shipDx;
+ double shipDy;
+
+ int textDy;
+ int mFrameNum;
+ bool mPaused;
+ int mTimerId;
+
+ double rockSpeed;
+ double powerupSpeed;
+
+ bool can_destroy_powerups;
+
+ TQTimer *shieldTimer;
+ bool initialized;
+};
+
+#endif