libpsynth 0.2.1
Public Types | Public Member Functions
psynth::base::timer Class Reference

A class for counting time and forcing update rates. More...

#include <timer.hpp>

List of all members.

Public Types

typedef int tick_type
typedef size_t frame_type

Public Member Functions

 timer ()
 Constructor.
 timer (int fpsrate)
 Constructor which sets a frames per second rate.
 ~timer ()
 Destructor.
void force_fps (int fpsrate)
 Makes the timer force a frames per second update rate.
void reset ()
 Resets the timer counts.
void update ()
 Updates the timer.
tick_type ticks ()
 Returns the milliseconds elapsed between the last call to update() and the creation of the Timer or the last rest call.
tick_type delta_ticks ()
 Returns the milliseconds elapsed between the last two update() calls.
frame_type frames ()
 Returns the number of total updates since start.

Detailed Description

A class for counting time and forcing update rates.


Member Typedef Documentation


Constructor & Destructor Documentation

psynth::base::timer::timer ( )

Constructor.

psynth::base::timer::timer ( int  fpsrate)

Constructor which sets a frames per second rate.

Parameters:
fpsrateThe frames per second rate of the timer.
See also:
forceFps
psynth::base::timer::~timer ( )

Destructor.


Member Function Documentation

tick_type psynth::base::timer::delta_ticks ( ) [inline]

Returns the milliseconds elapsed between the last two update() calls.

void psynth::base::timer::force_fps ( int  fpsrate)

Makes the timer force a frames per second update rate.

This means that every call to update() will cause a sleep to force a rate of updates per second as near as possible to the desired one.

Parameters:
fpsrateThe desired fpsrate. Set it to -1 if you no longer want to have a fixed fpsrate.
frame_type psynth::base::timer::frames ( ) [inline]

Returns the number of total updates since start.

void psynth::base::timer::reset ( )

Resets the timer counts.

tick_type psynth::base::timer::ticks ( ) [inline]

Returns the milliseconds elapsed between the last call to update() and the creation of the Timer or the last rest call.

void psynth::base::timer::update ( )

Updates the timer.


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