-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEKeyboard.cpp
More file actions
45 lines (33 loc) · 738 Bytes
/
Copy pathEKeyboard.cpp
File metadata and controls
45 lines (33 loc) · 738 Bytes
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
#include "EKeyboard.h"
#include <fstream>
void EKeyboard::Init()
{
std::ifstream i("keybindsConfig.json");
i >> keybindsJson;
std::vector<std::string> newActionKeybinds;
newActionKeybinds.empty();
for (int a = 0; a < ActionNames.size(); a++) {
newActionKeybinds[a-1] = keybindsJson[ActionNames[a-1]];
}
}
void EKeyboard::Update()
{
}
void EKeyboard::Shutdown()
{
}
void EKeyboard::RebindAction(std::string action)
{
bool keyPressed = false;
sf::Keyboard::Key newKey = sf::Keyboard::Key::Unknown;
while (!keyPressed) {
sf::Event event;
while (window->pollEvent(event))
{
if (event.type == sf::Event::KeyPressed) {
newKey = event.key.code;
}
}
}
const char* newKeyChar = getTextForEnum(newKey);
}