MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Public Member Functions | List of all members
util::FrameTimer Class Reference

A timer class for frame-based applications. More...

#include <frame_timer.h>

Public Member Functions

 FrameTimer (void)
 
std::size_t get_frame_count (void) const
 Returns the amount of calls to nextFrame.
 
std::size_t get_max_fps (void) const
 Returns the maximum frames per second.
 
std::size_t get_time (void) const
 Returns the current time in milli seconds since program start.
 
float get_time_sec (void) const
 Returns the current time in seconds since program start.
 
void next_frame (void)
 Called to update the current time and limit FPS.
 
void set_max_fps (std::size_t fps)
 Sets the desired FPS.
 

Detailed Description

A timer class for frame-based applications.

With the get_time() method, the class provides a constant time for each frame. A call to next_frame() updates this time. By setting a max FPS rate, next_frame() also limits the frames by sleeping. The code works with real-world time rather than with CPU time or execution time (like std::clock()).

Definition at line 31 of file frame_timer.h.

Constructor & Destructor Documentation

◆ FrameTimer()

util::FrameTimer::FrameTimer ( void  )
inline

Definition at line 77 of file frame_timer.h.

Member Function Documentation

◆ get_frame_count()

std::size_t util::FrameTimer::get_frame_count ( void  ) const
inline

Returns the amount of calls to nextFrame.

Definition at line 110 of file frame_timer.h.

◆ get_max_fps()

std::size_t util::FrameTimer::get_max_fps ( void  ) const
inline

Returns the maximum frames per second.

Definition at line 92 of file frame_timer.h.

◆ get_time()

std::size_t util::FrameTimer::get_time ( void  ) const
inline

Returns the current time in milli seconds since program start.

This time is constant over the whole frame.

Definition at line 98 of file frame_timer.h.

◆ get_time_sec()

float util::FrameTimer::get_time_sec ( void  ) const
inline

Returns the current time in seconds since program start.

This time is constant over the whole frame.

Definition at line 104 of file frame_timer.h.

◆ next_frame()

void util::FrameTimer::next_frame ( void  )
inline

Called to update the current time and limit FPS.

Definition at line 116 of file frame_timer.h.

◆ set_max_fps()

void util::FrameTimer::set_max_fps ( std::size_t  fps)
inline

Sets the desired FPS.

Zero disables frame limit.

Definition at line 86 of file frame_timer.h.


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