Package jme3utilities.ui
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
Modifier and TypeFieldDescriptionstatic final String
action string to generate a screenshotstatic final String
action string to toggle video recording on/offFields 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
ModifierConstructorDescriptionprotected
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 TypeMethodDescriptionabstract void
Invoke the user's application startup code.static void
activateInputMode
(String shortName) 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 theonAction(java.lang.String, boolean, float)
methods of both the input mode and the application.static String
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
getSpeed()
Return the effective speed of physics and animations.static boolean
Test whether a sandbox has been designated.static String
hhmmss()
Generate a six-digit timestamp.void
Callback invoked immediately after initializing the hotkey bindings of the default input mode.void
Process an action that wasn't handled by the active input mode.void
onInputModeChange
(InputMode oldMode, InputMode newMode) 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
-
Field Details
-
asScreenShot
action string to generate a screenshot- See Also:
-
asToggleRecorder
action string to toggle video recording on/off- See Also:
-
-
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
Activate the named InputMode.- Parameters:
shortName
- the short name of the desired InputMode (not null, mode must be initialized)
-
designateSandbox
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
Callback invoked when an ongoing action isn't handled after running through theonAction(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
Convert an asset path to a canonical filesystem path for writing the asset. Assumes thatdesignateSandbox(java.lang.String)
has been invoked.- Parameters:
assetPath
- (not null)- Returns:
- the file-system path (not null, not empty)
-
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
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
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
Callback invoked when the active InputMode changes. Meant to be overridden.- Parameters:
oldMode
- the old mode, or null if nonenewMode
- 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
Determine the filesystem path to the directory for writing assets. Assumes thatdesignateSandbox(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
Process an action that wasn't handled by the active input mode.- Specified by:
onAction
in interfacecom.jme3.input.controls.ActionListener
- Parameters:
actionString
- textual description of the action (not null)ongoing
- true if the action is ongoing, otherwise falsetpf
- time interval between frames (in seconds, ≥0)
-
getSpeed
public float getSpeed()Return the effective speed of physics and animations.- Overrides:
getSpeed
in classcom.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 classcom.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 classcom.jme3.app.SimpleApplication
-
simpleUpdate
public void simpleUpdate(float tpf) Callback invoked once per frame.- Overrides:
simpleUpdate
in classcom.jme3.app.SimpleApplication
- Parameters:
tpf
- time interval between frames (in seconds, ≥0)
-