Class ActionApplication

java.lang.Object
com.jme3.app.LegacyApplication
com.jme3.app.SimpleApplication
jme3utilities.ui.ActionApplication
All Implemented Interfaces:
com.jme3.app.Application, com.jme3.input.controls.ActionListener, com.jme3.input.controls.InputListener, com.jme3.system.SystemListener
Direct Known Subclasses:
AcorusDemo

public abstract class ActionApplication extends com.jme3.app.SimpleApplication implements com.jme3.input.controls.ActionListener
Simple application with an action-oriented user interface.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    action string to generate a screenshot
    static final String
    action string to toggle video recording on/off

    Fields inherited from class com.jme3.app.SimpleApplication

    flyCam, fpsText, guiFont, guiNode, INPUT_MAPPING_CAMERA_POS, INPUT_MAPPING_EXIT, INPUT_MAPPING_HIDE_STATS, INPUT_MAPPING_MEMORY, rootNode, showSettings

    Fields inherited from class com.jme3.app.LegacyApplication

    assetManager, audioRenderer, cam, context, guiViewPort, inputEnabled, inputManager, joyInput, keyInput, listener, lostFocusBehavior, mouseInput, paused, prof, renderer, renderManager, settings, speed, stateManager, timer, touchInput, viewPort
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Instantiate an application with the appstates favored by SimpleApplication (AudioListenerState, ConstantVerifierState, DebugKeysAppState, FlyCamAppState, and StatsAppState) pre-attached.
    protected
    ActionApplication(com.jme3.app.state.AppState... initialAppStates)
    Instantiate an application with the specified appstates pre-attached.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Invoke the user's application startup code.
    static void
    Activate the named InputMode.
    static void
    designateSandbox(String desiredPath)
    Designate a directory for writing assets, and if it doesn't exist, create it.
    void
    didntHandle(String actionString)
    Callback invoked when an ongoing action isn't handled after running through the onAction(java.lang.String, boolean, float) methods of both the input mode and the application.
    static String
    filePath(String assetPath)
    Convert an asset path to a canonical filesystem path for writing the asset.
    Access the default input mode.
    com.jme3.system.AppSettings
    Access the live display settings.
    Access the signal tracker.
    float
    Return the effective speed of physics and animations.
    static boolean
    Test whether a sandbox has been designated.
    static String
    Generate a six-digit timestamp.
    void
    Callback invoked immediately after initializing the hotkey bindings of the default input mode.
    void
    onAction(String actionString, boolean ongoing, float tpf)
    Process an action that wasn't handled by the active input mode.
    void
    Callback invoked when the active InputMode changes.
    float
    Return the quality level for new video recordings.
    static String
    Determine the filesystem path to the directory for writing assets.
    void
    setRecordingQuality(float qualityLevel)
    Alter the quality level for new video recordings.
    void
    setSpeed(float newSpeed)
    Alter the effective speeds of physics simulation and all animations.
    final void
    Initialization code common to all action-oriented applications.
    void
    simpleUpdate(float tpf)
    Callback invoked once per frame.

    Methods inherited from class com.jme3.app.SimpleApplication

    getFlyByCamera, getGuiNode, getRootNode, initialize, isShowSettings, loadGuiFont, setDisplayFps, setDisplayStatView, setShowSettings, simpleRender, start, update

    Methods inherited from class com.jme3.app.LegacyApplication

    createCanvas, destroy, destroyInput, enqueue, enqueue, gainFocus, getAppProfiler, getAssetManager, getAudioRenderer, getCamera, getContext, getGuiViewPort, getInputManager, getListener, getLostFocusBehavior, getRenderer, getRenderManager, getStateManager, getTimer, getViewPort, handleError, isPauseOnLostFocus, loseFocus, requestClose, rescale, reshape, restart, runQueuedTasks, setAppProfiler, setAssetManager, setLostFocusBehavior, setPauseOnLostFocus, setSettings, setTimer, start, start, start, startCanvas, startCanvas, stop, stop

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • ActionApplication

      protected ActionApplication()
      Instantiate an application with the appstates favored by SimpleApplication (AudioListenerState, ConstantVerifierState, DebugKeysAppState, FlyCamAppState, and StatsAppState) pre-attached. A DefaultInputMode and a ScreenshotAppState will be attached during initialization.
    • ActionApplication

      protected ActionApplication(com.jme3.app.state.AppState... initialAppStates)
      Instantiate an application with the specified appstates pre-attached. A DefaultInputMode and a ScreenshotAppState will be attached during initialization.
      Parameters:
      initialAppStates - the appstates to be pre-attached (may be null, unaffected)
  • Method Details

    • acorusInit

      public abstract void acorusInit()
      Invoke the user's application startup code.
    • activateInputMode

      public static void activateInputMode(String shortName)
      Activate the named InputMode.
      Parameters:
      shortName - the short name of the desired InputMode (not null, mode must be initialized)
    • designateSandbox

      public static void designateSandbox(String desiredPath) throws IOException
      Designate a directory for writing assets, and if it doesn't exist, create it. Also causes a ScreenshotAppState to be added during initialization.

      Invoke this at most once, prior to initialization---for instance, in main().

      Parameters:
      desiredPath - the desired filesystem path, or null for "./Written Assets"
      Throws:
      IOException - if directory creation fails
    • didntHandle

      public void didntHandle(String actionString)
      Callback invoked when an ongoing action isn't handled after running through the onAction(java.lang.String, boolean, float) methods of both the input mode and the application. Meant to be overridden.
      Parameters:
      actionString - textual description of the action (not null)
    • filePath

      public static String filePath(String assetPath)
      Convert an asset path to a canonical filesystem path for writing the asset. Assumes that designateSandbox(java.lang.String) has been invoked.
      Parameters:
      assetPath - (not null)
      Returns:
      the file-system path (not null, not empty)
    • getDefaultInputMode

      public InputMode getDefaultInputMode()
      Access the default input mode.
      Returns:
      pre-existing instance (not null)
    • getSettings

      public com.jme3.system.AppSettings getSettings()
      Access the live display settings.
      Returns:
      the pre-existing instance (not null)
    • getSignals

      public Signals getSignals()
      Access the signal tracker.
      Returns:
      pre-existing instance (not null)
    • hasSandbox

      public static boolean hasSandbox()
      Test whether a sandbox has been designated.
      Returns:
      true if designated, otherwise false
    • hhmmss

      public static String hhmmss()
      Generate a six-digit timestamp.
      Returns:
      the timestamp value
    • moreDefaultBindings

      public void moreDefaultBindings()
      Callback invoked immediately after initializing the hotkey bindings of the default input mode. Meant to be overridden. Can be used to add action names and/or override those bindings.
    • onInputModeChange

      public void onInputModeChange(InputMode oldMode, InputMode newMode)
      Callback invoked when the active InputMode changes. Meant to be overridden.
      Parameters:
      oldMode - the old mode, or null if none
      newMode - the new mode, or null if none
    • recordingQuality

      public float recordingQuality()
      Return the quality level for new video recordings.
      Returns:
      the level (≥0, ≤1)
    • sandboxPath

      public static String sandboxPath()
      Determine the filesystem path to the directory for writing assets. Assumes that designateSandbox(java.lang.String) has been invoked.
      Returns:
      the canonical pathname (not null, not empty)
    • setRecordingQuality

      public void setRecordingQuality(float qualityLevel)
      Alter the quality level for new video recordings.
      Parameters:
      qualityLevel - (≥0, ≤1, default=1)
    • onAction

      public void onAction(String actionString, boolean ongoing, float tpf)
      Process an action that wasn't handled by the active input mode.
      Specified by:
      onAction in interface com.jme3.input.controls.ActionListener
      Parameters:
      actionString - textual description of the action (not null)
      ongoing - true if the action is ongoing, otherwise false
      tpf - time interval between frames (in seconds, ≥0)
    • getSpeed

      public float getSpeed()
      Return the effective speed of physics and animations.
      Overrides:
      getSpeed in class com.jme3.app.SimpleApplication
      Returns:
      the speed (>0, standard speed → 1)
    • setSpeed

      public void setSpeed(float newSpeed)
      Alter the effective speeds of physics simulation and all animations.
      Overrides:
      setSpeed in class com.jme3.app.SimpleApplication
      Parameters:
      newSpeed - animation speed (>0, normal speed → 1)
    • simpleInitApp

      public final void simpleInitApp()
      Initialization code common to all action-oriented applications.
      Specified by:
      simpleInitApp in class com.jme3.app.SimpleApplication
    • simpleUpdate

      public void simpleUpdate(float tpf)
      Callback invoked once per frame.
      Overrides:
      simpleUpdate in class com.jme3.app.SimpleApplication
      Parameters:
      tpf - time interval between frames (in seconds, ≥0)