aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2008-08-25 15:14:29 +0000
committerJohannes Schickel2008-08-25 15:14:29 +0000
commita6c931459be0b9fd9122bf67d1ac2296512496ac (patch)
tree3a499b8a572cef8a405d6746aa1f1fc878386e9f
parentf21cc823de03412040687724e9eeb1e96d737a06 (diff)
downloadscummvm-rg350-a6c931459be0b9fd9122bf67d1ac2296512496ac.tar.gz
scummvm-rg350-a6c931459be0b9fd9122bf67d1ac2296512496ac.tar.bz2
scummvm-rg350-a6c931459be0b9fd9122bf67d1ac2296512496ac.zip
Implemented continous screen updating while waiting for text input in v2 GUI. (based on LoK implementation)
svn-id: r34157
-rw-r--r--engines/kyra/gui_v2.cpp13
-rw-r--r--engines/kyra/gui_v2.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/engines/kyra/gui_v2.cpp b/engines/kyra/gui_v2.cpp
index f3013e0cb0..2ef1109183 100644
--- a/engines/kyra/gui_v2.cpp
+++ b/engines/kyra/gui_v2.cpp
@@ -35,6 +35,7 @@ namespace Kyra {
GUI_v2::GUI_v2(KyraEngine_v2 *vm) : GUI(vm), _vm(vm), _screen(vm->screen_v2()) {
_backUpButtonList = _unknownButtonList = 0;
_buttonListChanged = false;
+ _lastScreenUpdate = 0;
_currentMenu = 0;
_isDeathMenu = false;
@@ -767,6 +768,7 @@ const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8
x2 -= getCharWidth(buffer[curPos]);
drawTextfieldBlock(x2, y2, c3);
_screen->updateScreen();
+ _lastScreenUpdate = _vm->_system->getMillis();
} else if (_keyPressed.ascii > 31 && _keyPressed.ascii < 127 && curPos < bufferSize) {
if (x2 + getCharWidth(_keyPressed.ascii) + 7 < 0x11F) {
buffer[curPos] = _keyPressed.ascii;
@@ -776,11 +778,11 @@ const char *GUI_v2::nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8
drawTextfieldBlock(x2, y2, c3);
++curPos;
_screen->updateScreen();
+ _lastScreenUpdate = _vm->_system->getMillis();
}
}
_keyPressed.reset();
- _vm->delay(10);
}
return buffer;
@@ -824,6 +826,8 @@ int GUI_v2::getCharWidth(uint8 c) {
void GUI_v2::checkTextfieldInput() {
Common::Event event;
+ uint32 now = _vm->_system->getMillis();
+
bool running = true;
int keys = 0;
while (_vm->_eventMan->pollEvent(event) && running) {
@@ -854,6 +858,7 @@ void GUI_v2::checkTextfieldInput() {
_vm->_mouseX = pos.x;
_vm->_mouseY = pos.y;
_screen->updateScreen();
+ _lastScreenUpdate = now;
} break;
default:
@@ -861,7 +866,13 @@ void GUI_v2::checkTextfieldInput() {
}
}
+ if (now - _lastScreenUpdate > 50) {
+ _vm->_system->updateScreen();
+ _lastScreenUpdate = now;
+ }
+
processButtonList(_menuButtonList, keys | 0x8000, 0);
+ _vm->_system->delayMillis(3);
}
void GUI_v2::drawTextfieldBlock(int x, int y, uint8 c) {
diff --git a/engines/kyra/gui_v2.h b/engines/kyra/gui_v2.h
index 60b7f0ab86..88861ff905 100644
--- a/engines/kyra/gui_v2.h
+++ b/engines/kyra/gui_v2.h
@@ -213,6 +213,7 @@ protected:
// savename menu
bool _finishNameInput, _cancelNameInput;
Common::KeyState _keyPressed;
+ uint32 _lastScreenUpdate;
const char *nameInputProcess(char *buffer, int x, int y, uint8 c1, uint8 c2, uint8 c3, int bufferSize);
int finishSavename(Button *caller);