Hi all
I don’t know whether this is a bug in SDL or something else, but the
problem shows when I check for mouse events. After (almost) every
SDL_MOUSEBUTTONDOWN event I receive, there is immediately
SDL_MOUSEMOTION event sitting in the event queue. Here is a
complete program that clearly shows this behaviour. (I have tested this
only under win98 with SDL-1.2.5a.)
#include <stdio.h>
#include <stdlib.h>
#include “SDL.h”
int main()
{
SDL_Surface *screen;
SDL_Event ev;
SDL_Init(SDL_INIT_VIDEO);
atexit(SDL_Quit);
screen = SDL_SetVideoMode(320, 200, 16, SDL_HWSURFACE);
if(screen == NULL)
{
fprintf(stderr, “SDL_SetVideoMode: %s\n”, SDL_GetError());
exit(1);
}
while(SDL_WaitEvent(&ev))
{
switch(ev.type)
{
case SDL_MOUSEBUTTONDOWN:
fprintf(stderr, “mouse button down\n”);
break;
case SDL_MOUSEMOTION:
fprintf(stderr, “mouse motion: %d, %d\n”,
ev.motion.x, ev.motion.y);
break;
case SDL_QUIT:
exit(0);
break;
default:
break;
}
}
return 0;
}–
Ivan Stankovic