aboutsummaryrefslogtreecommitdiff
path: root/engines/macventure/gui.cpp
diff options
context:
space:
mode:
authorBorja Lorente2016-07-15 23:02:37 +0200
committerBorja Lorente2016-08-14 18:55:17 +0200
commit734b453c86bb20b2cb52c4f695f8a770b97be459 (patch)
treebbc0e99ad8b85315fb1d17f98f3845903a040fec /engines/macventure/gui.cpp
parent2a521bb22df9c5e5d477deb32ebc8b6a54e91fde (diff)
downloadscummvm-rg350-734b453c86bb20b2cb52c4f695f8a770b97be459.tar.gz
scummvm-rg350-734b453c86bb20b2cb52c4f695f8a770b97be459.tar.bz2
scummvm-rg350-734b453c86bb20b2cb52c4f695f8a770b97be459.zip
MACVENTURE: Add text input dialog
Diffstat (limited to 'engines/macventure/gui.cpp')
-rw-r--r--engines/macventure/gui.cpp32
1 files changed, 23 insertions, 9 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 4b01f8bca9..d8deb4b568 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -31,6 +31,8 @@
namespace MacVenture {
+#define MACVENTURE_DEBUG_GUI true
+
enum MenuAction;
enum {
@@ -333,8 +335,8 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) {
newWindow->setDimensions(newData.bounds);
newWindow->setCallback(inventoryWindowCallback, this);
- loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
- loadBorder(newWindow, "border_no_scroll_act.bmp", true);
+ //loadBorder(newWindow, "border_no_scroll_inac.bmp", false);
+ //loadBorder(newWindow, "border_no_scroll_act.bmp", true);
_inventoryWindows.push_back(newWindow);
debug("Create new inventory window. Reference: %d", newData.refcon);
@@ -658,11 +660,9 @@ void Gui::drawObjectsInWindow(WindowReference target, Graphics::ManagedSurface *
surface, pos.x, pos.y, kBlitOR);
// For test
- surface->frameRect(Common::Rect(
- pos.x,
- pos.y,
- pos.x + _assets[child]->getWidth() + 1,
- pos.y + _assets[child]->getHeight() + 1), kColorGreen);
+ if (MACVENTURE_DEBUG_GUI) {
+ surface->frameRect(_engine->getObjBounds(child), kColorGreen);
+ }
}
}
@@ -802,11 +802,25 @@ void Gui::printText(const Common::String & text) {
_consoleText->printLine(text, _outConsoleWindow->getDimensions().width());
}
+void Gui::setTextInput(Common::String str) {
+ _engine->setTextInput(str);
+}
+
void Gui::closeDialog() {
delete _dialog;
_dialog = nullptr;
}
+void Gui::getTextFromUser() {
+ if (_dialog) {
+ delete _dialog;
+ }
+ _dialog = new Dialog(this, kSpeakDialog);
+ // Hack to pause the engine
+ _engine->clickToContinue();
+}
+
+
void Gui::moveDraggedObject(Common::Point target) {
Common::Point newPos = target + _draggedObj.mouseOffset;
bool movement = false;
@@ -1125,8 +1139,8 @@ bool Gui::tryCloseWindow(WindowReference winID) {
Common::Point Gui::getObjMeasures(ObjID obj) {
ensureAssetLoaded(obj);
- uint w = _assets[obj]->getWidth();
- uint h = _assets[obj]->getHeight();
+ int w = MAX(0, (int)_assets[obj]->getWidth());
+ int h = MAX(0, (int)_assets[obj]->getHeight());
return Common::Point(w, h);
}