Fixed duplicate shape bug

Thanks "howlevergreen" from discord! A great find, and a great fix!
pull/113/head
Javidx9 5 years ago committed by GitHub
parent bff621cced
commit 75683314a5
  1. 10
      Videos/OneLoneCoder_PGE_Polymorphism.cpp

@ -453,7 +453,13 @@ public:
{ {
tempShape->col = olc::WHITE; tempShape->col = olc::WHITE;
listShapes.push_back(tempShape); listShapes.push_back(tempShape);
tempShape = nullptr; // Thanks @howlevergreen /Disord
} }
}
else
{
selectedNode = nullptr;
} }
} }
@ -517,7 +523,7 @@ public:
DrawCircle(sx, sy, 3, olc::YELLOW); DrawCircle(sx, sy, 3, olc::YELLOW);
// Draw Cursor Position // Draw Cursor Position
DrawString(10, 10, "X=" + std::to_string(vCursor.x) + ", Y=" + std::to_string(vCursor.y), olc::YELLOW, 2); DrawString(10, 10, "X=" + std::to_string(vCursor.x) + ", Y=" + std::to_string(vCursor.x), olc::YELLOW, 2);
return true; return true;
} }
}; };
@ -526,7 +532,7 @@ public:
int main() int main()
{ {
Polymorphism demo; Polymorphism demo;
if (demo.Construct(1600, 960, 1, 1)) if (demo.Construct(800, 480, 1, 1, false))
demo.Start(); demo.Start();
return 0; return 0;
} }

Loading…
Cancel
Save