
#include <WFX/lang/WFXSystem.h>

#if SYSTEM==SDL
#include <WFX/SDL/System.h>
#endif

using namespace WFX;
using namespace WFX::lang;

WFXSystem::WFXSystem() {
    TimeTask = NULL;
    InputHandler = NULL;
    Renderer = NULL;
    TextureManager = NULL;
}

WFXSystem::~WFXSystem() {
    if (TimeTask)
        delete TimeTask;
    if (InputHandler)
        delete InputHandler;
        
    std::vector<WFX::renderer::RenderWindow*>::iterator it;
    for (it=RenderWindows.begin(); it!=RenderWindows.end(); it++) {
        WFX::renderer::RenderWindow* ptr = (*it);
        delete ptr;
    }
    if (Renderer)
        delete Renderer;
    if (TextureManager)
        delete TextureManager;
}

WFXSystem* WFXSystem::getImpl() {
    //create system on behalf of SYSTEM
    LOGN("Instantiating System ... ");
    return new WFX::SYSTEM::System(); 
    LOG("done");
    return NULL;
}


