-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathKeyboardInput.cpp
More file actions
53 lines (46 loc) · 2.59 KB
/
KeyboardInput.cpp
File metadata and controls
53 lines (46 loc) · 2.59 KB
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
#include "KeyboardInput.h"
// Define the keyboard input handling function
void handleKeyboardInput()
{
if (GetAsyncKeyState('W') & 0x8000) {
writeRealValues[0] += 0.1f; // Increment the first real value by 0.1
std::cout << "Incrementing linear velocity to " << writeRealValues[0] << std::endl;
}
if (GetAsyncKeyState('X') & 0x8000) {
writeRealValues[0] -= 0.1f; // Decrement the first real value by 0.1
std::cout << "Decrementing linear velocity to " << writeRealValues[0] << std::endl;
}
if (GetAsyncKeyState('S') & 0x8000) {
writeRealValues[0] = 0.0f; // Set the first real value to 0
writeRealValues[1] = 0.0f; // Set the second real value to 0
std::cout << "Setting linear velocity and angular velocity to 0.0" << std::endl;
}
if (GetAsyncKeyState('A') & 0x8000) {
writeRealValues[1] += 0.1f; // Increment the second real value by 0.1
std::cout << "Incrementing angular velocity to " << writeRealValues[1] << std::endl;
}
if (GetAsyncKeyState('D') & 0x8000) {
writeRealValues[1] -= 0.1f; // Decrement the second real value by 0.1
std::cout << "Decrementing angular velocity to " << writeRealValues[1] << std::endl;
}
if (GetAsyncKeyState('Q') & 0x8000) {
writeRealValues[0] += 0.1f; // Increment the first real value by 0.1
writeRealValues[1] += 0.1f; // Increment the second real value by 0.1
std::cout << "Incrementing linear and angular velocity to " << writeRealValues[0] << ", " << writeRealValues[1] << std::endl;
}
if (GetAsyncKeyState('E') & 0x8000) {
writeRealValues[0] += 0.1f; // Increment the first real value by 0.1
writeRealValues[1] -= 0.1f; // Decrement the second real value by 0.1
std::cout << "Incrementing linear velocity and decrementing angular velocity to " << writeRealValues[0] << ", " << writeRealValues[1] << std::endl;
}
if (GetAsyncKeyState('Z') & 0x8000) {
writeRealValues[0] -= 0.1f; // Decrement the first real value by 0.1
writeRealValues[1] += 0.1f; // Increment the second real value by 0.1
std::cout << "Decrementing linear velocity and incrementing angular velocity to " << writeRealValues[0] << ", " << writeRealValues[1] << std::endl;
}
if (GetAsyncKeyState('C') & 0x8000) {
writeRealValues[0] -= 0.1f; // Decrement the first real value by 0.1
writeRealValues[1] -= 0.1f; // Decrement the second real value by 0.1
std::cout << "Decrementing linear and angular velocity to " << writeRealValues[0] << ", " << writeRealValues[1] << std::endl;
}
}