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);
|
int kInt = static_cast<int>(k);
|
||||||
//Numbers
|
//Numbers
|
||||||
|
@ -118,6 +118,11 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
return "Keypad " + std::to_string(kInt - 96);
|
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
|
//Other keys
|
||||||
switch (k)
|
switch (k)
|
||||||
|
@ -248,35 +253,312 @@ namespace SHADE
|
||||||
case SH_KEYCODE::HELP:
|
case SH_KEYCODE::HELP:
|
||||||
return "Help";
|
return "Help";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_0:
|
case SH_KEYCODE::LEFT_WINDOWS:
|
||||||
return "0";
|
return "Left Windows";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_1:
|
case SH_KEYCODE::RIGHT_WINDOWS:
|
||||||
return "1";
|
return "Right Windows";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_2:
|
case SH_KEYCODE::APPS:
|
||||||
return "2";
|
return "Applications";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_3:
|
case SH_KEYCODE::SLEEP:
|
||||||
return "3";
|
return "Sleep";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_4:
|
case SH_KEYCODE::MULTIPLY:
|
||||||
return "4";
|
return "Multiply";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_5:
|
case SH_KEYCODE::ADD:
|
||||||
return "5";
|
return "Add";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_6:
|
case SH_KEYCODE::SEPARATOR:
|
||||||
return "6";
|
return "Separator";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_7:
|
case SH_KEYCODE::SUBTRACT:
|
||||||
return "7";
|
return "Subtract";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_8:
|
case SH_KEYCODE::DECIMAL:
|
||||||
return "8";
|
return "Decimal";
|
||||||
break;
|
break;
|
||||||
case SH_KEYCODE::NUMBER_9:
|
case SH_KEYCODE::DIVIDE:
|
||||||
return "9";
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,8 +415,11 @@ namespace SHADE
|
||||||
return controllerInUse;
|
return controllerInUse;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Get the name of keycode
|
//Get the name of key code
|
||||||
static std::string getKeycodeName(SH_KEYCODE const keycode) noexcept;
|
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
|
//For testing purposes
|
||||||
//static void PrintCurrentState() noexcept;
|
//static void PrintCurrentState() noexcept;
|
||||||
|
|
Loading…
Reference in New Issue