Java Code Examples for com.jme3.app.Application#getCamera()

The following examples show how to use com.jme3.app.Application#getCamera() . 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: CameraMovementState.java    From Lemur with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void initialize(Application app) {
    this.camera = app.getCamera();
    
    if( inputMapper == null )
        inputMapper = GuiGlobals.getInstance().getInputMapper();
    
    // Most of the movement functions are treated as analog.        
    inputMapper.addAnalogListener(this,
                                  CameraMovementFunctions.F_Y_LOOK,
                                  CameraMovementFunctions.F_X_LOOK,
                                  CameraMovementFunctions.F_MOVE,
                                  CameraMovementFunctions.F_ELEVATE,
                                  CameraMovementFunctions.F_STRAFE);

    // Only run mode is treated as a 'state' or a trinary value.
    // (Positive, Off, Negative) and in this case we only care about
    // Positive and Off.  See CameraMovementFunctions for a description
    // of alternate ways this could have been done.
    inputMapper.addStateListener(this,
                                 CameraMovementFunctions.F_RUN);
}
 
Example 2
Source File: CameraMovementState.java    From Lemur with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
protected void initialize(Application app) {
    this.camera = app.getCamera();
    
    AppMode.getInstance().onModeEnable( this, MODE_FLY_CAMERA );
    
    InputMapper inputMapper = GuiGlobals.getInstance().getInputMapper();
    inputMapper.addDelegate( MainFunctions.F_TOGGLE_MOVEMENT, this, "toggleEnabled" );
    
    inputMapper.addAnalogListener(this,
                                  CameraMovementFunctions.F_Y_LOOK,
                                  CameraMovementFunctions.F_X_LOOK,
                                  CameraMovementFunctions.F_MOVE,
                                  CameraMovementFunctions.F_ALTITUDE,
                                  CameraMovementFunctions.F_STRAFE);

    inputMapper.addStateListener(this,
                                 CameraMovementFunctions.F_RUN);
}
 
Example 3
Source File: AudioListenerState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
protected void initialize(Application app) {
    this.camera = app.getCamera();
    this.listener = app.getListener();
}