[PATCH] port testjoystick to the SDL 2 API

Greetings,

I have submitted a patch to Bugzilla which ports the testjoystick
program to the SDL 2 API.

http://bugzilla.libsdl.org/show_bug.cgi?id=1570

While doing so, I made the “draw” variable per-axis (i.e. turned it into
an array) – if I understand its purpose correctly, it has been
introduced to correctly clear the trails behind the white axis indicator
squares. The single-variable approach worked well for some gamepads
(e.g. “Generic X-Box Pad” with its 6 axes) and didn’t for others (e.g.
“Logitech RumblePad 2 USB”, 4 axes). The new approach has been tested to
work correctly with both.

Also, we don’t seem to have an indicator for hat positions; the
aforementioned gamepads announce their D-Pads as hats. Do you think such
an indicator might be something worth implementing?

Cheers,
~~ Ondra

I would say so. I haven’t looked at testjoystick, but hats are definitely
important for many joysticks and it’s good to have a code reference. Is
there an indicator for trackballs?

Jonny D

No, and I don’t have a device to test. Are they still common on gaming
input devices? The only trackballs I know act like mice.

Cheers,
~~ OndraOn Mon, 2012-08-13 at 21:31 -0400, Jonathan Dearborn wrote:

Is there an indicator for trackballs?

Also, we don’t seem to have an indicator for hat positions; the
aforementioned gamepads announce their D-Pads as hats. Do you think such
an indicator might be something worth implementing?

I would definitely accept a patch for this if you implement it.

(I haven’t looked at the current testjoystick you posted, but I’ll try
to soon.)

–ryan.

Alright. The new two-birds-with-one-stone patch has been attached to the
bug.

http://bugzilla.libsdl.org/show_bug.cgi?id=1570

I note at this point that we already have a lot of white squares flying
around. It might be worth making the interface a bit more colorful (e.g.
axes red, buttons yellow, hats cyan). And yes, I can implement that
too. :wink:

Cheers,
~~ OndraOn Die, 2012-08-14 at 11:35 -0400, Ryan C. Gordon wrote:

I would definitely accept a patch for this if you implement it.

Begging for forgiveness of my mailbombing, I have found out that the
whole window-surface shebang is considered obsoleted by the (potentially
accelerated) renderer API, so I ported testjoystick to use that.

The newest, freshest version of the patch is in Bugzilla.
http://bugzilla.libsdl.org/show_bug.cgi?id=1570

Cheers,
~~ OndraOn Tue, 2012-08-14 at 11:35 -0400, Ryan C. Gordon wrote:

I would definitely accept a patch for this if you implement it.

Begging for forgiveness of my mailbombing, I have found out that the
whole window-surface shebang is considered obsoleted by the (potentially
accelerated) renderer API, so I ported testjoystick to use that.

It’s not mailbombing if there are patches included. :slight_smile:

I put this in revision control now, thank you!

–ryan.