forked from fengjixuchui/XHOOK-WoW-1.12.1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtil.cpp
55 lines (46 loc) · 964 Bytes
/
Util.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "util.h"
#include "settings.h"
#include <algorithm>
#include <cctype>
#include <fcntl.h>
#include "Xorstr.hpp"
long Util::GetEpochTime()
{
using namespace std::chrono;
milliseconds ms = duration_cast< milliseconds >(
system_clock::now().time_since_epoch()
);
return ms.count();
}
ImColor Util::GetRainbowColor(float speed)
{
speed = 0.002f * speed;
long now = Util::GetEpochTime();
float hue = (now % (int)(1.0f / speed)) * speed;
return ImColor::HSV(hue, 1.0f, 1.0f);
}
Color Util::GetHealthColor(int hp)
{
return Color(
min(510 * (100 - hp) / 100, 255),
min(510 * hp / 100, 255),
25
);
}
//Color Util::GetHealthColor()
//{
// return Color(
// min(510 * (100 - 100) / 100, 255),
// min(510 * 15 / 100, 255),
// 25
// );
//}
//
//Color Util::GetHealthColor(int hp)
//{
// return Color(
// min(510 * (100 - hp) / 100, 255),
// min(510 * hp / 100, 255),
// 25
// );
//}