| |
Main Page Namespace List Class Hierarchy Alphabetical List Compound List Namespace Members Compound Members
PLMTimer Class ReferenceTimer.
More...
#include <PLMTimer.hpp>
Inheritance diagram for PLMTimer:
[legend]List of all members.
Detailed Description
Timer.
This object can :
- get current application time,
- store current time
- wait for a specific amount of time
For example, if you want to know how long a routine needs to execute :
Another use of timers is in event-oriented applications : void MainLoop ()
{
PLMTimer t;
while (! quit)
{
t.StoreTicks ();
get_new_events();
handle_events();
u32 diff = t.GetDiffNow ();
if (diff < FPS) t.Wait (FPS-diff);
}
}
This way, each loop is executed regurlarly and your program does not waste too much CPU resources.
Constructor & Destructor Documentation
| PLMTimer::PLMTimer |
( |
u32 |
val = 0 |
) |
|
|
|
|
Create a new timer initialized with val.
|
Member Function Documentation
| u32 PLMTimer::GetTicks |
( |
|
) |
[inline] |
|
|
|
Get current application time, in ticks (no modification).
|
| u32 PLMTimer::StoreTicks |
( |
|
) |
[inline] |
|
|
|
Get current time and store it internally (replace previous value).
|
| u32 PLMTimer::GetStoredTicks |
( |
|
) |
[inline] |
|
|
|
Get last saved time (no modification).
|
| u32 PLMTimer::GetDiffNow |
( |
|
) |
[inline] |
|
|
|
Get time difference between now and last saved time (no modification).
|
| u32 PLMTimer::GetDiffReplace |
( |
|
) |
[inline] |
|
|
|
Same as GetDiffNow() but replace saved time by current time.
|
| void PLMTimer::Reset |
( |
u32 |
val = 0 |
) |
[inline] |
|
| void PLMTimer::Wait |
( |
u32 |
delay |
) |
[inline] |
|
|
|
Wait (stop execution) for delay milliseconds (precision = 10 ms).
|
| void PLMTimer::WaitAcc |
( |
u32 |
delay |
) |
|
|
|
|
Wait (stop execution) for delay milliseconds (precision = 10 ms).
This version is designed to be a little bit more accurate, but more expensive in CPU time. |
| u32 PLMSDLMgr::NbInstances |
( |
|
) |
[inline, inherited] |
|
|
|
Get the current number of instances (classes using SDL).
|
| u32 PLMSDLMgr::SDLState |
( |
|
) |
[inline, inherited] |
|
|
|
Get the current value of SDL flags (initialized sub-systems).
|
The documentation for this class was generated from the following file:
Generated by
Doxygen 1.2.18 on Tue Oct 26 12:07:39 2004.
|