Boost logo

Boost Users :

From: fanzhe cui (fanzhe.cui_at_[hidden])
Date: 2007-06-07 11:03:02


Your version of the timer wrapper is quite similar to mine:
class CallbackTimer
{
public:
        ~CallbackTimer();
        CallbackTimer();
        uint32 getTick();
        RTS_TimerID addTimer(Uint32 interval, RTS_Callback callback, void*
param);
        bool removeTimer(RTS_TimerID timrId);
        bool delay(Uint32 interval);
        bool setTick(Uint32 interval);
        bool resetTick();
        static Uint32 SDLCALL Ticktock(Uint32 interval);
private:
        static int _Ticks;
        int init();
        int quit();
        SDL_mutex *_mut;
};

Yours is also class template, which would make it convenient to use. It
would be useful if you have separate member function
add_timer()/remove_timer(). I noticed that you embedded SDL_AddTimer() in
your set_timer() function. In addition I suggest you having a member
function delay() as well. It is because win32 has Sleep() and Linux has
different function for sleep, and we need an unified one across different
platforms, and this is good place to do so.

In the case you want to implement only the timer, it might be worth replace
other parts with boost library - for example using boost mutex rather than
the mutex in SDL, which I plan to do as next step. The reason I wanted to do
this is because I noticed SDL used WinMain() function, although in the case
of the timer I don't need to use WinMain().

Best regards,
Fanzhe Cui
++++++++++++++++++++++++++++++++++++++
Goldiom Systems LLC
- Information and Communication Technology Provider
Email: fanzhe.cui_at_[hidden]
Tel: 973-210-4254
www.goldiom.com

-----Original Message-----
From: boost-users-bounces_at_[hidden]
[mailto:boost-users-bounces_at_[hidden]] On Behalf Of Christian Henning
Sent: Thursday, June 07, 2007 9:56 AM
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] port of GameDev SDL lib in Boost?

My current version is more or less ready to use.

you can check it here:

http://gil-contributions.googlecode.com/svn/trunk/gil_2/boost/gil/extension/
sdl

Let me know what you think. I'm not so sure if you can put your
callback timer under the boost license. Maybe somebody else knows the
answer.

Christian

On 6/6/07, fanzhe cui <fanzhe.cui_at_[hidden]> wrote:
> Christian,
>
> Boost is very widely accepted and utilized by game developers, and on the
> web GameDev.net there are many many articles about various boost sub lib.
> But I haven't seen many discussions about SDL lib on this boost mail list
> from boost users/developers. SDL is very convenient cross-platform C++
> development platform that can be used not only game developers but also by
> other developers. It has easy-to-use classes of multithreads, mutex, event
> queues, timer callbacks, semaphores, key board input handling, audio,
video,
> to name a few. Most of these functionalities are available from Boost lib.
> But I haven't seen good timer callback available from Boost lib (anybody
can
> correct me if I am not so informed of Boost timer).
>
> I tried to extract the timer functions (classes) from the SDL lib into an
> individual timer lib, and the work is still in progress. I am not sure
other
> users in the list are interested in knowing about porting SDL timer to
> Boost. So if you can tell me your email of this email list, I can send you
> the project file.
>
> What exactly I did was that I included the relevant source files from SDL
> package, and compile it with testing program. I was able to get the exe
file
> but the project also generated a library file in addition to the exe file.
I
> am confused by the fact that the project generating TimerTest.lib, that I
> don't want t. Rather, I wanted to link them with TimerTest not intended
to.
> I checked the project configuration file, and there is no setting that
will
> generate a library file. I think it might be set in the program source
code,
> but I did not find it.
>
> I am interested in your idea of implement SDL wrapper in boost lib. Thank
> you!
>
> Best regards,
> Fanzhe Cui
> +++++++++++++++++++++++++++
> Goldiom Systems LLC
> - Information and Communication Technology Provider
> Email: fanzhe.cui_at_[hidden]
> Tel: 973-210-4254
> www.goldiom.com
>
>
> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Christian
Henning
> Sent: Wednesday, June 06, 2007 10:06 AM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] port of GameDev SDL lib in Boost?
>
> Fanzhe, I have been working on a sdl wrapper for boost::gil. It lets
> you draw on a canvas and react to event such as a timer event. I was
> thinking of outsourcing this portion so people can use just that. The
> good thing is the sdl is supporting almost the same platforms as boost
> does. The bad thing probably is the license sdl is using, LGPL.
>
> If you want I can give you a pointer for the code.
>
> Christian
>
> On 6/6/07, fanzhe cui <fanzhe.cui_at_[hidden]> wrote:
> > Yes, I was referring to that library and more info could be found from
the
> > web: http://www.libsdl.org/.
> > The problem with the boost timer that you mentioned is that it provides
> the
> > time elapsed, but not the interface like provided by SDL lib.
Particularly
> > the kind of timer callback function that is available in SDL lib is not
> > available in Boost lit.
> >
> > Best regards,
> > Fanzhe Cui
> >
> > ++++++++++++++++++++++
> > Goldiom Systems LLC
> > - Information and Communication Technology Provider
> > Email: fanzhe.cui_at_[hidden]
> > Tel: 973-210-4254
> > www.goldiom.com
> >
> > -----Original Message-----
> > From: boost-users-bounces_at_[hidden]
> > [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Tarjei
Knapstad
> > Sent: Wednesday, June 06, 2007 4:02 AM
> > To: boost-users_at_[hidden]
> > Subject: Re: [Boost-users] port of GameDev SDL lib in Boost?
> >
> > On 6/6/07, fanzhe cui <fanzhe.cui_at_[hidden]> wrote:
> > > I have been using both Boost lib and GameDev SDL lib in same projects.
> > Both
> > > of the lib have very good platform independency. But they have some
> > > functionalities overlapping each other and I would like to use only
one
> of
> > > them. The timer lib in GameDev SDL is very easy to use and I hope such
> lib
> > > or functionally similar one exists in Boost lib. I had a look at boost
> > > archive on previous discussion on implementing Boost timers and feel
> that
> > > there is still no good implementation of timer in Boost lib (correct
me
> if
> > I
> > > am wrong). Anybody in this email list had a look at GameDev timer and
> have
> > > considered implementing such a lib in Boost?
> > >
> >
> > Are you referring to the Simple Direct Medialayer?
> >
> > http://lazyfoo.net/SDL_tutorials/lesson12/index.php
> >
> > What's wrong with/missing in boost::timer ?
> >
> > http://boost.org/libs/timer/index.html
> >
> > --
> > Tarjei
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> >
> >
> > _______________________________________________
> > Boost-users mailing list
> > Boost-users_at_[hidden]
> > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> >
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net