sftools  2.0 dev
Bunch of tools for SFML application development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | List of all members
sftools::Chronometer Class Reference

Provide functionalities of a chronometer, aka stop watch. More...

#include <Chronometer.hpp>

+ Collaboration diagram for sftools::Chronometer:

Public Member Functions

 Chronometer (sf::Time initialTime=sf::Time::Zero)
 Constructor.
 
sf::Time add (sf::Time time)
 Add some time.
 
sf::Time reset (bool start=false)
 Reset the chronometer.
 
sf::Time pause ()
 Pause the chronometer.
 
sf::Time resume ()
 Resume the chronometer.
 
sf::Time toggle ()
 Pause or resume the chronometer.
 
bool isRunning () const
 Tell the chronometer is running or not.
 
sf::Time getElapsedTime () const
 Give the amount of time elapsed since the chronometer was started.
 
 operator sf::Time () const
 Implicit conversion to sf::Time.
 

Detailed Description

Provide functionalities of a chronometer, aka stop watch.

Definition at line 45 of file Chronometer.hpp.

Constructor & Destructor Documentation

sftools::Chronometer::Chronometer ( sf::Time  initialTime = sf::Time::Zero)
inline

Constructor.

Parameters
initialTimeInitial time elapsed

Definition at line 53 of file Chronometer.hpp.

References add(), and reset().

Member Function Documentation

sf::Time sftools::Chronometer::add ( sf::Time  time)
inline

Add some time.

Parameters
timeTime to be added to the time elapsed
Returns
Time elapsed

Definition at line 65 of file Chronometer.hpp.

References getElapsedTime().

Referenced by Chronometer().

sf::Time sftools::Chronometer::getElapsedTime ( ) const
inline

Give the amount of time elapsed since the chronometer was started.

Returns
Time elapsed

Definition at line 160 of file Chronometer.hpp.

Referenced by add(), operator sf::Time(), pause(), reset(), resume(), and toggle().

bool sftools::Chronometer::isRunning ( ) const
inline

Tell the chronometer is running or not.

chronometer's status

Definition at line 150 of file Chronometer.hpp.

Referenced by pause(), resume(), and toggle().

sftools::Chronometer::operator sf::Time ( ) const
inline

Implicit conversion to sf::Time.

Returns
Time elapsed
See Also
getElapsedTime

Definition at line 181 of file Chronometer.hpp.

References getElapsedTime().

sf::Time sftools::Chronometer::pause ( )
inline

Pause the chronometer.

Returns
Time elapsed
See Also
toggle

Definition at line 99 of file Chronometer.hpp.

References getElapsedTime(), and isRunning().

Referenced by toggle().

sf::Time sftools::Chronometer::reset ( bool  start = false)
inline

Reset the chronometer.

Parameters
startif true the chronometer automatically starts
Returns
Time elapsed on the chronometer before the reset

Definition at line 80 of file Chronometer.hpp.

References getElapsedTime(), and resume().

Referenced by Chronometer().

sf::Time sftools::Chronometer::resume ( )
inline

Resume the chronometer.

Returns
Time elapsed
See Also
toggle

Definition at line 116 of file Chronometer.hpp.

References getElapsedTime(), and isRunning().

Referenced by reset(), and toggle().

sf::Time sftools::Chronometer::toggle ( )
inline

Pause or resume the chronometer.

If the chronometer is running the it is paused; otherwise it is resumes.

Returns
Time elapsed
See Also
pause
resume

Definition at line 137 of file Chronometer.hpp.

References getElapsedTime(), isRunning(), pause(), and resume().


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