Console Show quickoption

(best way I could think of)
This commit is contained in:
jacob1 2012-10-03 23:44:59 -04:00 committed by Simon Robertshaw
parent 72b00ca5e1
commit a9619fad33
5 changed files with 27 additions and 5 deletions

View File

@ -146,6 +146,7 @@ GameController::GameController():
{
gameView = new GameView();
gameModel = new GameModel();
gameModel->BuildQuickOptionMenu(this);
gameView->AttachController(this);
gameModel->AddObserver(gameView);

View File

@ -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();

View File

@ -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);

View File

@ -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);

View File

@ -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();
}
};