/**
 *  Triangles
 *  Copyright (C) 2016 POSITIVE MENTAL ATTITUDE
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, version 3 of the License.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include <SFML/Graphics.hpp>
#include <functional>
#include "Foreground.hpp"

/**
 * @class Triangle
 * @author POSITIVE MENTAL ATTITUDE 
 * @date 05/03/16
 * @file Triangle.hpp
 * @brief A simple class for 45°/67.5°/67.5° triangles, including the player. Unlike sfml sf::Shapes, it does not support outlines.
 * Because they are not realy useful here.
 */
class Triangle: public sf::Drawable, public sf::Transformable
{
	public:
		Triangle(); 
		float getSize();
		void setSize(float size);
		virtual void setTexture(sf::Texture& texture);
		void setColor(sf::Color color);
		void setColor(unsigned r, unsigned g, unsigned b, unsigned a = 255);

	protected:
		virtual void redraw();
		void vertexFit();
		sf::VertexArray _vertices;
		const sf::Texture* _texture;

	private:
		virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
		float _size;
};