parent
111468c672
commit
88097496af
@ -248,9 +248,18 @@ void GameModel::BuildMenus()
|
|||||||
elementTools.clear();
|
elementTools.clear();
|
||||||
|
|
||||||
//Create menus
|
//Create menus
|
||||||
for(int i = 0; i < SC_TOTAL; i++)
|
for (int i = 1; i < SC_TOOL; i++)
|
||||||
{
|
{
|
||||||
menuList.push_back(new Menu((const char)sim->msections[i].icon[0], sim->msections[i].name));
|
sim->msections[i].doshow = 0;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < PT_NUM; i++)
|
||||||
|
{
|
||||||
|
if (sim->elements[i].Enabled && sim->elements[i].MenuVisible)
|
||||||
|
sim->msections[sim->elements[i].MenuSection].doshow = 1;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < SC_TOTAL; i++)
|
||||||
|
{
|
||||||
|
menuList.push_back(new Menu((const char)sim->msections[i].icon[0], sim->msections[i].name, sim->msections[i].doshow));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Build menus from Simulation elements
|
//Build menus from Simulation elements
|
||||||
|
@ -607,15 +607,18 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
|
|||||||
vector<Menu*> menuList = sender->GetMenuList();
|
vector<Menu*> menuList = sender->GetMenuList();
|
||||||
for (int i = (int)menuList.size()-1; i >= 0; i--)
|
for (int i = (int)menuList.size()-1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
std::string tempString = "";
|
if (menuList[i]->GetVisible())
|
||||||
tempString += menuList[i]->GetIcon();
|
{
|
||||||
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), tempString, menuList[i]->GetDescription());
|
std::string tempString = "";
|
||||||
tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
|
tempString += menuList[i]->GetIcon();
|
||||||
tempButton->SetTogglable(true);
|
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), tempString, menuList[i]->GetDescription());
|
||||||
tempButton->SetActionCallback(new MenuAction(this, i));
|
tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
|
||||||
currentY-=16;
|
tempButton->SetTogglable(true);
|
||||||
AddComponent(tempButton);
|
tempButton->SetActionCallback(new MenuAction(this, i));
|
||||||
menuButtons.push_back(tempButton);
|
currentY-=16;
|
||||||
|
AddComponent(tempButton);
|
||||||
|
menuButtons.push_back(tempButton);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,11 +8,13 @@ class Menu
|
|||||||
char icon;
|
char icon;
|
||||||
string description;
|
string description;
|
||||||
vector<Tool*> tools;
|
vector<Tool*> tools;
|
||||||
|
bool visible;
|
||||||
public:
|
public:
|
||||||
Menu(char icon_, string description_):
|
Menu(char icon_, string description_, int visible_):
|
||||||
icon(icon_),
|
icon(icon_),
|
||||||
description(description_),
|
description(description_),
|
||||||
tools(vector<Tool*>())
|
tools(vector<Tool*>()),
|
||||||
|
visible(visible_ ? true : false)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -41,6 +43,11 @@ public:
|
|||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GetVisible()
|
||||||
|
{
|
||||||
|
return visible;
|
||||||
|
}
|
||||||
|
|
||||||
void AddTool(Tool * tool_)
|
void AddTool(Tool * tool_)
|
||||||
{
|
{
|
||||||
tools.push_back(tool_);
|
tools.push_back(tool_);
|
||||||
|
Reference in New Issue
Block a user