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); gameModel->SetColourSelectorVisibility(false);
} }
std::vector<Menu*> GameController::GetMenuList()
{
return gameModel->GetMenuList();
}
void GameController::SetActiveTool(int toolSelection, Tool * tool) void GameController::SetActiveTool(int toolSelection, Tool * tool)
{ {
commandInterface->OnActiveToolChanged(toolSelection, tool); commandInterface->OnActiveToolChanged(toolSelection, tool);
@ -1387,9 +1392,3 @@ void GameController::RunUpdater()
Exit(); Exit();
new UpdateActivity(); new UpdateActivity();
} }
std::vector<Menu*> GameController::GetMenuList()
{
return gameModel->GetMenuList();
}

View File

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

View File

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

View File

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