tsp_cpp/xmlParser/DrawingElement.h

59 lines
1.4 KiB
C++

//
// Created by trotfunky on 15/05/19.
//
#ifndef SNIPPETS_DRAWINGELEMENT_H
#define SNIPPETS_DRAWINGELEMENT_H
#include <string>
#include <sstream>
#include <ostream>
#include <SFML/Graphics.hpp>
#include <pugixml.hpp>
#include "xmlParser.h"
namespace xmlParser
{
class DrawingElement
{
public:
// TODO : S'arranger pour n'avoir que des constructeurs sensés : pas de constructeur vide/résultat non évident
explicit DrawingElement(std::string label = "Test DrawingElement", float x = 0, float y = 1,
const sf::Color& = sf::Color::Yellow);
explicit DrawingElement(const pugi::xml_node&);
virtual void draw(sf::RenderWindow&) = 0;
void draw(sf::RenderWindow&, float referenceX, float referenceY);
std::string label;
virtual float getX() const;
virtual void setX(float newX);
virtual float getY() const;
virtual void setY(float newY);
const sf::Color& getColor() const;
const std::string getStringColor() const;
void setColor(const sf::Color& newColor);
void setColor(const std::string& stringColor);
virtual const std::string toString(int indent) const;
friend std::ostream& operator<<(std::ostream&,const DrawingElement&);
protected:
float x;
float y;
sf::Color color;
sf::Shape* shape;
};
}
#endif //SNIPPETS_DRAWINGELEMENT_H