mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-01 12:02:40 +02:00
modifier keys are now checked when doing stamp stuff
This commit is contained in:
@@ -1284,16 +1284,82 @@ void GameView::BeginStampSelection()
|
|||||||
|
|
||||||
void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
if(introText > 50)
|
if (introText > 50)
|
||||||
{
|
{
|
||||||
introText = 50;
|
introText = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(selectMode!=SelectNone)
|
// these key events still work when placing / creating stamps
|
||||||
|
switch (key)
|
||||||
{
|
{
|
||||||
if(selectMode==PlaceSave)
|
case KEY_LALT:
|
||||||
|
case KEY_RALT:
|
||||||
|
drawSnap = true;
|
||||||
|
enableAltBehaviour();
|
||||||
|
break;
|
||||||
|
case KEY_LCTRL:
|
||||||
|
case KEY_RCTRL:
|
||||||
|
if (!isMouseDown)
|
||||||
{
|
{
|
||||||
switch(key)
|
if (drawModeReset)
|
||||||
|
drawModeReset = false;
|
||||||
|
else
|
||||||
|
drawPoint1 = currentMouse;
|
||||||
|
if (shift)
|
||||||
|
{
|
||||||
|
if (!toolBrush)
|
||||||
|
drawMode = DrawFill;
|
||||||
|
else
|
||||||
|
drawMode = DrawPoints;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
drawMode = DrawRect;
|
||||||
|
}
|
||||||
|
enableCtrlBehaviour();
|
||||||
|
break;
|
||||||
|
case KEY_LSHIFT:
|
||||||
|
case KEY_RSHIFT:
|
||||||
|
if (!isMouseDown)
|
||||||
|
{
|
||||||
|
if (drawModeReset)
|
||||||
|
drawModeReset = false;
|
||||||
|
else
|
||||||
|
drawPoint1 = currentMouse;
|
||||||
|
if (ctrl)
|
||||||
|
{
|
||||||
|
if (!toolBrush)
|
||||||
|
drawMode = DrawFill;
|
||||||
|
else
|
||||||
|
drawMode = DrawPoints;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
drawMode = DrawLine;
|
||||||
|
}
|
||||||
|
enableShiftBehaviour();
|
||||||
|
break;
|
||||||
|
case ' ': //Space
|
||||||
|
c->SetPaused();
|
||||||
|
break;
|
||||||
|
case 'z':
|
||||||
|
if (ctrl)
|
||||||
|
{
|
||||||
|
c->HistoryRestore();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (drawMode != DrawLine && !windTool)
|
||||||
|
isMouseDown = false;
|
||||||
|
zoomCursorFixed = false;
|
||||||
|
c->SetZoomEnabled(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectMode != SelectNone)
|
||||||
|
{
|
||||||
|
if (selectMode == PlaceSave)
|
||||||
|
{
|
||||||
|
switch (key)
|
||||||
{
|
{
|
||||||
case KEY_RIGHT:
|
case KEY_RIGHT:
|
||||||
case 'd':
|
case 'd':
|
||||||
@@ -1330,75 +1396,14 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(key != ' ' && key != 'z')
|
if (key != ' ' && key != 'z')
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
switch(key)
|
switch(key)
|
||||||
{
|
{
|
||||||
case KEY_LALT:
|
|
||||||
case KEY_RALT:
|
|
||||||
drawSnap = true;
|
|
||||||
enableAltBehaviour();
|
|
||||||
break;
|
|
||||||
case KEY_LCTRL:
|
|
||||||
case KEY_RCTRL:
|
|
||||||
if(!isMouseDown)
|
|
||||||
{
|
|
||||||
if(drawModeReset)
|
|
||||||
drawModeReset = false;
|
|
||||||
else
|
|
||||||
drawPoint1 = currentMouse;
|
|
||||||
if(shift)
|
|
||||||
{
|
|
||||||
if (!toolBrush)
|
|
||||||
drawMode = DrawFill;
|
|
||||||
else
|
|
||||||
drawMode = DrawPoints;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
drawMode = DrawRect;
|
|
||||||
}
|
|
||||||
enableCtrlBehaviour();
|
|
||||||
break;
|
|
||||||
case KEY_LSHIFT:
|
|
||||||
case KEY_RSHIFT:
|
|
||||||
if(!isMouseDown)
|
|
||||||
{
|
|
||||||
if(drawModeReset)
|
|
||||||
drawModeReset = false;
|
|
||||||
else
|
|
||||||
drawPoint1 = currentMouse;
|
|
||||||
if(ctrl)
|
|
||||||
{
|
|
||||||
if (!toolBrush)
|
|
||||||
drawMode = DrawFill;
|
|
||||||
else
|
|
||||||
drawMode = DrawPoints;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
drawMode = DrawLine;
|
|
||||||
}
|
|
||||||
enableShiftBehaviour();
|
|
||||||
break;
|
|
||||||
case ' ': //Space
|
|
||||||
c->SetPaused();
|
|
||||||
break;
|
|
||||||
case KEY_TAB: //Tab
|
case KEY_TAB: //Tab
|
||||||
c->ChangeBrush();
|
c->ChangeBrush();
|
||||||
break;
|
break;
|
||||||
case 'z':
|
|
||||||
if (ctrl)
|
|
||||||
{
|
|
||||||
c->HistoryRestore();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (drawMode != DrawLine && !windTool)
|
|
||||||
isMouseDown = false;
|
|
||||||
zoomCursorFixed = false;
|
|
||||||
c->SetZoomEnabled(true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case '`':
|
case '`':
|
||||||
c->ShowConsole();
|
c->ShowConsole();
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user