Timers

Timers

Description

SwinGame Timers can be used to manage time based actions in your game. Each timer keeps track of the number of milliseconds that have ellapsed since the timer was started. They can be paused, stopped, restarted, etc.

Create Timer

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

  • Create Timer () : Timer [show]

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

    Returns:
    Timer :
    Signatures by Language:
    C/C++: timer create_timer();
    Pascal: function CreateTimer(): Timer;
  • Create Timer (name) : Timer [show]

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

    Parameters:
    name : String
    Returns:
    Timer :
    Signatures by Language:
    C/C++: timer create_timer_named(const char *name);
    C++: timer create_timer(const char *name);
    Pascal: function CreateTimer(name: String): Timer;

Free Timer

Free a created timer.

  • Free Timer (var toFree) [show]

    Free a created timer.

    Parameters:
    toFree : Timer
    Signatures by Language:
    C/C++: void free_timer(timer *toFree);
    C++: void free_timer(timer &toFree);
    Pascal: procedure FreeTimer(var toFree: Timer);

Pause Timer

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

  • Pause Timer (toPause) [show]

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

    Parameters:
    toPause : Timer
    Signatures by Language:
    C/C++: void pause_timer(timer toPause);
    Pascal: procedure PauseTimer(toPause: Timer);
  • Pause Timer (name) [show]

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

    Parameters:
    name : String
    Signatures by Language:
    C/C++: void pause_timer_named(const char *name);
    C++: void pause_timer(const char *name);
    Pascal: procedure PauseTimer(name: String);

Release All Timers

Releases all of the timers that have been loaded.

  • Release All Timers () [show]

    Releases all of the timers that have been loaded.


Release Timer

Release the resources used by the timer with the indicated name.

  • Release Timer (name) [show]

    Release the resources used by the timer with the indicated name.

    Parameters:
    name : String
    Signatures by Language:
    C/C++: void release_timer(const char *name);
    Pascal: procedure ReleaseTimer(name: String);

Reset Timer

Resets the time of a given timer

  • Reset Timer (name) [show]

    Resets the time of a given timer

    Parameters:
    name : String
    Signatures by Language:
    C/C++: void reset_timer_named(const char *name);
    C++: void reset_timer(const char *name);
    Pascal: procedure ResetTimer(name: String);
  • Reset Timer (tmr) [show]

    Resets the time of a given timer

    Parameters:
    tmr : Timer
    Signatures by Language:
    C/C++: void reset_timer(timer tmr);
    Pascal: procedure ResetTimer(tmr: Timer);

Resume Timer

Resumes a paused timer.

  • Resume Timer (name) [show]

    Resumes a paused timer.

    Parameters:
    name : String
    Signatures by Language:
    C/C++: void resume_timer_named(const char *name);
    C++: void resume_timer(const char *name);
    Pascal: procedure ResumeTimer(name: String);
  • Resume Timer (toUnpause) [show]

    Resumes a paused timer.

    Parameters:
    toUnpause : Timer
    Signatures by Language:
    C/C++: void resume_timer(timer toUnpause);
    Pascal: procedure ResumeTimer(toUnpause: Timer);

Start Timer

Start a timer recording the time that has passed.

  • Start Timer (name) [show]

    Start a timer recording the time that has passed.

    Parameters:
    name : String
    Signatures by Language:
    C/C++: void start_timer_named(const char *name);
    C++: void start_timer(const char *name);
    Pascal: procedure StartTimer(name: String);
  • Start Timer (toStart) [show]

    Start a timer recording the time that has passed.

    Parameters:
    toStart : Timer
    Signatures by Language:
    C/C++: void start_timer(timer toStart);
    Pascal: procedure StartTimer(toStart: Timer);

Stop Timer

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

  • Stop Timer (toStop) [show]

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

    Parameters:
    toStop : Timer
    Signatures by Language:
    C/C++: void stop_timer(timer toStop);
    Pascal: procedure StopTimer(toStop: Timer);
  • Stop Timer (name) [show]

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

    Parameters:
    name : String
    Signatures by Language:
    C/C++: void stop_timer_named(const char *name);
    C++: void stop_timer(const char *name);
    Pascal: procedure StopTimer(name: String);

Timer Named

Get the timer created with the indicated named.

  • Timer Named (name) : Timer [show]

    Get the timer created with the indicated named.

    Parameters:
    name : String
    Returns:
    Timer :
    Signatures by Language:
    C/C++: timer timer_named(const char *name);
    Pascal: function TimerNamed(name: String): Timer;

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.

  • Timer Ticks (name) : Longword [show]

    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 : String
    Returns:
    Longword :
    Signatures by Language:
    C/C++: uint32_t timer_ticks_named(const char *name);
    C++: uint32_t timer_ticks(const char *name);
    Pascal: function TimerTicks(name: String): Longword;
  • Timer Ticks (toGet) : Longword [show]

    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:
    toGet : Timer
    Returns:
    Longword :
    Signatures by Language:
    C/C++: uint32_t timer_ticks(timer toGet);
    Pascal: function TimerTicks(toGet: Timer): Longword;