/**
* 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 .
*/
#pragma once
#include
#include
/**
* @class Foreground
* @author POSITIVE MENTAL ATTITUDE
* @date 06/09/16
* @file Foreground.hpp
* @brief The destructible foreground.
*/
class Foreground: public sf::Drawable
{
public:
Foreground() = default;
~Foreground();
void create(sf::Image& foreground, sf::Image& map);
void create(std::string foreground, std::string map);
void setResolution(sf::Vector2u resolution);
void setPosition(sf::Vector2f position);
void reloadFromTile(int x, int y, bool neighbouring = false);
void reloadFromPixel(int x, int y, bool neighbouring = false);
bool destroy(unsigned x, unsigned y);
sf::Vector2u getSize();
const unsigned getTileSize() const;
unsigned const tileAlpha(unsigned x, unsigned y, unsigned pixelX, unsigned pixelY);
private:
void draw(sf::RenderTarget& target, sf::RenderStates states) const;
std::vector> _tiles;
std::vector> _sprites;
sf::Vector2u _renderCount;
sf::Vector2u _tileCount;
unsigned _tileSize;
sf::Vector2u _position;
};