Controller.cpp 953 B

12345678910111213141516
  1. #include "client/input/Controller.h"
  2. Controller::Controller(Buttons& b) : list(b.get()), left(b.add(GLFW_KEY_A, "Left")), right(b.add(GLFW_KEY_D, "Right")),
  3. up(b.add(GLFW_KEY_W, "X")), down(b.add(GLFW_KEY_S, "Y")), jump(b.add(GLFW_KEY_SPACE, "L")),
  4. sneak(b.add(GLFW_KEY_LEFT_SHIFT, "R")), camLeft(b.add(GLFW_KEY_LEFT, "Start")),
  5. camRight(b.add(GLFW_KEY_RIGHT, "Select")), camUp(b.add(GLFW_KEY_UP, "Left")), camDown(b.add(GLFW_KEY_DOWN, "Right")) {
  6. b.mapGamepadAxis(left, -0.5f, GLFW_GAMEPAD_AXIS_LEFT_X);
  7. b.mapGamepadAxis(right, 0.5f, GLFW_GAMEPAD_AXIS_LEFT_X);
  8. b.mapGamepadAxis(up, -0.5f, GLFW_GAMEPAD_AXIS_LEFT_Y);
  9. b.mapGamepadAxis(down, 0.5f, GLFW_GAMEPAD_AXIS_LEFT_Y);
  10. b.mapGamepadAxis(camUp, -0.5f, GLFW_GAMEPAD_AXIS_RIGHT_Y);
  11. b.mapGamepadAxis(camDown, 0.5f, GLFW_GAMEPAD_AXIS_RIGHT_Y);
  12. b.mapGamepadAxis(camLeft, -0.5f, GLFW_GAMEPAD_AXIS_RIGHT_X);
  13. b.mapGamepadAxis(camRight, 0.5f, GLFW_GAMEPAD_AXIS_RIGHT_X);
  14. }