port: allow pressing DEL to delete the binding

This commit is contained in:
fgsfds committed 2023-11-01 17:46:24 +01:00
1 parent 4a0296d1a4
commit a802d2db06
2 files changed
+11 -2

No files matched your search

+1
View File
@@ -20,6 +20,7 @@ enum virtkey {
VK_KEYBOARD_BEGIN = 0,
VK_RETURN = 40,
VK_ESCAPE = 41,
VK_DELETE = 76,
/* same order as SDL mouse buttons */
VK_MOUSE_BEGIN = 512,
+10 -2
View File
@@ -773,11 +773,19 @@ struct menuitem g_ExtendedBindKeyMenuItems[] = {
0,
menuhandlerDoBind,
},
{
MENUITEMTYPE_SELECTABLE,
0,
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_LITERAL_TEXT,
(uintptr_t)"ESC to cancel, DEL to remove binding\n",
0,
menuhandlerDoBind,
},
{ MENUITEMTYPE_END },
};
struct menudialogdef g_ExtendedBindKeyMenuDialog = {
MENUDIALOGTYPE_WHITE,
MENUDIALOGTYPE_SUCCESS,
(uintptr_t)"Bind",
g_ExtendedBindKeyMenuItems,
NULL,
@@ -882,7 +890,7 @@ static MenuItemHandlerResult menuhandlerDoBind(s32 operation, struct menuitem *i
const s32 key = inputGetLastKey();
if (key && key != VK_ESCAPE) {
inputKeyBind(g_BindsPlayer, g_BindContKey, g_BindIndex, key);
inputKeyBind(g_BindsPlayer, g_BindContKey, g_BindIndex, (key == VK_DELETE ? 0 : key));
menuPopDialog();
}