#include "BarinkEngine.h" #include "../Include/Input/GLFWInput.h" #include "../Include/EventSystem/InputSystemEvents.h" #include "../Include/Input/InputManager.h" namespace BarinkEngine { namespace Input { void BE_GLFW_KEYS(GLFWwindow* window, int key, int scancode, int action, int mods) { switch (action) { case GLFW_KEY_DOWN: { KEY_DOWN_EVENT keydown{}; keydown.name = "KEY::DOWN"; keydown.mods = mods; keydown.scancode = scancode; keydown.keycode = key; InputSystem.EmitEvent(keydown); break; } case GLFW_KEY_UP: { KEY_UP_EVENT keyup{}; keyup.name = "KEY::DOWN"; keyup.mods = mods; keyup.scancode = scancode; keyup.keycode = key; InputSystem.EmitEvent(keyup); break; } default: Event KeyEvent{}; KeyEvent.name = "KEY"; InputSystem.EmitEvent(KeyEvent); break; } } void BE_GLFW_CURSOR_POSITION(GLFWwindow* window, double x, double y) { Event CursorPosUpdate{}; CursorPosUpdate.name = "UPDATE::CURSOR:POSITION"; InputSystem.EmitEvent(CursorPosUpdate); } void BE_GLFW_CURSOR_ENTER(GLFWwindow* window, int entered) { if (entered) { Event mouseEntered{}; mouseEntered.name = "Mouse Entered Window's confines!"; InputSystem.EmitEvent(mouseEntered); } else { Event mouseLeft{}; mouseLeft.name = "Mouse Left Window's confines!"; InputSystem.EmitEvent(mouseLeft); } } void BE_GLFW_MOUSE_BUTTON(GLFWwindow* window, int button, int action, int mods) { Event MouseButtonEvent{}; MouseButtonEvent.name = "MOUSEBUTTON"; InputSystem.EmitEvent(MouseButtonEvent); } void BE_GLFW_SCROLL(GLFWwindow* window, double xoffset, double yoffset) { Event ScrollEvent{}; ScrollEvent.name = "SCROLL"; InputSystem.EmitEvent(ScrollEvent); } } }