com.jme3.input.FlyByCamera Java Examples

The following examples show how to use com.jme3.input.FlyByCamera. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleApplication.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void initialize() {
    super.initialize();

    guiNode.setQueueBucket(Bucket.Gui);
    guiNode.setCullHint(CullHint.Never);
    loadFPSText();
    loadStatsView();
    viewPort.attachScene(rootNode);
    guiViewPort.attachScene(guiNode);

    if (inputManager != null) {
        flyCam = new FlyByCamera(cam);
        flyCam.setMoveSpeed(1f);
        flyCam.registerWithInput(inputManager);

        if (context.getType() == Type.Display) {
            inputManager.addMapping(INPUT_MAPPING_EXIT, new KeyTrigger(KeyInput.KEY_ESCAPE));
        }

        inputManager.addMapping(INPUT_MAPPING_CAMERA_POS, new KeyTrigger(KeyInput.KEY_C));
        inputManager.addMapping(INPUT_MAPPING_MEMORY, new KeyTrigger(KeyInput.KEY_M));
        inputManager.addMapping(INPUT_MAPPING_HIDE_STATS, new KeyTrigger(KeyInput.KEY_F5));
        inputManager.addListener(actionListener, INPUT_MAPPING_EXIT,
                INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_MEMORY, INPUT_MAPPING_HIDE_STATS);
        
    }

    // call user code
    simpleInitApp();
}
 
Example #2
Source File: FlyCamAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 *  This is called by SimpleApplication during initialize().
 */
void setCamera( FlyByCamera cam ) {
    this.flyCam = cam;
}
 
Example #3
Source File: FlyCamAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FlyByCamera getCamera() {
    return flyCam;
}
 
Example #4
Source File: SimpleApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@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) {

        // We have to special-case the FlyCamAppState because too
        // many SimpleApplication subclasses expect it to exist in
        // simpleInit().  But at least it only gets initialized if
        // the app state is added.
        if (stateManager.getState(FlyCamAppState.class) != null) {
            flyCam = new FlyByCamera(cam);
            flyCam.setMoveSpeed(1f); // odd to set this here but it did it before
            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();
}
 
Example #5
Source File: GameControl.java    From MonkeyBrains with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Add all fly camera settings that will be used in game.
 * @param flyCam 
 */
public void setFlyCameraSettings(FlyByCamera flyCam);
 
Example #6
Source File: SimpleApplication.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 2 votes vote down vote up
/**
 * Retrieves flyCam
 * @return flyCam Camera object
 *
 */
public FlyByCamera getFlyByCamera() {
    return flyCam;
}
 
Example #7
Source File: SimpleApplication.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 2 votes vote down vote up
/**
 * Retrieves flyCam
 * @return flyCam Camera object
 *
 */
public FlyByCamera getFlyByCamera() {
    return flyCam;
}