Timers
Functions
Section titled “Functions”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
Returns: A new 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): TimerUsage: {</>}
Free all of timers that have been created.
Signatures:
void free_all_timers()public static void SplashKit.FreeAllTimers();def free_all_timers():procedure FreeAllTimers()Usage: {</>}
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.Free();public static void SplashKit.FreeTimer(Timer toFree);def free_timer(to_free):procedure FreeTimer(toFree: 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
Returns: True if SplashKit has created a timer with that name.
Signatures:
bool has_timer(string name)public static bool SplashKit.HasTimer(string name);def has_timer_named(name):function HasTimer(name: String): BooleanPause 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 SplashKit.PauseTimer(string name);def pause_timer_named(name):procedure PauseTimer(name: String)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.Pause();public static void SplashKit.PauseTimer(Timer toPause);def pause_timer(to_pause):procedure PauseTimer(toPause: 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 SplashKit.ResetTimer(string name);def reset_timer_named(name):procedure ResetTimer(name: String)Resets the time of a given timer
Parameters:
| Name | Type | Description |
|---|---|---|
| tmr | Timer | The timer |
Signatures:
void reset_timer(timer tmr)public void Timer.Reset();public static void SplashKit.ResetTimer(Timer tmr);def reset_timer(tmr):procedure ResetTimer(tmr: 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 SplashKit.ResumeTimer(string name);def resume_timer_named(name):procedure ResumeTimer(name: String)Resumes a paused timer.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_resume | Timer | The timer |
Signatures:
void resume_timer(timer to_resume)public void Timer.Resume();public static void SplashKit.ResumeTimer(Timer toResume);def resume_timer(to_resume):procedure ResumeTimer(toResume: 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 SplashKit.StartTimer(string name);def start_timer_named(name):procedure StartTimer(name: String)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.Start();public static void SplashKit.StartTimer(Timer toStart);def start_timer(to_start):procedure StartTimer(toStart: Timer)Usage: {</>}
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 SplashKit.StopTimer(string name);def stop_timer_named(name):procedure StopTimer(name: String)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.Stop();public static void SplashKit.StopTimer(Timer toStop);def stop_timer(to_stop):procedure StopTimer(toStop: Timer)Usage: {</>}
Get the timer created with the indicated name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer to fetch |
Return Type: Timer
Returns: Returns the timer fetched from SplashKit
Signatures:
timer timer_named(string name)public static Timer SplashKit.TimerNamed(string name);def timer_named(name):function TimerNamed(name: String): TimerIndicates if the timer is paused.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Return Type: Boolean
Returns: True if the timer is paused
Signatures:
bool timer_paused(string name)public static bool SplashKit.TimerPaused(string name);def timer_paused_named(name):function TimerPaused(name: String): BooleanIndicates if the timer is paused.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_get | Timer | The timer |
Return Type: Boolean
Returns: True if the timer is paused
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): BooleanIndicates if the timer is started.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the timer |
Return Type: Boolean
Returns: True if the timer has been started
Signatures:
bool timer_started(string name)public static bool SplashKit.TimerStarted(string name);def timer_started_named(name):function TimerStarted(name: String): BooleanIndicates if the timer is started.
Parameters:
| Name | Type | Description |
|---|---|---|
| to_get | Timer | The timer |
Return Type: Boolean
Returns: True if the timer has been started
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): BooleanGets 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 SplashKit.TimerTicks(string name);def timer_ticks_named(name):function TimerTicks(name: String): CardinalGets 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): CardinalUsage: {</>}
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).