[SDL] Strange problem with Win32 Sleep function and SDL

Matthias Weigand weigole at gmx.de
Wed Jun 6 00:17:51 PDT 2007


Hi,

The operating system ist still running when your program is waiting for 
Sleep to complete. And usually Windows is handling the display of the 
mouse cursor, except you draw it yourself in your program and disable 
the standard mouse cursor.

Maybe you forgot to "break;" the cases above SDL_QUIT?
Like...
switch (event.type)
{
  case SDL_MOUSEMOTION:
    updateMouse(...);
    break; // <-- !!!
  case SDL_MOUSEBUTTONDOWN:
    clickMouse(...);
    break; // <-- !!!
  case SDL_QUIT:
    return(0);
}

Hope that helps.
Matthias


voidstar schrieb:
> Hello, in my program I have this line:
>
> Sleep(3000);
>
> First, I noticed that during the sleep-time I can still
> move the mouse and I see my cursor moving on the screen
> (but the rest of the program is "stopped"). Why?
>
> Apart from that, my problem is that if during the sleep-time
> I click a mouse button, at the end of the sleep-time my
> program enters in this case of the switch:
>
> while (SDL_PollEvent(&event)) {
> 	switch (event.type)
> 	....
> 	....
> 	case SDL_QUIT:
> 		return(0);
> 	...
>
>
> And the program stops the execution.
>
> Is this normal? Why the event is now "SDL_QUIT"?
> Is there a way to solve this problem?
>
> Sorry but I'm new with SDL ;-)
>
> Thanks
>
>
> _______________________________________________
> SDL mailing list
> SDL at lists.libsdl.org
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>
>   


More information about the SDL mailing list