@wezrule said:
I don't think its possible. Just factor out ur event code into a function and call that directly.
How? To do it, I would have to modify some methods in InputManager class. To modify any method in InputManager class, I need to re-write it, because all fields in this class are private, so I don't have any access to them. I cannot also add to my subclass of InputManager any methods that use that private fields. The only way to do something is to re-write whole class...
I’ll try with writing own Input and modifying initInput() method in Application class (which is also private, so I’ll have to re-write 2 other methods in this class…).
EDIT:
Wow, more privates that I previously thought.
Application.java:
[java] public void initialize(){
if (assetManager == null){
initAssetManager(); // private
}
initDisplay(); // private
initCamera(); // private
if (inputEnabled){
initInput(); // private, re-implementing it by myself
}
initAudio(); // private
// update timer so that the next delta is not too large
// timer.update();
timer.reset();
// user code here..
}[/java]
It seems that the simplest way is to do what I want is to call super.initialize()
normally and then create InputManager second time… 
<p>EDIT2:
Am I doing something wrong here? The code doesn’t work. update()
method is called, but there’s no effect after all (the FlyByCam isn’t moving…).
[java] keyInput = new KeyInput() {
protected RawInputListener listener;
@Override
public void update() {
KeyInputEvent evt = new KeyInputEvent(KEY_W, 'w', true, false);
evt.setTime(System.nanoTime());
listener.onKeyEvent(evt);
}
@Override
public void setInputListener(RawInputListener listener) {
this.listener = listener;
}
@Override
public boolean isInitialized() {
return true;
}
@Override
public void initialize() {
}
@Override
public long getInputTimeNanos() {
return System.nanoTime();
}
@Override
public void destroy() {
}
};[/java]
<p>EDIT3:
Yeah, now it works.
[java]KeyInputEvent evt = new KeyInputEvent(KEY_W, ‘w’, new Random().nextBoolean(), false);[/java]
There’s a bit of random in it.