mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-23 15:52:41 +02:00
fixup keyboard input + vi insert shortcut
This commit is contained in:
1 parent
d58a423e5f
commit
ccb3c8668d
2 files changed
+10
-6
No files matched your search
@@ -1462,10 +1462,6 @@ s32 inputTextHandler(char *out, const u32 outSize, s32 *curCol, s32 oskCharsOnly
|
|||||||
} else {
|
} else {
|
||||||
out[0] = '\0';
|
out[0] = '\0';
|
||||||
}
|
}
|
||||||
} else if (key == VK_RETURN) {
|
|
||||||
if (out[0] && *curCol) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
} else if (key == VK_ESCAPE) {
|
} else if (key == VK_ESCAPE) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-2
@@ -1334,7 +1334,7 @@ Gfx *menuitemKeyboardRender(Gfx *gdl, struct menurendercontext *context)
|
|||||||
// make the button yellow if it's active
|
// make the button yellow if it's active
|
||||||
if (g_MenuKeyboardPlayer == g_MpPlayerNum) {
|
if (g_MenuKeyboardPlayer == g_MpPlayerNum) {
|
||||||
textcolour = (textcolour & 0xff) | 0xffff0000;
|
textcolour = (textcolour & 0xff) | 0xffff0000;
|
||||||
kbtext = (char *)"ESC: CANCEL ENTER: OK";
|
kbtext = (char *)"ESC: OK";
|
||||||
} else {
|
} else {
|
||||||
kbtext = (char *)"TYPE WITH KEYBOARD";
|
kbtext = (char *)"TYPE WITH KEYBOARD";
|
||||||
}
|
}
|
||||||
@@ -1531,6 +1531,14 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32
|
|||||||
|
|
||||||
u8 maxlen = item->param == 0 ? 10 : item->param;
|
u8 maxlen = item->param == 0 ? 10 : item->param;
|
||||||
#ifndef PLATFORM_N64
|
#ifndef PLATFORM_N64
|
||||||
|
if (g_MenuKeyboardPlayer != g_MpPlayerNum && inputKeyJustPressed(VK_A + ('i' - 'a'))) {
|
||||||
|
inputClearLastKey();
|
||||||
|
inputClearLastTextChar();
|
||||||
|
g_MenuKeyboardPlayer = g_MpPlayerNum;
|
||||||
|
inputStartTextInput();
|
||||||
|
menuPlaySound(MENUSOUND_SELECT);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_MenuKeyboardPlayer == g_MpPlayerNum) {
|
if (g_MenuKeyboardPlayer == g_MpPlayerNum) {
|
||||||
// match caps state to keyboard shift/caps if typing with keyboard
|
// match caps state to keyboard shift/caps if typing with keyboard
|
||||||
const u32 kmod = inputGetKeyModState();
|
const u32 kmod = inputGetKeyModState();
|
||||||
@@ -1541,7 +1549,7 @@ bool menuitemKeyboardTick(struct menuitem *item, struct menuinputs *inputs, u32
|
|||||||
// handle text input
|
// handle text input
|
||||||
s32 prevpos = strlen(kb->string);
|
s32 prevpos = strlen(kb->string);
|
||||||
s32 pos = prevpos;
|
s32 pos = prevpos;
|
||||||
s32 result = inputTextHandler(kb->string, maxlen-1, &pos, true);
|
s32 result = inputTextHandler(kb->string, maxlen + 1, &pos, true);
|
||||||
if (result == -1) {
|
if (result == -1) {
|
||||||
// cancel
|
// cancel
|
||||||
kb->row = 5;
|
kb->row = 5;
|
||||||
|
|||||||
Reference in new issue
Block a user