Add handling for new gamepad buttons

Added handles to 1, 2, next and previous as available on the wiimote
This commit is contained in:
fireclawthefox 2016-07-21 12:44:44 +02:00
parent c7dbf193f1
commit dcdbe4b339
4 changed files with 46 additions and 0 deletions

View File

@ -693,6 +693,12 @@ map_button(int code) {
case BTN_TR2:
return GamepadButton::rtrigger();
case BTN_1:
return GamepadButton::action_1();
case BTN_2:
return GamepadButton::action_2();
case BTN_SELECT:
return GamepadButton::back();
@ -702,6 +708,12 @@ map_button(int code) {
case BTN_MODE:
return GamepadButton::guide();
case KEY_NEXT:
return GamepadButton::next();
case KEY_PREVIOUS:
return GamepadButton::previous();
case BTN_THUMBL:
return GamepadButton::lstick();

View File

@ -163,6 +163,14 @@ open_device() {
handle = GamepadButton::rtrigger();
break;
case BTN_1:
handle = GamepadButton::action_1();
break;
case BTN_2:
handle = GamepadButton::action_2();
break;
case BTN_SELECT:
handle = GamepadButton::back();
break;
@ -175,6 +183,14 @@ open_device() {
handle = GamepadButton::guide();
break;
case KEY_NEXT:
handle = GamepadButton::next();
break;
case KEY_PREVIOUS:
handle = GamepadButton::previous();
break;
case BTN_THUMBL:
handle = GamepadButton::lstick();
break;

View File

@ -34,6 +34,9 @@ DEFINE_GAMEPAD_BUTTON_HANDLE(back)
DEFINE_GAMEPAD_BUTTON_HANDLE(guide)
DEFINE_GAMEPAD_BUTTON_HANDLE(start)
DEFINE_GAMEPAD_BUTTON_HANDLE(next)
DEFINE_GAMEPAD_BUTTON_HANDLE(previous)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_a)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_b)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_c)
@ -41,6 +44,9 @@ DEFINE_GAMEPAD_BUTTON_HANDLE(action_x)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_y)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_z)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_1)
DEFINE_GAMEPAD_BUTTON_HANDLE(action_2)
/**
* This is intended to be called only once, by the static initialization
* performed in config_util.cxx.
@ -63,10 +69,16 @@ init_gamepad_buttons() {
ButtonRegistry::ptr()->register_button(_guide, "guide");
ButtonRegistry::ptr()->register_button(_start, "start");
ButtonRegistry::ptr()->register_button(_next, "next");
ButtonRegistry::ptr()->register_button(_previous, "previous");
ButtonRegistry::ptr()->register_button(_action_a, "action_a");
ButtonRegistry::ptr()->register_button(_action_b, "action_b");
ButtonRegistry::ptr()->register_button(_action_c, "action_c");
ButtonRegistry::ptr()->register_button(_action_x, "action_x");
ButtonRegistry::ptr()->register_button(_action_y, "action_y");
ButtonRegistry::ptr()->register_button(_action_z, "action_z");
ButtonRegistry::ptr()->register_button(_action_1, "action_1");
ButtonRegistry::ptr()->register_button(_action_2, "action_2");
}

View File

@ -40,6 +40,9 @@ PUBLISHED:
static ButtonHandle guide();
static ButtonHandle start();
static ButtonHandle next();
static ButtonHandle previous();
static ButtonHandle action_a();
static ButtonHandle action_b();
static ButtonHandle action_c();
@ -47,6 +50,9 @@ PUBLISHED:
static ButtonHandle action_y();
static ButtonHandle action_z();
static ButtonHandle action_1();
static ButtonHandle action_2();
public:
static void init_gamepad_buttons();
};