Skip to content

Replay

The replay being watched: a ghost's run, with the camera following it. Times are in seconds.

IsActive

bool Replay::IsActive()

Whether a replay is being watched.

Example
window.visible = Replay::IsActive();

Time

double Replay::Time()

How far into the replay playback is, in seconds.

Example
timeText.text = FormatTime(Replay::Time()) + " / " + FormatTime(Replay::Length());

Length

double Replay::Length()

The replay's length in seconds, or a negative number while it's unknown (a downloaded replay fills it in once it has loaded).

Example
double length = Replay::Length();
if (length > 0)
    slider.value = float(Replay::Time() / length);

Seek

void Replay::Seek(double)

Jumps playback to a time in seconds.

Example
if (slider.dragging)
    Replay::Seek(slider.value * Replay::Length());

Restart

void Replay::Restart()

Starts the replay again from the beginning.

Example
if (restartButton.Clicked())
    Replay::Restart();

CameraMode

int Replay::CameraMode()

The current camera mode: Replay::Default, Replay::Follow3D or Replay::Free.

Example
if (Replay::CameraMode() == Replay::Free)
    hintText.text = "right mouse to look, WASD to move, E/Q up and down";

SetCameraMode

void Replay::SetCameraMode(int)

Sets the camera: Replay::Default (the game's own), Replay::Follow3D (behind the ball along its direction of travel, turning smoothly), or Replay::Free (fly around: hold the right mouse button to look, WASD to move, E/Q up and down, Shift for speed).

Example
Replay::SetCameraMode(Replay::Follow3D);

CameraDistance

double Replay::CameraDistance()

How far the replay camera stays from the ball, in whole units, or 0 for the game's own (375 units).

Example
distanceText.text = "" + int(Replay::CameraDistance());

SetCameraDistance

void Replay::SetCameraDistance(double)

Sets how far the camera stays from the ball, in whole units (a fraction is rounded). It's the length of the replay camera's arm in the default camera, and the chase distance in follow 3D. 0 goes back to the game's own.

Example
// A slider from 150 to 1500 units
if (distanceSlider.dragging)
    Replay::SetCameraDistance(150 + distanceSlider.value * 1350);

SeeThrough

bool Replay::SeeThrough()

Whether see-through is on.

Example
seeThroughBox.checked = Replay::SeeThrough();

SetSeeThrough

void Replay::SetSeeThrough(bool)

With true, anything between the camera and the ball turns to glass while it's in the way, and the default camera is no longer pushed in towards the ball by it. Pieces get their own look back a moment after they're clear. The free camera isn't affected.

Example
if (seeThroughBox.Changed())
    Replay::SetSeeThrough(seeThroughBox.checked);

Replay::Camera

Replay::Default, Replay::Follow3D, Replay::Free