diff options
author | Eugene Sandulenko | 2016-01-11 11:34:12 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-01-11 11:34:12 +0100 |
commit | faa2588ba4d2074ef7b62ff362c2fce176bfd91e (patch) | |
tree | 236ca0669e9098e94553e25cf54236263ffa6563 /engines | |
parent | 5b374c6f55885f61215bada85a57feb293ea0c8d (diff) | |
download | scummvm-rg350-faa2588ba4d2074ef7b62ff362c2fce176bfd91e.tar.gz scummvm-rg350-faa2588ba4d2074ef7b62ff362c2fce176bfd91e.tar.bz2 scummvm-rg350-faa2588ba4d2074ef7b62ff362c2fce176bfd91e.zip |
WAGE: Made rendering of 1st menu level generic
Diffstat (limited to 'engines')
-rw-r--r-- | engines/wage/gui.h | 2 | ||||
-rw-r--r-- | engines/wage/menu.cpp | 48 | ||||
-rw-r--r-- | engines/wage/menu.h | 5 |
3 files changed, 43 insertions, 12 deletions
diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 7e91479b07..8ba9ce904d 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -105,9 +105,9 @@ public: bool _cursorOff; bool _builtInFonts; + WageEngine *_engine; private: - WageEngine *_engine; Graphics::Surface _console; Menu *_menu; Scene *_scene; diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index c89ec83372..fab8d04ebb 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -48,18 +48,51 @@ #include "common/system.h" #include "wage/wage.h" +#include "wage/entities.h" #include "wage/design.h" #include "wage/gui.h" #include "wage/menu.h" +#include "wage/world.h" namespace Wage { -static const char *menuItems[] = { - "\xf0", "File", "Edit", "Commands", "Weapons", 0 +struct MenuSubItem { + Common::String text; + int style; + char shortcut; + bool enabled; + + MenuSubItem(Common::String &t, int s, char sh) : text(t), style(s), shortcut(sh), enabled(true) {} +}; + +struct MenuItem { + Common::String name; + Common::Array<MenuSubItem *> subitems; + + MenuItem(const char *n) : name(n) {} }; static byte fillPattern[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; +Menu::Menu(Gui *gui) : _gui(gui) { + MenuItem *about = new MenuItem(_gui->_builtInFonts ? "\xa9" : "\xf0"); // (c) Symbol as the most resembling apple + _items.push_back(about); + + MenuItem *file = new MenuItem("File"); + _items.push_back(file); + + MenuItem *edit = new MenuItem("Edit"); + _items.push_back(edit); + + MenuItem *commands = new MenuItem("Commands"); + _items.push_back(commands); + + if (!_gui->_engine->_world->_weaponMenuDisabled) { + MenuItem *weapons = new MenuItem("Weapons"); + _items.push_back(weapons); + } +} + const Graphics::Font *Menu::getMenuFont() { return _gui->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont); } @@ -79,14 +112,9 @@ void Menu::render() { int y = _gui->_builtInFonts ? 3 : 2; int x = 18; - for (int i = 0; menuItems[i]; i++) { - const char *s = menuItems[i]; - - if (i == 0 && _gui->_builtInFonts) - s = "\xa9"; // (c) Symbol as the most resembling apple - - int w = font->getStringWidth(s); - font->drawString(&_gui->_screen, s, x, y, w, kColorBlack); + for (int i = 0; i < _items.size(); i++) { + int w = font->getStringWidth(_items[i]->name); + font->drawString(&_gui->_screen, _items[i]->name, x, y, w, kColorBlack); x += w + 13; } diff --git a/engines/wage/menu.h b/engines/wage/menu.h index 9831814ccb..aec92cf5e1 100644 --- a/engines/wage/menu.h +++ b/engines/wage/menu.h @@ -50,9 +50,11 @@ namespace Wage { +struct MenuItem; + class Menu { public: - Menu(Gui *gui) : _gui(gui) {} + Menu(Gui *gui); void render(); @@ -61,6 +63,7 @@ private: private: const Graphics::Font *getMenuFont(); + Common::Array<MenuItem *> _items; }; } // End of namespace Wage |