123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #include "GLFW/glfw3.h"
- #include "client/Controls.h"
- Window::Controls::ButtonId Controls::left = 0;
- Window::Controls::ButtonId Controls::right = 0;
- Window::Controls::ButtonId Controls::up = 0;
- Window::Controls::ButtonId Controls::down = 0;
- Window::Controls::ButtonId Controls::jump = 0;
- Window::Controls::ButtonId Controls::sneak = 0;
- Window::Controls::ButtonId Controls::escape = 0;
- Window::Controls::ButtonId Controls::chat = 0;
- Window::Controls::ButtonId Controls::enter = 0;
- Window::Controls::ButtonId Controls::primaryClick = 0;
- Window::Controls::ButtonId Controls::secondaryClick = 0;
- void Controls::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);
- escape = Window::Controls::add("Escape");
- Window::Controls::bindKey(escape, GLFW_KEY_ESCAPE);
- chat = Window::Controls::add("Chat");
- Window::Controls::bindKey(chat, GLFW_KEY_T);
- enter = Window::Controls::add("Enter");
- Window::Controls::bindKey(enter, GLFW_KEY_ENTER);
- primaryClick = Window::Controls::add("Primary Click");
- Window::Controls::bindMouse(primaryClick, GLFW_MOUSE_BUTTON_LEFT);
- secondaryClick = Window::Controls::add("Secondary Click");
- Window::Controls::bindMouse(secondaryClick, GLFW_MOUSE_BUTTON_RIGHT);
- }
- bool Controls::wasReleased(Window::Controls::ButtonId id) {
- return Window::Controls::wasReleased(id);
- }
- bool Controls::isDown(Window::Controls::ButtonId id) {
- return Window::Controls::isDown(id);
- }
|