summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-09-30 15:26:05 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-09-30 15:26:05 (GMT)
commit68a32aa37607333d3d9a4ddb202a73cc01993000 (patch)
tree378d0c20bbf77b95007d8508e04c0dd308b72b86 /src
parent70174bff47432a3b63335b8205623757361d3191 (diff)
downloadpowder-68a32aa37607333d3d9a4ddb202a73cc01993000.zip
powder-68a32aa37607333d3d9a4ddb202a73cc01993000.tar.gz
Pass points by value for drawing tools
Diffstat (limited to 'src')
-rw-r--r--src/game/GameController.cpp8
-rw-r--r--src/game/GameController.h2
-rw-r--r--src/game/GameView.cpp14
-rw-r--r--src/game/GameView.h2
4 files changed, 13 insertions, 13 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 0ed9cf0..a1c4965 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -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)
{
diff --git a/src/game/GameController.h b/src/game/GameController.h
index dc95f8e..14dbccb 100644
--- a/src/game/GameController.h
+++ b/src/game/GameController.h
@@ -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);
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp
index af9eaaa..d952d5f 100644
--- a/src/game/GameView.cpp
+++ b/src/game/GameView.cpp
@@ -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())
{
diff --git a/src/game/GameView.h b/src/game/GameView.h
index 7fb5794..7c77dc0 100644
--- a/src/game/GameView.h
+++ b/src/game/GameView.h
@@ -62,7 +62,7 @@ private:
std::string infoTip;
int toolTipPresence;
- queue<ui::Point*> pointQueue;
+queue<ui::Point> pointQueue;
GameController * c;
Renderer * ren;
Brush * activeBrush;