diff options
author | Paul Gilbert | 2015-03-01 22:16:51 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-03-01 22:16:51 -0500 |
commit | 02c046941b76b5289d206bdc110cf55719a05dbb (patch) | |
tree | 30f6f94ea9d4add652b7b930babc43f61ca2c8fd | |
parent | 8e6708e6008b3ac1132f84923ebc766d1b199679 (diff) | |
download | scummvm-rg350-02c046941b76b5289d206bdc110cf55719a05dbb.tar.gz scummvm-rg350-02c046941b76b5289d206bdc110cf55719a05dbb.tar.bz2 scummvm-rg350-02c046941b76b5289d206bdc110cf55719a05dbb.zip |
XEEN: Fixes for text entry
-rw-r--r-- | engines/xeen/dialogs_input.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/engines/xeen/dialogs_input.cpp b/engines/xeen/dialogs_input.cpp index 042fabf102..3626441c7c 100644 --- a/engines/xeen/dialogs_input.cpp +++ b/engines/xeen/dialogs_input.cpp @@ -40,26 +40,35 @@ int Input::show(XeenEngine *vm, Window *window, Common::String &line, */ int Input::getString(Common::String &line, uint maxLen, int maxWidth, bool isNumeric) { _vm->_noDirectionSense = true; - Common::String msg = Common::String::format("\x03""l\t000\x04%03d\x03""c", maxWidth); + Common::String msg = Common::String::format("\x3""l\t000\x4%03d\x0""c", maxWidth); _window->writeString(msg); _window->update(); while (!_vm->shouldQuit()) { Common::KeyCode keyCode = doCursor(msg); + bool refresh = false; if ((keyCode == Common::KEYCODE_BACKSPACE || keyCode == Common::KEYCODE_DELETE) - && line.size() > 0) + && line.size() > 0) { line.deleteLastChar(); - else if (line.size() < maxLen && (line.size() > 0 || keyCode != Common::KEYCODE_SPACE) + refresh = true; + } else if (line.size() < maxLen && (line.size() > 0 || keyCode != Common::KEYCODE_SPACE) && ((isNumeric && keyCode >= Common::KEYCODE_0 && keyCode < Common::KEYCODE_9) || (!isNumeric && keyCode >= Common::KEYCODE_SPACE && keyCode < Common::KEYCODE_DELETE))) { line += (char)keyCode; + refresh = true; } else if (keyCode == Common::KEYCODE_RETURN || keyCode == Common::KEYCODE_KP_ENTER) { break; } else if (keyCode == Common::KEYCODE_ESCAPE) { line = ""; break; } + + if (refresh) { + msg = Common::String::format("\x3""l\t000\x4%03d\x3""c%s", maxWidth, line.c_str()); + _window->writeString(msg); + _window->update(); + } } _vm->_noDirectionSense = false; |