aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-08-16 17:47:32 +0200
committerBorja Lorente2016-08-19 16:30:24 +0200
commit68b171f328712d39072b5fd133eec93cb1bea3dd (patch)
tree6acbea180393cacbe6244ef71f6ade587e3ba7d8
parentace515643654b07002ee528bbc01f679f699b8cb (diff)
downloadscummvm-rg350-68b171f328712d39072b5fd133eec93cb1bea3dd.tar.gz
scummvm-rg350-68b171f328712d39072b5fd133eec93cb1bea3dd.tar.bz2
scummvm-rg350-68b171f328712d39072b5fd133eec93cb1bea3dd.zip
MACVENTURE: Remove constructors from prebuilt dialogs
-rw-r--r--engines/macventure/dialog.cpp17
-rw-r--r--engines/macventure/dialog.h2
-rw-r--r--engines/macventure/prebuilt_dialogs.cpp54
-rw-r--r--engines/macventure/prebuilt_dialogs.h14
4 files changed, 53 insertions, 34 deletions
diff --git a/engines/macventure/dialog.cpp b/engines/macventure/dialog.cpp
index c6315271b1..383befc1b8 100644
--- a/engines/macventure/dialog.cpp
+++ b/engines/macventure/dialog.cpp
@@ -32,7 +32,7 @@ Dialog::Dialog(Gui *gui, Common::Point pos, uint width, uint height) :
Dialog::Dialog(Gui *gui, PrebuiltDialogs prebuilt) {
_gui = gui;
const PrebuiltDialog &dialog = g_prebuiltDialogs[prebuilt];
- _bounds = dialog.bounds;
+ calculateBoundsFromPrebuilt(dialog.bounds);
for (int i = 0; dialog.elements[i].type != kDEEnd; i++) {
addPrebuiltElement(dialog.elements[i]);
}
@@ -124,15 +124,16 @@ void Dialog::setUserInput(Common::String content) {
}
void Dialog::addPrebuiltElement(const MacVenture::PrebuiltDialogElement &element) {
+ Common::Point position(element.left, element.top);
switch(element.type) {
case kDEButton:
- addButton(element.title, element.action, element.position, element.width, element.height);
+ addButton(element.title, element.action, position, element.width, element.height);
break;
case kDEPlainText:
- addText(element.title, element.position);
+ addText(element.title, position);
break;
case kDETextInput:
- addTextInput(element.position, element.width, element.height);
+ addTextInput(position, element.width, element.height);
break;
default:
break;
@@ -241,4 +242,12 @@ void DialogTextInput::doDraw(MacVenture::Dialog *dialog, Graphics::ManagedSurfac
target.frameRect(_bounds, kColorBlack);
dialog->getFont().drawString(&target, _text, _bounds.left, _bounds.top, _bounds.width(), kColorBlack);
}
+
+void Dialog::calculateBoundsFromPrebuilt(const PrebuiltDialogBounds &bounds) {
+ _bounds = Common::Rect(
+ bounds.left,
+ bounds.top,
+ bounds.right,
+ bounds.bottom);
+}
} // End of namespace MacVenture
diff --git a/engines/macventure/dialog.h b/engines/macventure/dialog.h
index 34f99dc643..7e85ccc2ba 100644
--- a/engines/macventure/dialog.h
+++ b/engines/macventure/dialog.h
@@ -57,6 +57,8 @@ public:
private:
void addPrebuiltElement(const PrebuiltDialogElement &element);
+ void calculateBoundsFromPrebuilt(const PrebuiltDialogBounds &bounds);
+
private:
Gui *_gui;
diff --git a/engines/macventure/prebuilt_dialogs.cpp b/engines/macventure/prebuilt_dialogs.cpp
index 49f2853203..6137fed219 100644
--- a/engines/macventure/prebuilt_dialogs.cpp
+++ b/engines/macventure/prebuilt_dialogs.cpp
@@ -27,49 +27,49 @@ namespace MacVenture {
const PrebuiltDialog g_prebuiltDialogs[kPrebuiltDialogCount] = {
{/* kSaveAsDialog */
- Common::Rect(0, 146, 456, 254),
+ {0, 146, 456, 254},
{
- {kDEButton, "YES", kDASaveAs, Common::Point(24, 68), 120, 22},
- {kDEButton, "NO", kDACloseDialog, Common::Point(168, 68), 120, 22},
- {kDEButton, "CANCEL", kDACloseDialog, Common::Point(312, 68), 120, 22},
- {kDEPlainText, "Save As...", kDANone, Common::Point(100, 10), 340, 38},
- {kDETextInput, "", kDANone, Common::Point(100, 30), 340, 20},
- {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ {kDEButton, "YES", kDASaveAs, 24, 68, 120, 22},
+ {kDEButton, "NO", kDACloseDialog, 168, 68, 120, 22},
+ {kDEButton, "CANCEL", kDACloseDialog, 312, 68, 120, 22},
+ {kDEPlainText, "Save As...", kDANone, 100, 10, 340, 38},
+ {kDETextInput, "", kDANone, 100, 30, 340, 20},
+ {kDEEnd, "", kDANone, 0, 0, 0, 0}
}
},
{ /* kSpeakDialog */
- Common::Rect(20, 92, 400, 200),
+ {20, 92, 400, 200},
{
- {kDEButton, "OK", kDASubmit, Common::Point(10, 70), 50, 20},
- {kDEButton, "CANCEL", kDACloseDialog, Common::Point(96, 70), 50, 20},
- {kDEPlainText, "What would you like to say?", kDANone, Common::Point(10, 10), 400, 20},
- {kDETextInput, "", kDANone, Common::Point(10, 25), 350, 40},
- {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ {kDEButton, "OK", kDASubmit, 10, 70, 50, 20},
+ {kDEButton, "CANCEL", kDACloseDialog, 96, 70, 50, 20},
+ {kDEPlainText, "What would you like to say?", kDANone, 10, 10, 400, 20},
+ {kDETextInput, "", kDANone, 10, 25, 350, 40},
+ {kDEEnd, "", kDANone, 0, 0, 0, 0}
}
},
{ /* kWinGameDialog */
- Common::Rect(20, 100, 320, 200),
+ {20, 100, 320, 200},
{
- {kDEPlainText, "You Won!", kDANone, Common::Point(20, 16), 280, 20},
- {kDEPlainText, "What do you want to do?", kDANone, Common::Point(20, 30), 280, 20},
- {kDEButton, "New Game", kDANewGame, Common::Point(20, 60), 70, 20},
- {kDEButton, "Load", kDALoadGame, Common::Point(110, 60), 70, 20},
- {kDEButton, "Quit", kDAQuit, Common::Point(200, 60), 70, 20},
- {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ {kDEPlainText, "You Won!", kDANone, 20, 16, 280, 20},
+ {kDEPlainText, "What do you want to do?", kDANone, 20, 30, 280, 20},
+ {kDEButton, "New Game", kDANewGame, 20, 60, 70, 20},
+ {kDEButton, "Load", kDALoadGame, 110, 60, 70, 20},
+ {kDEButton, "Quit", kDAQuit, 200, 60, 70, 20},
+ {kDEEnd, "", kDANone, 0, 0, 0, 0}
}
},
{ /* kLoseGameDialog */
- Common::Rect(20, 100, 320, 200),
+ {20, 100, 320, 200},
{
- {kDEPlainText, "You Died", kDANone, Common::Point(20, 16), 280, 20},
- {kDEPlainText, "What do you want to do?", kDANone, Common::Point(20, 30), 280, 20},
- {kDEButton, "New Game", kDANewGame, Common::Point(20, 60), 70, 20},
- {kDEButton, "Load", kDALoadGame, Common::Point(110, 60), 70, 20},
- {kDEButton, "Quit", kDAQuit, Common::Point(200, 60), 70, 20},
- {kDEEnd, "", kDANone, Common::Point(0, 0), 0, 0}
+ {kDEPlainText, "You Died", kDANone, 20, 16, 280, 20},
+ {kDEPlainText, "What do you want to do?", kDANone, 20, 30, 280, 20},
+ {kDEButton, "New Game", kDANewGame, 20, 60, 70, 20},
+ {kDEButton, "Load", kDALoadGame, 110, 60, 70, 20},
+ {kDEButton, "Quit", kDAQuit, 200, 60, 70, 20},
+ {kDEEnd, "", kDANone, 0, 0, 0, 0}
}
}
};
diff --git a/engines/macventure/prebuilt_dialogs.h b/engines/macventure/prebuilt_dialogs.h
index 9aff5c7926..9cd8f4c1a4 100644
--- a/engines/macventure/prebuilt_dialogs.h
+++ b/engines/macventure/prebuilt_dialogs.h
@@ -52,11 +52,19 @@ enum PrebuiltElementType {
kDEEnd
};
+struct PrebuiltDialogBounds {
+ uint left;
+ uint top;
+ uint right;
+ uint bottom;
+};
+
struct PrebuiltDialogElement {
PrebuiltElementType type;
- Common::String title;
+ const char *title;
DialogAction action;
- Common::Point position;
+ uint left;
+ uint top;
uint width;
uint height;
};
@@ -68,7 +76,7 @@ enum {
};
struct PrebuiltDialog {
- Common::Rect bounds;
+ PrebuiltDialogBounds bounds;
PrebuiltDialogElement elements[kMaxPrebuiltDialogElements];
};