[SDL] Re: Question about ignoring mouse events

Wolfgang Keller mail.wolfgang.keller at web.de
Tue Nov 15 12:27:14 PST 2005


Román Gorojovsky <rgorojovsky <at> gmail.com> writes:
> 
> The problem is that when I press the mouse's button it doesn't
> generate *one* event but many.  So when the program finishes
> redrawing, it starts to zoom in again... and again......
> 
> I tried using
>    SDL_EventState(SDL_MOUSEBUTTONDOWN, SDL_IGNORE)
> 
> and using
>    SDL_SetEventFilter(ignore_mouse_button_down)
> 
> as I found here
> http://www.devolution.com/pipermail/sdl/2004-July/063671.html
> 
> but I still have the same problem.
> 
> So my questions are: ¿How do I do this? and ¿Am I designing wrong this
> zoom function?

My idea: create a boolean var (use char for example): lets call it mouse_down.

At the beginning of the program set

mousedown=0;

When you get a mousebutton down event, set it to 1. If you get a mousebutton
down event and mousedown==1: ignore it. As soon as you get a mousebutton up
event, set mousedown=0.

Just my 0,02€

Please tell me if it helped.

Wolfgang





More information about the SDL mailing list