This is an attempt to fix the Travis build errors due to mismatched virtual override signatures

This commit is contained in:
2018-03-03 18:44:27 -05:00
parent ed402040c9
commit d1838991a8

View File

@@ -15,6 +15,7 @@
#include "render_image.hpp"
using boost::math::constants::pi;
using pt_idx_t = decltype(((sf::Shape*)nullptr)->getPointCount());
// TODO: Put these classes in a header?
class EllipseShape : public sf::Shape {
@@ -22,18 +23,18 @@ class EllipseShape : public sf::Shape {
int points;
float a, b;
public:
explicit EllipseShape(sf::Vector2f size, std::size_t points = 30) : points(points) {
explicit EllipseShape(sf::Vector2f size, pt_idx_t points = 30) : points(points) {
a = size.x / 2.0f;
b = size.y / 2.0f;
divSz = 2 * pi<float>() / points;
update();
}
std::size_t getPointCount() const override {
pt_idx_t getPointCount() const override {
return points;
}
sf::Vector2f getPoint(std::size_t i) const override {
sf::Vector2f getPoint(pt_idx_t i) const override {
float t = i * divSz;
return sf::Vector2f(a + a*sin(t), b + b*cos(t));
}
@@ -46,7 +47,7 @@ class RoundRectShape : public sf::Shape {
int points;
float w,h,r;
public:
RoundRectShape(sf::Vector2f size, float cornerRadius, std::size_t points = 32) : points(points / 4) {
RoundRectShape(sf::Vector2f size, float cornerRadius, pt_idx_t points = 32) : points(points / 4) {
w = size.x;
h = size.y;
r = cornerRadius;
@@ -54,11 +55,11 @@ public:
update();
}
std::size_t getPointCount() const override {
pt_idx_t getPointCount() const override {
return points * 4;
}
sf::Vector2f getPoint(std::size_t i) const override {
sf::Vector2f getPoint(pt_idx_t i) const override {
const float pi = ::pi<float>();
const float half_pi = 0.5 * pi;
float t = i * divSz;