Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 3006 times)
0 Members and 1 Guest are viewing this topic.
Offline bigor

Senior Newbie





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

Hi,
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:

1  
joystick.getComponent(Identifier.Axis.X)


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: 
1  
2  
3  
joystick.getComponent(Identifier.Axis.X)
joystick.getComponent(Identifier.Axis.Y)
joystick.getComponent(Identifier.Axis.Z)
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:

http://www.java-gaming.org/forums/index.php?topic=12843.0

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.

Thanx!
 
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 »

Hi

JInput old and new come with a class for testing

net.java.games.input.test.ControllerTextTest 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.

Cheers

Endolf

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 »

Hi

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

Endolf

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?

Steffen.
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.

Endolf

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (36 views)
2014-12-15 09:26:44

Mr.CodeIt (29 views)
2014-12-14 19:50:38

BurntPizza (61 views)
2014-12-09 22:41:13

BurntPizza (98 views)
2014-12-08 04:46:31

JscottyBieshaar (58 views)
2014-12-05 12:39:02

SHC (74 views)
2014-12-03 16:27:13

CopyableCougar4 (76 views)
2014-11-29 21:32:03

toopeicgaming1999 (136 views)
2014-11-26 15:22:04

toopeicgaming1999 (127 views)
2014-11-26 15:20:36

toopeicgaming1999 (37 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org 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‑gaming.org
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!