Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Light.h"
- Light::Light(sf::Vector2f position, float radius, int precision) :
- position(position), radius(radius), precision(precision)
- {
- }
- void Light::draw(sf::RenderTarget &target, sf::RenderStates states) const {
- sf::CircleShape shape;
- shape.setPosition(position);
- shape.setFillColor(sf::Color(255, 255, 255, 1));
- for (int i = 0;i <= radius; i+=precision) {
- if (i >= 5) {
- shape.setRadius(i);
- shape.setOrigin(i, i);
- target.draw(shape);
- }
- }
- }
Add Comment
Please, Sign In to add comment