
8 Jun
2007
8 Jun
'07
2:24 a.m.
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; }