diff options
author | Eugene Sandulenko | 2006-11-18 16:26:51 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2006-11-18 16:26:51 +0000 |
commit | 785d86b63e0151ab002ab49af4f481b7a564a6c9 (patch) | |
tree | ee3043fd7019fa75f8bc924a9d75bb79b927ec6a /engines | |
parent | 53c4684bbeb9bde65d80709f94d9c036b4415aef (diff) | |
download | scummvm-rg350-785d86b63e0151ab002ab49af4f481b7a564a6c9.tar.gz scummvm-rg350-785d86b63e0151ab002ab49af4f481b7a564a6c9.tar.bz2 scummvm-rg350-785d86b63e0151ab002ab49af4f481b7a564a6c9.zip |
Make input string truly editable
svn-id: r24732
Diffstat (limited to 'engines')
-rw-r--r-- | engines/cine/main_loop.cpp | 4 | ||||
-rw-r--r-- | engines/cine/various.cpp | 36 |
2 files changed, 30 insertions, 10 deletions
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp index 5b5a927be6..3e130cf781 100644 --- a/engines/cine/main_loop.cpp +++ b/engines/cine/main_loop.cpp @@ -39,7 +39,7 @@ mouseStatusStruct mouseData; uint16 mouseRight = 0; uint16 mouseLeft = 0; -char lastKeyStroke = 0; +int lastKeyStroke = 0; uint16 mouseUpdateStatus; uint16 dummyU16; @@ -112,7 +112,7 @@ void manageEvents(int count) { } break; default: - lastKeyStroke = event.kbd.ascii; + lastKeyStroke = event.kbd.keycode; break; } break; diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp index 25d801ad31..4347c7b27a 100644 --- a/engines/cine/various.cpp +++ b/engines/cine/various.cpp @@ -3192,9 +3192,14 @@ bool makeTextEntryMenu(const char *messagePtr, char *inputString, int stringMaxL currentX += characterWidth + 1; } } + // draw cursor here + if (inputPos == (int)(j + 2)) + gfxDrawLine(currentX, localY - 1, currentX, localY + 8, color, page1Raw); + } - gfxDrawLine(currentX, localY - 1, currentX, localY + 8, color, page1Raw); // cursor + if (strlen(inputString) == 0 || inputPos == 1) // cursor wasn't yet drawn + gfxDrawLine(x + 4, localY - 1, x + 4, localY + 8, color, page1Raw); blitRawScreen(page1Raw); redraw = false; @@ -3220,15 +3225,30 @@ bool makeTextEntryMenu(const char *messagePtr, char *inputString, int stringMaxL } inputPos--; redraw = true; - if (inputPos != 1) { - strncpy(tempString, inputString, inputPos - 1); + case 127: // del + if (inputPos <= inputLength) { + if (inputPos != 1) { + strncpy(tempString, inputString, inputPos - 1); + } + if (inputPos != inputLength) { + strncat(tempString, &inputString[inputPos], inputLength - inputPos); + } + strcpy(inputString, tempString); + inputLength = strlen(inputString); + redraw = true; } - if (inputPos != inputLength) { - strncat(tempString, &inputString[inputPos], inputLength - inputPos); + break; + case 276: // left + if (inputPos > 1) { + inputPos--; + redraw = true; + } + break; + case 275: // right + if (inputPos <= inputLength) { + inputPos++; + redraw = true; } - strcpy(inputString, tempString); - inputLength = strlen(inputString); - redraw = true; break; default: if (((ascii >= 'a') && (ascii <='z')) || |