Re: [Boost-users] port of GameDev SDL lib in Boost?

Hi there, I think there is something wrong with the timer. Whenever I run the code ( see below ) it slows down for whatever reason. Is that a known problem? When I look at the output the frequency is certainly not 10 times a second. #include <windows.h> #include <iostream> #include <sdl.h> using namespace std; Uint32 time_elapsed( Uint32 interval, void* param ) { cout << interval << endl; return ++interval; } int main( int argc, char* argv[] ) { SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ); SDL_TimerID id = SDL_AddTimer( 100, &time_elapsed, NULL ); SDL_Event event; while( SDL_PollEvent( &event ) >= 0 ) { ::Sleep( 100 ); } return 0; }

I am not aware of such problem, and it seems the timer works ok. Please try test with the test program in the library - testtimer.c. You might verify what you observed. Best regards, Fanzhe Cui Systems Architect Goldiom Systems LLC - Information and Communication Technology Provider Email: fanzhe.cui@goldiom.com Tel: 973-210-4254 www.goldiom.com -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Christian Henning Sent: Thursday, June 07, 2007 10:24 PM To: boost-users@lists.boost.org Subject: Re: [Boost-users] port of GameDev SDL lib in Boost? Hi there, I think there is something wrong with the timer. Whenever I run the code ( see below ) it slows down for whatever reason. Is that a known problem? When I look at the output the frequency is certainly not 10 times a second. #include <windows.h> #include <iostream> #include <sdl.h> using namespace std; Uint32 time_elapsed( Uint32 interval, void* param ) { cout << interval << endl; return ++interval; } int main( int argc, char* argv[] ) { SDL_Init( SDL_INIT_VIDEO | SDL_INIT_TIMER ); SDL_TimerID id = SDL_AddTimer( 100, &time_elapsed, NULL ); SDL_Event event; while( SDL_PollEvent( &event ) >= 0 ) { ::Sleep( 100 ); } return 0; } _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Christian Henning
-
fanzhe cui