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) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| ms | Int | number 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() ~ IntReturn
| Type | Description |
|---|---|
| Int | the 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() ~ IntReturn
| Type | Description |
|---|---|
| Int | counts per second |
GetTicks # function
Get the number of milliseconds since the SDL library initialization
function : GetTicks() ~ IntReturn
| Type | Description |
|---|---|
| Int | value representing the number of milliseconds since the SDL library initialized |