JInput Chapter Online

Dear All,

I’ve added a chapter on programming with JInput to the Killer Game Programming in Java web site at http://fivedots.coe.psu.ac.th/~ad/jg/.

It’s chapter 28.9 near the bottom of the page.

Comments are appreciated.

  • Andrew

Hi

It’s always goot to see people using JInput, and some documentation is always welcomed. Mind if I link to the PDF from the jinput.dev.java.net site and the forums? :slight_smile:

On page 6 you mention that all buttons are assigned the ID of “UNKNOWN”, there is a new build, that means they are assigned a number, or if possible the right ID (only works for a few so far). My gamepad has 11 buttons that directx admits to, a,b,c, x,y,z, R1, R2, L1, L2 and start. a,b,c and x,y,z now come up with the identifier A, B, C, X, Y, Z as they do under linux. The others don’t, but come up with an ID of _ where number is the order in which they were detected. This is a first attempt at getting some platform independance when it comes to button IDs (Axis are alot easier for some reason).

On page 8 you mention that jinput uses directx8, this is correct, I’m not sure if it’s me, but the wording almost suggests that something is broken for this to be the case. If thats your opinion then thats OK, everyone is entitled to one :), just wanted to see if that is what you meant, or if the wording is just not quite clear.

On page 8 you mention the Version number, thats a JInput issue, I’ll sort something out about that, your the only person I know who’s spotted that one, good find :slight_smile:

On page 9 you mention about the port type. I’m not 100%, but I think that information is hidden by direct x so there is no way for jinput to know, so unknown is correct. I’ll take a more thorough look at some point to confirm this though.

On page 14/15 you say don’t display 0.0 values because it means it’s not been manipulated, but thats only the case for relative devices, for absolute devices a value of 0.0 could mean that it has been moved from one extreme or some other location, to the centre. Checking it’s not the same as the last value when it becomes 0.0 would cerfice for absolute controls, for relative controls you are right, hide 0.0 values. (I just went through the same thing for my input code :)). It’s just a point thats worth making at some point in the text, it would slightly complicate the method though, and you might not want that in the simple examples. It’s your article after all :slight_smile:

On page 30 you mention the webstart version on the newdawnsoftware site. The version you reference should have been deleted (my fault), the new one, and the one that does get updated (although it’s a demo, not a repository, so it gets updated when I feel like it rather than at each release) can be found at http://www.newdawnsoftware.com/resources/jinput/webstart/jinput2.jnlp.

It’s an excelent document and I hope my comments are constructive. Nothing is intended to offend.

If you need more info, just holler.

Endolf

Endolf,

Thanks for the constructive comments. I’ve revised the chapter to address all your points.

When a new ‘official’ version of JInput is put up at https://jinput.dev.java.net/, I’d be happy to rerun my examples, and update the chapter again.

Of course you can link to the article. Could you please link to the Web page (http://fivedots.coe.psu.ac.th/~ad/jg/ch289/), rather than just the PDF, and then readers will see the examples zip file and the Portfolio loader.

  • Andrew

Great article Andrew, there is a lot of good information there. You bring up a few issues I noticed myself, so I thought I would discuss them while we’re at it…

@Endolf

1.) Andrew mentioned that his gamepad is detected as a joystick and so are mine, I was wondering what jinput/directx uses as its definition for a gamepad? Is it something reported by the hardware itself or is it the fact that many modern gamepads now include analog sticks that resemble the functionality we used to only find in joysticks?

2.) If directx does in fact prevent you from identifying the port type, would another possible solution be to find that out from the operating system API since you know other information like the device name?

Neither points are a big deal, I was just curious.

Chris

Thanks for the example JNLP file, Endolf. I used it to get my pacifier input device working with Java Web Start on Windows. Check out the movie I made:
http://www.croftsoft.com/library/software/infant/

Hi

Glad someone has found it useful. That was the point :slight_smile:

Endolf

[quote=“croft,post:5,topic:25450”]
Looking at that input device gives me the shivers. Can you say “strangulation risk” ?

http://www.dcu.org/streetwise/kids/toy.html

“Cords, string, ribbons, and rope can pose strangulation hazards. These can easily become wrapped around a child’s neck.”

I should reassure you that this is for use in scientific research only. I do not believe that the infant will be unattended.

Ah! Interesting!

I added a strangulation warning to my webpage describing the device in case anyone reading it should build and use it on their own:
http://www.croftsoft.com/library/software/infant/

Thank you for your comment.