[TuxKart-devel] Re: [Tuxkart-cvs] tuxkart/src WidgetSet.cxx,1.8,1.9
Status: Alpha
Brought to you by:
sjbaker
From: <jam...@bt...> - 2004-08-22 08:36:21
|
On Sun, 2004-08-22 at 06:51, tux...@li... wrote: > Update of /cvsroot/tuxkart/tuxkart/src > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23256/src > > Modified Files: > WidgetSet.cxx > Log Message: > %1 > > Index: WidgetSet.cxx > =================================================================== > RCS file: /cvsroot/tuxkart/tuxkart/src/WidgetSet.cxx,v > retrieving revision 1.8 > retrieving revision 1.9 > diff -u -d -r1.8 -r1.9 > --- WidgetSet.cxx 20 Aug 2004 19:28:25 -0000 1.8 > +++ WidgetSet.cxx 22 Aug 2004 05:51:45 -0000 1.9 > @@ -1503,14 +1503,14 @@ > > /* Find a new active widget in the direction of joystick motion. */ > > - if (x && -JOY_MID <= x && x <= +JOY_MID) > + if (!x && -JOY_MID <= x && x <= +JOY_MID) > xflag = 1; > > (and in the next commit:) > > - if (!x && -JOY_MID <= x && x <= +JOY_MID) > + if (!x || -JOY_MID <= x && x <= +JOY_MID) The reason that it originally checked to make sure x was true is that a value of 0 for an axis doesn't mean "stick is central", rather it means "the motion event was not in this axis". See sdldrv.cxx: int x = 0; int y = 0; if (event.jaxis.axis == 0) x = event.jaxis.value; else if (event.jaxis.axis == 1) y = event.jaxis.value; if (gui) gui -> stick ( x, y ); N.B. even a value of 0 did mean "stick is central" then testing for !x would still be pointless, as unless you have some very crazy constants when x == 0 then -JOY_MID <= x && x <= +JOY_MID will always be true. James |