+/*
+ * Copyright (C) 2008 Patrik Gornicz, Gornicz_P (at) hotmail (dot) com.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include "entityCreator.h"
+#include <queue>
+
+#include "entityManager.h"
+#include "Entities/Ball.h"
+#include "graphics/colors.h"
+
+/// ***** Private Variables *****
+
+typedef std::queue<Ball*> queBall;
+queBall Balls;
+
+/// ***** Initializers/Cleaners *****
+
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.55)),
+ 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();
}
+/// ***** Public Methods *****
+
void creator::addBall()
{
-
+ //TODO
}
void creator::removeBall()
{
-
+ //TODO
}
void creator::removeAllBalls()
{
+ while(! Balls.empty() )
+ {
+ Ball* ball = Balls.front();
+ Balls.pop();
+ manager::remove(ball);
+ delete ball;
+ }
}