Rename KEYCODE to NKCODE (native key code) to kill name collision. Implement keymapping for Blackberry.

This commit is contained in:
Sacha 2013-08-05 03:30:34 +10:00
parent 55897ffde0
commit 48498d1833
9 changed files with 454 additions and 399 deletions

View File

@ -8,9 +8,8 @@
#include <unistd.h>
#include <string>
#include "input/keycodes.h"
#include "BlackberryMain.h"
#include "base/KeyCodeTranslationFromBlackberry.h"
// Simple implementations of System functions
@ -53,28 +52,6 @@ void LaunchEmail(const char *email_address)
InputState input_state;
// Input - urgh, these may collide with the android keycodes when we bring in input/keycodes.h
const unsigned int buttonMappings[18] = {
KEYCODE_K, //Cross
KEYCODE_L, //Circle
KEYCODE_J, //Square
KEYCODE_I, //Triangle
KEYCODE_Q, //LBUMPER
KEYCODE_P, //RBUMPER
KEYCODE_SPACE, //START
KEYCODE_ZERO, //SELECT
KEYCODE_W, //UP
KEYCODE_S, //DOWN
KEYCODE_A, //LEFT
KEYCODE_D, //RIGHT
0, //MENU (SwipeDown)
KEYCODE_BACKSPACE, //BACK
KEYCODE_W, //JOY UP
KEYCODE_S, //JOY DOWN
KEYCODE_A, //JOY LEFT
KEYCODE_D, //JOY RIGHT
};
void SimulateGamepad(InputState *input) {
input->pad_lstick_x = 0;
input->pad_lstick_y = 0;
@ -158,7 +135,7 @@ void BlackberryMain::handleInput(screen_event_t screen_event)
int flags, value;
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_FLAGS, &flags);
screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_KEY_SYM, &value);
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, value, flags));
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawBlackberrytoNative.find(value)->second, (flags & KEY_DOWN) ? KEY_DOWN : KEY_UP));
break;
// Gamepad
// TODO: Isn't using new input system yet
@ -247,7 +224,7 @@ void BlackberryMain::runMain() {
{
case NAVIGATOR_BACK:
case NAVIGATOR_SWIPE_DOWN:
pad_buttons |= PAD_BUTTON_MENU;
NativeKey(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_ESCAPE, KEY_DOWN));
break;
case NAVIGATOR_EXIT:
return;
@ -270,8 +247,7 @@ void BlackberryMain::runMain() {
}
// TODO: This is broken. Instead we should just send keyboard events through using NativeKey and not
// even bother with these bitfields.
input_state.pad_buttons = pad_buttons | controller_buttons;
pad_buttons &= ~PAD_BUTTON_MENU;
input_state.pad_buttons = controller_buttons;
UpdateInputState(&input_state);
NativeUpdate(input_state);
// Work in Progress

View File

@ -12,9 +12,10 @@
#include <bps/navigator.h> // Invoke Service
#include <bps/virtualkeyboard.h>// Keyboard Service
#include <bps/sensor.h> // Accelerometer
#include <sys/keycodes.h>
#include <bps/dialog.h> // Dialog Service (Toast=BB10)
#include <bps/vibration.h> // Vibrate Service (BB10)
#include "sys/keycodes.h"
#include "input/keycodes.h"
// Display
#include <EGL/egl.h>
@ -47,7 +48,7 @@ public:
BlackberryMain(int argc, char *argv[]) :
emulating(false),
screen_ui(0), screen_emu(0),
pad_buttons(0), controller_buttons(0),
controller_buttons(0),
egl_cont(EGL_NO_CONTEXT)
{
startMain(argc, argv);
@ -79,7 +80,7 @@ private:
int ndisplays;
int screen_ui, screen_emu;
bool emulating;
int pad_buttons, controller_buttons;
int controller_buttons;
EGLDisplay* egl_disp;
EGLSurface* egl_surf;
EGLContext egl_cont;

View File

@ -0,0 +1,78 @@
#include <map>
#include "util/const_map.h"
// TODO: Add any missing keys
static const std::map<int, int> KeyMapRawBlackberrytoNative = InitConstMap<int, int>
(KEYCODE_P, NKCODE_P)
(KEYCODE_O, NKCODE_O)
(KEYCODE_I, NKCODE_I)
(KEYCODE_U, NKCODE_U)
(KEYCODE_Y, NKCODE_Y)
(KEYCODE_T, NKCODE_T)
(KEYCODE_R, NKCODE_R)
(KEYCODE_E, NKCODE_E)
(KEYCODE_W, NKCODE_W)
(KEYCODE_Q, NKCODE_Q)
(KEYCODE_L, NKCODE_L)
(KEYCODE_K, NKCODE_K)
(KEYCODE_J, NKCODE_J)
(KEYCODE_H, NKCODE_H)
(KEYCODE_G, NKCODE_G)
(KEYCODE_F, NKCODE_F)
(KEYCODE_D, NKCODE_D)
(KEYCODE_S, NKCODE_S)
(KEYCODE_A, NKCODE_A)
(KEYCODE_M, NKCODE_M)
(KEYCODE_N, NKCODE_N)
(KEYCODE_B, NKCODE_B)
(KEYCODE_V, NKCODE_V)
(KEYCODE_C, NKCODE_C)
(KEYCODE_X, NKCODE_X)
(KEYCODE_Z, NKCODE_Z)
(KEYCODE_COMMA, NKCODE_COMMA)
(KEYCODE_PERIOD, NKCODE_PERIOD)
(KEYCODE_LEFT_ALT, NKCODE_ALT_LEFT)
(KEYCODE_RIGHT_ALT, NKCODE_ALT_RIGHT)
(KEYCODE_LEFT_SHIFT, NKCODE_SHIFT_LEFT)
(KEYCODE_RIGHT_SHIFT, NKCODE_SHIFT_RIGHT)
(KEYCODE_TAB, NKCODE_TAB)
(KEYCODE_SPACE, NKCODE_SPACE)
(KEYCODE_RETURN, NKCODE_ENTER)
(KEYCODE_MINUS, NKCODE_MINUS)
(KEYCODE_EQUAL, NKCODE_EQUALS)
(KEYCODE_LEFT_BRACKET, NKCODE_LEFT_BRACKET)
(KEYCODE_RIGHT_BRACKET, NKCODE_RIGHT_BRACKET)
(KEYCODE_BACK_SLASH, NKCODE_BACKSLASH)
(KEYCODE_SEMICOLON, NKCODE_SEMICOLON)
(KEYCODE_APOSTROPHE, NKCODE_APOSTROPHE)
(KEYCODE_SLASH, NKCODE_SLASH)
(KEYCODE_AT, NKCODE_AT)
(KEYCODE_PLUS, NKCODE_PLUS)
(KEYCODE_ESCAPE, NKCODE_ESCAPE)
(KEYCODE_DELETE, NKCODE_FORWARD_DEL)
(KEYCODE_LEFT_CTRL, NKCODE_CTRL_LEFT)
(KEYCODE_RIGHT_CTRL, NKCODE_CTRL_RIGHT)
(KEYCODE_CAPS_LOCK, NKCODE_CAPS_LOCK)
(KEYCODE_HOME, NKCODE_MOVE_HOME)
(KEYCODE_END, NKCODE_MOVE_END)
(KEYCODE_INSERT, NKCODE_INSERT)
(KEYCODE_ZERO, NKCODE_0)
(KEYCODE_ONE, NKCODE_1)
(KEYCODE_TWO, NKCODE_2)
(KEYCODE_THREE, NKCODE_3)
(KEYCODE_FOUR, NKCODE_4)
(KEYCODE_FIVE, NKCODE_5)
(KEYCODE_SIX, NKCODE_6)
(KEYCODE_SEVEN, NKCODE_7)
(KEYCODE_EIGHT, NKCODE_8)
(KEYCODE_NINE, NKCODE_9)
(KEYCODE_KP_DIVIDE, NKCODE_NUMPAD_DIVIDE)
(KEYCODE_KP_MULTIPLY, NKCODE_NUMPAD_MULTIPLY)
(KEYCODE_KP_MINUS, NKCODE_NUMPAD_SUBTRACT)
(KEYCODE_KP_PLUS, NKCODE_NUMPAD_ADD)
(KEYCODE_KP_ENTER, NKCODE_NUMPAD_ENTER)
(KEYCODE_LEFT, NKCODE_DPAD_LEFT)
(KEYCODE_UP, NKCODE_DPAD_UP)
(KEYCODE_RIGHT, NKCODE_DPAD_RIGHT)
(KEYCODE_DOWN, NKCODE_DPAD_DOWN);

View File

@ -3,93 +3,93 @@
// TODO: Add any missing keys
static const std::map<int, int> KeyMapRawSDLtoNative = InitConstMap<int, int>
(SDLK_p, KEYCODE_P)
(SDLK_o, KEYCODE_O)
(SDLK_i, KEYCODE_I)
(SDLK_u, KEYCODE_U)
(SDLK_y, KEYCODE_Y)
(SDLK_t, KEYCODE_T)
(SDLK_r, KEYCODE_R)
(SDLK_e, KEYCODE_E)
(SDLK_w, KEYCODE_W)
(SDLK_q, KEYCODE_Q)
(SDLK_l, KEYCODE_L)
(SDLK_k, KEYCODE_K)
(SDLK_j, KEYCODE_J)
(SDLK_h, KEYCODE_H)
(SDLK_g, KEYCODE_G)
(SDLK_f, KEYCODE_F)
(SDLK_d, KEYCODE_D)
(SDLK_s, KEYCODE_S)
(SDLK_a, KEYCODE_A)
(SDLK_m, KEYCODE_M)
(SDLK_n, KEYCODE_N)
(SDLK_b, KEYCODE_B)
(SDLK_v, KEYCODE_V)
(SDLK_c, KEYCODE_C)
(SDLK_x, KEYCODE_X)
(SDLK_z, KEYCODE_Z)
(SDLK_COMMA, KEYCODE_COMMA)
(SDLK_PERIOD, KEYCODE_PERIOD)
(SDLK_LALT, KEYCODE_ALT_LEFT)
(SDLK_RALT, KEYCODE_ALT_RIGHT)
(SDLK_LSHIFT, KEYCODE_SHIFT_LEFT)
(SDLK_RSHIFT, KEYCODE_SHIFT_RIGHT)
(SDLK_TAB, KEYCODE_TAB)
(SDLK_SPACE, KEYCODE_SPACE)
(SDLK_RETURN, KEYCODE_ENTER)
(SDLK_MINUS, KEYCODE_MINUS)
(SDLK_EQUALS, KEYCODE_EQUALS)
(SDLK_LEFTBRACKET, KEYCODE_LEFT_BRACKET)
(SDLK_RIGHTBRACKET, KEYCODE_RIGHT_BRACKET)
(SDLK_BACKSLASH, KEYCODE_BACKSLASH)
(SDLK_SEMICOLON, KEYCODE_SEMICOLON)
// (SDLK_, KEYCODE_APOSTROPHE) // I cannot find the SDL equiv
(SDLK_SLASH, KEYCODE_SLASH)
(SDLK_AT, KEYCODE_AT)
(SDLK_PLUS, KEYCODE_PLUS)
(SDLK_PAGEUP, KEYCODE_PAGE_UP)
(SDLK_PAGEDOWN, KEYCODE_PAGE_DOWN)
(SDLK_ESCAPE, KEYCODE_ESCAPE)
(SDLK_DELETE, KEYCODE_FORWARD_DEL)
(SDLK_LCTRL, KEYCODE_CTRL_LEFT)
(SDLK_RCTRL, KEYCODE_CTRL_RIGHT)
(SDLK_CAPSLOCK, KEYCODE_CAPS_LOCK)
(SDLK_HOME, KEYCODE_MOVE_HOME)
(SDLK_END, KEYCODE_MOVE_END)
(SDLK_INSERT, KEYCODE_INSERT)
(SDLK_p, NKCODE_P)
(SDLK_o, NKCODE_O)
(SDLK_i, NKCODE_I)
(SDLK_u, NKCODE_U)
(SDLK_y, NKCODE_Y)
(SDLK_t, NKCODE_T)
(SDLK_r, NKCODE_R)
(SDLK_e, NKCODE_E)
(SDLK_w, NKCODE_W)
(SDLK_q, NKCODE_Q)
(SDLK_l, NKCODE_L)
(SDLK_k, NKCODE_K)
(SDLK_j, NKCODE_J)
(SDLK_h, NKCODE_H)
(SDLK_g, NKCODE_G)
(SDLK_f, NKCODE_F)
(SDLK_d, NKCODE_D)
(SDLK_s, NKCODE_S)
(SDLK_a, NKCODE_A)
(SDLK_m, NKCODE_M)
(SDLK_n, NKCODE_N)
(SDLK_b, NKCODE_B)
(SDLK_v, NKCODE_V)
(SDLK_c, NKCODE_C)
(SDLK_x, NKCODE_X)
(SDLK_z, NKCODE_Z)
(SDLK_COMMA, NKCODE_COMMA)
(SDLK_PERIOD, NKCODE_PERIOD)
(SDLK_LALT, NKCODE_ALT_LEFT)
(SDLK_RALT, NKCODE_ALT_RIGHT)
(SDLK_LSHIFT, NKCODE_SHIFT_LEFT)
(SDLK_RSHIFT, NKCODE_SHIFT_RIGHT)
(SDLK_TAB, NKCODE_TAB)
(SDLK_SPACE, NKCODE_SPACE)
(SDLK_RETURN, NKCODE_ENTER)
(SDLK_MINUS, NKCODE_MINUS)
(SDLK_EQUALS, NKCODE_EQUALS)
(SDLK_LEFTBRACKET, NKCODE_LEFT_BRACKET)
(SDLK_RIGHTBRACKET, NKCODE_RIGHT_BRACKET)
(SDLK_BACKSLASH, NKCODE_BACKSLASH)
(SDLK_SEMICOLON, NKCODE_SEMICOLON)
// (SDLK_, NKCODE_APOSTROPHE) // I cannot find the SDL equiv
(SDLK_SLASH, NKCODE_SLASH)
(SDLK_AT, NKCODE_AT)
(SDLK_PLUS, NKCODE_PLUS)
(SDLK_PAGEUP, NKCODE_PAGE_UP)
(SDLK_PAGEDOWN, NKCODE_PAGE_DOWN)
(SDLK_ESCAPE, NKCODE_ESCAPE)
(SDLK_DELETE, NKCODE_FORWARD_DEL)
(SDLK_LCTRL, NKCODE_CTRL_LEFT)
(SDLK_RCTRL, NKCODE_CTRL_RIGHT)
(SDLK_CAPSLOCK, NKCODE_CAPS_LOCK)
(SDLK_HOME, NKCODE_MOVE_HOME)
(SDLK_END, NKCODE_MOVE_END)
(SDLK_INSERT, NKCODE_INSERT)
/* Somehow these are undefined
* on my comp?
(SDLK_KP_0, KEYCODE_NUMPAD_0)
(SDLK_KP_1, KEYCODE_NUMPAD_1)
(SDLK_KP_2, KEYCODE_NUMPAD_2)
(SDLK_KP_3, KEYCODE_NUMPAD_3)
(SDLK_KP_4, KEYCODE_NUMPAD_4)
(SDLK_KP_5, KEYCODE_NUMPAD_5)
(SDLK_KP_6, KEYCODE_NUMPAD_6)
(SDLK_KP_7, KEYCODE_NUMPAD_7)
(SDLK_KP_8, KEYCODE_NUMPAD_8)
(SDLK_KP_9, KEYCODE_NUMPAD_9)
(SDLK_KP_0, NKCODE_NUMPAD_0)
(SDLK_KP_1, NKCODE_NUMPAD_1)
(SDLK_KP_2, NKCODE_NUMPAD_2)
(SDLK_KP_3, NKCODE_NUMPAD_3)
(SDLK_KP_4, NKCODE_NUMPAD_4)
(SDLK_KP_5, NKCODE_NUMPAD_5)
(SDLK_KP_6, NKCODE_NUMPAD_6)
(SDLK_KP_7, NKCODE_NUMPAD_7)
(SDLK_KP_8, NKCODE_NUMPAD_8)
(SDLK_KP_9, NKCODE_NUMPAD_9)
*/
(SDLK_KP_DIVIDE, KEYCODE_NUMPAD_DIVIDE)
(SDLK_KP_MULTIPLY, KEYCODE_NUMPAD_MULTIPLY)
(SDLK_KP_MINUS, KEYCODE_NUMPAD_SUBTRACT)
(SDLK_KP_PLUS, KEYCODE_NUMPAD_ADD)
(SDLK_KP_PERIOD, KEYCODE_NUMPAD_DOT)
(SDLK_KP_ENTER, KEYCODE_NUMPAD_ENTER)
(SDLK_KP_EQUALS, KEYCODE_NUMPAD_EQUALS)
(SDLK_1, KEYCODE_1)
(SDLK_2, KEYCODE_2)
(SDLK_3, KEYCODE_3)
(SDLK_4, KEYCODE_4)
(SDLK_5, KEYCODE_5)
(SDLK_6, KEYCODE_6)
(SDLK_7, KEYCODE_7)
(SDLK_8, KEYCODE_8)
(SDLK_9, KEYCODE_9)
(SDLK_0, KEYCODE_0)
(SDLK_LEFT, KEYCODE_DPAD_LEFT)
(SDLK_UP, KEYCODE_DPAD_UP)
(SDLK_RIGHT, KEYCODE_DPAD_RIGHT)
(SDLK_DOWN, KEYCODE_DPAD_DOWN);
(SDLK_KP_DIVIDE, NKCODE_NUMPAD_DIVIDE)
(SDLK_KP_MULTIPLY, NKCODE_NUMPAD_MULTIPLY)
(SDLK_KP_MINUS, NKCODE_NUMPAD_SUBTRACT)
(SDLK_KP_PLUS, NKCODE_NUMPAD_ADD)
(SDLK_KP_PERIOD, NKCODE_NUMPAD_DOT)
(SDLK_KP_ENTER, NKCODE_NUMPAD_ENTER)
(SDLK_KP_EQUALS, NKCODE_NUMPAD_EQUALS)
(SDLK_1, NKCODE_1)
(SDLK_2, NKCODE_2)
(SDLK_3, NKCODE_3)
(SDLK_4, NKCODE_4)
(SDLK_5, NKCODE_5)
(SDLK_6, NKCODE_6)
(SDLK_7, NKCODE_7)
(SDLK_8, NKCODE_8)
(SDLK_9, NKCODE_9)
(SDLK_0, NKCODE_0)
(SDLK_LEFT, NKCODE_DPAD_LEFT)
(SDLK_UP, NKCODE_DPAD_UP)
(SDLK_RIGHT, NKCODE_DPAD_RIGHT)
(SDLK_DOWN, NKCODE_DPAD_DOWN);

View File

@ -531,21 +531,21 @@ int main(int argc, char *argv[]) {
// This is just a standard mapping that matches the X360 controller on MacOSX. Names will probably be all wrong
// on other controllers.
std::map<int, int> SDLJoyButtonMap;
SDLJoyButtonMap[0] = KEYCODE_DPAD_UP;
SDLJoyButtonMap[1] = KEYCODE_DPAD_DOWN;
SDLJoyButtonMap[2] = KEYCODE_DPAD_LEFT;
SDLJoyButtonMap[3] = KEYCODE_DPAD_RIGHT;
SDLJoyButtonMap[4] = KEYCODE_BUTTON_10;
SDLJoyButtonMap[5] = KEYCODE_BUTTON_9;
SDLJoyButtonMap[6] = KEYCODE_BUTTON_5;
SDLJoyButtonMap[7] = KEYCODE_BUTTON_6;
SDLJoyButtonMap[8] = KEYCODE_BUTTON_7;
SDLJoyButtonMap[9] = KEYCODE_BUTTON_8;
SDLJoyButtonMap[10] = KEYCODE_BUTTON_SELECT;
SDLJoyButtonMap[11] = KEYCODE_BUTTON_2;
SDLJoyButtonMap[12] = KEYCODE_BUTTON_3;
SDLJoyButtonMap[13] = KEYCODE_BUTTON_4;
SDLJoyButtonMap[14] = KEYCODE_BUTTON_1;
SDLJoyButtonMap[0] = NKCODE_DPAD_UP;
SDLJoyButtonMap[1] = NKCODE_DPAD_DOWN;
SDLJoyButtonMap[2] = NKCODE_DPAD_LEFT;
SDLJoyButtonMap[3] = NKCODE_DPAD_RIGHT;
SDLJoyButtonMap[4] = NKCODE_BUTTON_10;
SDLJoyButtonMap[5] = NKCODE_BUTTON_9;
SDLJoyButtonMap[6] = NKCODE_BUTTON_5;
SDLJoyButtonMap[7] = NKCODE_BUTTON_6;
SDLJoyButtonMap[8] = NKCODE_BUTTON_7;
SDLJoyButtonMap[9] = NKCODE_BUTTON_8;
SDLJoyButtonMap[10] = NKCODE_BUTTON_SELECT;
SDLJoyButtonMap[11] = NKCODE_BUTTON_2;
SDLJoyButtonMap[12] = NKCODE_BUTTON_3;
SDLJoyButtonMap[13] = NKCODE_BUTTON_4;
SDLJoyButtonMap[14] = NKCODE_BUTTON_1;
std::map<int, int> SDLJoyAxisMap;
SDLJoyAxisMap[0] = JOYSTICK_AXIS_X;
@ -643,13 +643,13 @@ int main(int argc, char *argv[]) {
input.flags = TOUCH_DOWN;
input.id = 0;
NativeTouch(input);
KeyInput key(DEVICE_ID_MOUSE, KEYCODE_EXT_MOUSEBUTTON_1, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_1, KEY_DOWN);
NativeKey(key);
}
break;
case SDL_BUTTON_RIGHT:
{
KeyInput key(DEVICE_ID_MOUSE, KEYCODE_EXT_MOUSEBUTTON_2, KEY_DOWN);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, KEY_DOWN);
NativeKey(key);
}
break;
@ -657,7 +657,7 @@ int main(int argc, char *argv[]) {
{
KeyInput key;
key.deviceId = DEVICE_ID_MOUSE;
key.keyCode = KEYCODE_EXT_MOUSEWHEEL_UP;
key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
key.flags = KEY_DOWN;
NativeKey(key);
}
@ -666,7 +666,7 @@ int main(int argc, char *argv[]) {
{
KeyInput key;
key.deviceId = DEVICE_ID_MOUSE;
key.keyCode = KEYCODE_EXT_MOUSEWHEEL_DOWN;
key.keyCode = NKCODE_EXT_MOUSEWHEEL_DOWN;
key.flags = KEY_DOWN;
NativeKey(key);
}
@ -699,13 +699,13 @@ int main(int argc, char *argv[]) {
input.flags = TOUCH_UP;
input.id = 0;
NativeTouch(input);
KeyInput key(DEVICE_ID_MOUSE, KEYCODE_EXT_MOUSEBUTTON_1, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_1, KEY_UP);
NativeKey(key);
}
break;
case SDL_BUTTON_RIGHT:
{
KeyInput key(DEVICE_ID_MOUSE, KEYCODE_EXT_MOUSEBUTTON_2, KEY_UP);
KeyInput key(DEVICE_ID_MOUSE, NKCODE_EXT_MOUSEBUTTON_2, KEY_UP);
NativeKey(key);
}
break;
@ -713,7 +713,7 @@ int main(int argc, char *argv[]) {
{
KeyInput key;
key.deviceId = DEVICE_ID_DEFAULT;
key.keyCode = KEYCODE_EXT_MOUSEWHEEL_UP;
key.keyCode = NKCODE_EXT_MOUSEWHEEL_UP;
key.flags = KEY_UP;
NativeKey(key);
}
@ -722,7 +722,7 @@ int main(int argc, char *argv[]) {
{
KeyInput key;
key.deviceId = DEVICE_ID_DEFAULT;
key.keyCode = KEYCODE_EXT_MOUSEWHEEL_DOWN;
key.keyCode = NKCODE_EXT_MOUSEWHEEL_DOWN;
key.flags = KEY_UP;
NativeKey(key);
}

View File

@ -16,24 +16,24 @@ const char *GetDeviceName(int deviceId) {
// Default pad mapping to button bits. Used for UI and stuff that doesn't use PPSSPP's key mapping system.
int MapPadButtonFixed(int keycode) {
switch (keycode) {
case KEYCODE_BACK: return PAD_BUTTON_BACK; // Back
case KEYCODE_MENU: return PAD_BUTTON_MENU; // Menu
case NKCODE_BACK: return PAD_BUTTON_BACK; // Back
case NKCODE_MENU: return PAD_BUTTON_MENU; // Menu
case KEYCODE_Z:
case KEYCODE_SPACE:
case KEYCODE_BUTTON_1:
case KEYCODE_BUTTON_A: // same as KEYCODE_OUYA_BUTTON_O and KEYCODE_BUTTON_CROSS_PS3
case NKCODE_Z:
case NKCODE_SPACE:
case NKCODE_BUTTON_1:
case NKCODE_BUTTON_A: // same as NKCODE_OUYA_BUTTON_O and NKCODE_BUTTON_CROSS_PS3
return PAD_BUTTON_A;
case KEYCODE_ESCAPE:
case KEYCODE_BUTTON_2:
case KEYCODE_BUTTON_B: // same as KEYCODE_OUYA_BUTTON_A and KEYCODE_BUTTON_CIRCLE_PS3:
case NKCODE_ESCAPE:
case NKCODE_BUTTON_2:
case NKCODE_BUTTON_B: // same as NKCODE_OUYA_BUTTON_A and NKCODE_BUTTON_CIRCLE_PS3:
return PAD_BUTTON_B;
case KEYCODE_DPAD_LEFT: return PAD_BUTTON_LEFT;
case KEYCODE_DPAD_RIGHT: return PAD_BUTTON_RIGHT;
case KEYCODE_DPAD_UP: return PAD_BUTTON_UP;
case KEYCODE_DPAD_DOWN: return PAD_BUTTON_DOWN;
case NKCODE_DPAD_LEFT: return PAD_BUTTON_LEFT;
case NKCODE_DPAD_RIGHT: return PAD_BUTTON_RIGHT;
case NKCODE_DPAD_UP: return PAD_BUTTON_UP;
case NKCODE_DPAD_DOWN: return PAD_BUTTON_DOWN;
default:
return 0;
@ -73,4 +73,4 @@ void UpdateInputState(InputState *input, bool merge) {
void EndInputState(InputState *input) {
input->pad_last_buttons = input->pad_buttons;
}
}

View File

@ -1,243 +1,243 @@
#pragma once
typedef enum _keycode_t {
KEYCODE_BUTTON_CROSS = 23, // trackpad or X button(Xperia Play) is pressed
KEYCODE_BUTTON_CROSS_PS3 = 96, // PS3 X button is pressed
KEYCODE_BUTTON_CIRCLE = 1004, // Special custom keycode generated from 'O' button by our java code. Or 'O' button if Alt is pressed (TODO)
KEYCODE_BUTTON_CIRCLE_PS3 = 97, // PS3 O button is pressed
KEYCODE_BUTTON_SQUARE = 99, // Square button(Xperia Play) is pressed
KEYCODE_BUTTON_TRIANGLE = 100, // 'Triangle button(Xperia Play) is pressed
KEYCODE_DPAD_LEFT = 21,
KEYCODE_DPAD_UP = 19,
KEYCODE_DPAD_RIGHT = 22,
KEYCODE_DPAD_DOWN = 20,
KEYCODE_DPAD_CENTER = 23,
KEYCODE_UNKNOWN = 0,
KEYCODE_SOFT_LEFT = 1,
KEYCODE_SOFT_RIGHT = 2,
KEYCODE_HOME = 3,
KEYCODE_BACK = 4,
KEYCODE_CALL = 5,
KEYCODE_ENDCALL = 6,
KEYCODE_0 = 7,
KEYCODE_1 = 8,
KEYCODE_2 = 9,
KEYCODE_3 = 10,
KEYCODE_4 = 11,
KEYCODE_5 = 12,
KEYCODE_6 = 13,
KEYCODE_7 = 14,
KEYCODE_8 = 15,
KEYCODE_9 = 16,
KEYCODE_STAR = 17,
KEYCODE_POUND = 18,
KEYCODE_VOLUME_UP = 24,
KEYCODE_VOLUME_DOWN = 25,
KEYCODE_POWER = 26,
KEYCODE_CAMERA = 27,
KEYCODE_CLEAR = 28,
KEYCODE_A = 29,
KEYCODE_B = 30,
KEYCODE_C = 31,
KEYCODE_D = 32,
KEYCODE_E = 33,
KEYCODE_F = 34,
KEYCODE_G = 35,
KEYCODE_H = 36,
KEYCODE_I = 37,
KEYCODE_J = 38,
KEYCODE_K = 39,
KEYCODE_L = 40,
KEYCODE_M = 41,
KEYCODE_N = 42,
KEYCODE_O = 43,
KEYCODE_P = 44,
KEYCODE_Q = 45,
KEYCODE_R = 46,
KEYCODE_S = 47,
KEYCODE_T = 48,
KEYCODE_U = 49,
KEYCODE_V = 50,
KEYCODE_W = 51,
KEYCODE_X = 52,
KEYCODE_Y = 53,
KEYCODE_Z = 54,
KEYCODE_COMMA = 55,
KEYCODE_PERIOD = 56,
KEYCODE_ALT_LEFT = 57,
KEYCODE_ALT_RIGHT = 58,
KEYCODE_SHIFT_LEFT = 59,
KEYCODE_SHIFT_RIGHT = 60,
KEYCODE_TAB = 61,
KEYCODE_SPACE = 62,
KEYCODE_SYM = 63,
KEYCODE_EXPLORER = 64,
KEYCODE_ENVELOPE = 65,
KEYCODE_ENTER = 66,
KEYCODE_DEL = 67,
KEYCODE_GRAVE = 68,
KEYCODE_MINUS = 69,
KEYCODE_EQUALS = 70,
KEYCODE_LEFT_BRACKET = 71,
KEYCODE_RIGHT_BRACKET = 72,
KEYCODE_BACKSLASH = 73,
KEYCODE_SEMICOLON = 74,
KEYCODE_APOSTROPHE = 75,
KEYCODE_SLASH = 76,
KEYCODE_AT = 77,
KEYCODE_NUM = 78,
KEYCODE_HEADSETHOOK = 79,
KEYCODE_FOCUS = 80,
KEYCODE_PLUS = 81,
KEYCODE_MENU = 82,
KEYCODE_NOTIFICATION = 83,
KEYCODE_SEARCH = 84,
KEYCODE_MEDIA_PLAY_PAUSE = 85,
KEYCODE_MEDIA_STOP = 86,
KEYCODE_MEDIA_NEXT = 87,
KEYCODE_MEDIA_PREVIOUS = 88,
KEYCODE_MEDIA_REWIND = 89,
KEYCODE_MEDIA_FAST_FORWARD = 90,
KEYCODE_MUTE = 91,
KEYCODE_PAGE_UP = 92,
KEYCODE_PAGE_DOWN = 93,
KEYCODE_PICTSYMBOLS = 94,
KEYCODE_SWITCH_CHARSET = 95,
KEYCODE_BUTTON_A = 96,
KEYCODE_BUTTON_B = 97,
KEYCODE_BUTTON_C = 98,
KEYCODE_BUTTON_X = 99,
KEYCODE_BUTTON_Y = 100,
KEYCODE_BUTTON_Z = 101,
KEYCODE_BUTTON_L1 = 102,
KEYCODE_BUTTON_R1 = 103,
KEYCODE_BUTTON_L2 = 104,
KEYCODE_BUTTON_R2 = 105,
KEYCODE_BUTTON_THUMBL = 106,
KEYCODE_BUTTON_THUMBR = 107,
KEYCODE_BUTTON_START = 108,
KEYCODE_BUTTON_SELECT = 109,
KEYCODE_BUTTON_MODE = 110,
KEYCODE_ESCAPE = 111,
KEYCODE_FORWARD_DEL = 112,
KEYCODE_CTRL_LEFT = 113,
KEYCODE_CTRL_RIGHT = 114,
KEYCODE_CAPS_LOCK = 115,
KEYCODE_SCROLL_LOCK = 116,
KEYCODE_META_LEFT = 117,
KEYCODE_META_RIGHT = 118,
KEYCODE_FUNCTION = 119,
KEYCODE_SYSRQ = 120,
KEYCODE_BREAK = 121,
KEYCODE_MOVE_HOME = 122,
KEYCODE_MOVE_END = 123,
KEYCODE_INSERT = 124,
KEYCODE_FORWARD = 125,
KEYCODE_MEDIA_PLAY = 126,
KEYCODE_MEDIA_PAUSE = 127,
KEYCODE_MEDIA_CLOSE = 128,
KEYCODE_MEDIA_EJECT = 129,
KEYCODE_MEDIA_RECORD = 130,
KEYCODE_F1 = 131,
KEYCODE_F2 = 132,
KEYCODE_F3 = 133,
KEYCODE_F4 = 134,
KEYCODE_F5 = 135,
KEYCODE_F6 = 136,
KEYCODE_F7 = 137,
KEYCODE_F8 = 138,
KEYCODE_F9 = 139,
KEYCODE_F10 = 140,
KEYCODE_F11 = 141,
KEYCODE_F12 = 142,
KEYCODE_NUM_LOCK = 143,
KEYCODE_NUMPAD_0 = 144,
KEYCODE_NUMPAD_1 = 145,
KEYCODE_NUMPAD_2 = 146,
KEYCODE_NUMPAD_3 = 147,
KEYCODE_NUMPAD_4 = 148,
KEYCODE_NUMPAD_5 = 149,
KEYCODE_NUMPAD_6 = 150,
KEYCODE_NUMPAD_7 = 151,
KEYCODE_NUMPAD_8 = 152,
KEYCODE_NUMPAD_9 = 153,
KEYCODE_NUMPAD_DIVIDE = 154,
KEYCODE_NUMPAD_MULTIPLY = 155,
KEYCODE_NUMPAD_SUBTRACT = 156,
KEYCODE_NUMPAD_ADD = 157,
KEYCODE_NUMPAD_DOT = 158,
KEYCODE_NUMPAD_COMMA = 159,
KEYCODE_NUMPAD_ENTER = 160,
KEYCODE_NUMPAD_EQUALS = 161,
KEYCODE_NUMPAD_LEFT_PAREN = 162,
KEYCODE_NUMPAD_RIGHT_PAREN = 163,
KEYCODE_VOLUME_MUTE = 164,
KEYCODE_INFO = 165,
KEYCODE_CHANNEL_UP = 166,
KEYCODE_CHANNEL_DOWN = 167,
KEYCODE_ZOOM_IN = 168,
KEYCODE_ZOOM_OUT = 169,
KEYCODE_TV = 170,
KEYCODE_WINDOW = 171,
KEYCODE_GUIDE = 172,
KEYCODE_DVR = 173,
KEYCODE_BOOKMARK = 174,
KEYCODE_CAPTIONS = 175,
KEYCODE_SETTINGS = 176,
KEYCODE_TV_POWER = 177,
KEYCODE_TV_INPUT = 178,
KEYCODE_STB_POWER = 179,
KEYCODE_STB_INPUT = 180,
KEYCODE_AVR_POWER = 181,
KEYCODE_AVR_INPUT = 182,
KEYCODE_PROG_RED = 183,
KEYCODE_PROG_GREEN = 184,
KEYCODE_PROG_YELLOW = 185,
KEYCODE_PROG_BLUE = 186,
KEYCODE_APP_SWITCH = 187,
KEYCODE_BUTTON_1 = 188,
KEYCODE_BUTTON_2 = 189,
KEYCODE_BUTTON_3 = 190,
KEYCODE_BUTTON_4 = 191,
KEYCODE_BUTTON_5 = 192,
KEYCODE_BUTTON_6 = 193,
KEYCODE_BUTTON_7 = 194,
KEYCODE_BUTTON_8 = 195,
KEYCODE_BUTTON_9 = 196,
KEYCODE_BUTTON_10 = 197,
KEYCODE_BUTTON_11 = 198,
KEYCODE_BUTTON_12 = 199,
KEYCODE_BUTTON_13 = 200,
KEYCODE_BUTTON_14 = 201,
KEYCODE_BUTTON_15 = 202,
KEYCODE_BUTTON_16 = 203,
NKCODE_BUTTON_CROSS = 23, // trackpad or X button(Xperia Play) is pressed
NKCODE_BUTTON_CROSS_PS3 = 96, // PS3 X button is pressed
NKCODE_BUTTON_CIRCLE = 1004, // Special custom keycode generated from 'O' button by our java code. Or 'O' button if Alt is pressed (TODO)
NKCODE_BUTTON_CIRCLE_PS3 = 97, // PS3 O button is pressed
NKCODE_BUTTON_SQUARE = 99, // Square button(Xperia Play) is pressed
NKCODE_BUTTON_TRIANGLE = 100, // 'Triangle button(Xperia Play) is pressed
NKCODE_DPAD_LEFT = 21,
NKCODE_DPAD_UP = 19,
NKCODE_DPAD_RIGHT = 22,
NKCODE_DPAD_DOWN = 20,
NKCODE_DPAD_CENTER = 23,
NKCODE_UNKNOWN = 0,
NKCODE_SOFT_LEFT = 1,
NKCODE_SOFT_RIGHT = 2,
NKCODE_HOME = 3,
NKCODE_BACK = 4,
NKCODE_CALL = 5,
NKCODE_ENDCALL = 6,
NKCODE_0 = 7,
NKCODE_1 = 8,
NKCODE_2 = 9,
NKCODE_3 = 10,
NKCODE_4 = 11,
NKCODE_5 = 12,
NKCODE_6 = 13,
NKCODE_7 = 14,
NKCODE_8 = 15,
NKCODE_9 = 16,
NKCODE_STAR = 17,
NKCODE_POUND = 18,
NKCODE_VOLUME_UP = 24,
NKCODE_VOLUME_DOWN = 25,
NKCODE_POWER = 26,
NKCODE_CAMERA = 27,
NKCODE_CLEAR = 28,
NKCODE_A = 29,
NKCODE_B = 30,
NKCODE_C = 31,
NKCODE_D = 32,
NKCODE_E = 33,
NKCODE_F = 34,
NKCODE_G = 35,
NKCODE_H = 36,
NKCODE_I = 37,
NKCODE_J = 38,
NKCODE_K = 39,
NKCODE_L = 40,
NKCODE_M = 41,
NKCODE_N = 42,
NKCODE_O = 43,
NKCODE_P = 44,
NKCODE_Q = 45,
NKCODE_R = 46,
NKCODE_S = 47,
NKCODE_T = 48,
NKCODE_U = 49,
NKCODE_V = 50,
NKCODE_W = 51,
NKCODE_X = 52,
NKCODE_Y = 53,
NKCODE_Z = 54,
NKCODE_COMMA = 55,
NKCODE_PERIOD = 56,
NKCODE_ALT_LEFT = 57,
NKCODE_ALT_RIGHT = 58,
NKCODE_SHIFT_LEFT = 59,
NKCODE_SHIFT_RIGHT = 60,
NKCODE_TAB = 61,
NKCODE_SPACE = 62,
NKCODE_SYM = 63,
NKCODE_EXPLORER = 64,
NKCODE_ENVELOPE = 65,
NKCODE_ENTER = 66,
NKCODE_DEL = 67,
NKCODE_GRAVE = 68,
NKCODE_MINUS = 69,
NKCODE_EQUALS = 70,
NKCODE_LEFT_BRACKET = 71,
NKCODE_RIGHT_BRACKET = 72,
NKCODE_BACKSLASH = 73,
NKCODE_SEMICOLON = 74,
NKCODE_APOSTROPHE = 75,
NKCODE_SLASH = 76,
NKCODE_AT = 77,
NKCODE_NUM = 78,
NKCODE_HEADSETHOOK = 79,
NKCODE_FOCUS = 80,
NKCODE_PLUS = 81,
NKCODE_MENU = 82,
NKCODE_NOTIFICATION = 83,
NKCODE_SEARCH = 84,
NKCODE_MEDIA_PLAY_PAUSE = 85,
NKCODE_MEDIA_STOP = 86,
NKCODE_MEDIA_NEXT = 87,
NKCODE_MEDIA_PREVIOUS = 88,
NKCODE_MEDIA_REWIND = 89,
NKCODE_MEDIA_FAST_FORWARD = 90,
NKCODE_MUTE = 91,
NKCODE_PAGE_UP = 92,
NKCODE_PAGE_DOWN = 93,
NKCODE_PICTSYMBOLS = 94,
NKCODE_SWITCH_CHARSET = 95,
NKCODE_BUTTON_A = 96,
NKCODE_BUTTON_B = 97,
NKCODE_BUTTON_C = 98,
NKCODE_BUTTON_X = 99,
NKCODE_BUTTON_Y = 100,
NKCODE_BUTTON_Z = 101,
NKCODE_BUTTON_L1 = 102,
NKCODE_BUTTON_R1 = 103,
NKCODE_BUTTON_L2 = 104,
NKCODE_BUTTON_R2 = 105,
NKCODE_BUTTON_THUMBL = 106,
NKCODE_BUTTON_THUMBR = 107,
NKCODE_BUTTON_START = 108,
NKCODE_BUTTON_SELECT = 109,
NKCODE_BUTTON_MODE = 110,
NKCODE_ESCAPE = 111,
NKCODE_FORWARD_DEL = 112,
NKCODE_CTRL_LEFT = 113,
NKCODE_CTRL_RIGHT = 114,
NKCODE_CAPS_LOCK = 115,
NKCODE_SCROLL_LOCK = 116,
NKCODE_META_LEFT = 117,
NKCODE_META_RIGHT = 118,
NKCODE_FUNCTION = 119,
NKCODE_SYSRQ = 120,
NKCODE_BREAK = 121,
NKCODE_MOVE_HOME = 122,
NKCODE_MOVE_END = 123,
NKCODE_INSERT = 124,
NKCODE_FORWARD = 125,
NKCODE_MEDIA_PLAY = 126,
NKCODE_MEDIA_PAUSE = 127,
NKCODE_MEDIA_CLOSE = 128,
NKCODE_MEDIA_EJECT = 129,
NKCODE_MEDIA_RECORD = 130,
NKCODE_F1 = 131,
NKCODE_F2 = 132,
NKCODE_F3 = 133,
NKCODE_F4 = 134,
NKCODE_F5 = 135,
NKCODE_F6 = 136,
NKCODE_F7 = 137,
NKCODE_F8 = 138,
NKCODE_F9 = 139,
NKCODE_F10 = 140,
NKCODE_F11 = 141,
NKCODE_F12 = 142,
NKCODE_NUM_LOCK = 143,
NKCODE_NUMPAD_0 = 144,
NKCODE_NUMPAD_1 = 145,
NKCODE_NUMPAD_2 = 146,
NKCODE_NUMPAD_3 = 147,
NKCODE_NUMPAD_4 = 148,
NKCODE_NUMPAD_5 = 149,
NKCODE_NUMPAD_6 = 150,
NKCODE_NUMPAD_7 = 151,
NKCODE_NUMPAD_8 = 152,
NKCODE_NUMPAD_9 = 153,
NKCODE_NUMPAD_DIVIDE = 154,
NKCODE_NUMPAD_MULTIPLY = 155,
NKCODE_NUMPAD_SUBTRACT = 156,
NKCODE_NUMPAD_ADD = 157,
NKCODE_NUMPAD_DOT = 158,
NKCODE_NUMPAD_COMMA = 159,
NKCODE_NUMPAD_ENTER = 160,
NKCODE_NUMPAD_EQUALS = 161,
NKCODE_NUMPAD_LEFT_PAREN = 162,
NKCODE_NUMPAD_RIGHT_PAREN = 163,
NKCODE_VOLUME_MUTE = 164,
NKCODE_INFO = 165,
NKCODE_CHANNEL_UP = 166,
NKCODE_CHANNEL_DOWN = 167,
NKCODE_ZOOM_IN = 168,
NKCODE_ZOOM_OUT = 169,
NKCODE_TV = 170,
NKCODE_WINDOW = 171,
NKCODE_GUIDE = 172,
NKCODE_DVR = 173,
NKCODE_BOOKMARK = 174,
NKCODE_CAPTIONS = 175,
NKCODE_SETTINGS = 176,
NKCODE_TV_POWER = 177,
NKCODE_TV_INPUT = 178,
NKCODE_STB_POWER = 179,
NKCODE_STB_INPUT = 180,
NKCODE_AVR_POWER = 181,
NKCODE_AVR_INPUT = 182,
NKCODE_PROG_RED = 183,
NKCODE_PROG_GREEN = 184,
NKCODE_PROG_YELLOW = 185,
NKCODE_PROG_BLUE = 186,
NKCODE_APP_SWITCH = 187,
NKCODE_BUTTON_1 = 188,
NKCODE_BUTTON_2 = 189,
NKCODE_BUTTON_3 = 190,
NKCODE_BUTTON_4 = 191,
NKCODE_BUTTON_5 = 192,
NKCODE_BUTTON_6 = 193,
NKCODE_BUTTON_7 = 194,
NKCODE_BUTTON_8 = 195,
NKCODE_BUTTON_9 = 196,
NKCODE_BUTTON_10 = 197,
NKCODE_BUTTON_11 = 198,
NKCODE_BUTTON_12 = 199,
NKCODE_BUTTON_13 = 200,
NKCODE_BUTTON_14 = 201,
NKCODE_BUTTON_15 = 202,
NKCODE_BUTTON_16 = 203,
// Ouya buttons. Just here for reference, they map straight to regular android buttons
// and will be mapped the same way.
KEYCODE_OUYA_BUTTON_A = 97,
KEYCODE_OUYA_BUTTON_DPAD_DOWN = 20,
KEYCODE_OUYA_BUTTON_DPAD_LEFT = 21,
KEYCODE_OUYA_BUTTON_DPAD_RIGHT = 22,
KEYCODE_OUYA_BUTTON_DPAD_UP = 19,
KEYCODE_OUYA_BUTTON_L1 = 102,
KEYCODE_OUYA_BUTTON_L2 = 104,
KEYCODE_OUYA_BUTTON_L3 = 106,
KEYCODE_OUYA_BUTTON_MENU = 82,
KEYCODE_OUYA_BUTTON_O = 96,
KEYCODE_OUYA_BUTTON_R1 = 103,
KEYCODE_OUYA_BUTTON_R2 = 105,
KEYCODE_OUYA_BUTTON_R3 = 107,
KEYCODE_OUYA_BUTTON_U = 99,
KEYCODE_OUYA_BUTTON_Y = 100,
NKCODE_OUYA_BUTTON_A = 97,
NKCODE_OUYA_BUTTON_DPAD_DOWN = 20,
NKCODE_OUYA_BUTTON_DPAD_LEFT = 21,
NKCODE_OUYA_BUTTON_DPAD_RIGHT = 22,
NKCODE_OUYA_BUTTON_DPAD_UP = 19,
NKCODE_OUYA_BUTTON_L1 = 102,
NKCODE_OUYA_BUTTON_L2 = 104,
NKCODE_OUYA_BUTTON_L3 = 106,
NKCODE_OUYA_BUTTON_MENU = 82,
NKCODE_OUYA_BUTTON_O = 96,
NKCODE_OUYA_BUTTON_R1 = 103,
NKCODE_OUYA_BUTTON_R2 = 105,
NKCODE_OUYA_BUTTON_R3 = 107,
NKCODE_OUYA_BUTTON_U = 99,
NKCODE_OUYA_BUTTON_Y = 100,
// Extended keycodes, not available on Android
KEYCODE_EXT_PIPE = 1001, // The key next to Z on euro 102-key keyboards.
NKCODE_EXT_PIPE = 1001, // The key next to Z on euro 102-key keyboards.
KEYCODE_EXT_MOUSEBUTTON_1 = 1002,
KEYCODE_EXT_MOUSEBUTTON_2 = 1003,
KEYCODE_EXT_MOUSEBUTTON_3 = 1004,
KEYCODE_EXT_MOUSEWHEEL_UP = 1008,
KEYCODE_EXT_MOUSEWHEEL_DOWN = 1009
NKCODE_EXT_MOUSEBUTTON_1 = 1002,
NKCODE_EXT_MOUSEBUTTON_2 = 1003,
NKCODE_EXT_MOUSEBUTTON_3 = 1004,
NKCODE_EXT_MOUSEWHEEL_UP = 1008,
NKCODE_EXT_MOUSEWHEEL_DOWN = 1009
} keycode_t;
enum AndroidJoystickAxis {

View File

@ -422,14 +422,14 @@ void TriggerButton::GetContentDimensions(const UIContext &dc, float &w, float &h
void Slider::Key(const KeyInput &input) {
if (HasFocus() && input.flags & KEY_DOWN) {
switch (input.keyCode) {
case KEYCODE_DPAD_LEFT:
case KEYCODE_MINUS:
case KEYCODE_NUMPAD_SUBTRACT:
case NKCODE_DPAD_LEFT:
case NKCODE_MINUS:
case NKCODE_NUMPAD_SUBTRACT:
*value_ -= 1;
break;
case KEYCODE_DPAD_RIGHT:
case KEYCODE_PLUS:
case KEYCODE_NUMPAD_ADD:
case NKCODE_DPAD_RIGHT:
case NKCODE_PLUS:
case NKCODE_NUMPAD_ADD:
*value_ -= 1;
break;
}
@ -466,14 +466,14 @@ void Slider::GetContentDimensions(const UIContext &dc, float &w, float &h) const
void SliderFloat::Key(const KeyInput &input) {
if (HasFocus() && input.flags & KEY_DOWN) {
switch (input.keyCode) {
case KEYCODE_DPAD_LEFT:
case KEYCODE_MINUS:
case KEYCODE_NUMPAD_SUBTRACT:
case NKCODE_DPAD_LEFT:
case NKCODE_MINUS:
case NKCODE_NUMPAD_SUBTRACT:
*value_ -= 1;
break;
case KEYCODE_DPAD_RIGHT:
case KEYCODE_PLUS:
case KEYCODE_NUMPAD_ADD:
case NKCODE_DPAD_RIGHT:
case NKCODE_PLUS:
case NKCODE_NUMPAD_ADD:
*value_ -= 1;
break;
}

View File

@ -474,10 +474,10 @@ void ScrollView::Layout() {
void ScrollView::Key(const KeyInput &input) {
if (input.flags & KEY_DOWN) {
switch (input.keyCode) {
case KEYCODE_EXT_MOUSEWHEEL_UP:
case NKCODE_EXT_MOUSEWHEEL_UP:
ScrollRelative(-250);
break;
case KEYCODE_EXT_MOUSEWHEEL_DOWN:
case NKCODE_EXT_MOUSEWHEEL_DOWN:
ScrollRelative(250);
break;
}