Search in sources :

Example 1 with FlyByCamera

use of com.jme3.input.FlyByCamera in project jmonkeyengine by jMonkeyEngine.

the class FlyCamAppState method initialize.

@Override
public void initialize(AppStateManager stateManager, Application app) {
    super.initialize(stateManager, app);
    this.app = app;
    if (app.getInputManager() != null) {
        if (flyCam == null) {
            flyCam = new FlyByCamera(app.getCamera());
        }
        flyCam.registerWithInput(app.getInputManager());
    }
}
Also used : FlyByCamera(com.jme3.input.FlyByCamera)

Example 2 with FlyByCamera

use of com.jme3.input.FlyByCamera in project jmonkeyengine by jMonkeyEngine.

the class SimpleApplication method initialize.

@Override
public void initialize() {
    super.initialize();
    // Several things rely on having this
    guiFont = loadGuiFont();
    guiNode.setQueueBucket(Bucket.Gui);
    guiNode.setCullHint(CullHint.Never);
    viewPort.attachScene(rootNode);
    guiViewPort.attachScene(guiNode);
    if (inputManager != null) {
        // the app state is added.
        if (stateManager.getState(FlyCamAppState.class) != null) {
            flyCam = new FlyByCamera(cam);
            // odd to set this here but it did it before
            flyCam.setMoveSpeed(1f);
            stateManager.getState(FlyCamAppState.class).setCamera(flyCam);
        }
        if (context.getType() == Type.Display) {
            inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE));
        }
        if (stateManager.getState(StatsAppState.class) != null) {
            inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5));
            inputManager.addListener(actionListener, INPUT_MAPPING_HIDE_STATS);
        }
        inputManager.addListener(actionListener, INPUT_MAPPING_EXIT);
    }
    if (stateManager.getState(StatsAppState.class) != null) {
        // Some of the tests rely on having access to fpsText
        // for quick display.  Maybe a different way would be better.
        stateManager.getState(StatsAppState.class).setFont(guiFont);
        fpsText = stateManager.getState(StatsAppState.class).getFpsText();
    }
    // call user code
    simpleInitApp();
}
Also used : FlyByCamera(com.jme3.input.FlyByCamera) KeyTrigger(com.jme3.input.controls.KeyTrigger)

Aggregations

FlyByCamera (com.jme3.input.FlyByCamera)2 KeyTrigger (com.jme3.input.controls.KeyTrigger)1