Pass points by value for drawing tools
This commit is contained in:
parent
70174bff47
commit
68a32aa376
@ -401,7 +401,7 @@ void GameController::DrawFill(int toolSelection, ui::Point point)
|
||||
activeTool->DrawFill(sim, cBrush, point);
|
||||
}
|
||||
|
||||
void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueue)
|
||||
void GameController::DrawPoints(int toolSelection, queue<ui::Point> & pointQueue)
|
||||
{
|
||||
Simulation * sim = gameModel->GetSimulation();
|
||||
Tool * activeTool = gameModel->GetActiveTool(toolSelection);
|
||||
@ -413,7 +413,7 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueu
|
||||
{
|
||||
while(!pointQueue.empty())
|
||||
{
|
||||
delete pointQueue.front();
|
||||
//delete pointQueue.front();
|
||||
pointQueue.pop();
|
||||
}
|
||||
}
|
||||
@ -427,8 +427,8 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueu
|
||||
bool first = true;
|
||||
while(!pointQueue.empty())
|
||||
{
|
||||
ui::Point fPoint = *pointQueue.front();
|
||||
delete pointQueue.front();
|
||||
ui::Point fPoint = pointQueue.front();
|
||||
//delete pointQueue.front();
|
||||
pointQueue.pop();
|
||||
if(!first)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
void AdjustBrushSize(int direction, bool logarithmic = false, bool xAxis = false, bool yAxis = false);
|
||||
void AdjustZoomSize(int direction, bool logarithmic = false);
|
||||
void ToolClick(int toolSelection, ui::Point point);
|
||||
void DrawPoints(int toolSelection, queue<ui::Point*> & pointQueue);
|
||||
void DrawPoints(int toolSelection, queue<ui::Point> & pointQueue);
|
||||
void DrawRect(int toolSelection, ui::Point point1, ui::Point point2);
|
||||
void DrawLine(int toolSelection, ui::Point point1, ui::Point point2);
|
||||
void DrawFill(int toolSelection, ui::Point point);
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
GameView::GameView():
|
||||
ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, YRES+MENUSIZE)),
|
||||
pointQueue(queue<ui::Point*>()),
|
||||
pointQueue(queue<ui::Point>()),
|
||||
isMouseDown(false),
|
||||
ren(NULL),
|
||||
activeBrush(NULL),
|
||||
@ -926,8 +926,8 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
|
||||
currentMouse = ui::Point(x, y);
|
||||
if(isMouseDown && drawMode == DrawPoints)
|
||||
{
|
||||
pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy))));
|
||||
pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x, y))));
|
||||
pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy))));
|
||||
pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x, y))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -961,7 +961,7 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
||||
}
|
||||
if(drawMode == DrawPoints)
|
||||
{
|
||||
pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x, y))));
|
||||
pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x, y))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
|
||||
if(drawMode == DrawPoints)
|
||||
{
|
||||
c->ToolClick(toolIndex, c->PointTranslate(ui::Point(x, y)));
|
||||
//pointQueue.push(new ui::Point(x, y));
|
||||
//pointQueue.push(ui::Point(x, y));
|
||||
}
|
||||
if(drawModeReset)
|
||||
{
|
||||
@ -1117,7 +1117,7 @@ void GameView::OnMouseWheel(int x, int y, int d)
|
||||
c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour);
|
||||
if(isMouseDown)
|
||||
{
|
||||
pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x, y))));
|
||||
pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x, y))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1405,7 +1405,7 @@ void GameView::OnTick(float dt)
|
||||
{
|
||||
if(isMouseDown)
|
||||
{
|
||||
pointQueue.push(new ui::Point(c->PointTranslate(currentMouse)));
|
||||
pointQueue.push(ui::Point(c->PointTranslate(currentMouse)));
|
||||
}
|
||||
if(!pointQueue.empty())
|
||||
{
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
std::string infoTip;
|
||||
int toolTipPresence;
|
||||
|
||||
queue<ui::Point*> pointQueue;
|
||||
queue<ui::Point> pointQueue;
|
||||
GameController * c;
|
||||
Renderer * ren;
|
||||
Brush * activeBrush;
|
||||
|
Loading…
Reference in New Issue
Block a user