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 2 beta  (Read 4068 times)
0 Members and 1 Guest are viewing this topic.
Offline elias

Senior Devvie





« Posted 2006-03-15 12:29:49 »

Hi,

We've been working for the last few week on an updated JInput implementation with plugin fixes and some new features like controller event queues. Since there was so much to do, the project got a little out of hand and took a little longer than expected. Now the code is feature complete (including all the original features), we're making our changes available to the unsuspecting masses Smiley You can access the code with subversion at:

http://download.oddlabs.com/oss_svnroot/sun

it includes the jutils and the jinput projects, since a few tweaks had to be done to jutil (changed where the jutils.jar file is copied). It is our intention that the changes be merged with the official JInput version, but since I haven't got a developer role on jinput.dev.java.net (yet), we've had to make the changes in private. Here's the changes:

Major:
 - Flattened Mouse so it isn't separated into child controllers (ball, buttons).
 - Removed useless component members from Mouse and Keyboard. For example, Mouse.getX() is now simply getComponent(Component.Identifier.Axis.X).
 - Removed StandardKeyboard.
 - Removed Mouse.Button and Keyboard.Key since they only complicated plugins
 - Added Keyboard.isKeyDown(Component.Identifier.Key) (with default false for non-existent keys).
 - Removed Component.isPolling() and Component.setPolling().
 - Removed Component.isNormalized() since all plugins return normalized data for absolute axes anyway.
 - Windows XP: Added RawInputEnvironmentPlugin to enable multiple mice and keyboards. DirectInput will only report one system mouse and one system keyboard where all mice and keyboard input are combined (in fact, Windows was the OS with the most complicated and confusing APIs, apart from the fact that I had to code two separate plugins for it). The RawInputEnvironment is not enabled per default, since it seems to exclude mouse and keybaord input to DirectInput which will probably confuse unsuspecting applications. But at least there is now a method to access multiple keyboards and mice on windows xp.
 - DirectInput: Got rid of the nasty DataFormat special case handling. The DirectInput data format is now one large (java int) array which is a better match for the jinput abstraction than the builtin DirectInput data formats for mice, keyboards and joysticks.
 - Added event queue support. An Event contains a Component, a value and a relative timestamp in nanoseconds.
 - Basically rewrote all plugins from scratch, with focus on minimizing the amount of native code in general, and in particular for moving decisions from native to java, making the native code more general purpose and less likely to need changes. Additionally, all plugins support the new event queue interface. All plugins now have much better error handling (exceptions) and much tighter native code (no more global variables, helper functions declared static etc.). Additionally, all plugin internal java classes are package protected and final for added security.
 - Mac OS X: Added missing features and fixed broken Mouse.
 - Cleaned up build system and added option for a combined jinput.jar with all plugins as opposed to just the OS specific packages
 - JInput should now be thread safe.
 - Mac OS X intel mac support. The jinput-osx.jnilib library is for 10.4 or better (both ppc and i386), while libjinput-osx-legacy.jnilib is for 10.3 or earlier.

Minor:
 - Removed keyId from Component.Identifier.Key
 - Made components, children and rumblers final in AbstractController
 - Added Identifier->Component Map to AbstractController to avoid Keyboard special code and to speed up the Component.getComponent() method in general.
 - Added exceptions to native code for accurate error messages (instead of the standard printf). I use the checked IOException exclusively, but since exceptions are not exposed to user code, that can easily be changed.
 - Added printfJava(env, format, ...) to native code to avoid printfs altogether

Issues not fixed:
 - Linux plugin report buttons ids with semantic value (trigger button, thumb button etc.) while all other plugins use simple button indices (0, 1, 2, 3 etc.). This is a property of the underlying linux input API and will probably confuse some jinput programs.
 - The Plugin architecture seems somewhat complex and IMHO unnecessary. It involves custom Classloaders to separate the each Plugin's namespaces, but since you can't use custom Classloaders in restricted environments (web start, applets) the plugins have to have manually separate namespaces anyway. I'm inclined to remove it, but since it was there originally, there is probably some use case it covers I don't know about.

TODO:
 - A utility for collecting events from multiple controller at once. An application then just needs to register all its devices to the utility and only call poll() and getEventQueue() in one place. Event will probably need to be extended with a getController() method.
 



Offline elias

Senior Devvie





« Reply #1 - Posted 2006-03-15 13:18:38 »

