remove redundant static_cast by changing Events::pressedKeys template parameter from int to keycode
This commit is contained in:
parent
659a2610aa
commit
77b36f45f2
@ -101,7 +101,7 @@ void GUI::act(float delta) {
|
|||||||
focus->typed(codepoint);
|
focus->typed(codepoint);
|
||||||
}
|
}
|
||||||
for (auto key : Events::pressedKeys) {
|
for (auto key : Events::pressedKeys) {
|
||||||
focus->keyPressed(static_cast<keycode>(key)); // temporary solution
|
focus->keyPressed(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Events::_cursor_locked) {
|
if (!Events::_cursor_locked) {
|
||||||
|
|||||||
@ -13,7 +13,7 @@ glm::vec2 Events::cursor = {};
|
|||||||
bool Events::cursor_drag = false;
|
bool Events::cursor_drag = false;
|
||||||
bool Events::_cursor_locked = false;
|
bool Events::_cursor_locked = false;
|
||||||
std::vector<uint> Events::codepoints;
|
std::vector<uint> Events::codepoints;
|
||||||
std::vector<int> Events::pressedKeys;
|
std::vector<keycode> Events::pressedKeys;
|
||||||
std::unordered_map<std::string, Binding> Events::bindings;
|
std::unordered_map<std::string, Binding> Events::bindings;
|
||||||
|
|
||||||
bool Events::pressed(keycode keycode) {
|
bool Events::pressed(keycode keycode) {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public:
|
|||||||
static bool cursor_drag;
|
static bool cursor_drag;
|
||||||
static bool _cursor_locked;
|
static bool _cursor_locked;
|
||||||
static std::vector<uint> codepoints;
|
static std::vector<uint> codepoints;
|
||||||
static std::vector<int> pressedKeys;
|
static std::vector<keycode> pressedKeys;
|
||||||
static std::unordered_map<std::string, Binding> bindings;
|
static std::unordered_map<std::string, Binding> bindings;
|
||||||
|
|
||||||
static void pollEvents();
|
static void pollEvents();
|
||||||
|
|||||||
@ -27,13 +27,13 @@ void key_callback(GLFWwindow*, int key, int scancode, int action, int /*mode*/)
|
|||||||
if (key == GLFW_KEY_UNKNOWN) return;
|
if (key == GLFW_KEY_UNKNOWN) return;
|
||||||
if (action == GLFW_PRESS) {
|
if (action == GLFW_PRESS) {
|
||||||
Events::setKey(key, true);
|
Events::setKey(key, true);
|
||||||
Events::pressedKeys.push_back(key);
|
Events::pressedKeys.push_back(static_cast<keycode>(key));
|
||||||
}
|
}
|
||||||
else if (action == GLFW_RELEASE) {
|
else if (action == GLFW_RELEASE) {
|
||||||
Events::setKey(key, false);
|
Events::setKey(key, false);
|
||||||
}
|
}
|
||||||
else if (action == GLFW_REPEAT) {
|
else if (action == GLFW_REPEAT) {
|
||||||
Events::pressedKeys.push_back(key);
|
Events::pressedKeys.push_back(static_cast<keycode>(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user