public class StatsAppState extends AbstractAppState
Modifier and Type | Field and Description |
---|---|
protected Geometry |
darkenFps |
protected Geometry |
darkenStats |
protected BitmapText |
fpsText |
protected int |
frameCounter |
protected BitmapFont |
guiFont |
protected Node |
guiNode |
protected float |
secondCounter |
protected boolean |
showSettings |
protected StatsView |
statsView |
initialized
Constructor and Description |
---|
StatsAppState() |
StatsAppState(Node guiNode,
BitmapFont guiFont) |
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Called by
AppStateManager when transitioning this
AppState from terminating to detached. |
BitmapText |
getFpsText() |
float |
getSecondCounter() |
StatsView |
getStatsView() |
void |
initialize(AppStateManager stateManager,
Application app)
Called by
AppStateManager when transitioning this AppState
from initializing to running.This will happen on the next iteration through the update loop after AppStateManager.attach(com.jme3.app.state.AppState) was called. |
boolean |
isDarkenBehind() |
void |
loadDarken() |
void |
loadFpsText()
Attaches FPS statistics to guiNode and displays it on the screen.
|
void |
loadStatsView()
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 the
AppState . |
void |
setFont(BitmapFont guiFont)
Called by SimpleApplication to provide an early font
so that the fpsText can be created before init.
|
void |
toggleStats() |
void |
update(float tpf)
Called to update the
AppState . |
getId, isEnabled, isInitialized, postRender, render, setId, stateAttached, stateDetached
protected StatsView statsView
protected boolean showSettings
protected Node guiNode
protected float secondCounter
protected int frameCounter
protected BitmapText fpsText
protected BitmapFont guiFont
protected Geometry darkenFps
protected Geometry darkenStats
public StatsAppState()
public StatsAppState(Node guiNode, BitmapFont guiFont)
public void setFont(BitmapFont guiFont)
guiFont
- the desired font (not null, alias created)public BitmapText getFpsText()
public StatsView getStatsView()
public float getSecondCounter()
public void toggleStats()
public void setDisplayFps(boolean show)
public void setDisplayStatView(boolean show)
public void setDarkenBehind(boolean darkenBehind)
public boolean isDarkenBehind()
public void initialize(AppStateManager stateManager, Application app)
AppState
AppStateManager
when transitioning this AppState
from initializing to running.AppStateManager.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.
initialize
in interface AppState
initialize
in class AbstractAppState
stateManager
- The state managerapp
- The applicationpublic void loadFpsText()
public void loadStatsView()
public void loadDarken()
public void setEnabled(boolean enabled)
AppState
AppState
.
The effect of this call depends on implementation. An
AppState
starts as being enabled by default.
A disabled AppState
s does not get calls to
AppState.update(float)
, AppState.render(RenderManager)
, or
AppState.postRender()
from its AppStateManager
.setEnabled
in interface AppState
setEnabled
in class AbstractAppState
enabled
- activate the AppState or not.public void update(float tpf)
AppState
AppState
. This method will be called
every render pass if the AppState
is both attached and enabled.update
in interface AppState
update
in class AbstractAppState
tpf
- Time since the last call to update(), in seconds.public void cleanup()
AppState
AppStateManager
when transitioning this
AppState
from terminating to detached. This
method is called the following render pass after the AppState
has
been detached and is always called once and only once for each time
initialize()
is called. Either when the AppState
is detached or when the application terminates (if it terminates normally).cleanup
in interface AppState
cleanup
in class AbstractAppState