Re: Joystick problem
Daniel Gibson <[email protected]>
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <[email protected]> |
Hi Uwe,
Not sure if SDL even gets a value for the axis from the OS before
they're moved. Might also be different per platform; which OS are you using?
Cheers,
Daniel
On 21.11.2016 23:58, Huepper wrote:
> Hi Guys,
>
> I am developing a feeder for vJoy (virtual joystick) for my flight
> simulator.
> I use of SDL2 only the joystick part in a worker thread. The whole works
> so far super
> but I have a small problem as long as I have not moved the corresponding
> joystick axis.
>
> Below the minimized code I use
>
>
>
>
>
>
>
>
> Code:
>
>
> SDL_Init(SDL_INIT_JOYSTICK)
> Joystick = SDL_JoystickOpen(nJoystick);
> while (!done)
> {
> SDL_JoystickUpdate();
> nValue = SDL_JoystickGetAxis(Joystick, nThrottle1);
> }
>
>
>
>
> As long as I do not move the joystick axis (nThrottle1),
> SDL_JoystickGetAxis () always returns 0 (zero) -
> and not the current position.
>
> Once the axis is moved, SDL_JoystickGetAxis () works as expected.
>
> What am I doing wrong here?
>
> Thanks
> -Uwe
>
>
> _______________________________________________
> SDL mailing list
> [email protected]
> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
>