Ctrl + G gravity grid toggle

This commit is contained in:
jacob1 2012-10-20 20:06:38 -04:00 committed by Simon Robertshaw
parent 3ad7cf4539
commit e773abdcc8
6 changed files with 29 additions and 4 deletions

View File

@ -860,6 +860,12 @@ void GameController::SetDecoration()
gameModel->SetDecoration(!gameModel->GetDecoration());
}
void GameController::ShowGravityGrid()
{
gameModel->ShowGravityGrid(!gameModel->GetGravityGrid());
gameModel->UpdateQuickOptions();
}
void GameController::SetActiveColourPreset(int preset)
{
gameModel->SetActiveColourPreset(preset);

View File

@ -94,6 +94,7 @@ public:
void SetPaused();
void SetDecoration(bool decorationState);
void SetDecoration();
void ShowGravityGrid();
void SetActiveMenu(Menu * menu);
void SetActiveTool(int toolSelection, Tool * tool);
void SetActiveColourPreset(int preset);

View File

@ -802,6 +802,20 @@ bool GameModel::GetAHeatEnable()
return sim->aheat_enable;
}
void GameModel::ShowGravityGrid(bool showGrid)
{
ren->gravityFieldEnabled = showGrid;
if (showGrid)
SetInfoTip("Gravity Grid: On");
else
SetInfoTip("Gravity Grid: Off");
}
bool GameModel::GetGravityGrid()
{
return ren->gravityFieldEnabled;
}
void GameModel::FrameStep(int frames)
{
sim->framerender += frames;

View File

@ -162,6 +162,8 @@ public:
void SetDecoration(bool decorationState);
bool GetAHeatEnable();
void SetAHeatEnable(bool aHeat);
bool GetGravityGrid();
void ShowGravityGrid(bool showGrid);
void ClearSimulation();
vector<Menu*> GetMenuList();
vector<Tool*> GetUnlistedTools();

View File

@ -1271,7 +1271,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
c->FrameStep();
break;
case 'g':
if(shift)
if (ctrl)
c->ShowGravityGrid();
else if(shift)
c->AdjustGridSize(-1);
else
c->AdjustGridSize(1);
@ -1419,7 +1421,7 @@ void GameView::OnBlur()
void GameView::OnTick(float dt)
{
if(selectMode==PlaceSave && !placeSaveThumb)
selectMode = SelectNone;
selectMode = SelectNone;
if(zoomEnabled && !zoomCursorFixed)
c->SetZoomPosition(currentMouse);
if(drawMode == DrawPoints)

View File

@ -29,11 +29,11 @@ public:
}
virtual bool GetToggle()
{
return m->GetRenderer()->gravityFieldEnabled;
return m->GetGravityGrid();
}
virtual void perform()
{
m->GetRenderer()->gravityFieldEnabled = !m->GetRenderer()->gravityFieldEnabled;
m->ShowGravityGrid(!m->GetGravityGrid());
}
};