Work on input system + joystick support

I started working on the input system and input handlers. The following changes have already been made:


  • InputSystem.createInputSystem is deprecated - not needed any more
  • InputSystem.getMouseInput and getKeyInput is deprecated - use MouseInput.get() and KeyInput.get()
  • Joystick support is in - please test it, starting point is com.jme.input.joystick.JoystickInput
  • one can listen to mouse/joystick/keyboard events



    Please post any problems with the new input stuff.

    I'll post further advancement here…

Further cleanup:


  • InputHandler.getKeyBindingManager() removed as KeyBindingManager is a singleton use KeyBindingManager.getKeyBindingManager() instead
  • InputHandler.setKeyInput, getKeyInput, getMouseInput, setMouseInput removed as there is only one instance of those, too
  • addBufferedKeyAction removed as not used, events from KeyInput may be used, probably all actions get event based
  • InputActionEvent.isKeyDown was removed, please use KeyInput.get().isKeyDown instead
  • KeyInput.next() and other event methods are removed, too. Use new addListener method for subscribing a listener instead.



    Sorry for posting late - I thought nobody was using them.

I used them but without luck so far. I'm still trying to capture key press events for a chat box.

Today I changed my custom input handler so that it works with the new methods and added a check in update() which should either test for actions or just capture the chars.

The capturing works but the action is called as well even in capturing mode.



This is the custom handler:

http://cvs.world-of-mystery.de/cgi-bin/cvsweb.cgi/wom/src/de/worldofmystery/client/WomInputHandler.java



Where else could the action be performed? I cannot find it.

AAARG…



I found it. In the game class I call isValidCommand() and I thought it just processes the events in InputHandler. But these are two different things as KeyBindingManager is checking the keyboard state itself.

So the capturing worked in the custom InputHandler and the action came from the main game class.

irrisor said:

I started working on the input system and input handlers. The following changes have already been made:

- InputSystem.createInputSystem is deprecated - not needed any more
- InputSystem.getMouseInput and getKeyInput is deprecated - use MouseInput.get() and KeyInput.get()
- Joystick support is in - please test it, starting point is com.jme.input.joystick.JoystickInput
- one can listen to mouse/joystick/keyboard events

Please post any problems with the new input stuff.
I'll post further advancement here...


I don't want to sound ungrateful, as I know the amount of work that goes into this, but could I repectfully request that next time you make major refactorings you make some posts in advance rather than just go ahead and update the cvs.

Apart from keeping the cvs in synch with other dependant libs (I think jmebui is still broken now, as are some others no doubt)

I know cvs changes, and doing a regular update on cvs one usually expects a few changes, but when a bunch of code changes need to be done and dependant libs are also broken (hence totally breaking your app) it's a little frustrating...even more so when you have to trawl through code to find the changes you need to retrofit.

As there are a number of non-core jme libs out there I also think it is important to co-ordinate refactorings a little more closely so when implemented they are all refactored at once. Better for everyone.

my 0.2 cents eclipse package explorer red x rant:-/

ps: if you did post some warning notice in advance, my apologies as I missed it

Ok…something bad is up with this.



I just ran TestCloth out of the box, which used to run fine…great FPS as well.



Now it stutters and something is up with DX8Hat?



13-Oct-2005 10:42:13 com.jme.app.BaseGame start

INFO: Application started.

13-Oct-2005 10:42:13 com.jme.system.PropertiesIO <init>

INFO: PropertiesIO created

13-Oct-2005 10:42:13 com.jme.system.PropertiesIO load

INFO: Read properties

OS name is: Windows XP

DX8 plugin is supported

OS name is: Windows XP

DX8 plugin is supported

Creating Logitech WingMan RumblePad USB polling = true

Creating XD-0608-U polling = false

Creating P5  USB polling = false

Creating P5  USB polling = false

Creating ST7 RS232 USB BIOFBK polling = false

Creating PPJoy Virtual joystick 1 polling = true

OS name is: Windows XP

DX8 plugin is supported

13-Oct-2005 10:42:15 com.jme.system.lwjgl.LWJGLDisplaySystem <init>

INFO: LWJGL Display System created.

13-Oct-2005 10:42:15 com.jme.system.PropertiesIO save

INFO: Saved properties

13-Oct-2005 10:42:15 com.jme.system.lwjgl.LWJGLDisplaySystem <init>

INFO: LWJGL Display System created.

13-Oct-2005 10:42:16 com.jme.renderer.lwjgl.LWJGLRenderer <init>

INFO: LWJGLRenderer created. W:  1024H: 768

