Permalink
Browse files

modifier keys are now checked when doing stamp stuff

  • Loading branch information...
jacob1 committed Sep 20, 2015
1 parent bbdbb67 commit 8ecb2682aa953cbed999d2262ecd2ae98f825b89
Showing with 60 additions and 55 deletions.
  1. +60 −55 src/gui/game/GameView.cpp
@@ -1284,56 +1284,13 @@ void GameView::BeginStampSelection()
void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
{
if(introText > 50)
if (introText > 50)
{
introText = 50;
}
if(selectMode!=SelectNone)
{
if(selectMode==PlaceSave)
{
switch(key)
{
case KEY_RIGHT:
case 'd':
c->TranslateSave(ui::Point(1, 0));
break;
case KEY_LEFT:
case 'a':
c->TranslateSave(ui::Point(-1, 0));
break;
case KEY_UP:
case 'w':
c->TranslateSave(ui::Point(0, -1));
break;
case KEY_DOWN:
case 's':
c->TranslateSave(ui::Point(0, 1));
break;
case 'r':
if (ctrl && shift)
{
//Vertical flip
c->TransformSave(m2d_new(1,0,0,-1));
}
else if (!ctrl && shift)
{
//Horizontal flip
c->TransformSave(m2d_new(-1,0,0,1));
}
else
{
//Rotate 90deg
c->TransformSave(m2d_new(0,1,-1,0));
}
break;
}
}
if(key != ' ' && key != 'z')
return;
}
switch(key)
// these key events still work when placing / creating stamps
switch (key)
{
case KEY_LALT:
case KEY_RALT:
@@ -1342,13 +1299,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
break;
case KEY_LCTRL:
case KEY_RCTRL:
if(!isMouseDown)
if (!isMouseDown)
{
if(drawModeReset)
if (drawModeReset)
drawModeReset = false;
else
drawPoint1 = currentMouse;
if(shift)
if (shift)
{
if (!toolBrush)
drawMode = DrawFill;
@@ -1362,13 +1319,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
break;
case KEY_LSHIFT:
case KEY_RSHIFT:
if(!isMouseDown)
if (!isMouseDown)
{
if(drawModeReset)
if (drawModeReset)
drawModeReset = false;
else
drawPoint1 = currentMouse;
if(ctrl)
if (ctrl)
{
if (!toolBrush)
drawMode = DrawFill;
@@ -1383,9 +1340,6 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
case ' ': //Space
c->SetPaused();
break;
case KEY_TAB: //Tab
c->ChangeBrush();
break;
case 'z':
if (ctrl)
{
@@ -1399,6 +1353,57 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
c->SetZoomEnabled(true);
}
break;
}
if (selectMode != SelectNone)
{
if (selectMode == PlaceSave)
{
switch (key)
{
case KEY_RIGHT:
case 'd':
c->TranslateSave(ui::Point(1, 0));
break;
case KEY_LEFT:
case 'a':
c->TranslateSave(ui::Point(-1, 0));
break;
case KEY_UP:
case 'w':
c->TranslateSave(ui::Point(0, -1));
break;
case KEY_DOWN:
case 's':
c->TranslateSave(ui::Point(0, 1));
break;
case 'r':
if (ctrl && shift)
{
//Vertical flip
c->TransformSave(m2d_new(1,0,0,-1));
}
else if (!ctrl && shift)
{
//Horizontal flip
c->TransformSave(m2d_new(-1,0,0,1));
}
else
{
//Rotate 90deg
c->TransformSave(m2d_new(0,1,-1,0));
}
break;
}
}
if (key != ' ' && key != 'z')
return;
}
switch(key)
{
case KEY_TAB: //Tab
c->ChangeBrush();
break;
case '`':
c->ShowConsole();
break;

0 comments on commit 8ecb268

Please sign in to comment.