#include "glfw_window.h"
#include "glfw_input.h"
#include <extra2d/platform/backend_factory.h>

namespace extra2d {
namespace platform {

namespace {
    static bool s_glfwBackendRegistered = false;
}

void initGLFWBackend() {
    if (s_glfwBackendRegistered) {
        return;
    }
    s_glfwBackendRegistered = true;
    
    BackendFactory::reg(
        "glfw",
        []() -> UniquePtr<IWindow> { 
            return makeUnique<GLFWWindow>(); 
        },
        []() -> UniquePtr<IInput> { 
            return makeUnique<GLFWInput>(); 
        }
    );
}

} // namespace platform
} // namespace extra2d
