Latest Jinput

The JInput versions at https://games-binaries.dev.java.net/build/index.html are misleadingly dated. They’re actually from May 2004. Ignore the 2005 extension.

The windows download contains two copies of the 4 API files, and dxinput.jar and dxinput.dll need to be stored in a controller/ subdirectory in order for things to work.

But actually, none of that matters. The most current versions of JInput are at
http://www.newdawnsoftware.com/resources/jinput/, with the Windows version dating from September 2005. It’s been simplified to two files, but the only documentation on how to use it appears in http://www.java-gaming.org/forums/index.php?topic=10634.0, near the bottom of p.1 in a post by endolf.

None of the JInput documentation mentions this, including the freefodder tutorial https://freefodder.dev.java.net/tutorial/jinputTutorialOne.html.

Come on guys, spend 20 minutes and fix things up :slight_smile:

  • Andrew

I’m replying to myself again :slight_smile:

I tried installing jinput_windows_2005-09-01.zip from http://www.newdawnsoftware.com/resources/jinput/, and the Axis class is missing! That seems just a tad sloppy to my mind.

There’s eight other versions of the Windows version of the JInput at the site, but I think I’ll stick with the working version from https://games-binaries.dev.java.net/build/index.html. BTW, the Version.getVersion() method for that version reports 1.0.0-b01.

  • Andrew

Endolf is away at the moment - and since this “community” project is basically just him most of the time - I can’t see it being fixed in “20 minutes”.

Kev

Axis got renamed to Component some time ago, looks like you have old examples or javadocs. There are javadocs that should be up to date in the files section under core at the jinput project page.

HTH

Endolf

The only documentation at https://games-binaries.dev.java.net/build/index.html that I could find was in the nightly builds section, and uses Axis.

However, I did find current documentation at http://www.newdawnsoftware.com/resources/jinput/ in jinput_coreapi_javadoc.zip.

Perhaps, I’ve missed something, but was this change to one of the major class names announced anywhere? This will break most applications that upgrade their version of JInput.

Anyway, I changed Axis --> Component, and “axes” to “components”, and the freefodder examples and mine work again on my test Windows 98 and XP machines.

What is the ‘official’ version of JInput that users should download?
Should people wishing to use JInput go to http://jinput.dev.java.net or to http://www.newdawnsoftware.com/resources/jinput/?

  • Andrew

For the sake of other people upgrading their version of JInput.

Aside from Axis --> Component, the way that component (axis) identifiers are named has also changed. The ID names are now divided into Component.Identifier.Axis,
Component.Identifier.Button, and Component.Identifier.Key. They were previously all in Axis.Identifier. The new identifier classes have more names.

Previously, the buttons on my game pad were labelled as “button” but they are now “Unknown” in the Component.Identifier.Button class.

  • Andrew

Hi

It was announced and discussed on this board here and here.

The ‘Offical’ place to get things is from jinput.dev.java.net. Some of the things there are links to the newdawn sites copy, but thats just because thats where I uploaded them too, not because it’s the right source. I often upload to the newdawn site and then test it from there so I can check I got all the files right etc, and then update the webstart and test it. Then I create a new link on the jinput project page at jinput.dev.java.net. Until it’s in jinput.dev.java.net it’s not a proper release.

There used to be a build system somewhere at sun that did nightly jinput builds, those were the closest thing to official releases. For some reason it stopped doing any builds and we now have a ‘solution’ where by when I change something, I do a build and let other people access it by placing a link on jinput.dev.java.net, this is not an official release as such, it’s just the latest one I’ve done. Unfortunatly, at the moment, thats the closest we have.

As for the Unknown button stuff on windows, it’s an issue left over from when the change was made, I need to look at it, but I’ve been away on honeymoon for 10 days and just got back. I know why it does it, i’ve not got a solution yet though. It is on my list of todos.

Endolf

FUnding for the lab that did that and the person resonpsible was cut.

I can’t find any links at https://jinput.dev.java.net/ to http://www.newdawnsoftware.com/resources/jinput/; where are they?

How is a newbie JInput programmer (i.e. me :)) meant to find the posts about the class name changes?

I fixed the “Unknown” problem by getting the identifier’s class name and extracting the last part. So Component.Identifier.Axis, Component.Identifier.Button, and Component.Identifier.Key return “axis”, “button”, and “key”. Here’s a code fragment:


   String fullClassName = cmp.getIdentifier().getClass().getName();
    int index = fullClassName.indexOf("Identifier$");
    if (index == -1)    // the class name isn't useful
      return "Unknown";
    else
      return fullClassName.substring( index+11 ).toLowerCase();  // skip "Identifier$"

  • Andrew

I’m not sure what your use case is, but I would think that does not solve the real problem for the majority of users. For example, if I am creating a game I want to say “button0 means jump”, “button1 means punch”, or something similar. If your extracted identifier for each button only returns “button” then there is still no reliable way to distinguish between them all and therefore you don’t know what action the user actually wants.

Chris

Don’t look for links :slight_smile:

From the front page there, on the left hand menu, select documents and files, then select a platform to get the binaries for.

As for the Identifier stuff, I agree with chrisw1229, the identifier is supposed to be a type id so you can get the type of the button. I’ve done some investigation on this and will hopefully be fixing it this week.

Endolf

Thanks for the directions to the latest files. It’s clear then that user’s wanting a ‘stable’ version of JInput should go the “Documents and Files” menu item at https://jinput.dev.java.net/.

As regards the identifier, I’m using it to distinguish buttons from the axes on my game pad. In that case, “button” is more informative than “Unknown”.

  • Andrew

But it’s the same thing because it’s not Unknown, it’s Component.Identifier.Button.Unknown, which specifies that it’s an unknown button.

For your needs you should be able to do something like

String thingName = cmp.getIdentifier().toString();
if(cmp.getIdentifier() == Component.Identifier.Button.Unknown) {
thingyName = “Unknown Button”;
}

This should be more efficient that getting the class name and searching for the index.

From the changes to the ID’s, the identifiers returned from getIdentifier() should be the static ones in the components interface.

HTH

Endolf