LCOV - code coverage report
Current view: top level - blClone/src - Light.cpp (source / functions) Hit Total Coverage
Test: report.info Lines: 19 19 100.0 %
Date: 2014-06-08 Functions: 5 5 100.0 %

          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             : 

Generated by: LCOV version 1.9