2019-05-14 13:07:25 +02:00
|
|
|
//
|
|
|
|
// Created by trotfunky on 14/05/19.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Circle.h"
|
|
|
|
|
|
|
|
namespace xmlParser
|
|
|
|
{
|
|
|
|
|
2019-05-16 01:16:19 +02:00
|
|
|
Circle::Circle() : DrawingElement(), r(2)
|
|
|
|
{
|
|
|
|
label = "Test Circle";
|
|
|
|
shape = new sf::CircleShape(r);
|
|
|
|
shape->setPosition(x,y);
|
|
|
|
shape->setFillColor(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
Circle::Circle(const pugi::xml_node& node) : DrawingElement(node), r(node.attribute("r").as_int(2))
|
|
|
|
{
|
|
|
|
if(label == "Test DrawingElement")
|
|
|
|
{
|
|
|
|
label = "Test Circle";
|
|
|
|
}
|
|
|
|
shape = new sf::CircleShape(r);
|
|
|
|
shape->setPosition(x,y);
|
|
|
|
shape->setFillColor(color);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Circle::draw(sf::RenderWindow& window)
|
|
|
|
{
|
|
|
|
window.draw(*(dynamic_cast<sf::CircleShape*>(shape)));
|
|
|
|
}
|
|
|
|
|
|
|
|
int Circle::getR() const
|
|
|
|
{
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Circle::setR(int newR)
|
|
|
|
{
|
|
|
|
r = newR;
|
|
|
|
dynamic_cast<sf::CircleShape*>(shape)->setRadius(r);
|
|
|
|
}
|
2019-05-14 13:07:25 +02:00
|
|
|
}
|