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
FieldsModifier and TypeFieldDescriptionstatic final Stringaction string to generate a screenshotstatic final Stringaction 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, showSettingsFields 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
ConstructorsModifierConstructorDescriptionprotectedInstantiate an application with the appstates favored by SimpleApplication (AudioListenerState, ConstantVerifierState, DebugKeysAppState, FlyCamAppState, and StatsAppState) pre-attached.protectedActionApplication(com.jme3.app.state.AppState... initialAppStates) Instantiate an application with the specified appstates pre-attached. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidInvoke the user's application startup code.static voidactivateInputMode(String shortName) Activate the named InputMode.static voiddesignateSandbox(String desiredPath) Designate a directory for writing assets, and if it doesn't exist, create it.voiddidntHandle(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 StringConvert an asset path to a canonical filesystem path for writing the asset.Access the default input mode.com.jme3.system.AppSettingsAccess the live display settings.Access the signal tracker.floatgetSpeed()Return the effective speed of physics and animations.static booleanTest whether a sandbox has been designated.static Stringhhmmss()Generate a six-digit timestamp.voidCallback invoked immediately after initializing the hotkey bindings of the default input mode.voidProcess an action that wasn't handled by the active input mode.voidonInputModeChange(InputMode oldMode, InputMode newMode) Callback invoked when the active InputMode changes.floatReturn the quality level for new video recordings.static StringDetermine the filesystem path to the directory for writing assets.voidsetRecordingQuality(float qualityLevel) Alter the quality level for new video recordings.voidsetSpeed(float newSpeed) Alter the effective speeds of physics simulation and all animations.final voidInitialization code common to all action-oriented applications.voidsimpleUpdate(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, updateMethods inherited from class com.jme3.app.LegacyApplication
createCanvas, destroy, destroyInput, enqueue, enqueue, gainFocus, getAppProfiler, getAssetManager, getAudioRenderer, getCamera, getContext, getDisplays, getGuiViewPort, getInputManager, getListener, getLostFocusBehavior, getPrimaryDisplay, 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:
onActionin 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:
getSpeedin 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:
setSpeedin 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:
simpleInitAppin classcom.jme3.app.SimpleApplication
-
simpleUpdate
public void simpleUpdate(float tpf) Callback invoked once per frame.- Overrides:
simpleUpdatein classcom.jme3.app.SimpleApplication- Parameters:
tpf- time interval between frames (in seconds, ≥0)
-