summaryrefslogtreecommitdiffstats
path: root/ktux/spriteanim.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitae2a03c2941bf92573f89b88ef73f8aa842bea0a (patch)
tree3566563f3fb6ac3cb3496669d8f233062d3091bc /ktux/spriteanim.h
downloadtdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.tar.gz
tdetoys-ae2a03c2941bf92573f89b88ef73f8aa842bea0a.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdetoys@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'ktux/spriteanim.h')
-rw-r--r--ktux/spriteanim.h96
1 files changed, 96 insertions, 0 deletions
diff --git a/ktux/spriteanim.h b/ktux/spriteanim.h
new file mode 100644
index 0000000..9d5417b
--- /dev/null
+++ b/ktux/spriteanim.h
@@ -0,0 +1,96 @@
+//---------------------------------------------------------------------------
+//
+// spriteanim.h
+//
+// Copyright (c) 1999 Martin R. Jones <mjones@kde.org>
+//
+
+#ifndef SPRITEANIM_H
+#define SPRITEANIM_H
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <qpixmap.h>
+#include <qdict.h>
+#include <qptrlist.h>
+#include <qstrlist.h>
+#include <qcanvas.h>
+#include <kconfigbase.h>
+#include <ksimpleconfig.h>
+
+//---------------------------------------------------------------------------
+//
+// SpriteObject stores the animations that create an object
+//
+class SpriteObject : public QCanvasSprite
+{
+public:
+ SpriteObject(SpritePixmapSequence *seq, QCanvas *c);
+
+ void setLifeSpan(int l) { mLifeSpan = l; }
+ void age();
+ bool dead() const { return (mLifeSpan == 0); }
+ void setBounds( int x1, int y1, int x2, int y2 );
+ bool outOfBounds() const;
+
+protected:
+ int mCycle;
+ int mLifeSpan;
+ SpritePixmapSequence *mSeq;
+ QRect mBound;
+};
+
+//---------------------------------------------------------------------------
+//
+// SpriteDef stores the definition of a sprite
+//
+class SpriteDef
+{
+public:
+ SpriteDef(KConfigBase &config);
+
+ SpriteObject *create( QCanvas *c );
+
+protected:
+ void read(KConfigBase &config);
+
+protected:
+ SpriteRange mDirX;
+ SpriteRange mDirY;
+ SpriteRange mStartX;
+ SpriteRange mStartY;
+ SpriteRange mEndX;
+ SpriteRange mEndY;
+ int mLifeSpan;
+ int mZ;
+ SpritePixmapSequence *mSeq;
+};
+
+//---------------------------------------------------------------------------
+//
+// SpriteGroup
+//
+class SpriteGroup
+{
+public:
+ SpriteGroup(QCanvas *c, KConfigBase &config);
+
+ void next();
+ void refresh();
+ int refreshTime() const { return mRefresh.random(); }
+
+protected:
+ void read(KConfigBase &config);
+
+protected:
+ QPtrList<SpriteDef> mAvailable;
+ QPtrList<SpriteObject> mActive;
+ int mCount;
+ SpriteRange mRefresh;
+ QCanvas *mCanvas;
+};
+
+#endif // SPRITEANIM_H
+