Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

TickTimer Class Reference
[Glue-logic objects]

Simple stopwatch class, based on SDL_GetTicks(). More...

#include <ticktimer.h>

Inheritance diagram for TickTimer:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 TickTimer ()
 Constructor. Counting starts at zero.

void Reset ()
 Set the timer back to zero.

Sint32 Left (Sint32 time)
 Returns amount of time left in interval, or zero if none.

Sint32 Ticks ()
 Returns the time since last reset.

 operator Sint32 ()
 Makes it act like an integer representing time since last reset.

TickTimeroperator-= (Sint32 offset)
 Decrements stopwatch, aka increases lasttick.


Protected Member Functions

virtual Sint32 GetCurTime ()
 Overloadable function to get time reference.


Protected Attributes

Sint32 lasttick
 The starting point, aka reference time.


Detailed Description

A simple general-purpose stopwatch class, using SDL_GetTicks() as a time source. Starts at zero and counts up. Can be overloaded to use a different timing source.

Definition at line 41 of file ticktimer.h.


Member Function Documentation

Sint32 TickTimer::Left Sint32  time  )  [inline]
 

Used to time an interval. For example, you could do something like while((timer.Left(1000))>0)) to wait until one second had expired since the timer's last Reset().

Definition at line 58 of file ticktimer.h.

References Ticks().

Here is the call graph for this function:


The documentation for this class was generated from the following file:
Generated on Sat Oct 11 13:19:40 2003 for Spritelib by doxygen 1.3.4