Line data Source code
1 : #include "Util.h"
2 : #include "Config.h"
3 :
4 : #include "Light.h"
5 :
6 5 : Light::Light() {
7 :
8 : // Initially create light with random color and location
9 5 : randomColor();
10 5 : randomLocation();
11 5 : }
12 :
13 5 : Light::~Light() {
14 5 : }
15 :
16 278 : Vector2f& Light::location() {
17 :
18 278 : return location_;
19 : }
20 :
21 5 : void Light::randomColor() {
22 :
23 : // Set random color.
24 5 : float r = Util::randomInRange(0.0, Config::COLOR_MAX);
25 5 : float g = Util::randomInRange(0.0, Config::COLOR_MAX);
26 5 : float b = Util::randomInRange(0.0, Config::COLOR_MAX);
27 5 : color_.set(r, g, b);
28 5 : }
29 :
30 5 : void Light::randomLocation() {
31 :
32 : // Set random location.
33 5 : float x = Util::randomInRange(0.0, Config::SCREEN_WIDTH);
34 5 : float y = Util::randomInRange(0.0, Config::SCREEN_HEIGHT);
35 :
36 5 : location_.set(x, y);
37 5 : }
38 :
|