diff options
Diffstat (limited to 'engine/xe_input.cpp')
-rw-r--r-- | engine/xe_input.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/engine/xe_input.cpp b/engine/xe_input.cpp index 91b9cab..a764e0c 100644 --- a/engine/xe_input.cpp +++ b/engine/xe_input.cpp @@ -4,19 +4,19 @@ namespace xe { -static XeInput* _instance; +static Input* _instance; -XeInput::XeInput(XeWindow& window) : window{window} { - glfwSetKeyCallback(window.getGLFWwindow(), XeInput::key_callback); - glfwSetMouseButtonCallback(window.getGLFWwindow(), XeInput::mouse_callback); +Input::Input(Window& window) : window{window} { + glfwSetKeyCallback(window.getGLFWwindow(), Input::key_callback); + glfwSetMouseButtonCallback(window.getGLFWwindow(), Input::mouse_callback); _instance = this; } -bool XeInput::isKeyPressed(int key) { +bool Input::isKeyPressed(int key) { return glfwGetKey(window.getGLFWwindow(), key) == GLFW_PRESS; } -bool XeInput::wasKeyPressed(int key) { +bool Input::wasKeyPressed(int key) { if(_pressed[key] == true) { _pressed[key] = false; return true; @@ -24,7 +24,7 @@ bool XeInput::wasKeyPressed(int key) { return false; } -bool XeInput::wasKeyReleased(int key) { +bool Input::wasKeyReleased(int key) { if(_released[key] == true) { _released[key] = false; return true; @@ -32,12 +32,12 @@ bool XeInput::wasKeyReleased(int key) { return false; } -void XeInput::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { +void Input::key_callback(GLFWwindow* window, int key, int scancode, int action, int mods) { if(action == GLFW_PRESS) _instance->_pressed[key] = true; if(action == GLFW_RELEASE) _instance->_released[key] = true; } -void XeInput::mouse_callback(GLFWwindow* window, int key, int action, int mods) { +void Input::mouse_callback(GLFWwindow* window, int key, int action, int mods) { if(action == GLFW_PRESS) _instance->_pressed[key] = true; if(action == GLFW_RELEASE) _instance->_released[key] = true; } |