Skip to content

Timers

Functions

Create Timer

Create and return a new Timer. The timer will not be started, and will have an initial ‘ticks’ of 0.

Parameters:

NameTypeDescription
nameStringThe name of the timer for resource tracking

Return Type: Timer

Signatures:

timer create_timer(string name)

Free All Timers

Free all of timers that have been created.

Signatures:

void free_all_timers()

Free Timer

Free the memory used to store this timer.

Parameters:

NameTypeDescription
to_freeTimerThe time to be released.

Signatures:

void free_timer(timer to_free)

Has Timer

Checks if SplashKit has a timer with the indicated name.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Return Type: Boolean

Signatures:

bool has_timer(string name)

Pause Timer

Pause Timer

Pause the timer, getting ticks from a paused timer will continue to return the same time.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Signatures:

void pause_timer(string name)

Pause Timer

Pause the timer, getting ticks from a paused timer will continue to return the same time.

Parameters:

NameTypeDescription
to_pauseTimerThe timer

Signatures:

void pause_timer(timer to_pause)

Reset Timer

Reset Timer

Resets the named timer

Parameters:

NameTypeDescription
nameStringThe name of the timer

Signatures:

void reset_timer(string name)

Reset Timer

Resets the time of a given timer

Parameters:

NameTypeDescription
tmrTimerThe timer

Signatures:

void reset_timer(timer tmr)

Resume Timer

Resume Timer

Resumes the named timer.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Signatures:

void resume_timer(string name)

Resume Timer

Resumes a paused timer.

Parameters:

NameTypeDescription
to_resumeTimerThe timer

Signatures:

void resume_timer(timer to_resume)

Start Timer

Start Timer

Start a timer. The timer will then start recording the time that has passed. You can check how long has past since the timer was started using the Timer Ticks function.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Signatures:

void start_timer(string name)

Start Timer

Start a timer. The timer will then start recording the time that has passed. You can check how long has past since the timer was started using the Timer Ticks function.

Parameters:

NameTypeDescription
to_startTimerThe timer

Signatures:

void start_timer(timer to_start)

Stop Timer

Stop Timer

Stop the timer. The time is reset to 0 and you must recall start to begin the timer ticking again.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Signatures:

void stop_timer(string name)

Stop Timer

Stop the timer. The time is reset to 0 and you must recall start to begin the timer ticking again.

Parameters:

NameTypeDescription
to_stopTimerThe timer

Signatures:

void stop_timer(timer to_stop)

Timer Named

Get the timer created with the indicated name.

Parameters:

NameTypeDescription
nameStringThe name of the timer to fetch

Return Type: Timer

Signatures:

timer timer_named(string name)

Timer Paused

Timer Paused

Indicates if the timer is paused.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Return Type: Boolean

Signatures:

bool timer_paused(string name)

Timer Paused

Indicates if the timer is paused.

Parameters:

NameTypeDescription
to_getTimerThe timer

Return Type: Boolean

Signatures:

bool timer_paused(timer to_get)

Timer Started

Timer Started

Indicates if the timer is started.

Parameters:

NameTypeDescription
nameStringThe name of the timer

Return Type: Boolean

Signatures:

bool timer_started(string name)

Timer Started

Indicates if the timer is started.

Parameters:

NameTypeDescription
to_getTimerThe timer

Return Type: Boolean

Signatures:

bool timer_started(timer to_get)

Timer Ticks

Timer Ticks

Gets the number of ticks (milliseconds) that have passed since the timer was started/reset. When paused the timer’s ticks will not advance until the timer is once again resumed.

Parameters:

NameTypeDescription
nameStringThe name of the Timer

Return Type: Unsigned Integer

Signatures:

unsigned int timer_ticks(string name)

Timer Ticks

Gets the number of ticks (milliseconds) that have passed since the timer was started/reset. When paused the timer’s ticks will not advance until the timer is once again resumed.

Parameters:

NameTypeDescription
to_getTimerThe timer

Return Type: Unsigned Integer

Signatures:

unsigned int timer_ticks(timer to_get)

Types

Timer

Timers in SplashKit can be used to track the passing of time. In general you will create a timer, start it, then use it to track time by asking for the timer’s ticks (milliseconds).