All checks were successful
Linux arm64 / Build (push) Successful in 4m59s
C'est très long Co-authored-by: Morph01 <thibaut6969delastreet@gmail.com> Reviewed-on: #43 Co-authored-by: Persson-dev <sim16.prib@gmail.com> Co-committed-by: Persson-dev <sim16.prib@gmail.com>
68 lines
1.1 KiB
C++
68 lines
1.1 KiB
C++
#pragma once
|
|
|
|
/**
|
|
* \file TickCounter.h
|
|
* \brief File containing the blitz::utils::TickCounter class
|
|
*/
|
|
|
|
#include <cstdint>
|
|
|
|
namespace blitz {
|
|
namespace utils {
|
|
|
|
/**
|
|
* \class TickCounter
|
|
* \brief Class used to count ticks
|
|
*/
|
|
class TickCounter {
|
|
private:
|
|
float m_TPS;
|
|
float m_MSPT;
|
|
std::uint64_t m_LastTPSTime;
|
|
std::uint8_t m_TickCount;
|
|
int m_TargetTPS;
|
|
|
|
public:
|
|
/**
|
|
* \brief Constructor
|
|
* \param tps The target ticks per second
|
|
*/
|
|
TickCounter(int tps) : m_TargetTPS(tps) {}
|
|
|
|
/**
|
|
* \brief Reset the tick counter
|
|
*/
|
|
void Reset();
|
|
/**
|
|
* \brief Update the tick counter
|
|
* \return True if the tick counter has been updated
|
|
*/
|
|
bool Update();
|
|
|
|
/**
|
|
* \brief Get the ticks per second
|
|
* \return The ticks per second
|
|
*/
|
|
float GetTPS() const {
|
|
return m_TPS;
|
|
}
|
|
|
|
/**
|
|
* \brief Get the milliseconds per tick
|
|
* \return The milliseconds per tick
|
|
*/
|
|
float GetMSPT() const {
|
|
return m_MSPT;
|
|
}
|
|
|
|
/**
|
|
* \brief Set the ticks per second
|
|
* \param mspt The ticks per second
|
|
*/
|
|
void SetMSPT(float mspt) {
|
|
m_MSPT = mspt;
|
|
}
|
|
};
|
|
|
|
} // namespace utils
|
|
} // namespace blitz
|