mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
Add handling for new gamepad buttons
Added handles to 1, 2, next and previous as available on the wiimote
This commit is contained in:
parent
c7dbf193f1
commit
dcdbe4b339
@ -693,6 +693,12 @@ map_button(int code) {
|
|||||||
case BTN_TR2:
|
case BTN_TR2:
|
||||||
return GamepadButton::rtrigger();
|
return GamepadButton::rtrigger();
|
||||||
|
|
||||||
|
case BTN_1:
|
||||||
|
return GamepadButton::action_1();
|
||||||
|
|
||||||
|
case BTN_2:
|
||||||
|
return GamepadButton::action_2();
|
||||||
|
|
||||||
case BTN_SELECT:
|
case BTN_SELECT:
|
||||||
return GamepadButton::back();
|
return GamepadButton::back();
|
||||||
|
|
||||||
@ -702,6 +708,12 @@ map_button(int code) {
|
|||||||
case BTN_MODE:
|
case BTN_MODE:
|
||||||
return GamepadButton::guide();
|
return GamepadButton::guide();
|
||||||
|
|
||||||
|
case KEY_NEXT:
|
||||||
|
return GamepadButton::next();
|
||||||
|
|
||||||
|
case KEY_PREVIOUS:
|
||||||
|
return GamepadButton::previous();
|
||||||
|
|
||||||
case BTN_THUMBL:
|
case BTN_THUMBL:
|
||||||
return GamepadButton::lstick();
|
return GamepadButton::lstick();
|
||||||
|
|
||||||
|
@ -163,6 +163,14 @@ open_device() {
|
|||||||
handle = GamepadButton::rtrigger();
|
handle = GamepadButton::rtrigger();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case BTN_1:
|
||||||
|
handle = GamepadButton::action_1();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case BTN_2:
|
||||||
|
handle = GamepadButton::action_2();
|
||||||
|
break;
|
||||||
|
|
||||||
case BTN_SELECT:
|
case BTN_SELECT:
|
||||||
handle = GamepadButton::back();
|
handle = GamepadButton::back();
|
||||||
break;
|
break;
|
||||||
@ -175,6 +183,14 @@ open_device() {
|
|||||||
handle = GamepadButton::guide();
|
handle = GamepadButton::guide();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case KEY_NEXT:
|
||||||
|
handle = GamepadButton::next();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case KEY_PREVIOUS:
|
||||||
|
handle = GamepadButton::previous();
|
||||||
|
break;
|
||||||
|
|
||||||
case BTN_THUMBL:
|
case BTN_THUMBL:
|
||||||
handle = GamepadButton::lstick();
|
handle = GamepadButton::lstick();
|
||||||
break;
|
break;
|
||||||
|
@ -34,6 +34,9 @@ DEFINE_GAMEPAD_BUTTON_HANDLE(back)
|
|||||||
DEFINE_GAMEPAD_BUTTON_HANDLE(guide)
|
DEFINE_GAMEPAD_BUTTON_HANDLE(guide)
|
||||||
DEFINE_GAMEPAD_BUTTON_HANDLE(start)
|
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_a)
|
||||||
DEFINE_GAMEPAD_BUTTON_HANDLE(action_b)
|
DEFINE_GAMEPAD_BUTTON_HANDLE(action_b)
|
||||||
DEFINE_GAMEPAD_BUTTON_HANDLE(action_c)
|
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_y)
|
||||||
DEFINE_GAMEPAD_BUTTON_HANDLE(action_z)
|
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
|
* This is intended to be called only once, by the static initialization
|
||||||
* performed in config_util.cxx.
|
* performed in config_util.cxx.
|
||||||
@ -63,10 +69,16 @@ init_gamepad_buttons() {
|
|||||||
ButtonRegistry::ptr()->register_button(_guide, "guide");
|
ButtonRegistry::ptr()->register_button(_guide, "guide");
|
||||||
ButtonRegistry::ptr()->register_button(_start, "start");
|
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_a, "action_a");
|
||||||
ButtonRegistry::ptr()->register_button(_action_b, "action_b");
|
ButtonRegistry::ptr()->register_button(_action_b, "action_b");
|
||||||
ButtonRegistry::ptr()->register_button(_action_c, "action_c");
|
ButtonRegistry::ptr()->register_button(_action_c, "action_c");
|
||||||
ButtonRegistry::ptr()->register_button(_action_x, "action_x");
|
ButtonRegistry::ptr()->register_button(_action_x, "action_x");
|
||||||
ButtonRegistry::ptr()->register_button(_action_y, "action_y");
|
ButtonRegistry::ptr()->register_button(_action_y, "action_y");
|
||||||
ButtonRegistry::ptr()->register_button(_action_z, "action_z");
|
ButtonRegistry::ptr()->register_button(_action_z, "action_z");
|
||||||
|
|
||||||
|
ButtonRegistry::ptr()->register_button(_action_1, "action_1");
|
||||||
|
ButtonRegistry::ptr()->register_button(_action_2, "action_2");
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,9 @@ PUBLISHED:
|
|||||||
static ButtonHandle guide();
|
static ButtonHandle guide();
|
||||||
static ButtonHandle start();
|
static ButtonHandle start();
|
||||||
|
|
||||||
|
static ButtonHandle next();
|
||||||
|
static ButtonHandle previous();
|
||||||
|
|
||||||
static ButtonHandle action_a();
|
static ButtonHandle action_a();
|
||||||
static ButtonHandle action_b();
|
static ButtonHandle action_b();
|
||||||
static ButtonHandle action_c();
|
static ButtonHandle action_c();
|
||||||
@ -47,6 +50,9 @@ PUBLISHED:
|
|||||||
static ButtonHandle action_y();
|
static ButtonHandle action_y();
|
||||||
static ButtonHandle action_z();
|
static ButtonHandle action_z();
|
||||||
|
|
||||||
|
static ButtonHandle action_1();
|
||||||
|
static ButtonHandle action_2();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void init_gamepad_buttons();
|
static void init_gamepad_buttons();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user