mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-03 04:52:35 +02:00
Pass points by value for drawing tools
This commit is contained in:
@@ -401,7 +401,7 @@ void GameController::DrawFill(int toolSelection, ui::Point point)
|
|||||||
activeTool->DrawFill(sim, cBrush, 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();
|
Simulation * sim = gameModel->GetSimulation();
|
||||||
Tool * activeTool = gameModel->GetActiveTool(toolSelection);
|
Tool * activeTool = gameModel->GetActiveTool(toolSelection);
|
||||||
@@ -413,7 +413,7 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueu
|
|||||||
{
|
{
|
||||||
while(!pointQueue.empty())
|
while(!pointQueue.empty())
|
||||||
{
|
{
|
||||||
delete pointQueue.front();
|
//delete pointQueue.front();
|
||||||
pointQueue.pop();
|
pointQueue.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -427,8 +427,8 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point*> & pointQueu
|
|||||||
bool first = true;
|
bool first = true;
|
||||||
while(!pointQueue.empty())
|
while(!pointQueue.empty())
|
||||||
{
|
{
|
||||||
ui::Point fPoint = *pointQueue.front();
|
ui::Point fPoint = pointQueue.front();
|
||||||
delete pointQueue.front();
|
//delete pointQueue.front();
|
||||||
pointQueue.pop();
|
pointQueue.pop();
|
||||||
if(!first)
|
if(!first)
|
||||||
{
|
{
|
||||||
|
@@ -82,7 +82,7 @@ public:
|
|||||||
void AdjustBrushSize(int direction, bool logarithmic = false, bool xAxis = false, bool yAxis = false);
|
void AdjustBrushSize(int direction, bool logarithmic = false, bool xAxis = false, bool yAxis = false);
|
||||||
void AdjustZoomSize(int direction, bool logarithmic = false);
|
void AdjustZoomSize(int direction, bool logarithmic = false);
|
||||||
void ToolClick(int toolSelection, ui::Point point);
|
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 DrawRect(int toolSelection, ui::Point point1, ui::Point point2);
|
||||||
void DrawLine(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);
|
void DrawFill(int toolSelection, ui::Point point);
|
||||||
|
@@ -146,7 +146,7 @@ public:
|
|||||||
|
|
||||||
GameView::GameView():
|
GameView::GameView():
|
||||||
ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, YRES+MENUSIZE)),
|
ui::Window(ui::Point(0, 0), ui::Point(XRES+BARSIZE, YRES+MENUSIZE)),
|
||||||
pointQueue(queue<ui::Point*>()),
|
pointQueue(queue<ui::Point>()),
|
||||||
isMouseDown(false),
|
isMouseDown(false),
|
||||||
ren(NULL),
|
ren(NULL),
|
||||||
activeBrush(NULL),
|
activeBrush(NULL),
|
||||||
@@ -926,8 +926,8 @@ void GameView::OnMouseMove(int x, int y, int dx, int dy)
|
|||||||
currentMouse = ui::Point(x, y);
|
currentMouse = ui::Point(x, y);
|
||||||
if(isMouseDown && drawMode == DrawPoints)
|
if(isMouseDown && drawMode == DrawPoints)
|
||||||
{
|
{
|
||||||
pointQueue.push(new ui::Point(c->PointTranslate(ui::Point(x-dx, y-dy))));
|
pointQueue.push(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, y))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -961,7 +961,7 @@ void GameView::OnMouseDown(int x, int y, unsigned button)
|
|||||||
}
|
}
|
||||||
if(drawMode == DrawPoints)
|
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)
|
if(drawMode == DrawPoints)
|
||||||
{
|
{
|
||||||
c->ToolClick(toolIndex, c->PointTranslate(ui::Point(x, y)));
|
c->ToolClick(toolIndex, c->PointTranslate(ui::Point(x, y)));
|
||||||
//pointQueue.push(new ui::Point(x, y));
|
//pointQueue.push(ui::Point(x, y));
|
||||||
}
|
}
|
||||||
if(drawModeReset)
|
if(drawModeReset)
|
||||||
{
|
{
|
||||||
@@ -1117,7 +1117,7 @@ void GameView::OnMouseWheel(int x, int y, int d)
|
|||||||
c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour);
|
c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour);
|
||||||
if(isMouseDown)
|
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)
|
if(isMouseDown)
|
||||||
{
|
{
|
||||||
pointQueue.push(new ui::Point(c->PointTranslate(currentMouse)));
|
pointQueue.push(ui::Point(c->PointTranslate(currentMouse)));
|
||||||
}
|
}
|
||||||
if(!pointQueue.empty())
|
if(!pointQueue.empty())
|
||||||
{
|
{
|
||||||
|
@@ -62,7 +62,7 @@ private:
|
|||||||
std::string infoTip;
|
std::string infoTip;
|
||||||
int toolTipPresence;
|
int toolTipPresence;
|
||||||
|
|
||||||
queue<ui::Point*> pointQueue;
|
queue<ui::Point> pointQueue;
|
||||||
GameController * c;
|
GameController * c;
|
||||||
Renderer * ren;
|
Renderer * ren;
|
||||||
Brush * activeBrush;
|
Brush * activeBrush;
|
||||||
|
Reference in New Issue
Block a user