Updates to joystick support


#1

I finally got my hands on an XBox style gamepad and was able to address some long-standing issues that folks have complained about. Being able to put hands on one was very educational.

First, I’ve added two new JoystickAxis constants:
LEFT_TRIGGER
RIGHT_TRIGGER

These map to logical IDs .rx and .ry… which in my pile of game controllers seems to map to all non-XBox style gamepads. For XBox they will be remapped in config. The issue is that generic and play station style controllers never seem to report anything but a generic name (even a PS4 controller only shows up as “Wireless Controller”) but I guess most Xbox controllers will have “xbox” in the name somewhere.

Second, along those lines, the joystick remapping support now allows for a regex normalization in joystick name. For example:

XBOX.regex=(?i).*xbox.*

…means we can create one button/axis remapping for “XBOX” and anything with the word ‘xbox’ anywhere in its actual name (case insensitive) will match.

I’ve left the old XBox controller configurations in temporarily but I’ve commented them out.

Third, the TestJoystick app has been updated to support the new LEFT_TRIGGER/RIGHT_TRIGGER axes.

On Playstation style controllers, the triggers are axes and also buttons so they get reported both ways. (Buttons 6 and 7 usually) For Xbox controllers, these seem only to be treated as axes… so the test joystick app accounts for this now.

If you build JME from source and have a controller to test, you might consider giving the TestJoystick app a whirl to see if it still works with your game controller after these changes.

Commits:




#2

Thanks :slightly_smiling_face:


#3

question: i heard console machines (ps,xbox) dont have jvm installed. how can we make games for this platforms then? it can run some standalone jvm?


#4

Note the point here is to use Xbox/PS joystick controllers in JME.


#5

ah right, was just confused, but yes, just joystick :smiley: got it

anyway im curious if xbox/ps would allow provide game with some standalone jvm(if there is any for consoles i dont check)


#6

I think running JME games on a console is probably a separate thread from getting random gamepads to work on desktop PC JME.


#7

Thanks for your hard work Pspeed!

Being that I was the one complaining most about this, I really appreciate it. My next game is going to require this support. I will test it once I get fully prototyping.

Wobblytrout