Package jme3utilities.ui
Class AcorusDemo
java.lang.Object
com.jme3.app.LegacyApplication
com.jme3.app.SimpleApplication
jme3utilities.ui.ActionApplication
jme3utilities.ui.AcorusDemo
- All Implemented Interfaces:
com.jme3.app.Application
,com.jme3.input.controls.ActionListener
,com.jme3.input.controls.InputListener
,com.jme3.system.SystemListener
An ActionApplication with additional data and methods for use in demos.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
action string to request JVM garbage collectionstatic final String
action string to activate the display-settings editorstatic final String
action to toggle the state of the help nodestatic final String
action to toggle animation and physics simulation: paused/runningstatic final String
action to toggle visualization of world axesstatic final Logger
message logger for this classstatic final float
animation/physics speed when pausedFields inherited from class jme3utilities.ui.ActionApplication
asScreenShot, asToggleRecorder
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
ModifierConstructorDescriptionprotected
Instantiate a demo with the appstates favored by SimpleApplication (AudioListenerState, ConstantVerifierState, DebugKeysAppState, FlyCamAppState, and StatsAppState) pre-attached.protected
AcorusDemo
(com.jme3.app.state.AppState... initialAppStates) Instantiate a demo with the specified appstates pre-attached. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Initialize this application.static float
advanceFloat
(float[] valuesArray, float startValue, int amount) Advance a float selection by the specified (cyclic) amount.static int
advanceInt
(int[] valuesArray, int startValue, int amount) Advance an integer selection by the specified (cyclic) amount.static String
advanceString
(String[] valuesArray, String startValue, int amount) Advance a String selection by the specified (cyclic) amount.boolean
Test whether the world axes are enabled.void
attachWorldAxes
(float axisLength) Add a visualizer for the axes of the world coordinate system.static void
centerCgm
(com.jme3.scene.Spatial cgModel) Translate a model's center so that the model rests on the X-Z plane, and its center lies on the Y axis.com.jme3.font.Rectangle
detailedHelpBounds
(int viewPortWidth, int viewPortHeight) Calculate screen bounds for a detailed help node.com.jme3.material.Material
findMaterial
(String name) Find the named Material in the library.void
Initialize the library of named materials.Access the HelpBuilder for this application.boolean
isPaused()
Test whether animation is paused.void
Process an action that wasn't handled by the active InputMode.void
onColorSpaceChange
(com.jme3.texture.image.ColorSpace newSpace) Update colors after the renderer's ColorSpace changes.void
onInputModeChange
(InputMode oldMode, InputMode newMode) Callback invoked when the active InputMode changes.void
onViewPortResize
(int newWidth, int newHeight) Update the GUI layout after the ViewPort gets resized.void
registerMaterial
(String name, com.jme3.material.Material material) Add a Material to the library.static void
setCgmHeight
(com.jme3.scene.Spatial cgModel, float height) Scale the specified C-G model uniformly so that it has the specified height, assuming Y-up orientation.void
setHelpVersion
(HelpVersion newVersion) Display the specified version of the help node.void
simpleUpdate
(float tpf) Callback invoked once per frame.void
Toggle between the detailed help node and the minimal version.void
Toggle the animation and physics simulation: paused/running.void
Toggle visualization of world axes.void
Update the help node to reflect changed bindings.Methods inherited from class jme3utilities.ui.ActionApplication
activateInputMode, designateSandbox, didntHandle, filePath, getDefaultInputMode, getSettings, getSignals, getSpeed, hasSandbox, hhmmss, moreDefaultBindings, recordingQuality, sandboxPath, setRecordingQuality, setSpeed, simpleInitApp
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
-
pausedSpeed
public static final float pausedSpeedanimation/physics speed when paused- See Also:
-
loggerA
message logger for this class -
asCollectGarbage
action string to request JVM garbage collection- See Also:
-
asEditDisplaySettings
action string to activate the display-settings editor- See Also:
-
asToggleHelp
action to toggle the state of the help node- See Also:
-
asTogglePause
action to toggle animation and physics simulation: paused/running- See Also:
-
asToggleWorldAxes
action to toggle visualization of world axes- See Also:
-
-
Constructor Details
-
AcorusDemo
protected AcorusDemo()Instantiate a demo with the appstates favored by SimpleApplication (AudioListenerState, ConstantVerifierState, DebugKeysAppState, FlyCamAppState, and StatsAppState) pre-attached. A DefaultInputMode and a ScreenshotAppState will be attached during initialization. -
AcorusDemo
protected AcorusDemo(com.jme3.app.state.AppState... initialAppStates) Instantiate a demo 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
-
advanceFloat
public static float advanceFloat(float[] valuesArray, float startValue, int amount) Advance a float selection by the specified (cyclic) amount.- Parameters:
valuesArray
- an array of values in ascending order (not null, not empty, unaffected)startValue
- the starting value (found in values[])amount
- the number of values to advance (may be negative)- Returns:
- the new (advanced) value
-
advanceInt
public static int advanceInt(int[] valuesArray, int startValue, int amount) Advance an integer selection by the specified (cyclic) amount.- Parameters:
valuesArray
- an array of values in ascending order (not null, not empty, unaffected)startValue
- the starting value (found in values[])amount
- the number of values to advance (may be negative)- Returns:
- the new (advanced) value
-
advanceString
Advance a String selection by the specified (cyclic) amount.- Parameters:
valuesArray
- an array of values in ascending order (not null, not empty, unaffected)startValue
- the starting value (found in values[])amount
- the number of values to advance (may be negative)- Returns:
- the new (advanced) value
-
areWorldAxesEnabled
public boolean areWorldAxesEnabled()Test whether the world axes are enabled.- Returns:
- true if enabled, otherwise false
-
attachWorldAxes
public void attachWorldAxes(float axisLength) Add a visualizer for the axes of the world coordinate system.- Parameters:
axisLength
- the desired length for each axis arrow (in world units, >0)
-
centerCgm
public static void centerCgm(com.jme3.scene.Spatial cgModel) Translate a model's center so that the model rests on the X-Z plane, and its center lies on the Y axis.- Parameters:
cgModel
- (not null, modified)
-
detailedHelpBounds
public com.jme3.font.Rectangle detailedHelpBounds(int viewPortWidth, int viewPortHeight) Calculate screen bounds for a detailed help node. Meant to be overridden.- Parameters:
viewPortWidth
- (in pixels, >0)viewPortHeight
- (in pixels, >0)- Returns:
- a new instance
-
findMaterial
Find the named Material in the library.- Parameters:
name
- the name of the Material to find (not null)- Returns:
- the pre-existing instance, or null if not found
-
generateMaterials
public void generateMaterials()Initialize the library of named materials. Invoke during startup. -
getHelpBuilder
Access the HelpBuilder for this application.- Returns:
- the pre-existing instance (not null)
-
isPaused
public boolean isPaused()Test whether animation is paused.- Returns:
- true if paused, otherwise false
-
onColorSpaceChange
public void onColorSpaceChange(com.jme3.texture.image.ColorSpace newSpace) Update colors after the renderer's ColorSpace changes.- Parameters:
newSpace
- the new ColorSpace (not null)
-
onViewPortResize
public void onViewPortResize(int newWidth, int newHeight) Update the GUI layout after the ViewPort gets resized.- Parameters:
newWidth
- the new width of the ViewPort (in pixels, >0)newHeight
- the new height of the ViewPort (in pixels, >0)
-
registerMaterial
Add a Material to the library.- Parameters:
name
- the desired name for the Material, which is also the key that will be used to find it (not null)material
- (not null, alias created)
-
setCgmHeight
public static void setCgmHeight(com.jme3.scene.Spatial cgModel, float height) Scale the specified C-G model uniformly so that it has the specified height, assuming Y-up orientation.- Parameters:
cgModel
- (not null, modified)height
- the desired height (in world units, >0)
-
setHelpVersion
Display the specified version of the help node.- Parameters:
newVersion
- which version to display (not null)
-
toggleHelp
public void toggleHelp()Toggle between the detailed help node and the minimal version. -
togglePause
public void togglePause()Toggle the animation and physics simulation: paused/running. -
toggleWorldAxes
public void toggleWorldAxes()Toggle visualization of world axes. -
updateHelp
public void updateHelp()Update the help node to reflect changed bindings. -
acorusInit
public void acorusInit()Initialize this application.- Specified by:
acorusInit
in classActionApplication
-
onAction
Process an action that wasn't handled by the active InputMode.- Specified by:
onAction
in interfacecom.jme3.input.controls.ActionListener
- Overrides:
onAction
in classActionApplication
- Parameters:
actionString
- textual description of the action (not null)ongoing
- true if the action is ongoing, otherwise falsetpf
- the time interval between frames (in seconds, ≥0)
-
onInputModeChange
Callback invoked when the active InputMode changes.- Overrides:
onInputModeChange
in classActionApplication
- Parameters:
oldMode
- the old mode, or null if nonenewMode
- the new mode, or null if none
-
simpleUpdate
public void simpleUpdate(float tpf) Callback invoked once per frame.- Overrides:
simpleUpdate
in classActionApplication
- Parameters:
tpf
- time interval between frames (in seconds, ≥0)
-