For those interested in the binaries only, here's a zip package with all native binaries and the jinput.jar combined jar:

http://odense.kollegienet.dk/~naur/jinput-2-15032006.zip

 - elias

Offline Tomas

Junior Devvie




Agency9


« Reply #2 - Posted 2006-03-15 13:29:42 »

Cool! Cheesy

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

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #3 - Posted 2006-03-15 13:34:37 »

Excellent.  Thanks Elias!

Offline Jeff

JGO Coder




Got any cats?


« Reply #4 - Posted 2006-03-15 15:48:08 »

Terrific!  COngrats guys!  Its great to see you running with this Cool

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2006-03-17 05:49:10 »

Okay Guys,

Im trying to use JInput2 to geta roudn a nasty JINput bug.

My old axis finding code isnt working however.  oi used to compare an identifier string (eg "w" with the identifier.getName()) but it
doesnt seem to work anymore.

Suggestions?

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #6 - Posted 2006-03-21 00:56:40 »

I found and fixed the poblem.

Bug in my code that JInput happen to hide but JInput2 made pretty visible.

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #7 - Posted 2006-03-21 01:53:24 »

MAjor problem in my demo....

I seem to be getting the Raw plug in on WIn32 and as a result I am rading the wrong keyboard device,

How do I force it to dx8 ?

OR how do I recognize and reject the raw keyboard device?

Thanks

jk

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline elias

Senior Devvie





« Reply #8 - Posted 2006-03-21 18:47:12 »

I've commented out line 126 and line 132 in DefaultControllerEnvironment.java to disable the raw plugin. I can't commit here from the firewalled GDC wireless so you'll have to do it manually for now Smiley

 - elias

Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #9 - Posted 2006-03-21 22:46:27 »

Hi

I've merged elias changes in to the CVS repository at cvs.dev.java.net under the branch version2.

It's version 2 from the svn repository.

Endolf

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

JGO Coder




Got any cats?


« Reply #10 - Posted 2006-03-25 23:37:35 »

Thanks guys!

I actually figrued out how to force it to use the DX plugin only from the -D flags, but by default you probably want it that way and to have to use falags to enable the raw input device...

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #11 - Posted 2006-03-26 02:53:36 »

It's version 2 from the svn repository.

Ah.. "revision" 2... here I was poking around trying to find a "version2" tag or something Smiley.  2 seemed like such a low number for the head revision of a subversion repository Smiley

Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #12 - Posted 2006-03-26 08:51:37 »

Hi

Yeah, on svn it's revision 2, in CVS it's on a branch called 'version2'.

HTH

Endolf

Offline dugh

Senior Newbie





« Reply #13 - Posted 2006-03-28 17:00:30 »

I can build the oddlabs version fine, but when I test it with my own code (which worked earlier with this version of jinput: http://www.newdawnsoftware.com/resources/jinput/?C=M;O=D)
it is not finding a force feedback steering wheel I have connected.  I have the latest version of the sources with the raw plugin commented out.  I tried various combinations with dxinput.jar and the other dlls in the same folder or a "controller" folder.  I tried various values for -Djinput.plugins.
It recognizes the directx plugin, but only lists the mouse and keyboard.  It says "Failed to create rumblers: Failed to create effect (Ox80070057)".

I was just wondering where are the right places to put all the jar files and dll files, if that is the problem.   Thanks for any help.
Offline dugh

Senior Newbie





« Reply #14 - Posted 2006-03-28 17:36:59 »

Nevermind, I see the rumble stuff doesn't work like it did before.

Is the source code for this version of jinput:
http://www.newdawnsoftware.com/resources/jinput/?C=M;O=D
available anywhere?
All the files there appear to only have the binaries.
Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #15 - Posted 2006-03-28 19:41:39 »

Hi

It's all in CVS, details over at jinput.dev.java.net.

It's not tagged, so you'll have to extract it by date if you want a particular date.

HTH

Endolf.

Offline elias

Senior Devvie





« Reply #16 - Posted 2006-03-30 09:43:40 »

I've added support for wheels (and defaulted unknown devices as STICKs) and attempted to fix the FF issue for wheels (can't test since I don't have a wheel). Check out the latest source from subversion if you'd like to test it.

 - elias

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 (30 views)
2014-12-15 09:26:44

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

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

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

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

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

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

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

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

toopeicgaming1999 (32 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!