Prevent key overlap for Stickman movement and Gravity/Debug/Stamp actions, fixes #81

This commit is contained in:
Simon Robertshaw 2012-08-24 17:34:36 +01:00
parent 7ead5edd5f
commit beb0e80849
3 changed files with 33 additions and 13 deletions

View File

@ -590,6 +590,22 @@ bool GameController::KeyPress(int key, Uint16 character, bool shift, bool ctrl,
{
sim->player2.comm = (int)(sim->player2.comm)|0x04; //Jump command
}
if((!sim->elementCount[PT_STKM2] || ctrl) && gameView->GetSelectMode() == SelectNone)
{
switch(key)
{
case 'w':
SwitchGravity();
break;
case 'd':
gameView->ToggleDebug();
break;
case 's':
gameView->BeginStampSelection();
break;
}
}
}
return ret;
}

View File

@ -1179,6 +1179,19 @@ void GameView::OnMouseWheel(int x, int y, int d)
}
}
void GameView::ToggleDebug()
{
showDebug = !showDebug;
}
void GameView::BeginStampSelection()
{
selectMode = SelectStamp;
selectPoint1 = ui::Point(-1, -1);
infoTip = "\x0F\xEF\xEF\x10Select an area to create a stamp";
infoTipPresence = 120;
}
void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
if(colourRValue->IsFocused() || colourGValue->IsFocused() || colourBValue->IsFocused() || colourAValue->IsFocused())
@ -1300,9 +1313,6 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
else
c->AdjustGridSize(1);
break;
case 'd':
showDebug = !showDebug;
break;
case KEY_F1:
if(!introText)
introText = 8047;
@ -1324,15 +1334,6 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
if(ctrl)
c->SetDecoration();
break;
case 's':
selectMode = SelectStamp;
selectPoint1 = ui::Point(-1, -1);
infoTip = "\x0F\xEF\xEF\x10Select an area to create a stamp";
infoTipPresence = 120;
break;
case 'w':
c->SwitchGravity();
break;
case 'y':
c->SwitchAir();
break;

View File

@ -138,6 +138,10 @@ public:
void SetSample(SimulationSample sample);
bool CtrlBehaviour(){ return ctrlBehaviour; }
bool ShiftBehaviour(){ return shiftBehaviour; }
void ExitPrompt();
void ToggleDebug();
SelectMode GetSelectMode() { return selectMode; }
void BeginStampSelection();
void AttachController(GameController * _c){ c = _c; }
void NotifyRendererChanged(GameModel * sender);
@ -160,7 +164,6 @@ public:
void NotifyQuickOptionsChanged(GameModel * sender);
void NotifyLastToolChanged(GameModel * sender);
void ExitPrompt();
virtual void ToolTip(ui::Component * sender, ui::Point mousePosition, std::string toolTip);