/**
 *  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 "Foreground.hpp"

/**
 * @class Collidable
 * @author POSITIVE MENTAL ATTITUDE
 * @date 06/09/16
 * @file Collidable.hpp
 * @brief In theory this enables pixel perfect collision with the Foreground.
 * @see Foreground
 */
class Collidable
{
	public:
		Collidable() = default;
		virtual ~Collidable();
		void updateTransform(sf::Transform transform);
		int pixelPerfect(Foreground& foreground);
		
	protected:
		void genCollisionBox(std::string file, sf::Vector2f size);
		void setPointCount(unsigned pointCount);
		std::vector<sf::Vector2f> _cmap; /// Current to-be-destroyed points on the edges
		std::vector<sf::Vector2f> _cbanned; /// Already destroyed points
		unsigned _pointCount; // Total number of non-transparent points
		float _durability; // Normalized value how many points the Collidable object can lose before dying

	private:
		sf::Transform _transform;
};