paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [paragui-users] re: timer widget


From: Alexander Pipelka
Subject: Re: [paragui-users] re: timer widget
Date: 28 May 2002 21:13:29 +0200

Am Die, 2002-05-28 um 20.07 schrieb Keith Swyer:
> took a look at the animation.cpp and it's what i'm looking for, minus the
> use of SDL_AddTimer as it requires threads. THe
> SetEventCallback(MSG_APPIDLE, ...,...) and enabling the appidle calls seems
> to work partially. i have not been able to set two different callbacks to
> run on the MSG_APPIDLE message. is it even possible??

Hmm,...
This piece of code wasn't written by myself,...

I'm just thinking about a clean implementation of timers.
What about introducing something like PG_TimerObject ?

Here a quick draft:

class PG_TimerObject : protected map<int, PG_TimerObject*> {

public:
        PG_TimerObject() {
                initialize SDL_Time on first instance
        }

        virtual ~PG_TimerObject();

        virtual eventTimer(int id);

        int AddTimer(int delay);

        int RemoveTimer(int id);

private:

        static int callbackTimer(int id) {
                *this[id]->eventTimer(id);
        }

}

Should be no problem to implement and would solve all timer problems :))

Ideas ?

Alex






reply via email to

[Prev in Thread] Current Thread [Next in Thread]