as handling input was quite complicated in the past the InputHandler is about to be revamped:
InputHandlers get organized in a tree structure to allow for composite handlers, e.g. FirstPersonHandler is composed from MouseLookHandler and KeyboardLookHandler
InputHandlers can be disabled, which cause them not to update any sub-handlers
InputActions are not divided into key and mouse actions any more, to easy controls configuration
actions can query the ActionEvent for the trigger that caused their invocation, and they get additional data about it (e.g. keyCode, axis position, button state)
First changes will be checked in today. I tried to keep most of the old behaviour and have set methods to deprecated. The major effect on jME users are:
InputAction becomes an abstract class instead of an interface: 'implements InputAction' must be changed to 'extends InputAction'
MouseInputAction becomes a class (change 'implements', too)
InputAction got key and allowsRepeats deprecated, these trigger parameters are specified in InputHandler.addAction, now
InputHandler.setKeySpeed and setMouseSpeed cannot be used any more, but setActionSpeed
I'm hesitant to update cvs now due to the work I had to fix last time, especially when you imply there will be more changes coming.
Could you explain a little more clearly what your refactoring path/timeline is likely to be?
Are you doing it in stages or in one go? if not in one go, fully tested, why not?
The reason I ask is that I am prototyping Jme with a number of alternate control interfaces (biofeedback and 6dof) so changes to the input system impact me greatly atm, and I'd just like to get a better idea of what is happening.
The slow movement (and speed of some other actions) in the tests resulted from use of the deprecated setKeySpeed and from the change in FirstPersonHandler: it is composed from two handlers now, one for mouse, one for keyboard. setKeySpeed and setMouseSpeed thus were not able to set the speed. I have corrected the tests now (and Mojo has increased the default speed in SimpleGame). I will write about new stuff in InputHandler in the Wiki when the implementation is done…
@sonicviz: I have no timeline for the work on jME as it depends on how much spare time I have for it (as the other developers, I guess). But I want to get the input stuff done quickly - so I could say it's a matter of days, most probably below one week…
Another thing, sonicviz: you seem to have very interesting controllers :-o attached to your jME apps - do you have additional requirements for the input stuff in jME?
@sonicviz: I have no timeline for the work on jME as it depends on how much spare time I have for it (as the other developers, I guess). But I want to get the input stuff done quickly - so I could say it's a matter of days, most probably below one week....
Another thing, sonicviz: you seem to have very interesting controllers :-o attached to your jME apps - do you have additional requirements for the input stuff in jME?
Thanks for the info. Could you make a post when it's all in and done?
re: controllers. yup...I'm really interested in pushing games into new interaction areas. Fortunately Nintendo thinks the same (ie: revolution), so hopefully all my hacking will be worth the effort:-)
re: requirements...not at the moment. I'll need to refactor based on your changes and then I'll have another look at generic issues that could be extracted.
Input stuff is nearly complete. But I won't have time to finish it the next days (rl kicks in ;)). But I can already tell you that no further API changes are made. So don't fear any adaption work - only easier working with jME because of the new features
Perhaps I missed something clearly stated elsewhere, but I'm having problems using FirstPersonHandler now. I changed to the following code and I still can't get the mouse look to work:
input = new FirstPersonHandler(camera, properties.getRenderer());
input.getKeyboardLookHandler().setActionSpeed(50.0f);
input.getMouseLookHandler().setActionSpeed(1.0f);
input.setActionSpeed(1.0f);
/**
* <code>PhysicsGame</code> is a implementation of AbstractGame to simplify the process
* of physics game creation and management.
*
* @author Matthew D. Hicks
*/
public class PhysicsGame extends AbstractGame {
private static String fontLocation = "/com/jme/app/defaultfont.tga";
public PhysicsGame(Game game) {
// TODO remove eventually - game should provide the display info.
setDialogBehaviour(ALWAYS_SHOW_PROPS_DIALOG);
this.game = game;
commands = new ArrayList();
}
public Camera getCamera() {
return camera;
}
public Game getGame() {
return game;
}
public PhysicsWorld getPhysicsWorld() {
return physicsWorld;
}
public Node getRootNode() {
return rootNode;
}
public float getTimePerFrame() {
return timePerFrame;
}
True, I wrote that implementation of joystick support. I tried commenting it out and it didn't make any difference at all. I can use the keyboard to move around with the arrow keys, but mouse support is not functioning in my game it would seem.
I'm running the most recent build of jME from CVS. Do I need to initialize anything to do with mouse support?
I think I'll have to start over from scratch on this thing and just pull everything from SimpleGame and BaseGame and just pulling junk out in order to figure out what the problem is.
Made no difference at all. It's not that it's moving incredibly slow, it's just not moving at all.
I haven't spent a whole lot of time debugging this. I need to create a test case and get down to the problem. I'm not sure what my problem is, but it would seem this is a bug of some sort since I've got all the required aspects in order to make mouse support work, correct?
After quite a bit of looking I finally figured out the problem. This is something that will need to be put into the wiki when Irrisor gets to that, but with the new input system the following call has to be made:
InputSystem.update();
It is in the while loop in BaseGame and since I extend AbstractGame and wrote this previous to the re-write I did not have this in my code.
Hope this keeps someone else from having the headache I've had. :o
What do you think about some warning message if any calls are made to request information from the InputSystem before InputSystem.update() is called for the first time? This would be a great way to keep people from having the same problem I had and not knowing how to resolve it.