#include "entityCreator.h"
+#include <queue>
+
#include "entityManager.h"
#include "Entities/Ball.h"
#include "graphics/colors.h"
/// ***** Private Method Headers *****
-Ball* ball1;
+typedef std::queue<Ball*> queBall;
+queBall Balls;
/// ***** Private Variables *****
/// ***** Public Methods *****
void creator::init()
{
- Vector2 pos(400, 400);
- ball1 = new Ball(pos, 20, cBlue);
+ Ball* ball;
+
+ // needs to be first for the overlap
+ ball = new Ball(Vector2(50, 50), 20, cWhite);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(100, 50), 20, cBlack);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(150, 50), 20, cGrey);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(50, 100), 20, cRed);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(100, 100), 20, cGreen);
- manager::add(ball1);
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(150, 100), 20, cBlue);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(50, 150), 20, cYellow);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(100, 150), 20, cMagenta);
+
+ Balls.push(ball);
+ manager::add(ball);
+
+ ball = new Ball(Vector2(150, 150), 20, cCyan);
+
+ Balls.push(ball);
+ manager::add(ball);
}
void creator::clean()
{
- manager::remove(ball1);
-
- delete ball1;
+ removeAllBalls();
}
void creator::addBall()
}
void creator::removeAllBalls()
{
+ while(! Balls.empty() )
+ {
+ Ball* ball = Balls.front();
+ Balls.pop();
+ manager::remove(ball);
+ delete ball;
+ }
}
#include <set>
-using std::set;
#include <iostream>
void updatePhysics(float);
/// ***** Private Variables *****
-typedef set<Particle*> setPart;
+typedef std::set<Particle*> setPart;
setPart particles_To_Add;
setPart active_Particles;
setPart particles_To_Remove;
bool clearParticles;
-typedef set<PhysicsEntity*> setPhys;
+typedef std::set<PhysicsEntity*> setPhys;
setPhys physics_To_Add;
setPhys active_Physics;
setPhys physics_To_Remove;
+static float const cWhite[] = {1.0, 1.0, 1.0};
+static float const cBlack[] = {0.0, 0.0, 0.0};
+static float const cGrey[] = {0.5, 0.5, 0.5};
+
static float const cRed[] = {1.0, 0.0, 0.0};
static float const cGreen[] = {0.0, 1.0, 0.0};
static float const cBlue[] = {0.0, 0.0, 1.0};
+
static float const cYellow[] = {1.0, 1.0, 0.0};
+static float const cMagenta[] = {1.0, 0.0, 1.0};
+static float const cCyan[] = {0.0, 1.0, 1.0};