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

GraphicsEngine::GraphicsEngine()
{
    
}

void GraphicsEngine::addObject(sf::Drawable *object)
{
    m_drawingList.push_back(object);
}

void GraphicsEngine::removeObject(sf::Drawable *object)
{
    //Search for the object
    std::vector<sf::Drawable*>::iterator it;
    it = std::find(m_drawingList.begin(), m_drawingList.end(), object);
    
    //If find, destroy it
    if (it != m_drawingList.end())
        m_drawingList.erase(it);
}

void GraphicsEngine::draw(sf::RenderWindow &renderWindow)
{
    for (int i=0; i < m_drawingList.size(); i++)
    {
        renderWindow.Draw(*m_drawingList[i]);
    }
}