-
Notifications
You must be signed in to change notification settings - Fork 0
/
Helper.h
118 lines (114 loc) · 1.89 KB
/
Helper.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#pragma once
#include "raylib.h"
#include <string>
#include <vector>
#ifdef NDEBUG
#else
#define DBG
#include <iostream>
#endif
float PercentageOf(float Percentage, float Value)
{
return (Value * Percentage) / 100;
}
char KeyToChar(int Key)
{
switch (Key)
{
case KEY_A:
return 'a';
break;
case KEY_B:
return 'b';
break;
case KEY_C:
return 'c';
break;
case KEY_D:
return 'd';
break;
case KEY_E:
return 'e';
break;
case KEY_F:
return 'f';
break;
case KEY_G:
return 'g';
break;
case KEY_H:
return 'h';
break;
case KEY_I:
return 'i';
break;
case KEY_J:
return 'j';
break;
case KEY_K:
return 'k';
break;
case KEY_L:
return 'l';
break;
case KEY_M:
return 'm';
break;
case KEY_N:
return 'n';
break;
case KEY_O:
return 'o';
break;
case KEY_P:
return 'p';
break;
case KEY_Q:
return 'q';
break;
case KEY_R:
return 'r';
break;
case KEY_S:
return 's';
break;
case KEY_T:
return 't';
break;
case KEY_U:
return 'u';
break;
case KEY_V:
return 'v';
break;
case KEY_W:
return 'w';
break;
case KEY_X:
return 'x';
break;
case KEY_Y:
return 'y';
break;
case KEY_Z:
return 'z';
break;
case KEY_SPACE:
return ' ';
break;
default:
return 'a';
}
}
int GetAnyKeyDown()
{
for (int Key = KEY_SPACE; Key < 350; Key++) // Assuming 350 is the upper limit for key codes
{
if (IsKeyReleased(Key))
{
return Key;
break;
}
}
return 0;
}