Guest User

Light.cpp

a guest
Dec 26th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include "Light.h"
  2.  
  3. Light::Light(sf::Vector2f position, float radius, int precision) :
  4.     position(position), radius(radius), precision(precision)
  5. {
  6. }
  7.  
  8. void Light::draw(sf::RenderTarget &target, sf::RenderStates states) const {
  9.     sf::CircleShape shape;
  10.     shape.setPosition(position);
  11.     shape.setFillColor(sf::Color(255, 255, 255, 1));
  12.     for (int i = 0;i <= radius; i+=precision) {
  13.         if (i >= 5) {
  14.             shape.setRadius(i);
  15.             shape.setOrigin(i, i);
  16.             target.draw(shape);
  17.         }
  18.     }
  19. }
Add Comment
Please, Sign In to add comment