[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-games-devel
Subject: Re: [Kde-games-devel] QCanvasSprite + QObject
From: Kevin Krammer <kevin.krammer () gmx ! at>
Date: 2001-12-20 16:23:28
[Download RAW message or body]
Hi!
How about this:
create a base class for timed objects:
class TimedObject
{
public:
virtual void tick() = 0;
};
Every sprite inherits from this.
For every different timing interval you create an instance of the following
class:
class TimeManager : public QObject
{
Q_OBJECT
public:
void addTimedObject(TimedObject* to)
{
if (to != 0)
{
// add to to inetrnal list
}
}
void removeTimedObject(TimedObject* to)
{
if (to != 0)
{
// remove to from inetrnal list
}
}
protected slots:
// connect this to timeout() of a QTimer
void slotTimeOut()
{
// iterate through list
// call tick() on each element
}
};
Kevin
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Krammer <kevin.krammer@gmx.at>
Developer at the Kmud Project http://www.kmud.de/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
kde-games-devel mailing list
kde-games-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-games-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic