2024-11-06 17:02:59 -07:00
|
|
|
#ifndef POLYGON_H
|
|
|
|
#define POLYGON_H
|
|
|
|
#include "Coordinate.h"
|
|
|
|
|
2024-11-18 00:16:40 -07:00
|
|
|
#include <SFML/Graphics.hpp>
|
|
|
|
|
2024-11-06 17:02:59 -07:00
|
|
|
class APolygon {
|
2024-11-18 00:18:28 -07:00
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* @brief Construct a new Polygon object, with a white color and 0 vertices
|
|
|
|
*/
|
|
|
|
APolygon();
|
|
|
|
/**
|
|
|
|
* @brief Destroy the APolygon object
|
|
|
|
*/
|
|
|
|
virtual ~APolygon();
|
2024-11-18 00:16:40 -07:00
|
|
|
|
2024-11-18 00:18:28 -07:00
|
|
|
/**
|
|
|
|
* @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;
|
2024-11-18 00:16:40 -07:00
|
|
|
|
2024-11-18 00:18:28 -07:00
|
|
|
protected:
|
|
|
|
short mNumVertices;
|
|
|
|
Coordinate* mVertices;
|
2024-11-06 17:02:59 -07:00
|
|
|
|
2024-11-18 00:18:28 -07:00
|
|
|
private:
|
|
|
|
sf::Color _color;
|
2024-11-06 17:02:59 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // POLYGON_H
|