deco menu needs to be clicked to enter, press 'b' to get out of deco editor too

This commit is contained in:
jacob1 2013-01-14 13:11:01 -05:00
parent 73fdfd411c
commit e515512d88
4 changed files with 33 additions and 14 deletions

View File

@ -925,6 +925,11 @@ void GameController::SetActiveMenu(Menu * menu)
gameModel->SetColourSelectorVisibility(false);
}
std::vector<Menu*> GameController::GetMenuList()
{
return gameModel->GetMenuList();
}
void GameController::SetActiveTool(int toolSelection, Tool * tool)
{
commandInterface->OnActiveToolChanged(toolSelection, tool);
@ -1387,9 +1392,3 @@ void GameController::RunUpdater()
Exit();
new UpdateActivity();
}
std::vector<Menu*> GameController::GetMenuList()
{
return gameModel->GetMenuList();
}

View File

@ -98,6 +98,7 @@ public:
void ShowGravityGrid();
void SetHudEnable(bool hudState);
void SetActiveMenu(Menu * menu);
std::vector<Menu*> GetMenuList();
void SetActiveTool(int toolSelection, Tool * tool);
void SetActiveColourPreset(int preset);
void SetColour(ui::Colour colour);
@ -148,7 +149,6 @@ public:
virtual void NotifyAuthUserChanged(Client * sender);
virtual void NotifyNewNotification(Client * sender, std::pair<std::string, std::string> notification);
void RunUpdater();
std::vector<Menu*> GetMenuList();
};
#endif // GAMECONTROLLER_H

View File

@ -185,7 +185,8 @@ GameView::GameView():
recordingIndex(0),
toolTipPresence(0),
currentSaveType(0),
lastLogEntry(0.0f)
lastLogEntry(0.0f),
lastMenu(NULL)
{
int currentX = 1;
@ -451,15 +452,25 @@ class GameView::MenuAction: public ui::ButtonAction
GameView * v;
public:
Menu * menu;
MenuAction(GameView * _v, Menu * menu_) { v = _v; menu = menu_; }
bool needsClick = false;
MenuAction(GameView * _v, Menu * menu_)
{
v = _v;
menu = menu_;
if (v->c->GetMenuList()[SC_DECO] == menu)
needsClick = true;
}
void MouseEnterCallback(ui::Button * sender)
{
if(!ui::Engine::Ref().GetMouseButton())
if(!needsClick && !ui::Engine::Ref().GetMouseButton())
v->c->SetActiveMenu(menu);
}
void ActionCallback(ui::Button * sender)
{
MouseEnterCallback(sender);
if (needsClick)
v->c->SetActiveMenu(menu);
else
MouseEnterCallback(sender);
}
};
@ -674,7 +685,8 @@ void GameView::NotifyToolListChanged(GameModel * sender)
AddComponent(tempButton);
toolButtons.push_back(tempButton);
}
if (sender->GetActiveMenu() != sender->GetMenuList()[SC_DECO])
lastMenu = sender->GetActiveMenu();
}
void GameView::NotifyColourSelectorVisibilityChanged(GameModel * sender)
@ -1322,8 +1334,15 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case 'b':
if(ctrl)
c->SetDecoration();
else
c->SetActiveMenu(c->GetMenuList()[SC_DECO]);
else
if (colourPicker->GetParentWindow())
c->SetActiveMenu(lastMenu);
else
{
c->SetDecoration(true);
c->SetPaused(true);
c->SetActiveMenu(c->GetMenuList()[SC_DECO]);
}
break;
case 'y':
c->SwitchAir();

View File

@ -56,6 +56,7 @@ private:
std::string introTextMessage;
int toolIndex;
int currentSaveType;
Menu * lastMenu;
int infoTipPresence;
std::string toolTip;