Skip to content
Snippets Groups Projects
Commit 75f3562c authored by Mirko Wächter's avatar Mirko Wächter
Browse files

fixed keyboard control for platform

parent eb39a2c1
No related branches found
No related tags found
No related merge requests found
......@@ -262,6 +262,36 @@ void PlatformUnitWidget::controlPlatformWithKeyboard(int key)
void PlatformUnitWidget::stopPlatformWithKeyboard(int key)
{
QPointF position = speedCtrl->getPosition();
QPointF rotation = rotaCtrl->getPosition();
switch (key)
{
case Qt::Key_A:
rotation.rx() = 1;
break;
case Qt::Key_W:
position.ry() -= -1;
break;
case Qt::Key_S:
position.ry() += -1;
break;
case Qt::Key_D:
rotation.rx() = -1;
break;
case Qt::Key_Q:
position.rx() -= -1;
break;
case Qt::Key_E:
position.rx() += -1;
break;
default:
break;
}
speedCtrl->setNibble(position);
rotaCtrl->setNibble(rotation);
pressedKeys.remove(key);
if (pressedKeys.size() == 0)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment