Skip to content

Smoothed<T>

namespace Griff.Scenes;
public struct Smoothed<T>

A value a component (or a game’s system) draws that changes as the game steps, which remembers what it was as the step it last changed in began, so a frame drawn between two steps can show it between the two: draw it with Of (or TurnOf for an angle). Keep it in a field (it’s a struct, so not a readonly one or an auto-property) and change it with Set.

public long ChangedIn { get; }

The step it last changed in (see Step), or 0 if it hasn’t changed while the game ran.

public T Value { get; }

What it is now.

public T Was { get; }

What it was as the step it last changed in began.

public void Set(Component owner, T value)

Changes it, for owner’s entity: the first change in a step remembers what it was as the step began.

public void Set(Scene? scene, T value)

Changes it, in scene (for a game’s system): the first change in a step remembers what it was as the step began.