[SDL] SDL mouse events.

Lucas lucas_pet at live.co.uk
Sun Mar 16 22:06:50 PDT 2008


I set my program to 1fps (SDL_DELAY) and printed the event count, but 
somehow a mousemovement only adds a single event?
Typing did as expected.
Let me guess, SDL_DELAY disables mouse events. No that isn't it, as 
replacing the delay with a long dumb loop doesn't change a thing.
What did I do wrong?

int eventCount=0;
 while (SDL_PollEvent(&event))
 {
  eventCount++;
  switch (event.type)
  {
   case SDL_MOUSEBUTTONDOWN:
//handling code
    break;
   case SDL_MOUSEMOTION:
//handling code
    break;
   case SDL_QUIT:
//handling code
    break;
   case SDL_KEYDOWN:
//handling code
    break;
   default:
    break;
  }
 }
  print(eventCount);




>> the queue at ~10fps, which isn't unheard of.
>
> Have you actually seen this fill the SDL queue on any platform?
> Even with ~15 FPS, I've never seen more than 20 or 30 mouse events in the
> queue with any mouse on any platform.
>
> See ya,
> -Sam Lantinga, Lead Software Engineer, Blizzard Entertainment 





More information about the SDL mailing list