Tickrate class

Tickrate provides fractional Frametime values over time via digest.

Frametime values are whole integers and represent frame-perfect or even pixel-perfect quanities. Because of this, representing anything less than 1 fixed unit is impossible. Tickrate takes in a units and delay field and represent the expression "every (delay-1) frames, increase units".

  // Every 5 frames move 2 pixels, or in other words:
  // After 4 frames, the next frame yields an additional 2 pixels.
  frame = frame.inc();
  final ticker = Tickrate(2, 4);
  playerXY += Vector2(ticker.digest(frame), playerXY.y);

Constructors

Tickrate(int units, int delay)
const
Tickrate.fromPercentage(double percent)
Creates a lossy Tickrate using a factor proportional to the percent.
factory

Properties

delay int
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
units int
final

Methods

digest(Frametime elapsed) Frametime
fractional() double
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited