Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (595)
Games in Android Showcase (168)
games submitted by our members
Games in WIP (646)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Jinput status  (Read 3217 times)
0 Members and 1 Guest are viewing this topic.
Offline bigor

Senior Newbie

« Posted 2006-03-16 08:39:31 »

I am using jinput in my game, but I have serious problems with it. I am trying to detect and use joystick , but a have few  problems. First thing, on linux (Ubuntu Breezy Badger) when I list controllers I got just one controller, which is funny, because I got Keyboard, Mouse and Joystick attached to computer. But the real problem is when I try to find out if this controller is Joystick I cant really do it because getIdentifier for this controller returns Unknown (on windows it returns STICK identifier).  I found out that this is Joystick by the number of axis and buttons, but I think this is very bad way to detect it.

Second problems is with Axes. I can't detect axis right on linux. Here is how I do it:


and I get null. On windows it works OK, I get X Axis.

So , on linux, the only thing I can do is to assume that first axes returned is X, second is Y, and third is Z. I don't feel comfortable with this, because I am not sure if axes are always returned in this order,(on windows I get Z axes first.). getname method returns "X Axes" for all axes !!!!

Ok, now let's switch to windows. On windows, Jinput returns Keyboard, Mouse and Joystick controller, and I can detect Jostick by Identifier, so far everything is OK. Axis are also detected by Identifier: 
and it works fine.

The only problem I have on windows are buttons. Once again I can not access desired button by Idenifier, because for every button method getIdentifier returns Unknown. So I must assume that buttons are return in right order form getComponents method of the controller.

With all this said above,  I have serious doubts on using JInput at all. Are there some plans to fix this issues soon?
Offline elias

Senior Devvie

« Reply #1 - Posted 2006-03-16 09:47:28 »

We've recently completed some major rework on JInput. Try out a beta from:

The problem with linux and mice/keyboards is that of permissions, and can't be solved by JInput alone. You'll have to have read rights to /dev/input/event* if you want keyboards and mice to work.

 - elias

Offline bigor

Senior Newbie

« Reply #2 - Posted 2006-03-16 12:30:00 »

I am glad to here that this API isn't dead.

 I don't really need mouse and keyboard support, I am handling them through java's usual event listeners.

I will defenetly try new JInput.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #3 - Posted 2006-03-16 12:49:24 »


JInput old and new come with a class for testing should dump out large amounts of debug information. On the current release it includes loads of information from the native layer too which would be useful. I've not managed to get the new one running yet as I needed to rebuild some kernel modules to enable force feedback (I use Ubuntu too and they disable it by default so when I get kernel updates it over writes the module).

If you run the texttest and copy the output to here or post it on a webpage somewhere, i'll take a look and see what I can find out.



Offline elias

Senior Devvie

« Reply #4 - Posted 2006-03-16 13:17:44 »

You should have told me Smiley I've comitted a fix that should ignore any problems with the rumbler detection.

 - elias

Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #5 - Posted 2006-03-16 13:54:41 »


Everything works fine. It's just that my kernel doesn't have FF enabled, so I can't run the FF tests Smiley. I ran the linux build (which I had had to modify because ant *always* overrides my JAVA_HOME to point to the JRE so things like javah don't work) and built the linux version, and ran the readtest and rumble test. It's just that with no FF enabled in the kernel, it detected no rumblers, and I know I have one as I used it to write the FF code in the first place Smiley.

Now i'm gonna have to go and do an svn update too Smiley


Offline stefiqeg

Junior Newbie

« Reply #6 - Posted 2006-08-10 11:22:02 »

The problem with linux and mice/keyboards is that of permissions, and can't be solved by JInput alone. You'll have to have read rights to /dev/input/event* if you want keyboards and mice to work.
I guess the answer is somewhere in the forum, but I could not find it:

Why does jinput need extra read permissions for mouse/keyboard? Any other application can easily read them and I also think that lwjgl doesn't need these permissions. For me it is no problem to fix some permissions, but people running our java Web Starts might not be able to do that.

Are there any plans to get around that somehow?

Offline endolf

JGO Coder

Medals: 7
Exp: 15 years

Current project release date: sometime in 3003

« Reply #7 - Posted 2006-08-10 11:54:08 »

LWJGL has the advantage of being an X11 application, which means it can use X11's mouse/keyboard objects. JInput uses the /dev/input/event* nodes. These nodes are not always created with read permissions to everyone by the distribution, so they need updating manually.

JInput was specifically designed to not *require* a windowing system to be present.

There is an AWT plugin, that will capture events through java awt. This will work on any platform where the AWT sub system is in play. You won't get any joysticks this way, but you also will not need the /dev/input/event* nodes to even exist.


Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Riven (22 views)
2015-07-03 11:22:16

deepthought (47 views)
2015-06-30 15:39:44

deepthought (49 views)
2015-06-30 15:39:09

deepthought (62 views)
2015-06-30 15:36:52

Za\'Anzabar (34 views)
2015-06-29 05:44:54

TritonDreyja (45 views)
2015-06-24 17:10:40

CopyableCougar4 (44 views)
2015-06-23 00:34:45

BurntPizza (50 views)
2015-06-21 20:36:46

cookiecompiler (91 views)
2015-06-11 15:42:53

cookiecompiler (54 views)
2015-06-11 15:41:14
How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!