summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-24 16:34:36 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-24 16:34:36 (GMT)
commitbeb0e8084932c437d68bbbf7efb82734e5d01ef1 (patch)
tree8c13f2bf46c30577ca3e01337566b25dfb0d17ef /src
parent7ead5edd5f2f6ed8e3b62adcc25d897ddba5fb3c (diff)
downloadpowder-beb0e8084932c437d68bbbf7efb82734e5d01ef1.zip
powder-beb0e8084932c437d68bbbf7efb82734e5d01ef1.tar.gz
Prevent key overlap for Stickman movement and Gravity/Debug/Stamp actions, fixes #81
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp16
-rw-r--r--src/game/GameView.cpp25
-rw-r--r--src/game/GameView.h5
3 files changed, 33 insertions, 13 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 48632a7..47c9c0f 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -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;
}
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index 26477e0..4a9bd93 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -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;
diff --git a/src/game/GameView.h b/src/game/GameView.h
index c449ba2..02dadc8 100644
--- a/src/game/GameView.h
+++ b/src/game/GameView.h
@@ -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);