Class FrameCounter

  • All Implemented Interfaces:
    RenderLifecycle

    public class FrameCounter
    extends java.lang.Object
    implements RenderLifecycle
    A system to add a debug overlay showing the FPS, frame count, Element count and frame time graph.
    
     // Create and attach a new FrameCounter with default settings
     new FrameCounter().attach();
     
    • Constructor Detail

      • FrameCounter

        public FrameCounter()
        Create a new FrameCounter with default settings:
        • Enabled: true
        • FrameChart: true
        • DataPoints: 100
        • Lines: {}
    • Method Detail

      • enabled

        public FrameCounter enabled​(boolean enabled)
        Enabled by default.
        Parameters:
        enabled - To enable or disable the overlay
        Returns:
        `this` for method chaining
      • frameChart

        public FrameCounter frameChart​(boolean enabled)
        Enabled by default.
        Parameters:
        enabled - To enable or disable the frame time graph
        Returns:
        `this` for method chaining
      • dataPoints

        public FrameCounter dataPoints​(int dataPoints)
        The number of data points used for the FPS and FrameTime text / FrameTime graph. 100 by default.
        Parameters:
        dataPoints - The number of data-points to use
        Returns:
        `this` for method chaining
      • lines

        public FrameCounter lines​(FrameCounter.GetLines lines)
        The function you supply will be run every frame. Empty by default.
        Parameters:
        lines - Function to get extra lines.
        Returns:
        `this` for method chaining
      • line

        public FrameCounter line​(FrameCounter.GetLine line)
        The function you supply will be run every frame. Empty by default.
        Parameters:
        line - The function to get an extra line
        Returns:
        `this` for method chaining
      • font

        public FrameCounter font​(java.awt.Font font)
        Sets the font used by the overlay UI. 12pt Dialog is the default.
        Parameters:
        font - The font to use
        Returns:
        `this` for method chaining
      • attach

        public void attach()
        Adds system to the default static canvas.
      • renderEnd

        public void renderEnd​(java.awt.Graphics g)
        Description copied from interface: RenderLifecycle
        Runs after everything else; the image in CanvasPanel will not reflect your changes.
        Specified by:
        renderEnd in interface RenderLifecycle
        Parameters:
        g - The graphics context