I recently moved over from SimpleGame to standard game and I can't get input to work. I just started programming pretty recently and i'm afraid this is way over my head. None of the examples are working for me.
I can't get InputHandler to work at all. Is there anyone that could give me a sample of how to implement a simple game that simply move a box?
Also, the game I'm trying to implement needs to have a cursor that fluidly leaves the window and goes back into it easily. Would that be hard to implement?
Take a look at TestControls (package jmetest.input.controls) it moves a Box in StandardGame.
you can call MouseInput.get().setCursorVisible(true); to make the mouse cursor visible, and have it leave the window.
It worked, thanks!
I'll attach the edited code in case someone needs it.
GameControlManager manager = new GameControlManager();
GameControl forward = manager.addControl("Forward");
forward.addBinding(new KeyboardBinding(KeyInput.KEY_W));
GameControl backward = manager.addControl("Backward");
backward.addBinding(new KeyboardBinding(KeyInput.KEY_S));
GameControl left = manager.addControl("Move Left");
left.addBinding(new KeyboardBinding(KeyInput.KEY_A));
GameControl right = manager.addControl("Move Right");
right.addBinding(new KeyboardBinding(KeyInput.KEY_D));
ThrottleController VerticalThrottle = new ThrottleController(model, forward, 10.0f, backward, -10.0f, 0, 10.0f, 1.0f, true, Axis.Y);
model.addController(VerticalThrottle);
ThrottleController HorizThrottle = new ThrottleController(model, left, 10.0f, right, -10.0f, 0, 10.0f, 1.0f, true, Axis.X);
model.addController(HorizThrottle);
So simple and concise…doesn't it just make you want to cry tears of joy?