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.
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,
DanielOn 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.
Oh, sorry, I forgot to mention: Win10 x64, VS2015 C ++ / MFC, SDL2.05, Target Win32 App
It also seems to happen only in debug sessions. I notice it at sometimes jerky throttle levers (in the Simulator) at the first moment and during the line-wise debugings (SDL_JoystickGetAxis () returns 0 as long as I do not move the joy axis).
In the release version, there is nothing negative to note.
If the code snippet I’ve published is OK, then I can live with it.
the code snippet looks ok; however you /could/ do it differently to work
around the problem, by using a proper event-loop, with SDL_PollEvent().
Then you could save a “not initialized” flag per axis and only use the
axis once you received a SDL_JOYAXISMOTION event for it.
Those events will always have real values, and not an “I don’t have a
value yet so you get 0”.
(No idea why debug vs release builds behave differently here)
Cheers,
DanielOn 28.11.2016 23:39, Huepper wrote:
Hi Daniel,
Oh, sorry, I forgot to mention: Win10 x64, VS2015 C ++ / MFC, SDL2.05,
Target Win32 App
It also seems to happen only in debug sessions. I notice it at sometimes
jerky throttle levers (in the Simulator) at the first moment and during
the line-wise debugings (SDL_JoystickGetAxis () returns 0 as long as I
do not move the joy axis).
In the release version, there is nothing negative to note.
If the code snippet I’ve published is OK, then I can live with it.
I can not use the SDL_EventSystem because I have no SDL_Window. That with the poll is OK for me.
I may be doing something different during the debugging session and the problem is not within SDL.
With my request I only wanted to make sure that I did nothing wrong, since the published examples
always refer to the EventSystem.