#include "sdl2_window.h"
#include "sdl2_input.h"
#include <extra2d/platform/backend_factory.h>

namespace extra2d {
namespace platform {

namespace {
    static bool s_sdl2BackendRegistered = false;
}

void initSDL2Backend() {
    if (s_sdl2BackendRegistered) {
        return;
    }
    s_sdl2BackendRegistered = true;
    
    BackendFactory::reg(
        "sdl2",
        []() -> UniquePtr<IWindow> { 
            return makeUnique<SDL2Window>(); 
        },
        []() -> UniquePtr<IInput> { 
            return makeUnique<SDL2Input>(); 
        }
    );
}

} // namespace platform
} // namespace extra2d
