Nymph Game Engine
Chaiscript based Game Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Utility::FPSCounter Class Reference

Class for fps counter. More...

#include <fps_counter.h>

Inheritance diagram for Utility::FPSCounter:
Events::Subject

Public Member Functions

 FPSCounter (const float max_fps=0.0f)
 FPSCounter cunstructer. More...
 
virtual ~FPSCounter ()=default
 Destroys the object. More...
 
float assessCountAndGetDelta ()
 Calculates frame delta from FPS counter. More...
 
float getMaxFPS () const noexcept
 Gets the maximum fps. More...
 
float getCurrentFPS () const noexcept
 Gets the current fps. More...
 
float getAverageFPS () const noexcept
 Gets the average fps. More...
 
void resetAverageFPS () noexcept
 Resets FPS Average. More...
 
- Public Member Functions inherited from Events::Subject
virtual ~Subject ()=default
 
virtual void notify (std::shared_ptr< Event > event)
 notify is used to tell observers of an event. More...
 
virtual void notifyNow (std::shared_ptr< Event > event)
 notifyNow is used to tell observers of an event as an interrupt. More...
 
virtual void addObserver (std::shared_ptr< Observer > observer)
 Adds an observer. More...
 
virtual void removeObserver (std::shared_ptr< Observer > observer)
 Removes an observer. More...
 

Detailed Description

Class for fps counter.

Constructor & Destructor Documentation

Utility::FPSCounter::FPSCounter ( const float  max_fps = 0.0f)

FPSCounter cunstructer.

Parameters
[in]max_fpsThe maximum fps
virtual Utility::FPSCounter::~FPSCounter ( )
virtualdefault

Destroys the object.

Member Function Documentation

float Utility::FPSCounter::assessCountAndGetDelta ( )

Calculates frame delta from FPS counter.

Returns
frame delta

References Graphics::UI::ChangeTextEvent::create(), and Events::Subject::notifyNow().

float Utility::FPSCounter::getAverageFPS ( ) const
noexcept

Gets the average fps.

Returns
The average fps.

Referenced by generated::getFPSCounterModule().

float Utility::FPSCounter::getCurrentFPS ( ) const
noexcept

Gets the current fps.

Returns
The current fps.

Referenced by generated::getFPSCounterModule().

float Utility::FPSCounter::getMaxFPS ( ) const
noexcept

Gets the maximum fps.

Returns
The maximum fps.

Referenced by generated::getFPSCounterModule().

void Utility::FPSCounter::resetAverageFPS ( )
noexcept

Resets FPS Average.

Referenced by generated::getFPSCounterModule().


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