Hello I've made custom ellipse shape according to this code:
#pragma once
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
class EllipseShape : public sf::Shape
{
public:
explicit EllipseShape(const sf::Vector2f& radius = sf::Vector2f(0.f, 0.f)) :
m_radius(radius)
{
update();
}
void setRadius(const sf::Vector2f& radius)
{
m_radius = radius;
update();
}
const sf::Vector2f& getRadius() const
{
return m_radius;
}
virtual std::size_t getPointCount() const
{
return 30;
}
virtual sf::Vector2f getPoint(std::size_t index) const
{
static const float pi = 3.141592654f;
float angle = index * 2 * pi / getPointCount() - pi / 2;
float x = std::cos(angle) * m_radius.x;
float y = std::sin(angle) * m_radius.y;
return sf::Vector2f(m_radius.x + x, m_radius.y + y);
}
//void setPointCount(std::size_t count);
private:
std::size_t m_pointCount;
sf::Vector2f m_radius;
};
I would like to set point count to this ellipse because it's too edgy when i resize it. I added there void setPointCount(std::size_t count) according to circleshape.hpp but i couldn't find definition of that function. Any ideas how can I define that function so it would add more points to that ellipse ?