Package de.gurkenlabs.litiengine
Class GameMetrics
java.lang.Object
de.gurkenlabs.litiengine.GameMetrics
- All Implemented Interfaces:
IRenderable
public final class GameMetrics
extends java.lang.Object
implements IRenderableThe class
GameMetrics provides meta information about the game's metrics. This allows the developer to
get a feeling about the performance of different aspects (e.g. memory consumption, potential fps, network traffic, ...) and to identify potential
issues.This information can be rendered as debug information if configured to get live data during a gameplay session.
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGameMetrics.RenderInfoclassGameMetrics.RenderMetricsMethod Summary
Modifier and Type Method Description intgetFramesPerSecond()java.awt.ColorgetRenderColor()floatgetUsedMemory()voidrender(java.awt.Graphics2D g)Renders the visual contents of this instance onto the provided graphics context.voidsetRenderColor(java.awt.Color color)Sets the color that is used when rendering the metrics ifcl_showGameMetrics = true.voidtrackRenderTime(java.lang.String name, double renderTime, GameMetrics.RenderInfo... infos)
Method Details
getFramesPerSecond
public int getFramesPerSecond()getUsedMemory
public float getUsedMemory()getRenderColor
public java.awt.Color getRenderColor()trackRenderTime
public void trackRenderTime(java.lang.String name, double renderTime, GameMetrics.RenderInfo... infos)render
public void render(java.awt.Graphics2D g)Description copied from interface:IRenderableRenders the visual contents of this instance onto the provided graphics context.If an
Entityimplements this interface, this method will be called right after the entity was rendered from the environment. Allowing for a custom rendering mechanism.This interface can be implemented in general by anything that should be rendered to the game's screen.
- Specified by:
renderin interfaceIRenderable- Parameters:
g- The current graphics object onto which this instance will render its visual contents.- See Also:
RenderEngine.renderEntity(Graphics2D, de.gurkenlabs.litiengine.entities.IEntity)
setRenderColor
public void setRenderColor(java.awt.Color color)Sets the color that is used when rendering the metrics ifcl_showGameMetrics = true.- Parameters:
color- The color for rendering the metrics.- See Also:
ClientConfiguration.showGameMetrics(),render(Graphics2D)
