Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: MovingAverageQueue

[13:7] extends: FxObj

Wraps FXGL's MovingAverageQueue (com.almasb.fxgl.core.collection.MovingAverageQueue), a fixed-size FIFO of doubles that tracks the running average. Useful for FPS / latency / damage-per-second widgets.

Methods

  • MovingAverageQueue (int MaxSize = 60)

    Creates a new MovingAverageQueue with the given max size.

    • @p MaxSize is the queue's max length.
  • put (double Item)

    Pushes a new sample. When the queue is full, the oldest entry is evicted.

    • @p Item is the value to add.
    • @r this object
  • getAverage ()

    Returns the current moving average.

    • @r A double.