aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/macventure/gui.cpp38
-rw-r--r--engines/macventure/gui.h50
2 files changed, 81 insertions, 7 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 9e0b37760a..6bb54d8b79 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -40,7 +40,7 @@ enum {
static const Graphics::MenuData menuSubItems[] = {
{ kMenuHighLevel, "File", 0, 0, false },
- { kMenuHighLevel, "Edit", 0, 0, false },
+ { kMenuHighLevel, "Edit", 0, 0, false },
{ kMenuHighLevel, "Special", 0, 0, false },
{ kMenuHighLevel, "Font", 0, 0, false },
{ kMenuHighLevel, "FontSize", 0, 0, false },
@@ -83,6 +83,12 @@ Gui::~Gui() {
void Gui::draw() {
_wm.draw();
+ Common::List<CommandButton>::const_iterator it = _controlData->begin();
+ for (; it != _controlData->end(); ++it) {
+ CommandButton button = *it;
+ if (button.getData().refcon != kControlExitBox)
+ button.draw(*_controlsWindow->getSurface());
+ }
}
bool Gui::processEvent(Common::Event &event) {
@@ -100,12 +106,34 @@ void Gui::initGUI() {
_menu->setCommandsCallback(menuCommandsCallback, this);
_menu->calcDimensions();
+ if (!loadWindows())
+ error("Could not load windows");
+
+ initWindows();
+
+ if (!loadControls())
+ error("Could not load controls");
+
+ draw();
+
+}
+
+void Gui::initWindows() {
+
// In-game Output Console
_outConsoleWindow = _wm.addWindow(false, true, true);
_outConsoleWindow->setDimensions(Common::Rect(20, 20, 120, 120));
_outConsoleWindow->setActive(false);
_outConsoleWindow->setCallback(outConsoleWindowCallback, this);
- loadBorder(_outConsoleWindow, "border_inac.bmp", false);
+ loadBorder(_outConsoleWindow, "border_command.bmp", false);
+
+ // Game Controls Window
+ _controlsWindow = _wm.addWindow(false, false, false);
+ _controlsWindow->setDimensions(getWindowData(kCommandsWindow).bounds);
+ _controlsWindow->setActive(false);
+ _controlsWindow->setCallback(controlsWindowCallback, this);
+ loadBorder(_controlsWindow, "border_command.bmp", false);
+
}
void Gui::loadBorder(Graphics::MacWindow * target, Common::String filename, bool active) {
@@ -152,7 +180,7 @@ bool Gui::loadMenus() {
Common::MacResIDArray::const_iterator iter;
if ((resArray = _resourceManager->getResIDArray(MKTAG('M', 'E', 'N', 'U'))).size() == 0)
- return false;
+ return false;
_menu->addMenuSubItem(0, "Abb", kMenuActionAbout, 0, 'A', true);
@@ -192,12 +220,12 @@ bool Gui::loadMenus() {
style = res->readUint16BE();
_menu->addMenuSubItem(i, title, 0, style, key, false);
}
- }
+ }
i++;
}
- return true;
+ return true;
}
/* CALLBACKS */
diff --git a/engines/macventure/gui.h b/engines/macventure/gui.h
index eb5197bd8d..d63f7fcb18 100644
--- a/engines/macventure/gui.h
+++ b/engines/macventure/gui.h
@@ -53,7 +53,7 @@ enum MenuAction {
};
//} using namespace MacVentureMenuActions;
-class Gui {
+class Gui {
public:
Gui(MacVentureEngine *engine, Common::MacResManager *resman);
@@ -78,10 +78,56 @@ private: // Methods
void initGUI();
bool loadMenus();
- void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active);
+ void loadBorder(Graphics::MacWindow * target, Common::String filename, bool active);
};
+class CommandButton {
+
+enum {
+ kCommandsLeftPadding = 0,
+ kCommandsTopPadding = 0
+};
+
+public:
+ CommandButton(ControlData data, Gui *g) {
+ _data = data;
+ _gui = g;
+ }
+ ~CommandButton() {}
+
+ void draw(Graphics::ManagedSurface &surface) {
+
+
+ surface.fillRect(_data.bounds, kColorWhite);
+ surface.frameRect(_data.bounds, kColorBlack);
+
+ const Graphics::Font &font = _gui->getCurrentFont();
+ Common::String title(_data.title);
+ font.drawString(
+ &surface,
+ title,
+ _data.bounds.left,
+ _data.bounds.top,
+ _data.bounds.right - _data.bounds.left,
+ kColorBlack,
+ Graphics::kTextAlignCenter);
+
+ }
+
+ bool isInsideBounds(Common::Point point) {
+ return _data.bounds.contains(point);
+ }
+
+ const ControlData& getData() {
+ return _data;
+ }
+
+private:
+ ControlData _data;
+ Gui *_gui;
+};
+
} // End of namespace MacVenture
#endif