Commit | Line | Data |
---|---|---|
054d658f PG |
1 | #include "entityCreator.h" |
2 | ||
f72f4a59 PG |
3 | #include <queue> |
4 | ||
a483ed75 PG |
5 | #include "entityManager.h" |
6 | #include "Entities/Ball.h" | |
7 | #include "graphics/colors.h" | |
8 | ||
9 | /// ***** Private Method Headers ***** | |
f72f4a59 PG |
10 | typedef std::queue<Ball*> queBall; |
11 | queBall Balls; | |
a483ed75 PG |
12 | |
13 | /// ***** Private Variables ***** | |
14 | ||
15 | /// ***** Public Methods ***** | |
054d658f PG |
16 | void creator::init() |
17 | { | |
f72f4a59 PG |
18 | Ball* ball; |
19 | ||
f72f4a59 PG |
20 | ball = new Ball(Vector2(50, 50), 20, cWhite); |
21 | ||
3980ceb3 | 22 | ball->applyImpulse(Vector2(0.25,0.05)), |
f72f4a59 PG |
23 | Balls.push(ball); |
24 | manager::add(ball); | |
25 | ||
26 | ball = new Ball(Vector2(100, 50), 20, cBlack); | |
27 | ||
3980ceb3 | 28 | ball->applyImpulse(Vector2(-0.15,-0.05)), |
f72f4a59 PG |
29 | Balls.push(ball); |
30 | manager::add(ball); | |
31 | ||
32 | ball = new Ball(Vector2(150, 50), 20, cGrey); | |
33 | ||
3980ceb3 | 34 | ball->applyImpulse(Vector2(0.25,0.15)), |
f72f4a59 PG |
35 | Balls.push(ball); |
36 | manager::add(ball); | |
37 | ||
38 | ball = new Ball(Vector2(50, 100), 20, cRed); | |
39 | ||
3980ceb3 | 40 | ball->applyImpulse(Vector2(0.35,-0.15)), |
f72f4a59 PG |
41 | Balls.push(ball); |
42 | manager::add(ball); | |
43 | ||
44 | ball = new Ball(Vector2(100, 100), 20, cGreen); | |
054d658f | 45 | |
3980ceb3 | 46 | ball->applyImpulse(Vector2(-0.15,0.05)), |
f72f4a59 PG |
47 | Balls.push(ball); |
48 | manager::add(ball); | |
49 | ||
50 | ball = new Ball(Vector2(150, 100), 20, cBlue); | |
51 | ||
3980ceb3 | 52 | ball->applyImpulse(Vector2(0.25,0.15)), |
f72f4a59 PG |
53 | Balls.push(ball); |
54 | manager::add(ball); | |
55 | ||
56 | ball = new Ball(Vector2(50, 150), 20, cYellow); | |
57 | ||
3980ceb3 | 58 | ball->applyImpulse(Vector2(0.25,-0.05)), |
f72f4a59 PG |
59 | Balls.push(ball); |
60 | manager::add(ball); | |
61 | ||
62 | ball = new Ball(Vector2(100, 150), 20, cMagenta); | |
63 | ||
3980ceb3 | 64 | ball->applyImpulse(Vector2(-0.15,-0.05)), |
f72f4a59 PG |
65 | Balls.push(ball); |
66 | manager::add(ball); | |
67 | ||
68 | ball = new Ball(Vector2(150, 150), 20, cCyan); | |
69 | ||
3980ceb3 | 70 | ball->applyImpulse(Vector2(-0.15,0.05)), |
f72f4a59 PG |
71 | Balls.push(ball); |
72 | manager::add(ball); | |
054d658f PG |
73 | } |
74 | void creator::clean() | |
75 | { | |
f72f4a59 | 76 | removeAllBalls(); |
054d658f PG |
77 | } |
78 | ||
79 | void creator::addBall() | |
80 | { | |
81 | ||
82 | } | |
83 | void creator::removeBall() | |
84 | { | |
85 | ||
86 | } | |
87 | void creator::removeAllBalls() | |
88 | { | |
f72f4a59 PG |
89 | while(! Balls.empty() ) |
90 | { | |
91 | Ball* ball = Balls.front(); | |
92 | Balls.pop(); | |
93 | manager::remove(ball); | |
054d658f | 94 | |
f72f4a59 PG |
95 | delete ball; |
96 | } | |
054d658f | 97 | } |