Implemented Input Binding Panel via Editor #318
|
@ -100,7 +100,7 @@ namespace SHADE
|
|||
}
|
||||
}
|
||||
|
||||
std::string SHInputManager::getKeycodeName(SH_KEYCODE k) noexcept
|
||||
std::string SHInputManager::getKeyCodeName(SH_KEYCODE k) noexcept
|
||||
{
|
||||
int kInt = static_cast<int>(k);
|
||||
//Numbers
|
||||
|
@ -118,6 +118,11 @@ namespace SHADE
|
|||
{
|
||||
return "Keypad " + std::to_string(kInt - 96);
|
||||
}
|
||||
//Function keys
|
||||
if (kInt >= static_cast<int>(SH_KEYCODE::F1) && kInt <= static_cast<int>(SH_KEYCODE::F24))
|
||||
{
|
||||
return "F" + std::to_string(kInt - 111);
|
||||
}
|
||||
|
||||
//Other keys
|
||||
switch (k)
|
||||
|
@ -248,35 +253,312 @@ namespace SHADE
|
|||
case SH_KEYCODE::HELP:
|
||||
return "Help";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_0:
|
||||
return "0";
|
||||
case SH_KEYCODE::LEFT_WINDOWS:
|
||||
return "Left Windows";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_1:
|
||||
return "1";
|
||||
case SH_KEYCODE::RIGHT_WINDOWS:
|
||||
return "Right Windows";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_2:
|
||||
return "2";
|
||||
case SH_KEYCODE::APPS:
|
||||
return "Applications";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_3:
|
||||
return "3";
|
||||
case SH_KEYCODE::SLEEP:
|
||||
return "Sleep";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_4:
|
||||
return "4";
|
||||
case SH_KEYCODE::MULTIPLY:
|
||||
return "Multiply";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_5:
|
||||
return "5";
|
||||
case SH_KEYCODE::ADD:
|
||||
return "Add";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_6:
|
||||
return "6";
|
||||
case SH_KEYCODE::SEPARATOR:
|
||||
return "Separator";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_7:
|
||||
return "7";
|
||||
case SH_KEYCODE::SUBTRACT:
|
||||
return "Subtract";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_8:
|
||||
return "8";
|
||||
case SH_KEYCODE::DECIMAL:
|
||||
return "Decimal";
|
||||
break;
|
||||
case SH_KEYCODE::NUMBER_9:
|
||||
return "9";
|
||||
case SH_KEYCODE::DIVIDE:
|
||||
return "Divide";
|
||||
break;
|
||||
case SH_KEYCODE::NUM_LOCK:
|
||||
return "Num Lock";
|
||||
break;
|
||||
case SH_KEYCODE::SCROLL_LOCK:
|
||||
return "Scroll Lock";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_PC98_NUMPAD_EQUAL:
|
||||
return "OEM PC98 Numpad Equal / Fujitsu Dictionary";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_FUJITSU_UNREGISTER:
|
||||
return "OEM Fujitsu Unregister";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_FUJITSU_REGISTER:
|
||||
return "OEM Fujitsu Register";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_FUJITSU_LEFT_THUMB:
|
||||
return "OEM Fujitsu Left Thumb";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_FUJITSU_RIGHT_THUMB:
|
||||
return "OEM Fujitsu Right Thumb";
|
||||
break;
|
||||
case SH_KEYCODE::LEFT_SHIFT:
|
||||
return "Left Shift";
|
||||
break;
|
||||
case SH_KEYCODE::RIGHT_SHIFT:
|
||||
return "Right Shift";
|
||||
break;
|
||||
case SH_KEYCODE::LEFT_CTRL:
|
||||
return "Left Ctrl";
|
||||
break;
|
||||
case SH_KEYCODE::RIGHT_CTRL:
|
||||
return "Right Ctrl";
|
||||
break;
|
||||
case SH_KEYCODE::LEFT_ALT:
|
||||
return "Left Alt";
|
||||
break;
|
||||
case SH_KEYCODE::RIGHT_ALT:
|
||||
return "Right Alt";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_BACK:
|
||||
return "Browser Back";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_FORWARD:
|
||||
return "Browser Forward";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_REFRESH:
|
||||
return "Browser Refresh";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_STOP:
|
||||
return "Browser Stop";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_SEARCH:
|
||||
return "Browser Search";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_FAVOURITES:
|
||||
return "Browser Favourites";
|
||||
break;
|
||||
case SH_KEYCODE::BROWSER_HOME:
|
||||
return "Browser Start and Home";
|
||||
break;
|
||||
case SH_KEYCODE::VOLUME_MUTE:
|
||||
return "Volume Mute";
|
||||
break;
|
||||
case SH_KEYCODE::VOLUME_DOWN:
|
||||
return "Volume Down";
|
||||
break;
|
||||
case SH_KEYCODE::VOLUME_UP:
|
||||
return "Volume Up";
|
||||
break;
|
||||
case SH_KEYCODE::MEDIA_NEXT_TRACK:
|
||||
return "Media Next Track";
|
||||
break;
|
||||
case SH_KEYCODE::MEDIA_PREVIOUS_TRACK:
|
||||
return "Media Previous Track";
|
||||
break;
|
||||
case SH_KEYCODE::MEDIA_STOP:
|
||||
return "Media Stop";
|
||||
break;
|
||||
case SH_KEYCODE::MEDIA_PLAY_PAUSE:
|
||||
return "Media Play/Pause";
|
||||
break;
|
||||
case SH_KEYCODE::LAUNCH_MAIL:
|
||||
return "Launch Mail";
|
||||
break;
|
||||
case SH_KEYCODE::LAUNCH_MEDIA_SELECT:
|
||||
return "Select Media";
|
||||
break;
|
||||
case SH_KEYCODE::LAUNCH_APP_1:
|
||||
return "Launch App 1";
|
||||
break;
|
||||
case SH_KEYCODE::LAUNCH_APP_2:
|
||||
return "Launch App 2";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_1:
|
||||
return "; or :";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_PLUS:
|
||||
return "+";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_COMMA:
|
||||
return ",";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_2:
|
||||
return "/ or ?";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_3:
|
||||
return "` or ~";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_4:
|
||||
return "[ or {";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_5:
|
||||
return "\\ or |";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_6:
|
||||
return "] or }";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_7:
|
||||
return "\' or \"";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_8:
|
||||
return "OEM 8";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_AX:
|
||||
return "OEM AX";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_102:
|
||||
return "< or > or \\ or |";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_ICO_HELP:
|
||||
return "ICO Help";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_ICO_00:
|
||||
return "ICO 00";
|
||||
break;
|
||||
case SH_KEYCODE::IME_PROCESS:
|
||||
return "IME Process";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_ICO_CLEAR:
|
||||
return "ICO Clear";
|
||||
break;
|
||||
case SH_KEYCODE::PACKET:
|
||||
return "Packet";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_RESET:
|
||||
return "OEM Reset";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_JUMP:
|
||||
return "OEM Jump";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_PA1:
|
||||
return "OEM PA1";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_PA2:
|
||||
return "OEM PA2";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_PA3:
|
||||
return "OEM PA3";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_WSCTRL:
|
||||
return "OEM WSCTRL";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_CUSEL:
|
||||
return "OEM CuSel";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_ATTN:
|
||||
return "OEM Attn";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_FINISH:
|
||||
return "OEM Finish";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_COPY:
|
||||
return "OEM Copy";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_AUTO:
|
||||
return "OEM Auto";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_ENLW:
|
||||
return "OEM ENLW";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_BACKTAB:
|
||||
return "OEM Backtab";
|
||||
break;
|
||||
case SH_KEYCODE::ATTN:
|
||||
return "Attn";
|
||||
break;
|
||||
case SH_KEYCODE::CRSEL:
|
||||
return "CrSel";
|
||||
break;
|
||||
case SH_KEYCODE::EXSEL:
|
||||
return "ExSel";
|
||||
break;
|
||||
case SH_KEYCODE::EREOF:
|
||||
return "Erase EOF";
|
||||
break;
|
||||
case SH_KEYCODE::PLAY:
|
||||
return "Play";
|
||||
break;
|
||||
case SH_KEYCODE::ZOOM:
|
||||
return "Zoom";
|
||||
break;
|
||||
case SH_KEYCODE::NONAME:
|
||||
return "No Name Key";
|
||||
break;
|
||||
case SH_KEYCODE::PA_1:
|
||||
return "PA1";
|
||||
break;
|
||||
case SH_KEYCODE::OEM_CLEAR:
|
||||
return "OEM Clear";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::string SHInputManager::getControllerCodeName(SH_CONTROLLERCODE c) noexcept
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case SH_CONTROLLERCODE::DPAD_UP:
|
||||
return "D-Pad Up";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::DPAD_DOWN:
|
||||
return "D-Pad Down";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::DPAD_LEFT:
|
||||
return "D-Pad Left";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::DPAD_RIGHT:
|
||||
return "D-Pad Right";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::START:
|
||||
return "Start Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::BACK:
|
||||
return "Back Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::LEFT_THUMBSTICK:
|
||||
return "Left Thumbstick Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::RIGHT_THUMBSTICK:
|
||||
return "Right Thumbstick Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::LEFT_SHOULDER:
|
||||
return "Left Shoulder Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::RIGHT_SHOULDER:
|
||||
return "Right Shoulder Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::A:
|
||||
return "A Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::B:
|
||||
return "B Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::X:
|
||||
return "X Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::Y:
|
||||
return "Y Button";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::LEFT_TRIGGER:
|
||||
return "Left Trigger";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::RIGHT_TRIGGER:
|
||||
return "Right Trigger";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::LEFT_THUMBSTICK_X:
|
||||
return "Left Thumbstick Horizontal";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::LEFT_THUMBSTICK_Y:
|
||||
return "Left Thumbstick Vertical";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::RIGHT_THUMBSTICK_X:
|
||||
return "Right Thumbstick Horizontal";
|
||||
break;
|
||||
case SH_CONTROLLERCODE::RIGHT_THUMBSTICK_Y:
|
||||
return "Right Thumbstick Vertical";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,8 +415,11 @@ namespace SHADE
|
|||
return controllerInUse;
|
||||
}
|
||||
|
||||
//Get the name of keycode
|
||||
static std::string getKeycodeName(SH_KEYCODE const keycode) noexcept;
|
||||
//Get the name of key code
|
||||
static std::string getKeyCodeName(SH_KEYCODE const keyCode) noexcept;
|
||||
|
||||
//Get the name of controller code
|
||||
static std::string getControllerCodeName(SH_CONTROLLERCODE const controllerCode) noexcept;
|
||||
|
||||
//For testing purposes
|
||||
//static void PrintCurrentState() noexcept;
|
||||
|
|
Loading…
Reference in New Issue