summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjacob1 <jfu614@gmail.com>2013-06-09 02:23:53 (GMT)
committer jacob1 <jfu614@gmail.com>2013-06-09 02:23:53 (GMT)
commit16cb95de641e2a28a40599f4b6c21336b78f7287 (patch)
treedca340f6f751aa49770759699045dad046e29c37 /src
parent0f5d0859b451f7cd716422a8b389129eb135ed60 (diff)
downloadpowder-16cb95de641e2a28a40599f4b6c21336b78f7287.zip
powder-16cb95de641e2a28a40599f4b6c21336b78f7287.tar.gz
fix problems with point queue, where it would draw a Point at A, a line from A to B, and a line from B to B every frame
Diffstat (limited to 'src')
-rw-r--r--src/gui/console/ConsoleController.cpp8
-rw-r--r--src/gui/game/GameController.cpp14
-rw-r--r--src/gui/game/GameView.cpp7
3 files changed, 15 insertions, 14 deletions
diff --git a/src/gui/console/ConsoleController.cpp b/src/gui/console/ConsoleController.cpp
index 602636f..b79470c 100644
--- a/src/gui/console/ConsoleController.cpp
+++ b/src/gui/console/ConsoleController.cpp
@@ -15,11 +15,13 @@ ConsoleController::ConsoleController(ControllerCallback * callback, CommandInter
void ConsoleController::EvaluateCommand(std::string command)
{
- if (command.substr(0, 6) == "!load ")
- CloseConsole();
- int returnCode = commandInterface->Command(command);
if(command.length())
+ {
+ if (command.substr(0, 6) == "!load ")
+ CloseConsole();
+ int returnCode = commandInterface->Command(command);
consoleModel->AddLastCommand(ConsoleCommand(command, returnCode, commandInterface->GetLastError()));
+ }
else
CloseConsole();
}
diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp
index b873360..9dd949f 100644
--- a/src/gui/game/GameController.cpp
+++ b/src/gui/game/GameController.cpp
@@ -444,7 +444,6 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point> & pointQueue
{
while(!pointQueue.empty())
{
- //delete pointQueue.front();
pointQueue.pop();
}
}
@@ -455,20 +454,25 @@ void GameController::DrawPoints(int toolSelection, queue<ui::Point> & pointQueue
if(!pointQueue.empty())
{
ui::Point sPoint(0, 0);
+ int size = pointQueue.size();
bool first = true;
while(!pointQueue.empty())
{
ui::Point fPoint = pointQueue.front();
- //delete pointQueue.front();
pointQueue.pop();
- if(!first)
+ if(size > 1)
{
- activeTool->DrawLine(sim, cBrush, sPoint, fPoint, true);
+ if (!first)
+ {
+ activeTool->DrawLine(sim, cBrush, sPoint, fPoint, true);
+ printf("From (%d, %d) To (%d, %d)\n", sPoint.X, sPoint.Y, fPoint.X, fPoint.Y);
+ }
+ first = false;
}
else
{
- first = false;
activeTool->Draw(sim, cBrush, fPoint);
+ printf("(%d, %d)\n", fPoint.X, fPoint.Y);
}
sPoint = fPoint;
}
diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp
index 735728f..d84bc41 100644
--- a/src/gui/game/GameView.cpp
+++ b/src/gui/game/GameView.cpp
@@ -1141,7 +1141,6 @@ void GameView::OnMouseUp(int x, int y, unsigned button)
if(drawMode == DrawPoints)
{
c->ToolClick(toolIndex, c->PointTranslate(ui::Point(x, y)));
- //pointQueue.push(ui::Point(x, y));
}
if(drawModeReset)
{
@@ -1209,10 +1208,6 @@ void GameView::OnMouseWheel(int x, int y, int d)
else
{
c->AdjustBrushSize(d, false, shiftBehaviour, ctrlBehaviour);
- if(isMouseDown)
- {
- pointQueue.push(ui::Point(c->PointTranslate(ui::Point(x, y))));
- }
}
}
@@ -1522,7 +1517,7 @@ void GameView::OnTick(float dt)
c->SetZoomPosition(currentMouse);
if(drawMode == DrawPoints)
{
- if(isMouseDown)
+ if(isMouseDown && pointQueue.empty())
{
pointQueue.push(ui::Point(c->PointTranslate(currentMouse)));
}