Class GameMetrics
- All Implemented Interfaces:
IRenderable
The 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.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classclass -
Method Summary
Modifier and TypeMethodDescriptionintGets the estimated maximum frame rate based on the latest frame processing time.intfloatvoidrender(Graphics2D g) Renders the visual contents of this instance onto the provided graphics context.voidsetRenderColor(Color color) Sets the color that is used when rendering the metrics ifcl_showGameMetrics = true.voidtrackRenderTime(String name, double renderTime, GameMetrics.RenderInfo... infos)
-
Method Details
-
getFramesPerSecond
public int getFramesPerSecond() -
getEstimatedMaxFramesPerSecond
public int getEstimatedMaxFramesPerSecond()Gets the estimated maximum frame rate based on the latest frame processing time.- Returns:
- the estimated maximum frames per second
-
getUsedMemory
public float getUsedMemory() -
getRenderColor
-
trackRenderTime
-
render
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:
-
setRenderColor
Sets the color that is used when rendering the metrics ifcl_showGameMetrics = true.- Parameters:
color- The color for rendering the metrics.- See Also:
-