com.jmex.game.state
Class StatisticsGameState

java.lang.Object
  extended by com.jmex.game.state.GameState
      extended by com.jmex.game.state.BasicGameState
          extended by com.jmex.game.state.StatisticsGameState

public class StatisticsGameState
extends BasicGameState

A GameState which displays some useful statistics like FPS, avg. Objects/Tris etc.
Note: statistic gathering needs to be activated: System.setProperty("jme.stats", "set");

Author:
Christoph Luder

Field Summary
 
Fields inherited from class com.jmex.game.state.BasicGameState
rootNode
 
Fields inherited from class com.jmex.game.state.GameState
active, name, parent
 
Constructor Summary
StatisticsGameState()
          a GameState which displays the statistics graph.
StatisticsGameState(java.lang.String name, float widthFactor, float heightFactor, float alpha, boolean doLineGraph)
          a GameState which displays the statistics graph with the given width, height and alpha.
 
Method Summary
 Quad getLabGraph()
           
 Quad getLineGraph()
           
 void render(float tpf)
          draws the graph.
 void setActive(boolean active)
          Enable/Disable this GameState and statistics gathering.
protected  void setupStatGraphs()
           
protected  void setupStats()
          Set up which stats to graph
 void update(float tpf)
          updates the statistics graph.
 
Methods inherited from class com.jmex.game.state.BasicGameState
cleanup, getRootNode
 
Methods inherited from class com.jmex.game.state.GameState
getName, getParent, isActive, setName, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsGameState

public StatisticsGameState()
a GameState which displays the statistics graph.


StatisticsGameState

public StatisticsGameState(java.lang.String name,
                           float widthFactor,
                           float heightFactor,
                           float alpha,
                           boolean doLineGraph)
a GameState which displays the statistics graph with the given width, height and alpha.

Parameters:
name - name of the game state
width - with of the graph
height - height of the graph
alpha - transparency of the graph
doLineGraph - display the lines graph also
Method Detail

setupStatGraphs

protected void setupStatGraphs()

setupStats

protected void setupStats()
Set up which stats to graph


update

public void update(float tpf)
updates the statistics graph.

Overrides:
update in class BasicGameState
Parameters:
tpf - The elapsed time since last frame.
See Also:
GameState.update(float)

render

public void render(float tpf)
draws the graph.

Overrides:
render in class BasicGameState
Parameters:
tpf - The elapsed time since last frame.
See Also:
GameState.render(float)

setActive

public void setActive(boolean active)
Enable/Disable this GameState and statistics gathering.

Overrides:
setActive in class GameState
Parameters:
active - Whether or not you want this GameState to be updated and rendered.

getLineGraph

public Quad getLineGraph()
Returns:
the line graph quad

getLabGraph

public Quad getLabGraph()
Returns:
the label quad graph