/*Copyright (C) 2010 Deveaux Duncan

This file is part of Hikou no mizu.

Hikou no mizu 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, either version 3 of the License, or
(at your option) any later version.

Hikou no mizu 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 Hikou no mizu.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "ImageButton.hpp"

ImageButton::ImageButton()
{
    ImageButton(sf::Sprite(), 100, 50, sf::Color());
}

ImageButton::ImageButton(const sf::Sprite &image, float width, float height, const sf::Color &borderColor) :
Button(width, height, borderColor), m_image(image)
{
    m_image.SetX((m_width - m_image.GetSize().x) / 2);
    m_image.SetY((m_height - m_image.GetSize().y) / 2);
}

void ImageButton::Render(sf::RenderTarget& target, sf::Renderer& renderer) const
{
    Button::Render(target, renderer);
    target.Draw(m_image);
}

void ImageButton::setImage(const sf::Sprite &image)
{
    m_image = image;
}

const sf::Sprite &ImageButton::getImage() const
{
    return m_image;
}