R-Type  2
Doom but in better
Loading...
Searching...
No Matches
GUI::ECS::Systems::Clock Class Reference

A class for managing time tracking within the ECS system. More...

#include <Clock.hpp>

Inheritance diagram for GUI::ECS::Systems::Clock:
Inheritance graph
Collaboration diagram for GUI::ECS::Systems::Clock:
Collaboration graph

Public Member Functions

 Clock (const std::uint32_t entityId=0)
 Construct a new Clock object.
 
 ~Clock ()
 Destroy the Clock object.
 
const std::int64_t reset ()
 Resets the clock and returns the elapsed time since the last reset.
 
const std::int64_t getElapsedTime () const
 Gets the elapsed time since the clock was last reset.
 
void stop ()
 Stops the clock.
 
void start ()
 Starts the clock.
 
const bool isRunning () const
 Checks if the clock is currently running.
 
const std::string getInfo (const unsigned int indent=0) const
 This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.
 
- Public Member Functions inherited from GUI::ECS::EntityNode
 EntityNode (const size_t entityId=0)
 
virtual ~EntityNode ()=default
 
virtual size_t getEntityNodeId () const
 

Additional Inherited Members

- Protected Attributes inherited from GUI::ECS::EntityNode
size_t _entityID
 

Detailed Description

A class for managing time tracking within the ECS system.

This class extends EntityNode and provides functionality for managing time, including starting, stopping, resetting, and getting the elapsed time. It also supports debug information output through the getInfo method.

Definition at line 36 of file Clock.hpp.

Constructor & Destructor Documentation

◆ Clock()

GUI::ECS::Systems::Clock::Clock ( const std::uint32_t entityId = 0)

Construct a new Clock object.

Parameters
entityIdThe ID of the entity associated with this Clock. Defaults to 0.

Definition at line 16 of file Clock.cpp.

◆ ~Clock()

GUI::ECS::Systems::Clock::~Clock ( )

Destroy the Clock object.

Definition at line 23 of file Clock.cpp.

Member Function Documentation

◆ getElapsedTime()

const std::int64_t GUI::ECS::Systems::Clock::getElapsedTime ( ) const

Gets the elapsed time since the clock was last reset.

Returns
The elapsed time in microseconds as a signed 64-bit integer.

Definition at line 36 of file Clock.cpp.

◆ getInfo()

const std::string GUI::ECS::Systems::Clock::getInfo ( const unsigned int indent = 0) const

This is a function meant for debugging purposes It will dump the current state of the variables upon call. It will dump them for itself and any of it's underlying classes.

Parameters
indentThe level to which the class should be indented in the dump.
Returns
const std::string The formatted output.

Definition at line 59 of file Clock.cpp.

◆ isRunning()

const bool GUI::ECS::Systems::Clock::isRunning ( ) const

Checks if the clock is currently running.

Returns
true if the clock is running, false otherwise.

Definition at line 53 of file Clock.cpp.

◆ reset()

const std::int64_t GUI::ECS::Systems::Clock::reset ( )

Resets the clock and returns the elapsed time since the last reset.

Returns
The elapsed time in microseconds as a signed 64-bit integer.

Definition at line 25 of file Clock.cpp.

◆ start()

void GUI::ECS::Systems::Clock::start ( )

Starts the clock.

Definition at line 41 of file Clock.cpp.

◆ stop()

void GUI::ECS::Systems::Clock::stop ( )

Stops the clock.

Definition at line 47 of file Clock.cpp.


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