mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
WAGE: Made rendering of 1st menu level generic
This commit is contained in:
parent
5b374c6f55
commit
faa2588ba4
@ -105,9 +105,9 @@ public:
|
||||
bool _cursorOff;
|
||||
|
||||
bool _builtInFonts;
|
||||
WageEngine *_engine;
|
||||
|
||||
private:
|
||||
WageEngine *_engine;
|
||||
Graphics::Surface _console;
|
||||
Menu *_menu;
|
||||
Scene *_scene;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user