Class FpsPlugin

  • All Implemented Interfaces:
    com.google.inject.Module

    @PluginDescriptor(name="FPS Control",
                      description="Show current FPS and/or set an FPS limit",
                      tags={"frames","framerate","limit","overlay"},
                      enabledByDefault=false)
    public class FpsPlugin
    extends Plugin
    FPS Control has two primary areas, this plugin class just keeps those areas up to date and handles setup / teardown.

    Overlay paints the current FPS, the color depends on whether or not FPS is being enforced. The overlay is lightweight and is merely and indicator.

    Draw Listener, sleeps a calculated amount after each canvas paint operation. This is the heart of the plugin, the amount of sleep taken is regularly adjusted to account varying game and system load, it usually finds the sweet spot in about two seconds.