mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-08 00:14:00 +02:00
parent
111468c672
commit
88097496af
@ -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
|
||||
|
@ -607,15 +607,18 @@ void GameView::NotifyMenuListChanged(GameModel * sender)
|
||||
vector<Menu*> menuList = sender->GetMenuList();
|
||||
for (int i = (int)menuList.size()-1; i >= 0; i--)
|
||||
{
|
||||
std::string tempString = "";
|
||||
tempString += menuList[i]->GetIcon();
|
||||
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), tempString, menuList[i]->GetDescription());
|
||||
tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
|
||||
tempButton->SetTogglable(true);
|
||||
tempButton->SetActionCallback(new MenuAction(this, i));
|
||||
currentY-=16;
|
||||
AddComponent(tempButton);
|
||||
menuButtons.push_back(tempButton);
|
||||
if (menuList[i]->GetVisible())
|
||||
{
|
||||
std::string tempString = "";
|
||||
tempString += menuList[i]->GetIcon();
|
||||
ui::Button * tempButton = new ui::Button(ui::Point(WINDOWW-16, currentY), ui::Point(15, 15), tempString, menuList[i]->GetDescription());
|
||||
tempButton->Appearance.Margin = ui::Border(0, 2, 3, 2);
|
||||
tempButton->SetTogglable(true);
|
||||
tempButton->SetActionCallback(new MenuAction(this, i));
|
||||
currentY-=16;
|
||||
AddComponent(tempButton);
|
||||
menuButtons.push_back(tempButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user