1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3
4#ifndef ENGINE_CLIENT_SMOOTH_TIME_H
5#define ENGINE_CLIENT_SMOOTH_TIME_H
6
7#include <cstdint>
8
9class CGraph;
10
11class CSmoothTime
12{
13public:
14 enum EAdjustDirection
15 {
16 ADJUSTDIRECTION_DOWN = 0,
17 ADJUSTDIRECTION_UP,
18 NUM_ADJUSTDIRECTIONS,
19 };
20
21private:
22 int64_t m_Snap;
23 int64_t m_Current;
24 int64_t m_Target;
25 int64_t m_Margin;
26
27 int m_SpikeCounter;
28 float m_aAdjustSpeed[NUM_ADJUSTDIRECTIONS];
29
30public:
31 void Init(int64_t Target);
32 void SetAdjustSpeed(EAdjustDirection Direction, float Value);
33
34 int64_t Get(int64_t Now) const;
35
36 void UpdateInt(int64_t Target);
37 void Update(CGraph *pGraph, int64_t Target, int TimeLeft, EAdjustDirection AdjustDirection);
38
39 void UpdateMargin(int64_t Margin);
40};
41
42#endif
43