12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #include "input/Controller.h"
- Button Controller::a{GLFW_KEY_A, "A"};
- Button Controller::b{GLFW_KEY_S, "B"};
- Button Controller::x{GLFW_KEY_X, "X"};
- Button Controller::y{GLFW_KEY_Z, "Y"};
- Button Controller::l{GLFW_KEY_Q, "L"};
- Button Controller::r{GLFW_KEY_W, "R"};
- Button Controller::start{GLFW_KEY_E, "Start"};
- Button Controller::select{GLFW_KEY_D, "Select"};
- Button Controller::left{GLFW_KEY_LEFT, "Left"};
- Button Controller::right{GLFW_KEY_RIGHT, "Right"};
- Button Controller::up{GLFW_KEY_UP, "Up"};
- Button Controller::down{GLFW_KEY_DOWN, "Down"};
- void Controller::init(Buttons& bs) {
- bs.add(a);
- bs.add(b);
- bs.add(x);
- bs.add(y);
- bs.add(l);
- bs.add(r);
- bs.add(start);
- bs.add(select);
- bs.add(left);
- bs.add(right);
- bs.add(up);
- bs.add(down);
- bs.mapGamepadButton(a, GLFW_GAMEPAD_BUTTON_A);
- bs.mapGamepadButton(b, GLFW_GAMEPAD_BUTTON_B);
- bs.mapGamepadButton(x, GLFW_GAMEPAD_BUTTON_X);
- bs.mapGamepadButton(y, GLFW_GAMEPAD_BUTTON_Y);
- bs.mapGamepadButton(l, GLFW_GAMEPAD_BUTTON_LEFT_BUMPER);
- bs.mapGamepadButton(r, GLFW_GAMEPAD_BUTTON_RIGHT_BUMPER);
- bs.mapGamepadButton(select, GLFW_GAMEPAD_BUTTON_BACK);
- bs.mapGamepadButton(start, GLFW_GAMEPAD_BUTTON_START);
- bs.mapGamepadButton(select, GLFW_GAMEPAD_BUTTON_LEFT_THUMB);
- bs.mapGamepadButton(start, GLFW_GAMEPAD_BUTTON_RIGHT_THUMB);
- bs.mapGamepadButton(up, GLFW_GAMEPAD_BUTTON_DPAD_UP);
- bs.mapGamepadButton(right, GLFW_GAMEPAD_BUTTON_DPAD_RIGHT);
- bs.mapGamepadButton(down, GLFW_GAMEPAD_BUTTON_DPAD_DOWN);
- bs.mapGamepadButton(left, GLFW_GAMEPAD_BUTTON_DPAD_LEFT);
- bs.mapGamepadAxis(left, -0.5f, GLFW_GAMEPAD_AXIS_LEFT_X);
- bs.mapGamepadAxis(right, 0.5f, GLFW_GAMEPAD_AXIS_LEFT_X);
- bs.mapGamepadAxis(left, -0.5f, GLFW_GAMEPAD_AXIS_RIGHT_X);
- bs.mapGamepadAxis(right, 0.5f, GLFW_GAMEPAD_AXIS_RIGHT_X);
- bs.mapGamepadAxis(up, -0.5f, GLFW_GAMEPAD_AXIS_LEFT_Y);
- bs.mapGamepadAxis(down, 0.5f, GLFW_GAMEPAD_AXIS_LEFT_Y);
- bs.mapGamepadAxis(up, -0.5f, GLFW_GAMEPAD_AXIS_RIGHT_Y);
- bs.mapGamepadAxis(down, 0.5f, GLFW_GAMEPAD_AXIS_RIGHT_Y);
- bs.mapGamepadAxis(l, 0.1f, GLFW_GAMEPAD_AXIS_LEFT_TRIGGER);
- bs.mapGamepadAxis(r, 0.1f, GLFW_GAMEPAD_AXIS_RIGHT_TRIGGER);
- }
|