#if 1
#include <windows.h>

#include "Application/Application.h"

#include "Window/GLFWImpl/GLFWImpl.h"

static int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nCmdShow) {
    Application app;
    if (!app.Initialize()) {
        return -1;
    }

    WindowSettings settings;
    GLFWImpl impl;
    if (!impl.Create(settings)) {
        return -1;
    }

    /*PPEngine::Window::WindowSettings settings;
    settings.title = "PPEditor";
    PPEngine::PPRHI::DriverSettings driverSettings;
    PPEngine::Window::Window window(driverSettings, settings, std::make_unique<CFrameWnd>());*/
    //CFrameWnd* window = new CFrameWnd();
    //window->Create(NULL, "ProjectorPlayer", WNDSTYLE_FRAME, 0L, 0L, 0, 640, 480);
    //window->CenterWindow();
    //window->ShowWindow(true);
    //godot_hinstance = hInstance;

    int ret = app.RunLoop();
    app.Uninitialize();
    return ret;
}

#else

#if 0
#include <windows.h>


TCHAR* szClassName = TEXT("HumanRenderWindow");
TCHAR* szWindowTitle = TEXT("HumanRender");

HWND hwnd;
LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam);

static int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t* lpCmdLine, int nCmdShow) {
    MSG         Msg;
    WNDCLASSEX  WndClsEx = { 0 };

    WndClsEx.cbSize = sizeof(WNDCLASSEX);
    WndClsEx.style = CS_HREDRAW | CS_VREDRAW;
    WndClsEx.lpfnWndProc = WndProc;
    WndClsEx.hInstance = hInstance;
    WndClsEx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
    WndClsEx.lpszClassName = szClassName;
    WndClsEx.hIconSm = LoadIcon(hInstance, IDI_APPLICATION);

    RegisterClassEx(&WndClsEx);

    hwnd = CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,
        szClassName,
        szWindowTitle,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT,
        CW_USEDEFAULT, CW_USEDEFAULT,
        NULL,
        NULL,
        hInstance,
        NULL);
    if (nullptr == hwnd) {
        MessageBox(NULL, TEXT("Window Creation Failed!"), TEXT("Error!"), MB_OK);
        return 0;
    }

    ShowWindow(hwnd, nCmdShow);
    UpdateWindow(hwnd);

    while (GetMessage(&Msg, NULL, 0, 0)) {
        TranslateMessage(&Msg);
        DispatchMessage(&Msg);
    }

    UnregisterClass(szClassName, hInstance);
    return 0;
}

LRESULT CALLBACK WndProc(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
    switch (Msg) {
    case WM_DESTROY:
        PostQuitMessage(WM_QUIT);
        break;
    case WM_PAINT:
    {

        PAINTSTRUCT ps;
        HDC         hdc;
        RECT        rc;
        hdc = BeginPaint(hwnd, &ps);

        GetClientRect(hwnd, &rc);
        SetTextColor(hdc, 0);
        SetBkMode(hdc, TRANSPARENT);
        DrawText(hdc, "HELLO WORLD", -1, &rc, DT_CENTER | DT_SINGLELINE | DT_VCENTER);

        EndPaint(hwnd, &ps);
        break;
    }
    break;
    default:
        return DefWindowProc(hwnd, Msg, wParam, lParam);
    }
    return 0;
}
#else 

//#include <glad/glad.h>
#include <GLFW/glfw3.h>

static int wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, wchar_t* lpCmdLine, int nCmdShow)
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    //glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);

    return 0;
}

#endif
#endif

  