diff options
| author | jacob1 <jfu614@gmail.com> | 2012-10-04 03:44:59 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-10-05 15:32:50 (GMT) |
| commit | a9619fad333f9326d7a70ac5d06032189849dc40 (patch) | |
| tree | 8d30cc1885ad17f09d18d18e072b63a60b435742 /src | |
| parent | 72b00ca5e142569d6911c1c009e3cce4d89c2627 (diff) | |
| download | powder-a9619fad333f9326d7a70ac5d06032189849dc40.zip powder-a9619fad333f9326d7a70ac5d06032189849dc40.tar.gz | |
Console Show quickoption
(best way I could think of)
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/GameController.cpp | 1 | ||||
| -rw-r--r-- | src/game/GameModel.cpp | 4 | ||||
| -rw-r--r-- | src/game/GameModel.h | 4 | ||||
| -rw-r--r-- | src/game/GameView.h | 4 | ||||
| -rw-r--r-- | src/game/QuickOptions.h | 19 |
5 files changed, 27 insertions, 5 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 1928a0b..99315b0 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -146,6 +146,7 @@ GameController::GameController(): { gameView = new GameView(); gameModel = new GameModel(); + gameModel->BuildQuickOptionMenu(this); gameView->AttachController(this); gameModel->AddObserver(gameView); diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 97c7aad..49e031f 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -98,7 +98,6 @@ GameModel::GameModel(): } BuildMenus(); - BuildQuickOptionMenu(); //Set default decoration colour unsigned char colourR = min(Client::Ref().GetPrefInteger("Decoration.Red", 200), 255); @@ -173,7 +172,7 @@ void GameModel::UpdateQuickOptions() } } -void GameModel::BuildQuickOptionMenu() +void GameModel::BuildQuickOptionMenu(GameController * controller) { for(std::vector<QuickOption*>::iterator iter = quickOptions.begin(), end = quickOptions.end(); iter != end; ++iter) { @@ -186,6 +185,7 @@ void GameModel::BuildQuickOptionMenu() quickOptions.push_back(new DecorationsOption(this)); quickOptions.push_back(new NGravityOption(this)); quickOptions.push_back(new AHeatOption(this)); + quickOptions.push_back(new ConsoleShowOption(this, controller)); notifyQuickOptionsChanged(); UpdateQuickOptions(); diff --git a/src/game/GameModel.h b/src/game/GameModel.h index 3a18935..311f89c 100644 --- a/src/game/GameModel.h +++ b/src/game/GameModel.h @@ -8,6 +8,7 @@ #include "interface/Colour.h" #include "graphics/Renderer.h" #include "GameView.h" +#include "GameController.h" #include "Brush.h" #include "client/User.h" #include "Notification.h" @@ -18,6 +19,7 @@ using namespace std; class GameView; +class GameController; class Simulation; class Renderer; @@ -126,7 +128,7 @@ public: std::string GetInfoTip(); void BuildMenus(); - void BuildQuickOptionMenu(); + void BuildQuickOptionMenu(GameController * controller); std::deque<Snapshot*> GetHistory(); void SetHistory(std::deque<Snapshot*> newHistory); diff --git a/src/game/GameView.h b/src/game/GameView.h index 7c77dc0..f36aef3 100644 --- a/src/game/GameView.h +++ b/src/game/GameView.h @@ -62,7 +62,7 @@ private: std::string infoTip; int toolTipPresence; -queue<ui::Point> pointQueue; + queue<ui::Point> pointQueue; GameController * c; Renderer * ren; Brush * activeBrush; @@ -168,7 +168,7 @@ public: virtual void OnDraw(); virtual void OnBlur(); - //Top-level handers, for Lua interface + //Top-level handlers, for Lua interface virtual void DoDraw(); virtual void DoMouseMove(int x, int y, int dx, int dy); virtual void DoMouseDown(int x, int y, unsigned button); diff --git a/src/game/QuickOptions.h b/src/game/QuickOptions.h index 431f5e9..5455051 100644 --- a/src/game/QuickOptions.h +++ b/src/game/QuickOptions.h @@ -99,3 +99,22 @@ public: m->SetAHeatEnable(!m->GetAHeatEnable()); } }; + +class ConsoleShowOption: public QuickOption +{ + GameController * c; +public: + ConsoleShowOption(GameModel * m, GameController * c_): + QuickOption("C", "Show Console", m, Toggle) + { + c = c_; + } + virtual bool GetToggle() + { + return 0; + } + virtual void perform() + { + c->ShowConsole(); + } +}; |
