Re: [AD] Should al_set_mouse_xy generate events?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, 2009-02-28 at 09:42 -0800, Evert Glebbeek wrote:
> 
> I prefer C:
> C) If the mouse position was changed by al_set_mouse_xy, send  
> ALLEGRO_EVENT_MOUSE_WARPED instead of ALLEGRO_EVENT_MOUSE_AXES. The  
> structure is set exactly the same as for ALLEGRO_EVENT_MOUSE_AXES.
> 
> This avoids the hacky nature of adding an extra field to the struct of  
> the first solution and it includes the second solution implicitly by  
> allowing the user to ignore ALLEGRO_EVENT_MOUSE_WARPED events. If you  
> want to catch both, you simply do
> 
> case ALLEGRO_EVENT_MOUSE_AXES:
> case ALLEGRO_EVENT_MOUSE_WARPED:
>     do_stuff();
> 
> I think it's the most elegant solution to the problem (but then, I  
> thought of it).
> It's not stupid user proof in the sense of  
> "al_set_mouse_xy(event.mouse.x + 1, 0)", but can we trust to people to  
> not be that stupid (or at least tell them not to be)? ;)
> 

Yes, it's really a user mistake anyway, I only thought of it when I
wanted to change ex_warp_mouse before and suddenly everything got slower
and slower...

Anyway, I also think solution C is best, so committed it to SVN. Only
X11 will generate ALLEGRO_EVENT_MOUSE_WARPED events right now (and
because X11 is stupid, needed a small hack to have it work properly :P).
Hopefully for DX and OSX this will be even easier to implement.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/