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:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer for resource tracking |
Return Type: Timer
Signatures:
timer create_timer(string name)public static Timer SplashKit.CreateTimer(string name);public Timer(string name);def create_timer(name):function CreateTimer(name: String): TimerFree All Timers
Free all of timers that have been created.
Signatures:
void free_all_timers()public static void Timers.FreeAllTimers();public static void SplashKit.FreeAllTimers();def free_all_timers():procedure FreeAllTimers()Free Timer
Free the memory used to store this timer.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_free | Timer | The time to be released. |
Signatures:
void free_timer(timer to_free)public void Timer.FreeTimer();public static void SplashKit.FreeTimer(Timer toFree);def free_timer(to_free):procedure FreeTimer(toFree: Timer)Has Timer
Checks if SplashKit has a timer with the indicated name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Return Type: Boolean
Signatures:
bool has_timer(string name)public static bool Timers.HasTimer(string name);public static bool SplashKit.HasTimer(string name);def has_timer__named(name):function HasTimer(name: String): BooleanPause Timer
Pause Timer
Pause the timer, getting ticks from a paused timer will continue to return the same time.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Signatures:
void pause_timer(string name)public static void Timers.PauseTimer(string name);public static void SplashKit.PauseTimer(string name);def pause_timer__named(name):procedure PauseTimer(name: String)Pause Timer
Pause the timer, getting ticks from a paused timer will continue to return the same time.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_pause | Timer | The timer |
Signatures:
void pause_timer(timer to_pause)public void Timer.PauseTimer();public static void SplashKit.PauseTimer(Timer toPause);def pause_timer(to_pause):procedure PauseTimer(toPause: Timer)Reset Timer
Reset Timer
Resets the named timer
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Signatures:
void reset_timer(string name)public static void Timers.ResetTimer(string name);public static void SplashKit.ResetTimer(string name);def reset_timer__named(name):procedure ResetTimer(name: String)Reset Timer
Resets the time of a given timer
Parameters:
| Name | Type | Description |
|---|---|---|
| tmr | Timer | The timer |
Signatures:
void reset_timer(timer tmr)public void Timer.ResetTimer();public static void SplashKit.ResetTimer(Timer tmr);def reset_timer(tmr):procedure ResetTimer(tmr: Timer)Resume Timer
Resume Timer
Resumes the named timer.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Signatures:
void resume_timer(string name)public static void Timers.ResumeTimer(string name);public static void SplashKit.ResumeTimer(string name);def resume_timer__named(name):procedure ResumeTimer(name: String)Resume Timer
Resumes a paused timer.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_resume | Timer | The timer |
Signatures:
void resume_timer(timer to_resume)public void Timer.ResumeTimer();public static void SplashKit.ResumeTimer(Timer toResume);def resume_timer(to_resume):procedure ResumeTimer(toResume: Timer)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:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Signatures:
void start_timer(string name)public static void Timers.StartTimer(string name);public static void SplashKit.StartTimer(string name);def start_timer__named(name):procedure StartTimer(name: String)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:
| Name | Type | Description |
|---|---|---|
| to_start | Timer | The timer |
Signatures:
void start_timer(timer to_start)public void Timer.StartTimer();public static void SplashKit.StartTimer(Timer toStart);def start_timer(to_start):procedure StartTimer(toStart: Timer)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:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Signatures:
void stop_timer(string name)public static void Timers.StopTimer(string name);public static void SplashKit.StopTimer(string name);def stop_timer__named(name):procedure StopTimer(name: String)Stop Timer
Stop the timer. The time is reset to 0 and you must recall start to begin the timer ticking again.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_stop | Timer | The timer |
Signatures:
void stop_timer(timer to_stop)public void Timer.StopTimer();public static void SplashKit.StopTimer(Timer toStop);def stop_timer(to_stop):procedure StopTimer(toStop: Timer)Timer Named
Get the timer created with the indicated name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer to fetch |
Return Type: Timer
Signatures:
timer timer_named(string name)public static Timer Timers.TimerNamed(string name);public static Timer SplashKit.TimerNamed(string name);def timer_named(name):function TimerNamed(name: String): TimerTimer Paused
Timer Paused
Indicates if the timer is paused.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Return Type: Boolean
Signatures:
bool timer_paused(string name)public static bool Timers.TimerPaused(string name);public static bool SplashKit.TimerPaused(string name);def timer_paused__named(name):function TimerPaused(name: String): BooleanTimer Paused
Indicates if the timer is paused.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_get | Timer | The timer |
Return Type: Boolean
Signatures:
bool timer_paused(timer to_get)public bool Timer.IsPaused { get }public static bool SplashKit.TimerPaused(Timer toGet);def timer_paused(to_get):function TimerPaused(toGet: Timer): BooleanTimer Started
Timer Started
Indicates if the timer is started.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Return Type: Boolean
Signatures:
bool timer_started(string name)public static bool Timers.TimerStarted(string name);public static bool SplashKit.TimerStarted(string name);def timer_started__named(name):function TimerStarted(name: String): BooleanTimer Started
Indicates if the timer is started.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_get | Timer | The timer |
Return Type: Boolean
Signatures:
bool timer_started(timer to_get)public bool Timer.IsStarted { get }public static bool SplashKit.TimerStarted(Timer toGet);def timer_started(to_get):function TimerStarted(toGet: Timer): BooleanTimer 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:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the Timer |
Return Type: Unsigned Integer
Signatures:
unsigned int timer_ticks(string name)public static uint Timers.TimerTicks(string name);public static uint SplashKit.TimerTicks(string name);def timer_ticks__named(name):function TimerTicks(name: String): CardinalTimer 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:
| Name | Type | Description |
|---|---|---|
| to_get | Timer | The timer |
Return Type: Unsigned Integer
Signatures:
unsigned int timer_ticks(timer to_get)public uint Timer.Ticks { get }public static uint SplashKit.TimerTicks(Timer toGet);def timer_ticks(to_get):function TimerTicks(toGet: Timer): CardinalTypes
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).