1234567891011121314151617181920212223242526272829303132 |
- #include "input/Controller.h"
- Controller::Controller(Buttons& bs) : list(bs.get()), a(bs.add(GLFW_KEY_A, "A")), b(bs.add(GLFW_KEY_S, "B")),
- x(bs.add(GLFW_KEY_X, "X")), y(bs.add(GLFW_KEY_Z, "Y")), l(bs.add(GLFW_KEY_Q, "L")), r(bs.add(GLFW_KEY_W, "R")),
- start(bs.add(GLFW_KEY_E, "Start")), select(bs.add(GLFW_KEY_D, "Select")), left(bs.add(GLFW_KEY_LEFT, "Left")),
- right(bs.add(GLFW_KEY_RIGHT, "Right")), up(bs.add(GLFW_KEY_UP, "Up")), down(bs.add(GLFW_KEY_DOWN, "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);
- }
|