Package com.jme3.app
Class StatsAppState
java.lang.Object
com.jme3.app.state.AbstractAppState
com.jme3.app.StatsAppState
- All Implemented Interfaces:
AppState
Displays stats in SimpleApplication's GUI node or
using the node and font parameters provided.
-
Field Summary
Modifier and TypeFieldDescriptionprotected Geometry
protected Geometry
protected BitmapText
protected int
protected BitmapFont
protected Node
protected float
protected boolean
protected StatsView
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Called byAppStateManager
when transitioning thisAppState
from terminating to detached.float
void
initialize
(AppStateManager stateManager, Application app) Called byAppStateManager
when transitioning thisAppState
from initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)
was called.boolean
void
void
Attaches FPS statistics to guiNode and displays it on the screen.void
Attaches Statistics View to guiNode and displays it on the screen above FPS statistics line.void
setDarkenBehind
(boolean darkenBehind) void
setDisplayFps
(boolean show) void
setDisplayStatView
(boolean show) void
setEnabled
(boolean enabled) Enable or disable the functionality of theAppState
.void
setFont
(BitmapFont guiFont) Called by SimpleApplication to provide an early font so that the fpsText can be created before init.void
void
update
(float tpf) Called to update theAppState
.Methods inherited from class com.jme3.app.state.AbstractAppState
getId, isEnabled, isInitialized, postRender, render, setId, stateAttached, stateDetached
-
Field Details
-
statsView
-
showSettings
protected boolean showSettings -
guiNode
-
secondCounter
protected float secondCounter -
frameCounter
protected int frameCounter -
fpsText
-
guiFont
-
darkenFps
-
darkenStats
-
-
Constructor Details
-
StatsAppState
public StatsAppState() -
StatsAppState
-
-
Method Details
-
setFont
Called by SimpleApplication to provide an early font so that the fpsText can be created before init. This is because several applications expect to directly access fpsText... unfortunately.- Parameters:
guiFont
- the desired font (not null, alias created)
-
getFpsText
-
getStatsView
-
getSecondCounter
public float getSecondCounter() -
toggleStats
public void toggleStats() -
setDisplayFps
public void setDisplayFps(boolean show) -
setDisplayStatView
public void setDisplayStatView(boolean show) -
setDarkenBehind
public void setDarkenBehind(boolean darkenBehind) -
isDarkenBehind
public boolean isDarkenBehind() -
initialize
Description copied from interface:AppState
Called byAppStateManager
when transitioning thisAppState
from initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)
was called.AppStateManager
will call this only from the update loop inside the rendering thread. This means is it safe to modify the scene graph from this method.- Specified by:
initialize
in interfaceAppState
- Overrides:
initialize
in classAbstractAppState
- Parameters:
stateManager
- The state managerapp
- The application
-
loadFpsText
public void loadFpsText()Attaches FPS statistics to guiNode and displays it on the screen. -
loadStatsView
public void loadStatsView()Attaches Statistics View to guiNode and displays it on the screen above FPS statistics line. -
loadDarken
public void loadDarken() -
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:AppState
Enable or disable the functionality of theAppState
. The effect of this call depends on implementation. AnAppState
starts as being enabled by default. A disabledAppState
s does not get calls toAppState.update(float)
,AppState.render(RenderManager)
, orAppState.postRender()
from itsAppStateManager
.- Specified by:
setEnabled
in interfaceAppState
- Overrides:
setEnabled
in classAbstractAppState
- Parameters:
enabled
- activate the AppState or not.
-
update
public void update(float tpf) Description copied from interface:AppState
Called to update theAppState
. This method will be called every render pass if theAppState
is both attached and enabled.- Specified by:
update
in interfaceAppState
- Overrides:
update
in classAbstractAppState
- Parameters:
tpf
- Time since the last call to update(), in seconds.
-
cleanup
public void cleanup()Description copied from interface:AppState
Called byAppStateManager
when transitioning thisAppState
from terminating to detached. This method is called the following render pass after theAppState
has been detached and is always called once and only once for each timeinitialize()
is called. Either when theAppState
is detached or when the application terminates (if it terminates normally).- Specified by:
cleanup
in interfaceAppState
- Overrides:
cleanup
in classAbstractAppState
-