tsp_cpp/xmlParser/DrawingElement.h

60 lines
1.4 KiB
C
Raw Permalink Normal View History

//
// 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:
2019-05-21 12:48:08 +02:00
// 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&);
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 = 0;
friend std::ostream& operator<<(std::ostream&,const DrawingElement&);
protected:
float x;
float y;
sf::Color color;
std::unique_ptr<sf::Shape> shape;
};
}
#endif //SNIPPETS_DRAWINGELEMENT_H