v2026.11.0
All Bundles
Bundle

SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

Timer

SDL time management routines

Operations

Delay # function

Wait a specified number of milliseconds before returning

function : Delay(ms:Int) ~ Nil

Parameters

NameTypeDescription
msIntnumber of milliseconds to delay

GetPerformanceCounter # function

Get the current value of the high resolution counter, for timing. Only differences between two readings are meaningful; divide by GetPerformanceFrequency for seconds.

function : GetPerformanceCounter() ~ Int

Return

TypeDescription
Intthe current counter value

Example

start := Timer->GetPerformanceCounter();
Step();
elapsed := (Timer->GetPerformanceCounter() - start)->As(Float) / Timer->GetPerformanceFrequency()->As(Float);

GetPerformanceFrequency # function

Get the count per second of the high resolution counter

function : GetPerformanceFrequency() ~ Int

Return

TypeDescription
Intcounts per second

GetTicks # function

Get the number of milliseconds since the SDL library initialization

function : GetTicks() ~ Int

Return

TypeDescription
Intvalue representing the number of milliseconds since the SDL library initialized

GetTicks64 # function

Get the number of milliseconds since the SDL library initialization, as 64 bits so it does not wrap after 49 days as GetTicks does

function : GetTicks64() ~ Int

Return

TypeDescription
Intmilliseconds since SDL was initialized

Passed # function

Compares SDL ticks values

function : Passed(a:Int, b:Int) ~ Bool

Parameters

NameTypeDescription
aIntthe first ticks values
bIntthe second ticks values

Return

TypeDescription
Booltrue if A has passed B, false otherwise