prevent 'z' keypresses while doing stamp stuff, add skipDraw variable to prevent wasted drawing calls
This commit is contained in:
parent
74471dcda4
commit
cf5ec57ab3
@ -150,6 +150,7 @@ public:
|
|||||||
GameView::GameView():
|
GameView::GameView():
|
||||||
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
|
ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, WINDOWH)),
|
||||||
isMouseDown(false),
|
isMouseDown(false),
|
||||||
|
skipDraw(false),
|
||||||
zoomEnabled(false),
|
zoomEnabled(false),
|
||||||
zoomCursorFixed(false),
|
zoomCursorFixed(false),
|
||||||
mouseInZoom(false),
|
mouseInZoom(false),
|
||||||
@ -1077,10 +1078,12 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
|
|||||||
currentPoint = mousePosition;
|
currentPoint = mousePosition;
|
||||||
c->DrawPoints(toolIndex, lastPoint, currentPoint, true);
|
c->DrawPoints(toolIndex, lastPoint, currentPoint, true);
|
||||||
lastPoint = currentPoint;
|
lastPoint = currentPoint;
|
||||||
|
skipDraw = true;
|
||||||
}
|
}
|
||||||
else if (drawMode == DrawFill)
|
else if (drawMode == DrawFill)
|
||||||
{
|
{
|
||||||
c->DrawFill(toolIndex, mousePosition);
|
c->DrawFill(toolIndex, mousePosition);
|
||||||
|
skipDraw = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (drawMode == DrawPoints || drawMode == DrawFill)
|
else if (drawMode == DrawPoints || drawMode == DrawFill)
|
||||||
@ -1376,7 +1379,9 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
c->SetPaused();
|
c->SetPaused();
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
if (ctrl)
|
if (selectMode != SelectNone && isMouseDown)
|
||||||
|
break;
|
||||||
|
if (ctrl && !isMouseDown)
|
||||||
{
|
{
|
||||||
c->HistoryRestore();
|
c->HistoryRestore();
|
||||||
}
|
}
|
||||||
@ -1609,11 +1614,16 @@ void GameView::OnBlur()
|
|||||||
|
|
||||||
void GameView::OnTick(float dt)
|
void GameView::OnTick(float dt)
|
||||||
{
|
{
|
||||||
if (selectMode==PlaceSave && !placeSaveThumb)
|
if (selectMode == PlaceSave && !placeSaveThumb)
|
||||||
selectMode = SelectNone;
|
selectMode = SelectNone;
|
||||||
if (zoomEnabled && !zoomCursorFixed)
|
if (zoomEnabled && !zoomCursorFixed)
|
||||||
c->SetZoomPosition(currentMouse);
|
c->SetZoomPosition(currentMouse);
|
||||||
if (selectMode == SelectNone && isMouseDown)
|
|
||||||
|
if (skipDraw)
|
||||||
|
{
|
||||||
|
skipDraw = false;
|
||||||
|
}
|
||||||
|
else if (selectMode == SelectNone && isMouseDown)
|
||||||
{
|
{
|
||||||
if (drawMode == DrawPoints)
|
if (drawMode == DrawPoints)
|
||||||
{
|
{
|
||||||
|
@ -34,6 +34,7 @@ class GameView: public ui::Window
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
bool isMouseDown;
|
bool isMouseDown;
|
||||||
|
bool skipDraw;
|
||||||
bool zoomEnabled;
|
bool zoomEnabled;
|
||||||
bool zoomCursorFixed;
|
bool zoomCursorFixed;
|
||||||
bool mouseInZoom;
|
bool mouseInZoom;
|
||||||
|
Reference in New Issue
Block a user