54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
#ifndef POLYGON_H
|
|
#define POLYGON_H
|
|
#include "Coordinate.h"
|
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
class APolygon {
|
|
public:
|
|
/**
|
|
* @brief Construct a new Polygon object, with a white color and 0 vertices
|
|
*/
|
|
APolygon();
|
|
/**
|
|
* @brief Destroy the APolygon object
|
|
*/
|
|
virtual ~APolygon();
|
|
|
|
/**
|
|
* @brief Sets the color of this polygon
|
|
*
|
|
* @param COLOR The color to change the polygon to
|
|
*/
|
|
void setColor(const sf::Color COLOR);
|
|
/**
|
|
* @brief Draws this polygon to a SFML render target
|
|
*
|
|
* @param window The render target to draw the polygon on
|
|
*/
|
|
void draw(sf::RenderTarget& window);
|
|
/**
|
|
* @brief Sets the coordinate point at a specific vertex of this polygon
|
|
*
|
|
* @param IDX The index of the vertex to change
|
|
* @param COORD The coordinate location to set the vertex to
|
|
*/
|
|
void setCoordinate(const int IDX, const Coordinate COORD);
|
|
/**
|
|
* @brief Returns if the created polygon is valid or not
|
|
*
|
|
* @return true All of the vertices of the polygon line up with the current
|
|
* polygon type
|
|
* @return false The vertices are invalid for the current polygon type
|
|
*/
|
|
virtual bool validate() = 0;
|
|
|
|
protected:
|
|
short mNumVertices;
|
|
Coordinate* mVertices;
|
|
|
|
private:
|
|
sf::Color _color;
|
|
};
|
|
|
|
#endif // POLYGON_H
|