public interface Application
Application
interface represents the minimum exposed
capabilities of a concrete jME3 application.Modifier and Type | Method and Description |
---|---|
<V> java.util.concurrent.Future<V> |
enqueue(java.util.concurrent.Callable<V> callable)
Enqueues a task/callable object to execute in the jME3
rendering thread.
|
void |
enqueue(java.lang.Runnable runnable)
Enqueues a runnable object to execute in the jME3
rendering thread.
|
AppProfiler |
getAppProfiler()
Returns the current AppProfiler hook, or null if none is set.
|
AssetManager |
getAssetManager() |
AudioRenderer |
getAudioRenderer() |
Camera |
getCamera() |
JmeContext |
getContext() |
ViewPort |
getGuiViewPort() |
InputManager |
getInputManager() |
Listener |
getListener() |
LostFocusBehavior |
getLostFocusBehavior()
Determine the application's behavior when unfocused.
|
Renderer |
getRenderer() |
RenderManager |
getRenderManager() |
AppStateManager |
getStateManager() |
Timer |
getTimer() |
ViewPort |
getViewPort() |
boolean |
isPauseOnLostFocus()
Returns true if pause on lost focus is enabled, false otherwise.
|
void |
restart()
Restarts the context, applying any changed settings.
|
void |
setAppProfiler(AppProfiler prof)
Sets an AppProfiler hook that will be called back for
specific steps within a single update frame.
|
void |
setLostFocusBehavior(LostFocusBehavior lostFocusBehavior)
Changes the application's behavior when unfocused.
|
void |
setPauseOnLostFocus(boolean pauseOnLostFocus)
Enables or disables pause on lost focus.
|
void |
setSettings(AppSettings settings)
Set the display settings to define the display created.
|
void |
setTimer(Timer timer)
Sets the Timer implementation that will be used for calculating
frame times.
|
void |
start()
Starts the application.
|
void |
start(boolean waitFor)
Starts the application.
|
void |
stop()
Requests the context to close, shutting down the main loop
and making necessary cleanup operations.
|
void |
stop(boolean waitFor)
Requests the context to close, shutting down the main loop
and making necessary cleanup operations.
|
LostFocusBehavior getLostFocusBehavior()
void setLostFocusBehavior(LostFocusBehavior lostFocusBehavior)
throttle the update loop
so as not to use 100% of the CPU when it is out of focus, e.g.
alt-tabbed, minimized, or obstructed by another window.lostFocusBehavior
- The new lost focus behavior to use.LostFocusBehavior
boolean isPauseOnLostFocus()
getLostFocusBehavior()
void setPauseOnLostFocus(boolean pauseOnLostFocus)
By default, pause on lost focus is enabled. If enabled, the application will stop updating when it loses focus or becomes inactive (e.g. alt-tab). For online or real-time applications, this might not be preferable, so this feature should be disabled. For other applications, it is best to keep it enabled so that CPU is not used unnecessarily.
pauseOnLostFocus
- True to enable pause on lost focus, false
otherwise.setLostFocusBehavior(com.jme3.app.LostFocusBehavior)
void setSettings(AppSettings settings)
Examples of display parameters include display pixel width and height,
color bit depth, z-buffer bits, anti-aliasing samples, and update frequency.
If this method is called while the application is already running, then
restart()
must be called to apply the settings to the display.
settings
- The settings to set.void setTimer(Timer timer)
timer
- the desired timer (alias created)Timer getTimer()
AssetManager getAssetManager()
asset manager
for this application.InputManager getInputManager()
input manager
.AppStateManager getStateManager()
app state manager
RenderManager getRenderManager()
render manager
AudioRenderer getAudioRenderer()
audio renderer
for the applicationJmeContext getContext()
display context
for the applicationvoid start()
void start(boolean waitFor)
waitFor
- true→wait for the context to be initialized,
false→don't waitvoid setAppProfiler(AppProfiler prof)
prof
- the profiler to use (alias created) or null for none
(default=null)AppProfiler getAppProfiler()
void restart()
Changes to the AppSettings
of this Application are not
applied immediately; calling this method forces the context
to restart, applying the new settings.
void stop()
stop(boolean)
void stop(boolean waitFor)
waitFor
- true→wait for the context to be fully destroyed,
true→don't wait<V> java.util.concurrent.Future<V> enqueue(java.util.concurrent.Callable<V> callable)
Callables are executed right at the beginning of the main loop. They are executed even if the application is currently paused or out of focus.
V
- type of result returned by the Callablecallable
- The callable to run in the main jME3 threadvoid enqueue(java.lang.Runnable runnable)
Runnables are executed right at the beginning of the main loop. They are executed even if the application is currently paused or out of focus.
runnable
- The runnable to run in the main jME3 threadViewPort getGuiViewPort()
ViewPort getViewPort()