[SDL] Re: Question about ignoring mouse events

Román Gorojovsky rgorojovsky at gmail.com
Tue Nov 15 20:33:33 PST 2005


Oh, I forgot: this is SDL 1.2.8 and the system is Linux, Ubuntu 5.10

On 11/16/05, Román Gorojovsky <rgorojovsky at gmail.com> wrote:
> No, sorry, it didn't help.  It's the same logic I'm using with
> SDL_SetEventFilter(), and it didn't work with that either:
>
> main(){
>
> /* initialize SDL and draw the
> /* first mandelbrot set */
>
>         while (1) {
>                 SDL_PollEvent(&event);
>                 switch (event.type) {
>                         /* SDL_QUIT Handling*/
>                         case SDL_MOUSEBUTTONDOWN:
>                                 SDL_SetEventFilter(ignore_mouse_button_down);
>                                 /* get begining of area */
>                                 break;
>
>                         case SDL_MOUSEBUTTONUP:
>                                 /* zoom in */
>                                 SDL_SetEventFilter(NULL);
>                                 break;
>                 }
>         }
>
>         return 0
> }
>
> Maybe I shouldn't be using PollEvent() but I couldn't find any useful
> replacement (I allready tried WaitEvent() ).
>
> Any ideas??  I'll keep trying to find a solution, and I'll write if I
> can find it.
>
>
> On 11/15/05, Wolfgang Keller <mail.wolfgang.keller at web.de> wrote:
> > 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
> >
> >
> > _______________________________________________
> > SDL mailing list
> > SDL at libsdl.org
> > http://www.libsdl.org/mailman/listinfo/sdl
> >
>
>
> --
> Román
>


--
Román


More information about the SDL mailing list