mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-12 11:24:04 +02:00
@@ -248,9 +248,18 @@ void GameModel::BuildMenus()
|
||||
elementTools.clear();
|
||||
|
||||
//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
|
||||
|
@@ -606,6 +606,8 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
|
||||
toolButtons.clear();
|
||||
vector<Menu*> menuList = sender->GetMenuList();
|
||||
for (int i = (int)menuList.size()-1; i >= 0; i--)
|
||||
{
|
||||
if (menuList[i]->GetVisible())
|
||||
{
|
||||
std::string tempString = "";
|
||||
tempString += menuList[i]->GetIcon();
|
||||
@@ -617,6 +619,7 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
|
||||
AddComponent(tempButton);
|
||||
menuButtons.push_back(tempButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GameView::SetSample(SimulationSample sample)
|
||||
|
@@ -8,11 +8,13 @@ class Menu
|
||||
char icon;
|
||||
string description;
|
||||
vector<Tool*> tools;
|
||||
bool visible;
|
||||
public:
|
||||
Menu(char icon_, string description_):
|
||||
Menu(char icon_, string description_, int visible_):
|
||||
icon(icon_),
|
||||
description(description_),
|
||||
tools(vector<Tool*>())
|
||||
tools(vector<Tool*>()),
|
||||
visible(visible_ ? true : false)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -41,6 +43,11 @@ public:
|
||||
return description;
|
||||
}
|
||||
|
||||
bool GetVisible()
|
||||
{
|
||||
return visible;
|
||||
}
|
||||
|
||||
void AddTool(Tool * tool_)
|
||||
{
|
||||
tools.push_back(tool_);
|
||||
|
Reference in New Issue
Block a user