aboutsummaryrefslogtreecommitdiff
path: root/engines/zvision/scripting/controls/input_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/zvision/scripting/controls/input_control.cpp')
-rw-r--r--engines/zvision/scripting/controls/input_control.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp
index 47da27fa08..b25aa13543 100644
--- a/engines/zvision/scripting/controls/input_control.cpp
+++ b/engines/zvision/scripting/controls/input_control.cpp
@@ -39,6 +39,7 @@ namespace ZVision {
InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStream &stream)
: Control(engine, key, CONTROL_INPUT),
+ _background(0),
_nextTabstop(0),
_focused(false),
_textChanged(false),
@@ -111,6 +112,11 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre
}
}
+InputControl::~InputControl() {
+ _background->free();
+ delete _background;
+}
+
bool InputControl::onMouseUp(const Common::Point &screenSpacePos, const Common::Point &backgroundImageSpacePos) {
if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return false;
@@ -191,12 +197,16 @@ bool InputControl::process(uint32 deltaTimeInMillis) {
if (_engine->getScriptManager()->getStateFlag(_key) & Puzzle::DISABLED)
return false;
+ if (!_background) {
+ _background = _engine->getRenderManager()->getBkgRect(_textRectangle);
+ }
+
// First see if we need to render the text
if (_textChanged) {
// Blit the text using the RenderManager
Graphics::Surface txt;
- txt.create(_textRectangle.width(), _textRectangle.height(), _engine->_resourcePixelFormat);
+ txt.copyFrom(*_background);
if (!_readOnly || !_focused)
_txtWidth = _engine->getTextRenderer()->drawTxt(_currentInputText, _stringInit, txt);