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
FieldsModifier and TypeFieldDescriptionprotected Geometryprotected Geometryprotected BitmapTextprotected intprotected BitmapFontprotected Nodeprotected floatprotected booleanprotected StatsViewFields inherited from class com.jme3.app.state.AbstractAppState
initialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Called byAppStateManagerwhen transitioning thisAppStatefrom terminating to detached.floatvoidinitialize(AppStateManager stateManager, Application app) Called byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.booleanvoidvoidAttaches FPS statistics to guiNode and displays it on the screen.voidAttaches Statistics View to guiNode and displays it on the screen above FPS statistics line.voidsetDarkenBehind(boolean darkenBehind) voidsetDisplayFps(boolean show) voidsetDisplayStatView(boolean show) voidsetEnabled(boolean enabled) Enable or disable the functionality of theAppState.voidsetFont(BitmapFont guiFont) Called by SimpleApplication to provide an early font so that the fpsText can be created before init.voidvoidupdate(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:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.AppStateManagerwill 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:
initializein interfaceAppState- Overrides:
initializein 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:AppStateEnable or disable the functionality of theAppState. The effect of this call depends on implementation. AnAppStatestarts as being enabled by default. A disabledAppStates does not get calls toAppState.update(float),AppState.render(RenderManager), orAppState.postRender()from itsAppStateManager.- Specified by:
setEnabledin interfaceAppState- Overrides:
setEnabledin classAbstractAppState- Parameters:
enabled- activate the AppState or not.
-
update
public void update(float tpf) Description copied from interface:AppStateCalled to update theAppState. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
updatein interfaceAppState- Overrides:
updatein classAbstractAppState- Parameters:
tpf- Time since the last call to update(), in seconds.
-
cleanup
public void cleanup()Description copied from interface:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom terminating to detached. This method is called the following render pass after theAppStatehas been detached and is always called once and only once for each timeinitialize()is called. Either when theAppStateis detached or when the application terminates (if it terminates normally).- Specified by:
cleanupin interfaceAppState- Overrides:
cleanupin classAbstractAppState
-