13-Oct-2005 10:42:16 com.jme.renderer.AbstractCamera <init>

INFO: Camera created.

13-Oct-2005 10:42:16 com.jme.util.lwjgl.LWJGLTimer <init>

INFO: Timer resolution: 1000 ticks per second

13-Oct-2005 10:42:16 com.jme.scene.Node <init>

INFO: Node created.

13-Oct-2005 10:42:16 com.jme.scene.Node <init>

INFO: Node created.

13-Oct-2005 10:42:16 com.jme.scene.Node attachChild

INFO: Child (FPS label) attached to this node (FPS node)

13-Oct-2005 10:42:16 com.jme.scene.Node attachChild

INFO: Child (sphere) attached to this node (rootNode)

13-Oct-2005 10:42:17 com.jme.scene.Node attachChild

INFO: Child (cloth) attached to this node (rootNode)

Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT: 17999Unexpected value for DX8 HAT:



and so on for a looooooong time

Still runs fine on my side, but I have no joystick, so it's most likely joystick support itself with the issue and not the particular test.



Update: problem message was coming from PPJoy - "Creating PPJoy Virtual joystick 1 polling = true", which I uninstalled and message gone. Worked ok before under native jinput so not sure what has changed with the jme/lwjgl implementation.

It seems I really underestimated the number of uses of these methods  :-o - sorry for that. I will be more careful next time and will be setting even small methods to deprecated instead of removing them instantly; and consider a warning on major changes, sure.



Concerning other dependent libs: what you say is true - but at least I have sent a patch for bui to Sam and a new version of nui to Guurk before checking in - I thought it would get in quickly…

Ok, some of the removed methods went back in - set to deprecated instead.

No worries…all fixed for me now…though I had a bitch of a time tracking down a missing MouseInput.get().update() :slight_smile:



thanks for the updates.

Concerning the joystick issues - seems like a problem in jinput. So if you want to have joystick support in your game, please report the issue over there.

If you don't want joystick support, I have added a method to disable it (so messages will be gone): simply make the following call before creating display (start the game)

JoystickInput.setProvider( InputSystem.INPUT_SYSTEM_DUMMY );

sonicviz,



Though I understand your plight, this is the inherent risk you take by running directly from CVS.  If you are developing a game and need the assurance of stability during development you should probably be using the release instead.  You have no guarantees that the CVS won't drastically change at any point in time because it is, and must remain the "development" code.  I think for exactly your situation is why there is a release build.



darkfrog

Concerning DUMMY… shouldn't this be default?

As it has potential to cause problems - yes, I'll disable it by default.

darkfrog said:

sonicviz,

Though I understand your plight, this is the inherent risk you take by running directly from CVS.  If you are developing a game and need the assurance of stability during development you should probably be using the release instead.  You have no guarantees that the CVS won't drastically change at any point in time because it is, and must remain the "development" code.  I think for exactly your situation is why there is a release build.

darkfrog


Sure, that's a risk..but I'm more prototyping than developing a game so I'm willing to trade off. My point being a suggestion for more coordination and warning, rather than just dump a whole load of new stuff in. There's levels of development. I'm not sure at what point you regard something as being developed enough that you can check/merge it into the main branch, or keep it seperate until tested and complete (at least beyond basic development). Just a thought.
irrisor said:

Concerning the joystick issues - seems like a problem in jinput. So if you want to have joystick support in your game, please report the issue over there.
If you don't want joystick support, I have added a method to disable it (so messages will be gone): simply make the following call before creating display (start the game)

JoystickInput.setProvider( InputSystem.INPUT_SYSTEM_DUMMY );




I'm not sure if the problem is Jinput.

I'm using a usb biofeedback interface and a usb Logitech wingman runmlepad (+ 2 P5 usb gloves).
The rumblepad I've been accessing by Jinput directly (ie: non lwjgl and non jme) for some time, along with all the other usb devices and they have been working great. After your update I can't get access to the USB biofeedback device. I had to JoystickInput.setProvider( InputSystem.INPUT_SYSTEM_DUMMY ); and now I can use it fine, as well as access the rumblepad ok by direct (ie non jME) Jinput access.

I suspect that somewhere there is a problem with the jinput implementation, but buggered if I know where it is:-)
Could be the lwjgl implmentation?

I investigated a bit on the message and it looks like this: jInput prints the error message ("Unexpected value for DX8 HAT") and it seems to be caused by lwjgl, which tries to use everything as an 'axis' if it does not know the type…



And, yes, if you initialize the lwjgl controllers and update the display before handling the jinput events, lwjgl Controllers.update consumes all the events  :expressionless: