TmpMenu/src/util/timer.hpp
navmodder 0220f727b6 Better Aimbot & Flying Axe (#2480)
* Better Aimbot

* Revert "Better Aimbot"

This reverts commit 176824ad20ca46a9ec5bda79eeb5784d8bd277d9.

* Better Aimbot

* Flying Axe

* Aimbot smoothing

* More fixes & improvements

* Little missing detail

* Fixed

* Improvements

-switch to using inline
-switched timer to steady_clock
-changed axe lerp to "Lagrange's Interpolation"
- i hope girl is satisfied XD

* PEMDAS

* Comment!
2024-01-21 15:32:01 +01:00

37 lines
611 B
C++

#pragma once
#include <chrono>
namespace big
{
class timer
{
public:
explicit timer(std::chrono::milliseconds delay) :
m_timer(std::chrono::steady_clock::now()),
m_delay(delay)
{
}
bool updated()
{
auto now = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::milliseconds>(now - m_timer) >= m_delay)
{
m_timer = now;
return true;
}
return false;
}
void set_delay(std::chrono::milliseconds delay)
{
m_delay = delay;
}
private:
std::chrono::steady_clock::time_point m_timer;
std::chrono::milliseconds m_delay;
};
}