made all the balls start moving
[physics.git] / src / entityCreator.cpp
index 6ed785d..078e40f 100644 (file)
@@ -1,12 +1,79 @@
 #include "entityCreator.h"
 
+#include <queue>
+
+#include "entityManager.h"
+#include "Entities/Ball.h"
+#include "graphics/colors.h"
+
+/// ***** Private Method Headers *****
+typedef std::queue<Ball*> queBall;
+queBall Balls;
+
+/// ***** Private Variables *****
+
+/// ***** Public Methods *****
 void creator::init()
 {
+    Ball* ball;
+
+    ball = new Ball(Vector2(50, 50), 20, cWhite);
+
+    ball->applyImpulse(Vector2(0.25,0.05)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(100, 50), 20, cBlack);
+
+    ball->applyImpulse(Vector2(-0.15,-0.05)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(150, 50), 20, cGrey);
+
+    ball->applyImpulse(Vector2(0.25,0.15)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(50, 100), 20, cRed);
 
+    ball->applyImpulse(Vector2(0.35,-0.15)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(100, 100), 20, cGreen);
+
+    ball->applyImpulse(Vector2(-0.15,0.05)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(150, 100), 20, cBlue);
+
+    ball->applyImpulse(Vector2(0.25,0.15)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(50, 150), 20, cYellow);
+
+    ball->applyImpulse(Vector2(0.25,-0.05)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(100, 150), 20, cMagenta);
+
+    ball->applyImpulse(Vector2(-0.15,-0.05)),
+    Balls.push(ball);
+    manager::add(ball);
+
+    ball = new Ball(Vector2(150, 150), 20, cCyan);
+
+    ball->applyImpulse(Vector2(-0.15,0.05)),
+    Balls.push(ball);
+    manager::add(ball);
 }
 void creator::clean()
 {
-
+    removeAllBalls();
 }
 
 void creator::addBall()
@@ -19,5 +86,12 @@ void creator::removeBall()
 }
 void creator::removeAllBalls()
 {
+    while(! Balls.empty() )
+    {
+        Ball* ball = Balls.front();
+        Balls.pop();
+        manager::remove(ball);
 
+        delete ball;
+    }
 }