#include "GLFW/glfw3.h" #include "client/input/Controller.h" #include "client/rendering/Engine.h" Window::Controls::ButtonId Controller::left = 0; Window::Controls::ButtonId Controller::right = 0; Window::Controls::ButtonId Controller::up = 0; Window::Controls::ButtonId Controller::down = 0; Window::Controls::ButtonId Controller::jump = 0; Window::Controls::ButtonId Controller::sneak = 0; Window::Controls::ButtonId Controller::camLeft = 0; Window::Controls::ButtonId Controller::camRight = 0; Window::Controls::ButtonId Controller::camUp = 0; Window::Controls::ButtonId Controller::camDown = 0; Window::Controls::ButtonId Controller::leftClick = 0; Window::Controls::ButtonId Controller::rightClick = 0; void Controller::init() { left = Window::Controls::add("Left"); Window::Controls::bindKey(left, GLFW_KEY_A); right = Window::Controls::add("Right"); Window::Controls::bindKey(right, GLFW_KEY_D); up = Window::Controls::add("Up"); Window::Controls::bindKey(up, GLFW_KEY_W); down = Window::Controls::add("Down"); Window::Controls::bindKey(down, GLFW_KEY_S); jump = Window::Controls::add("Jump"); Window::Controls::bindKey(jump, GLFW_KEY_SPACE); sneak = Window::Controls::add("Sneak"); Window::Controls::bindKey(sneak, GLFW_KEY_LEFT_SHIFT); camLeft = Window::Controls::add("Camera Left"); Window::Controls::bindKey(camLeft, GLFW_KEY_LEFT); camRight = Window::Controls::add("Camera Right"); Window::Controls::bindKey(camRight, GLFW_KEY_RIGHT); camUp = Window::Controls::add("Camera Up"); Window::Controls::bindKey(camUp, GLFW_KEY_UP); camDown = Window::Controls::add("Camera Down"); Window::Controls::bindKey(camDown, GLFW_KEY_DOWN); leftClick = Window::Controls::add("Left Click"); Window::Controls::bindMouse(leftClick, GLFW_MOUSE_BUTTON_LEFT); rightClick = Window::Controls::add("Right Click"); Window::Controls::bindMouse(leftClick, GLFW_MOUSE_BUTTON_RIGHT); } bool Controller::wasReleased(Window::Controls::ButtonId id) { return Window::Controls::wasReleased(id); } bool Controller::isDown(Window::Controls::ButtonId id) { return Window::Controls::isDown(id); }