SDL_joystic.c - possible improvement

SDL_joystic.c

/*

  • Get the number of multi-dimensional axis controls on a joystick
    */
    int SDL_JoystickNumAxes(SDL_Joystick *joystick)
    {
    if ( ! ValidJoystick(&joystick) ) {
    return(-1);
    }
    return(joystick->naxes);
    }

In the same way that SDL joystick hats are represented as one unit, it
might be better to represent each analog stick (2 axes) in its own struct.

Having an event that had 2 axes could combine the info passed and save a
little time in some cases.

Regards

JG

um, haven’t read it, will later, if you want grab the CVS code from
sdljoytest.sourceforge.net
in hurry

k later
SamuelOn Monday 14 July 2003 3:11 pm, J. Grant wrote:

SDL_joystic.c

/*

  • Get the number of multi-dimensional axis controls on a joystick
    */
    int SDL_JoystickNumAxes(SDL_Joystick *joystick)
    {
    if ( ! ValidJoystick(&joystick) ) {
    return(-1);
    }
    return(joystick->naxes);
    }

In the same way that SDL joystick hats are represented as one unit, it
might be better to represent each analog stick (2 axes) in its own struct.

Having an event that had 2 axes could combine the info passed and save a
little time in some cases.

Regards

JG


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety. "
–Benjamin Franklin

Hi,

I was suggesting an API improvement. I believe not related to your test
program.

Regards

JG

on the 15/07/03 00:51, Samuel wrote:> um, haven’t read it, will later, if you want grab the CVS code from

sdljoytest.sourceforge.net
in hurry

k later
Samuel

On Monday 14 July 2003 3:11 pm, J. Grant wrote:

SDL_joystic.c

/*

  • Get the number of multi-dimensional axis controls on a joystick
    */
    int SDL_JoystickNumAxes(SDL_Joystick *joystick)
    {
    if ( ! ValidJoystick(&joystick) ) {
    return(-1);
    }
    return(joystick->naxes);
    }

In the same way that SDL joystick hats are represented as one unit, it
might be better to represent each analog stick (2 axes) in its own struct.

Having an event that had 2 axes could combine the info passed and save a
little time in some cases.

Regards

JG


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl