#include <QApplication>
#include <Windows.h>
#include "wnd_main.h"
#include "states.h"
#include <shlobj.h>
namespace {
void EnableAnsiColor() {
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    if (hOut == INVALID_HANDLE_VALUE)
        return;

    DWORD dwMode = 0;
    if (!GetConsoleMode(hOut, &dwMode))
        return;

    dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
    SetConsoleMode(hOut, dwMode);
}
}

class MainCppHelper {
public:
    static void InitStateFromMain() {
        States::desktopWidth = GetSystemMetrics(SM_CXSCREEN);
        States::desktopHeight = GetSystemMetrics(SM_CYSCREEN);
    }

};


int main(int argc, char **argv) {
    SetConsoleOutputCP(CP_UTF8);
    EnableAnsiColor();
    MainCppHelper::InitStateFromMain();
    HRESULT hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
    if (FAILED(hr)) {
        MessageBoxW(nullptr, L"CoInitalizeEx Failed", L"main.cpp :: main()",MB_OK);
        return 886;
    }

    QApplication app{argc, argv};
    WndMain *wm = new WndMain{};
    int rqt = QApplication::exec();

    CoUninitialize();
    return rqt;
}













//
