summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-01-14 18:11:01 (GMT)
committer jacob1 <jfu614@gmail.com>2013-01-14 18:11:01 (GMT)
commite515512d88eab18794cf490ad55d4050a8d9f403 (patch)
treef501b97270b037260a6b6670deb88df4e39c10dd /src
parent73fdfd411ce2a8470cf854e48237d609d0ad3bb6 (diff)
downloadpowder-e515512d88eab18794cf490ad55d4050a8d9f403.zip
powder-e515512d88eab18794cf490ad55d4050a8d9f403.tar.gz
deco menu needs to be clicked to enter, press 'b' to get out of deco editor too
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp11
-rw-r--r--src/game/GameController.h2
-rw-r--r--src/game/GameView.cpp33
-rw-r--r--src/game/GameView.h1
4 files changed, 33 insertions, 14 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 01b4b13..0b35681 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -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();
-}
-
diff --git a/src/game/GameController.h b/src/game/GameController.h
index 53b83d4..4f82243 100644
--- a/src/game/GameController.h
+++ b/src/game/GameController.h
@@ -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
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index bd9b879..82dd630 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -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();
diff --git a/src/game/GameView.h b/src/game/GameView.h
index 7474da0..ff688d9 100644
--- a/src/game/GameView.h
+++ b/src/game/GameView.h
@@ -56,6 +56,7 @@ private:
std::string introTextMessage;
int toolIndex;
int currentSaveType;
+ Menu * lastMenu;
int infoTipPresence;
std::string toolTip;