sf::Clock Class Reference

Utility class for manipulating time. More...

#include <Clock.hpp>

List of all members.

Public Member Functions

 Clock ()
 Default constructor.
float GetElapsedTime () const
 Get the time elapsed.
void Reset ()
 Restart the timer.

Detailed Description

Utility class for manipulating time.

sf::Clock is a lightweight class for measuring time.

Its accuray depends on the underlying OS, but you can generally expect a 1 ms precision.

Usage example:

 sf::Clock clock;
 ...
 float time1 = clock.GetElapsedTime();
 clock.Reset();
 ...
 float time2 = clock.GetElapsedTime();

Definition at line 40 of file Clock.hpp.


Constructor & Destructor Documentation

sf::Clock::Clock (  ) 

Default constructor.

The clock starts automatically after being constructed.

Definition at line 35 of file Clock.cpp.


Member Function Documentation

float sf::Clock::GetElapsedTime (  )  const

Get the time elapsed.

This function returns the time elapsed since the last call to Reset() (or the construction of the instance if Reset() has not been called) in seconds.

Returns:
Time elapsed, in seconds

Definition at line 42 of file Clock.cpp.

void sf::Clock::Reset (  ) 

Restart the timer.

This function puts the time counter back to zero.

Definition at line 49 of file Clock.cpp.


The documentation for this class was generated from the following files: