Tao.Sdl SDK Documentation

Sdl.SDL_JoystickGetBall Method 

Get relative trackball motion.

[Visual Basic]
Public Shared Function SDL_JoystickGetBall( _
   ByVal joystick As IntPtr, _
   ByVal ball As Integer, _
   ByRef dx As Integer, _
   ByRef dy As Integer _
) As Integer
[C#]
public static int SDL_JoystickGetBall(
   IntPtr joystick,
   int ball,
   out int dx,
   out int dy
);

Parameters

joystick
ball
dx
dy

Return Value

Returns 0 on success or -1 on failure

Remarks

Get the ball axis change.

Trackballs can only return relative motion since the last call to SDL_JoystickGetBall, these motion deltas a placed into dx and dy.

Binds to C-function in SDL_joystick.h

int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
            

Example

            int delta_x, delta_y;
                    SDL_Joystick *joy;
                    .
                    .
                    .
                    SDL_JoystickUpdate();
                    if(SDL_JoystickGetBall(joy, 0, &delta_x, &delta_y)==-1)
                    printf("TrackBall Read Error!\n");
                    printf("Trackball Delta- X:%d, Y:%d\n", delta_x, delta_y);
            

See Also

Sdl Class | Tao.Sdl Namespace | SDL_JoystickNumBalls