[
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/DiscordHook/Discord.cpp",
    "content": "/*\n\n\n*/\n#include <cstdint>\n#include <Windows.h>\n#include \"../Helper/Helper.h\"\n#include \"Discord.h\"\n\n#define DEVELOPER\n\nuintptr_t Discord::GetDiscordModuleBase()\n{\n    // This is static because we only need to get once.\n    static uintptr_t discordModuleBase = 0;\n\n    // If its false, we use GetModuleHandle to grab the Module Base adress. \n    if (!discordModuleBase)\n        discordModuleBase = (uintptr_t)GetModuleHandleA(\"DiscordHook64.dll\");\n\n    return discordModuleBase;\n}\n\nbool Discord::CreateHook(uintptr_t originalPresent, uintptr_t hookFunction, uintptr_t pOriginal)\n{\n\n    static uintptr_t addrCreateHook = NULL;\n\n    if (!addrCreateHook)\n    {\n        addrCreateHook = Helper::PatternScan(GetDiscordModuleBase(), \"41 57 41 56 56 57 55 53 48 83 EC 68 4D 89 C6 49 89 D7\");\n\n#ifdef DEVELOPER\n#endif\n    }\n\n    if (!addrCreateHook)\n        return false;\n\n    using CreateHook_t = uint64_t(__fastcall*)(LPVOID, LPVOID, LPVOID*);\n    auto fnCreateHook = (CreateHook_t)addrCreateHook;\n    return fnCreateHook((void*)originalPresent, (void*)hookFunction, (void**)pOriginal) == 0 ? true : false;\n\n}\n\nbool Discord::EnableHook(uintptr_t pTarget, bool toggle)\n{\n    static uintptr_t addrEnableHook = NULL;\n\n    if (!addrEnableHook)\n    {\n        addrEnableHook = Helper::PatternScan(GetDiscordModuleBase(),\n            \"41 56 56 57 53 48 83 EC 28 49 89 CE BF 01 00 00 00 31 C0 F0 ? ? ? ? ? ? ? 74\"\n        );\n    }\n\n    if (!addrEnableHook)\n        return false;\n\n    using EnableHook_t = uint64_t(__fastcall*)(LPVOID, bool);\n    auto fnEnableHook = (EnableHook_t)addrEnableHook;\n\n    return fnEnableHook((void*)pTarget, toggle) == 0 ? true : false;\n}\n\nbool Discord::EnableHookQue()\n{\n    static uintptr_t addrEnableHookQueu = NULL;\n\n    if (!addrEnableHookQueu)\n    {\n        addrEnableHookQueu = Helper::PatternScan(GetDiscordModuleBase(),\n            \"41 57 41 56 41 55 41 54 56 57 55 53 48 83 EC 38 48 ? ? ? ? ? ? 48 31 E0 48 89 44 24 30 BE 01 00 00 00 31 C0 F0 ? ? ? ? ? ? ? 74 2B\");\n\n    }\n\n    if (!addrEnableHookQueu)\n        return false;\n\n    using EnableHookQueu_t = uint64_t(__stdcall*)(VOID);\n    auto fnEnableHookQueu = (EnableHookQueu_t)addrEnableHookQueu;\n\n    return fnEnableHookQueu() == 0 ? true : false;\n}\n\nshort Discord::GetAsyncKeyState(const int vKey)\n{\n    static uintptr_t addrGetAsyncKeyState = NULL;\n\n    if (!addrGetAsyncKeyState)\n    {\n        addrGetAsyncKeyState = Helper::PatternScan(GetDiscordModuleBase(),\n            \"48 FF ? ? ? ? ? CC CC CC CC CC CC CC CC CC 48 FF ? ? ? ? ? CC CC CC CC CC CC CC CC CC 48 83 EC 28 48 ? ? ? ? ? ? 48 85 C9\");\n    }\n\n    if (!addrGetAsyncKeyState)\n        return false;\n\n    using GetAsyncKeyState_t = short(__fastcall*)(int);\n    auto fnGetAyncKeyState = (GetAsyncKeyState_t)addrGetAsyncKeyState;\n\n    return fnGetAyncKeyState(vKey);\n}\n\nshort Discord::SetCursorPos(int x, int y)\n{\n    static uintptr_t addrSetCursorPos = NULL;\n\n    if (!addrSetCursorPos)\n    {\n        addrSetCursorPos = Helper::PatternScan(GetDiscordModuleBase(),\n            \"44 0F B6 05 ? ? ? ? 45 84 C0\");\n\n#ifdef DEVELOPER\n#endif\n    }\n\n    if (!addrSetCursorPos)\n        return false;\n\n    using SetCursorPos_t = short(__fastcall*)(int, int);\n    auto fnSetCursorPos = (SetCursorPos_t)addrSetCursorPos;\n\n    return fnSetCursorPos(x, y);\n}\n\n\nbool Discord::GetCursorPos(LPPOINT lpPoint)\n{\n    static uintptr_t addrGetCursorPos = NULL;\n\n    if (!addrGetCursorPos)\n    {\n        addrGetCursorPos = Helper::PatternScan(GetDiscordModuleBase(),\n            \"40 53 48 83 EC 20 48 8B D9 FF 15 ? ? ? ? 0F B6 15 ? ? ? ?\");\n\n#ifdef DEVELOPER\n#endif\n    }\n\n    if (!addrGetCursorPos)\n        return false;\n\n    using GetCursorPos_t = short(__fastcall*)(LPPOINT);\n    auto fnGetCursorPos = (GetCursorPos_t)addrGetCursorPos;\n\n    return fnGetCursorPos(lpPoint);\n}\n\nHCURSOR Discord::SetCursor(HCURSOR hCursor)\n{\n    static uintptr_t addrSetCursor = NULL;\n\n    if (!addrSetCursor)\n    {\n        addrSetCursor = Helper::PatternScan(GetDiscordModuleBase(),\n            \"40 53 48 83 EC 20 0F B6 05 ? ? ? ? 48 8B D9 84 C0 74 4F\");\n\n#ifdef DEVELOPER\n#endif\n    }\n\n    if (!addrSetCursor)\n        return 0;\n\n    using SetCursor_t = HCURSOR(__fastcall*)(HCURSOR);\n    auto fnSetCursor = (SetCursor_t)addrSetCursor;\n\n    return fnSetCursor(hCursor);\n}\n\nbool Discord::HookFunction(uintptr_t originalFunction, uintptr_t hookedFunction, uintptr_t pOriginalPresent)\n{\n#ifdef DEVELOPER\n#endif\n\n\n    if (DISCORD.CreateHook(originalFunction, hookedFunction, pOriginalPresent))\n    {\n#ifdef DEVELOPER\n#endif\n        if (DISCORD.EnableHook(originalFunction, true))\n        {\n#ifdef DEVELOPER\n#endif\n\n            if (DISCORD.EnableHookQue())\n            {\n#ifdef DEVELOPER\n#endif\n                return true;\n            }\n        }\n    }\n\n    return false;\n}\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/DiscordHook/Discord.h",
    "content": "/*\n\n\n*/\n#pragma once\n\n#define DISCORD Discord::Instance()\n\nclass Discord\n{\n\n\npublic:\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Get Discord64.dll module base adresss\n    /// </summary>\n    /// <returns>Discord module base adress</returns>\n    // ********************************************************************************\n    static uintptr_t GetDiscordModuleBase();\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Create Hook\n    /// </summary>\n    /// <param name=\"originalPresent\">Original function</param>\n    /// <param name=\"hookFunction\">Hook function. (The one that will be redirect to)</param>\n    /// <param name=\"pOriginal\">A Pointer to original Function</param>\n    /// <returns>Sucess if the hook has been created.</returns>\n    // ********************************************************************************\n    bool CreateHook(uintptr_t originalPresent, uintptr_t hookFunction, uintptr_t pOriginal);\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Enable Hook\n    /// </summary>\n    /// <param name=\"pTarget\">Function target</param>\n    /// <param name=\"toggle\">Enable / Disable</param>\n    /// <returns>Sucess if the Hook has been enabled.</returns>\n    // ********************************************************************************\n    bool EnableHook(uintptr_t pTarget, bool toggle);\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Enable Hook queu. (If there any function pending)\n    /// </summary>\n    /// <returns>Sucess if the queu has been initiated</returns>\n    // ********************************************************************************\n    bool EnableHookQue();\n\n    // ********************************************************************************\n    /// <summary>\n    /// Determines whether a key is up or down at the time the function is called\n    /// </summary>\n    /// <param name=\"vKey\">VirtualKeyCode. You can have a look at msdn for getting the key such VK_F1 for example.</param>\n    /// <returns>If sucess return a specified value which determined if the key was pressed, or if its currently down. 0 If current desktop its not active.</returns>\n    // ********************************************************************************\n    short GetAsyncKeyState(int vKey);\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Moves the cursor to the specified screen coordinates.\n    /// </summary>\n    /// <param name=\"x\">The new x-coordinate of the cursor, in screen coordinates.</param>\n    /// <param name=\"y\">The new y-coordinate of the cursor, in screen coordinates.</param>\n    /// <returns>Returns nonzero if successful or zero otherwise.</returns>\n    // ********************************************************************************\n    short SetCursorPos(int x, int y);\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Retrieves the position of the mouse cursor, in screen coordinates.\n    /// </summary>\n    /// <param name=\"lpPoint\">A pointer to a POINT structure that receives the screen coordinates of the cursor.</param>\n    /// <returns>Returns nonzero if successful or zero otherwise.</returns>\n    // ********************************************************************************\n    bool GetCursorPos(LPPOINT lpPoint);\n\n\n    // ********************************************************************************\n    /// <summary>\n    /// Sets the cursor shape.\n    /// </summary>\n    /// <param name=\"hCursor\">A handle to the cursor. The cursor must have been created by the CreateCursor function or loaded by the LoadCursor or LoadImage function. If this parameter is NULL, the cursor is removed from the screen.</param>\n    /// <returns>The return value is the handle to the previous cursor, if there was one.</returns>\n    // ********************************************************************************\n    HCURSOR SetCursor(HCURSOR hCursor);\n\n    // ********************************************************************************\n    /// <summary>\n    /// Its Create and Enable hook.\n    /// </summary>\n    /// <param name=\"sig\">Pointer to original func.</param>\n    /// <param name=\"function\">Pointer to hooked func.</param>\n    /// <param name=\"ints\">Pointer to origianl func.</param>\n    /// <returns>Sucess if the hook has been enabled.</returns>\n    // ********************************************************************************\n    bool HookFunction(uintptr_t sig, uintptr_t function, uintptr_t ints);\n\n    // ********************************************************************************\n    /// <summary>\n    /// Class Singleton.\n    /// </summary>\n    /// <returns>Handle to a static Discord class.</returns>\n    // ********************************************************************************\n    static Discord& Instance()\n    {\n        static Discord handle;\n        return handle;\n    }\n};\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/FortniteCheatSRCUpdateEveryUpdate.filters",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"4.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup>\r\n    <Filter Include=\"Source Files\">\r\n      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>\r\n      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Header Files\">\r\n      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>\r\n      <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Resource Files\">\r\n      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>\r\n      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\offsets\">\r\n      <UniqueIdentifier>{8416771d-7784-41b1-bf2d-a01f84bbe794}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\utils\">\r\n      <UniqueIdentifier>{9bd2e87f-de85-49d3-ba86-5b6e9c0ad62b}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\menu\">\r\n      <UniqueIdentifier>{6ec731d4-4d85-41ae-ae50-fae180c0d113}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\core\">\r\n      <UniqueIdentifier>{a1eeff16-103e-4ca4-9616-aea15be5a45e}</UniqueIdentifier>\r\n    </Filter>\r\n    <Filter Include=\"Source Files\\setting\">\r\n      <UniqueIdentifier>{7889e946-8e7b-406b-8a86-308d22ca4c60}</UniqueIdentifier>\r\n    </Filter>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"dllmain.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"imgui\\imgui.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"imgui\\imgui_draw.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"imgui\\imgui_impl_dx11.cpp\">\r\n      <Filter>Source Files</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"offsets.cpp\">\r\n      <Filter>Source Files\\offsets</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"Util.cpp\">\r\n      <Filter>Source Files\\utils</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"menu.cpp\">\r\n      <Filter>Source Files\\menu</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"core.cpp\">\r\n      <Filter>Source Files\\core</Filter>\r\n    </ClCompile>\r\n    <ClCompile Include=\"settings.cpp\">\r\n      <Filter>Source Files\\setting</Filter>\r\n    </ClCompile>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"imgui\\imconfig.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"imgui\\imgui.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"imgui\\imgui_impl_dx11.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"imgui\\imgui_internal.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"imgui\\stb_rect_pack.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"imgui\\stb_textedit.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"imgui\\stb_truetype.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"stdafx.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"offsets.h\">\r\n      <Filter>Source Files\\offsets</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"util.h\">\r\n      <Filter>Source Files\\utils</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"Structs.h\">\r\n      <Filter>Header Files</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"meni.h\">\r\n      <Filter>Source Files\\menu</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"core.h\">\r\n      <Filter>Source Files\\core</Filter>\r\n    </ClInclude>\r\n    <ClInclude Include=\"settings.h\">\r\n      <Filter>Source Files\\setting</Filter>\r\n    </ClInclude>\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <MASM Include=\"spoofinternal.asm\">\r\n      <Filter>Source Files</Filter>\r\n    </MASM>\r\n  </ItemGroup>\r\n</Project>\r\n\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/FortniteCheatSRCUpdateEveryUpdate.user",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup />\r\n</Project>\r\n\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/FortniteCheatSRCUpdateEveryUpdate.vcxproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <ItemGroup Label=\"ProjectConfigurations\">\r\n    <ProjectConfiguration Include=\"Debug|Win32\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|Win32\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>Win32</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Debug|x64\">\r\n      <Configuration>Debug</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n    <ProjectConfiguration Include=\"Release|x64\">\r\n      <Configuration>Release</Configuration>\r\n      <Platform>x64</Platform>\r\n    </ProjectConfiguration>\r\n  </ItemGroup>\r\n  <PropertyGroup Label=\"Globals\">\r\n    <VCProjectVersion>16.0</VCProjectVersion>\r\n    <ProjectGuid>{432CD352-DFE6-4AC6-B858-3F74D5CB161F}</ProjectGuid>\r\n    <Keyword>Win32Proj</Keyword>\r\n    <RootNamespace>example</RootNamespace>\r\n    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>\r\n    <ProjectName>FortniteCheatSRCUpdateEveryUpdate</ProjectName>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v142</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v142</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>true</UseDebugLibraries>\r\n    <PlatformToolset>v142</PlatformToolset>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\" Label=\"Configuration\">\r\n    <ConfigurationType>DynamicLibrary</ConfigurationType>\r\n    <UseDebugLibraries>false</UseDebugLibraries>\r\n    <PlatformToolset>v142</PlatformToolset>\r\n    <WholeProgramOptimization>true</WholeProgramOptimization>\r\n    <CharacterSet>Unicode</CharacterSet>\r\n    <SpectreMitigation>false</SpectreMitigation>\r\n  </PropertyGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.props\" />\r\n  <ImportGroup Label=\"ExtensionSettings\">\r\n    <Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\marmasm.props\" />\r\n    <Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.props\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"Shared\">\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <ImportGroup Label=\"PropertySheets\" Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <Import Project=\"$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props\" Condition=\"exists('$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props')\" Label=\"LocalAppDataPlatform\" />\r\n  </ImportGroup>\r\n  <PropertyGroup Label=\"UserMacros\" />\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <LinkIncremental>true</LinkIncremental>\r\n    <TargetName>FortniteCheatSRCUpdateEveryUpdate</TargetName>\r\n    <IncludePath>C:\\Users\\liam_\\Documents\\detours;C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior;C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior\\minhook;C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior\\imgui;$(IncludePath)</IncludePath>\r\n    <LibraryPath>C:\\Users\\liam_\\Documents\\detours;C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior\\imgui;C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior\\minhook;C:\\Users\\alex7\\Desktop\\Superior New\\Superior;$(LibraryPath)</LibraryPath>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <IncludePath>$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\\Users\\Ticx\\source\\repos\\l0st.dev FN\\l0st.dev FN\\imgui;C:\\Users\\Ticx\\source\\repos\\l0st.dev FN\\l0st.dev FN\\minhook</IncludePath>\r\n    <LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\\um\\x86;C:\\Users\\Ticx\\source\\repos\\l0st.dev FN\\l0st.dev FN\\minhook</LibraryPath>\r\n    <TargetName>fn</TargetName>\r\n    <OutDir>..\\x64\\Release</OutDir>\r\n  </PropertyGroup>\r\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <LinkIncremental>false</LinkIncremental>\r\n    <IncludePath>.\\imgui;.\\minhook;$(VC_IncludePath);$(WindowsSDK_IncludePath);C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior\\detours</IncludePath>\r\n    <LibraryPath>.\\minhook;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\\um\\x64;C:\\Users\\alex7\\OneDrive\\Skrivebord\\Superior New\\Superior\\detours</LibraryPath>\r\n    <TargetName>FortniteCheatSRCUpdateEveryUpdateVisual9999</TargetName>\r\n    <OutDir>.\\x64\\Release\\Release</OutDir>\r\n  </PropertyGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;_DEBUG;EXAMPLE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableUAC>false</EnableUAC>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|x64'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>_DEBUG;EXAMPLE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableUAC>false</EnableUAC>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|Win32'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>Use</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>WIN32;NDEBUG;EXAMPLE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableUAC>false</EnableUAC>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemDefinitionGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|x64'\">\r\n    <ClCompile>\r\n      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r\n      <WarningLevel>Level3</WarningLevel>\r\n      <FunctionLevelLinking>true</FunctionLevelLinking>\r\n      <IntrinsicFunctions>true</IntrinsicFunctions>\r\n      <SDLCheck>true</SDLCheck>\r\n      <PreprocessorDefinitions>NDEBUG;EXAMPLE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r\n      <ConformanceMode>true</ConformanceMode>\r\n      <PrecompiledHeaderFile>\r\n      </PrecompiledHeaderFile>\r\n      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>\r\n      <LanguageStandard>stdcpplatest</LanguageStandard>\r\n    </ClCompile>\r\n    <Link>\r\n      <SubSystem>Windows</SubSystem>\r\n      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r\n      <OptimizeReferences>true</OptimizeReferences>\r\n      <GenerateDebugInformation>true</GenerateDebugInformation>\r\n      <EnableUAC>false</EnableUAC>\r\n      <IgnoreAllDefaultLibraries>\r\n      </IgnoreAllDefaultLibraries>\r\n      <AdditionalDependencies>libcmtd.lib;%(AdditionalDependencies)</AdditionalDependencies>\r\n    </Link>\r\n  </ItemDefinitionGroup>\r\n  <ItemGroup>\r\n    <ClCompile Include=\"DiscordHook\\Discord.cpp\" />\r\n    <ClCompile Include=\"dllmain.cPP\" />\r\n    <ClCompile Include=\"Header Files\\FortUpdaters\\FortUpdaters.cpp\" />\r\n    <ClCompile Include=\"Helper\\Helper.cpp\" />\r\n    <ClCompile Include=\"imgui\\imgui.cpp\" />\r\n    <ClCompile Include=\"imgui\\imgui_draw.cpp\" />\r\n    <ClCompile Include=\"imgui\\imgui_impl_dx11.cpp\" />\r\n    <ClCompile Include=\"Source Files\\Config\\Config.cpp\" />\r\n    <ClCompile Include=\"Source Files\\core\\core.cpp\" />\r\n    <ClCompile Include=\"Source Files\\FortUpdaters\\FortUpdaters.cpp\" />\r\n    <ClCompile Include=\"Source Files\\menu\\menu.cpp\" />\r\n    <ClCompile Include=\"Source Files\\offsets\\offsets.cpp\" />\r\n    <ClCompile Include=\"Source Files\\settings\\settings.cpp\" />\r\n    <ClCompile Include=\"Source Files\\util\\Util.cpp\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <ClInclude Include=\"DiscordHook\\Discord.h\" />\r\n    <ClInclude Include=\"Header Files\\Config\\Archivex.h\" />\r\n    <ClInclude Include=\"Header Files\\Config\\Config.h\" />\r\n    <ClInclude Include=\"Header Files\\core\\core.h\" />\r\n    <ClInclude Include=\"Header Files\\FortUpdaters\\FortUpdaters.h\" />\r\n    <ClInclude Include=\"Header Files\\includes.h\" />\r\n    <ClInclude Include=\"Header Files\\menu\\menu.h\" />\r\n    <ClInclude Include=\"Header Files\\offsets\\offsets.h\" />\r\n    <ClInclude Include=\"Header Files\\settings\\settings.h\" />\r\n    <ClInclude Include=\"Header Files\\Structs.h\" />\r\n    <ClInclude Include=\"Header Files\\util\\util.h\" />\r\n    <ClInclude Include=\"Header Files\\xor\\xor.hpp\" />\r\n    <ClInclude Include=\"Helper\\Helper.h\" />\r\n    <ClInclude Include=\"imgui\\imconfig.h\" />\r\n    <ClInclude Include=\"imgui\\imgui.h\" />\r\n    <ClInclude Include=\"imgui\\imgui_impl_dx11.h\" />\r\n    <ClInclude Include=\"imgui\\imgui_internal.h\" />\r\n    <ClInclude Include=\"imgui\\stb_rect_pack.h\" />\r\n    <ClInclude Include=\"imgui\\stb_textedit.h\" />\r\n    <ClInclude Include=\"imgui\\stb_truetype.h\" />\r\n  </ItemGroup>\r\n  <ItemGroup>\r\n    <MASM Include=\"spoofinternal.asm\">\r\n      <FileType>Document</FileType>\r\n    </MASM>\r\n  </ItemGroup>\r\n  <Import Project=\"$(VCTargetsPath)\\Microsoft.Cpp.targets\" />\r\n  <ImportGroup Label=\"ExtensionTargets\">\r\n    <Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\marmasm.targets\" />\r\n    <Import Project=\"$(VCTargetsPath)\\BuildCustomizations\\masm.targets\" />\r\n  </ImportGroup>\r\n</Project>\r\n\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/FortniteCheatSRCUpdateEveryUpdate.vcxproj.user",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\r\n  <PropertyGroup>\r\n    <ShowAllFiles>true</ShowAllFiles>\r\n  </PropertyGroup>\r\n</Project>\r\n\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/Config/Archivex.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n\r\ntemplate <typename Stream>\r\nclass ArchiveX final {\r\npublic:\r\n\tconstexpr explicit ArchiveX(Stream& stream) noexcept : stream{ stream } { }\r\n\r\n\ttemplate <typename T>\r\n\tconstexpr const auto& operator<<(const T& item) const noexcept\r\n\t{\r\n\t\tstream.write(reinterpret_cast<const char*>(&item), sizeof(item));\r\n\t\treturn *this;\r\n\t}\r\n\r\n\ttemplate <typename T>\r\n\tconstexpr const auto& operator>>(T& item) const noexcept\r\n\t{\r\n\t\tstream.read(reinterpret_cast<char*>(&item), sizeof(item));\r\n\t\treturn *this;\r\n\t}\r\n\r\nprivate:\r\n\tStream& stream;\r\n};\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/Config/Config.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n\r\n#include <filesystem>\r\n\r\nclass c_config final {\r\npublic:\r\n\tvoid run(const char*) noexcept;\r\n\tvoid load(size_t) noexcept;\r\n\tvoid save(size_t) const noexcept;\r\n\tvoid add(const char*) noexcept;\r\n\tvoid remove(size_t) noexcept;\r\n\tvoid rename(size_t, const char*) noexcept;\r\n\tvoid reset() noexcept;\r\n\r\n\tconstexpr auto& get_configs() noexcept {\r\n\t\treturn configs;\r\n\t}\r\n\r\n\tstruct {\r\n\t\t// item\r\n\r\n\t\tbool Players;\r\n\t\tbool Chest;\r\n\t\tbool PlayerBox;\r\n\t\tbool PlayersCorner;\r\n\t\tbool Llama;\r\n\t\tbool PlayerLines;\r\n\t\tbool ClosestLineESP;\r\n\t\tint PlayerLinesLocation;\r\n\t\tbool PlayerNames;\r\n\t\tfloat PlayerVisibleColor[3];\r\n\t\tfloat PlayerNotVisibleColor[3];\r\n\t\tbool kazoisgay;\r\n\t\tfloat PlayerTeammate[3];\r\n\t\tfloat FOVCircleColor[3];\r\n\t\tfloat BoxESP[3];\r\n\t\tfloat BoxESPOpacity;\r\n\t\tfloat FOVCircleOpacity;\r\n\t\tfloat FOVCircleFilledOpacity;\r\n\t\tfloat LineESP[3];\r\n\t\tbool Ammo;\r\n\t\tbool boat;\r\n\t\tbool chopper;\r\n\t\tbool Weapons;\r\n\t\tbool Items;\r\n\t\tint MinWeaponTier;\r\n\t\tint Page;\r\n\t\tint AimPoint;\r\n\t\tbool Aimbot;\r\n\t\tbool AutoAimbot;\r\n\t\tbool SilentAimbot;\r\n\t\tbool FlickAimbot;\r\n\t\tbool SpinBot;\r\n\t\tbool AutoAim;\r\n\t\tbool SpamAutoAim;\r\n\t\tbool TriggerAimbot;\r\n\t\tint TriggerSpeed;\r\n\t\tbool NoSpreadAimbot;\r\n\t\tbool AntiAim;\r\n\t\tbool BetterMap;\r\n\t\tbool AirStuck;\r\n\t\tbool ThirdPerson;\r\n\t\tbool FreeCam;\r\n\t\tfloat FreeCamSpeed;\r\n\t\tbool CheckVisible;\r\n\t\tchar StreamSnipeName;\r\n\t\tbool StreamSnipe;\r\n\t\tbool DrawAimbotFOV;\r\n\t\tbool DrawFilledAimbotFOV;\r\n\t\tfloat CrosshairSize;\r\n\t\tfloat MenuColor[3] = { 1.f, 0.f, 0.f };\r\n\t\tfloat CrosshairThickness;\r\n\t\tfloat AimbotFOV;\r\n\t\tfloat AimbotSlow;\r\n\t\tbool RapidFire;\r\n\t\tbool BulletTP;\r\n\t\tbool ARTP;\r\n\t\tbool fastmode420;\r\n\t\tbool BoatRocketTP;\r\n\t\tbool RocketTP;\r\n\t\tbool FreeCamRotationLock;\r\n\t\tbool InstantReload;\r\n\t\tbool FOVSlider;\r\n\t\tfloat FOV;\r\n\t\tbool Extra;\r\n\r\n\t} item;\r\n\r\n\tstruct {\r\n\t\t//keybind\r\n\r\n\t\tint Menu = 0x2D;\r\n\t\tint AimbotLock = 0x02;\r\n\t\tint AimbotShoot = 0x01;\r\n\t\tint AntiAim = 0x01;\r\n\t\tint Spinbot = 0x14;\r\n\t\tint Freecam = 0;\r\n\t\tint StreamSnipe = 0;\r\n\t\tint ThirdPerson = 0;\r\n\t\tint Airstuck1 = 0;\r\n\t\tint Airstuck2 = 0;\r\n\t\tint BetterMap = 0;\r\n\r\n\t} keybind;\r\n\r\nprivate:\r\n\tstd::filesystem::path path;\r\n\tstd::vector<std::string> configs;\r\n};\r\n\r\nextern c_config config_system;"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/FortUpdaters/FortUpdaters.cpp",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#include \"FortUpdaters.h\"\r\n\r\ntemplate<class T>\r\nstruct TArray\r\n{\r\n\tfriend struct FString;\r\n\r\npublic:\r\n\tinline TArray()\r\n\t{\r\n\t\tData = nullptr;\r\n\t\tCount = Max = 0;\r\n\t};\r\n\r\n\tinline int Num() const\r\n\t{\r\n\t\treturn Count;\r\n\t};\r\n\r\n\tinline T& operator[](int i)\r\n\t{\r\n\t\treturn Data[i];\r\n\t};\r\n\r\n\tinline const T& operator[](int i) const\r\n\t{\r\n\t\treturn Data[i];\r\n\t};\r\n\r\n\tinline bool IsValidIndex(int i) const\r\n\t{\r\n\t\treturn i < Num();\r\n\t}\r\n\r\nprivate:\r\n\tT* Data;\r\n\tint Count;\r\n\tint Max;\r\n};\r\n\r\nstruct FString : private TArray<wchar_t>\r\n{\r\n\tinline FString()\r\n\t{\r\n\t};\r\n\r\n\tinline bool IsValid() const\r\n\t{\r\n\t\treturn Data != nullptr;\r\n\t}\r\n\r\n\tinline const wchar_t* c_str() const\r\n\t{\r\n\t\treturn Data;\r\n\t}\r\n\r\n\tstd::string ToString() const\r\n\t{\r\n\t\tauto length = std::wcslen(Data);\r\n\r\n\t\tstd::string str(length, '\\0');\r\n\r\n\t\tstd::use_facet<std::ctype<wchar_t>>(std::locale()).narrow(Data, Data + length, '?', &str[0]);\r\n\r\n\t\treturn str;\r\n\t}\r\n};\r\n\r\nstruct FName\r\n{\r\n\tint32_t ComparisonIndex;\r\n\tint32_t Number;\r\n};\r\n\r\nbool FortUpdater::Init(uintptr_t UObjectArray, uintptr_t GetObjectName, uintptr_t GetNameByIndex, uintptr_t FnFree)\r\n{\r\n\tif (!UObjectArray || !GetObjectName || !GetNameByIndex || !FnFree) return false;\r\n\r\n\tuintptr_t deref_1 = *(uintptr_t*)UObjectArray;\r\n\tif (IsBadReadPtr((void*)deref_1, sizeof(uintptr_t))) return false;\r\n\r\n\tuintptr_t deref_2 = *(uintptr_t*)deref_1;\r\n\tif (IsBadReadPtr((void*)deref_2, sizeof(uintptr_t))) return false;\r\n\r\n\tthis->UObjectArray = deref_2;\r\n\tthis->GetObjectName = GetObjectName;\r\n\tthis->GetNameByIndex = GetNameByIndex;\r\n\tthis->FnFree = FnFree;\r\n\r\n\treturn true;\r\n}\r\n\r\nDWORD FortUpdater::FindOffset(const char* Class, const char* varName)\r\n{\r\n\tfor (DWORD i = 0x0; i < 0x9000; i++)\r\n\t{\r\n\t\tauto CurrentObject = *(uintptr_t*)(this->UObjectArray + (i * 0x18));\r\n\r\n\t\tif (!CurrentObject) return NULL;\r\n\t\tif (!(*(uintptr_t*)(CurrentObject + 0x50)) || *(DWORD*)(CurrentObject + 0x54) == 0xFFFFFFFF) continue;\r\n\r\n\t\tchar* CurObjectName = this->fGetObjectName(CurrentObject);\r\n\r\n\t\tif (!strcmp(CurObjectName, Class)) //Same class\r\n\t\t{\r\n\t\t\tfor (auto Property = *(uint64_t*)(CurrentObject + 0x50); !IsBadReadPtr((void*)Property, 8); Property = *(uint64_t*)(Property + 0x20))\r\n\t\t\t{\r\n\t\t\t\tauto Type = *(uint64_t*)(Property + 0x8);\r\n\r\n\t\t\t\tif (!IsBadReadPtr((void*)Type, 8) && Type)\r\n\t\t\t\t{\r\n\t\t\t\t\tauto Property_FName = *(FName*)(Property + 0x28);\r\n\t\t\t\t\tauto Offset = *(DWORD*)(Property + 0x4C);\r\n\r\n\t\t\t\t\tif (Offset != 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tauto Property_idx = Property_FName.ComparisonIndex;\r\n\r\n\t\t\t\t\t\tif (Property_idx)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tchar* PropertyName = this->fGetNameByIndex(Property_idx);\r\n\r\n\t\t\t\t\t\t\tif (!strcmp(PropertyName, varName))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\treturn Offset;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tprintf(\" % X\", Offset);\r\n\t\t\t\t\t\tsystem(\"pause\");\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid FortUpdater::cFixName(char* Name)\r\n{\r\n\tfor (int i = 0; Name[i] != '\\0'; i++)\r\n\t{\r\n\t\tif (Name[i] == '_')\r\n\t\t{\r\n\t\t\tif (Name[i + 1] == '0' ||\r\n\t\t\t\tName[i + 1] == '1' ||\r\n\t\t\t\tName[i + 1] == '2' ||\r\n\t\t\t\tName[i + 1] == '3' ||\r\n\t\t\t\tName[i + 1] == '4' ||\r\n\t\t\t\tName[i + 1] == '5' ||\r\n\t\t\t\tName[i + 1] == '6' ||\r\n\t\t\t\tName[i + 1] == '7' ||\r\n\t\t\t\tName[i + 1] == '8' ||\r\n\t\t\t\tName[i + 1] == '9')\r\n\t\t\t\tName[i] = '\\0';\r\n\t\t}\r\n\t}\r\n\r\n\treturn;\r\n}\r\n\r\nvoid FortUpdater::FreeObjName(uintptr_t Address)\r\n{\r\n\tif (Address == NULL) return;\r\n\r\n\tauto func = reinterpret_cast<__int64(__fastcall*)(__int64)>(this->FnFree);\r\n\r\n\tfunc(Address);\r\n}\r\n\r\nchar* FortUpdater::fGetObjectName(uintptr_t Object)\r\n{\r\n\tif (Object == NULL) return (char*)\"\";\r\n\r\n\tauto fGetObjName = reinterpret_cast<FString * (__fastcall*)(FString*, uintptr_t)>(this->GetObjectName);\r\n\r\n\tFString result;\r\n\tfGetObjName(&result, Object);\r\n\r\n\tif (result.c_str() == NULL) return (char*)\"\";\r\n\r\n\tauto tmp = result.ToString();\r\n\r\n\tchar return_string[1024];\r\n\tmemcpy(return_string, std::string(tmp.begin(), tmp.end()).c_str(), 1024);\r\n\r\n\tthis->FreeObjName((uintptr_t)result.c_str());\r\n\r\n\tcFixName(return_string);\r\n\r\n\treturn (char*)std::string(tmp.begin(), tmp.end()).c_str();\r\n}\r\n\r\nchar* FortUpdater::fGetNameByIndex(int Index)\r\n{\r\n\tif (Index == 0) return (char*)\"\";\r\n\r\n\tauto fGetNameByIdx = reinterpret_cast<FString * (__fastcall*)(int*, FString*)>(this->GetNameByIndex);\r\n\r\n\tFString result;\r\n\tfGetNameByIdx(&Index, &result);\r\n\r\n\tif (result.c_str() == NULL) return (char*)\"\";\r\n\r\n\tauto tmp = result.ToString();\r\n\r\n\tchar return_string[1024];\r\n\tmemcpy(return_string, std::string(tmp.begin(), tmp.end()).c_str(), 1024);\r\n\r\n\tFreeObjName((uintptr_t)result.c_str());\r\n\r\n\tcFixName(return_string);\r\n\r\n\treturn return_string;\r\n}"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/FortUpdaters/FortUpdaters.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n#include <Windows.h>\r\n#include <iostream>\r\n#include <string>\r\n\r\nclass FortUpdater\r\n{\r\npublic:\r\n\tbool Init(uintptr_t UObjectArray, uintptr_t GetObjectName, uintptr_t GetNameByIndex, uintptr_t FnFree);\r\n\tDWORD FindOffset(const char* Class, const char* var);\r\n\r\nprivate:\r\n\tuintptr_t UObjectArray = NULL;\r\n\tuintptr_t GetObjectName = NULL;\r\n\tuintptr_t GetNameByIndex = NULL;\r\n\tuintptr_t FnFree = NULL;\r\n\r\n\tvoid cFixName(char* Name);\r\n\tvoid FreeObjName(uintptr_t Address);\r\n\tchar* fGetObjectName(uintptr_t Object);\r\n\tchar* fGetNameByIndex(int Index);\r\n};"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/Structs.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n#include \"includes.h\"\r\n\r\nclass UClass {\r\npublic:\r\n\tBYTE _padding_0[0x40];\r\n\tUClass* SuperClass;\r\n};\r\n\r\nclass UObject {\r\npublic:\r\n\tPVOID VTableObject;\r\n\tDWORD ObjectFlags;\r\n\tDWORD InternalIndex;\r\n\tUClass* Class;\r\n\tBYTE _padding_0[0x8];\r\n\tUObject* Outer;\r\n\r\n\tinline BOOLEAN IsA(PVOID parentClass) {\r\n\t\tfor (auto super = this->Class; super; super = super->SuperClass) {\r\n\t\t\tif (super == parentClass) {\r\n\t\t\t\treturn TRUE;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn FALSE;\r\n\t}\r\n};\r\n\r\nclass FUObjectItem {\r\npublic:\r\n\tUObject* Object;\r\n\tDWORD Flags;\r\n\tDWORD ClusterIndex;\r\n\tDWORD SerialNumber;\r\n\tDWORD SerialNumber2;\r\n};\r\n\r\nclass TUObjectArray {\r\npublic:\r\n\tFUObjectItem* Objects[9];\r\n};\r\n\r\nclass GObjects {\r\npublic:\r\n\tTUObjectArray* ObjectArray;\r\n\tBYTE _padding_0[0xC];\r\n\tDWORD ObjectCount;\r\n};\r\n\r\ntemplate<class T>\r\nstruct TArray {\r\n\tfriend struct FString;\r\n\r\npublic:\r\n\tinline TArray() {\r\n\t\tData = nullptr;\r\n\t\tCount = Max = 0;\r\n\t};\r\n\r\n\tinline INT Num() const {\r\n\t\treturn Count;\r\n\t};\r\n\r\n\tinline T& operator[](INT i) {\r\n\t\treturn Data[i];\r\n\t};\r\n\r\n\tinline BOOLEAN IsValidIndex(INT i) {\r\n\t\treturn i < Num();\r\n\t}\r\n\r\nprivate:\r\n\tT* Data;\r\n\tINT Count;\r\n\tINT Max;\r\n};\r\n\r\nstruct FString : private TArray<WCHAR> {\r\n\tFString() {\r\n\t\tData = nullptr;\r\n\t\tMax = Count = 0;\r\n\t}\r\n\r\n\tFString(LPCWSTR other) {\r\n\t\tMax = Count = static_cast<INT>(wcslen(other));\r\n\r\n\t\tif (Count) {\r\n\t\t\tData = const_cast<PWCHAR>(other);\r\n\t\t}\r\n\t};\r\n\r\n\tinline BOOLEAN IsValid() {\r\n\t\treturn Data != nullptr;\r\n\t}\r\n\r\n\tinline PWCHAR c_str() {\r\n\t\treturn Data;\r\n\t}\r\n};\r\n\r\nclass FText {\r\nprivate:\r\n\tchar _padding_[0x28];\r\n\tPWCHAR Name;\r\n\tDWORD Length;\r\n\r\npublic:\r\n\tinline PWCHAR c_str() {\r\n\t\treturn Name;\r\n\t}\r\n};\r\n\r\ntypedef struct {\r\n\tfloat X, Y, Z;\r\n} FVector;\r\n\r\ntypedef struct {\r\n\tfloat X, Y;\r\n} FVector2D;\r\n\r\ntypedef struct {\r\n\tfloat Pitch;\r\n\tfloat Yaw;\r\n\tfloat Roll;\r\n} FRotator;\r\n\r\ntypedef struct {\r\n\tFVector Location;\r\n\tFRotator Rotation;\r\n\tfloat FOV;\r\n\tfloat OrthoWidth;\r\n\tfloat OrthoNearClipPlane;\r\n\tfloat OrthoFarClipPlane;\r\n\tfloat AspectRatio;\r\n} FMinimalViewInfo;\r\n\r\ntypedef struct {\r\n\tfloat M[4][4];\r\n} FMatrix;\r\n\r\ntypedef struct {\r\n\tFVector ViewOrigin;\r\n\tchar _padding_0[4];\r\n\tFMatrix ViewRotationMatrix;\r\n\tFMatrix ProjectionMatrix;\r\n} FSceneViewProjectionData;\r\n\r\ntypedef struct {\r\n\tFVector Origin;\r\n\tFVector BoxExtent;\r\n\tfloat SphereRadius;\r\n} FBoxSphereBounds;"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/core/core.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n#include \"../includes.h\"\r\n\r\n// BODY\r\n#define BONE_HEAD_ID (66)\r\n#define BONE_NECK_ID (65)\r\n#define BONE_CHEST_ID (36)\r\n#define BONE_PELVIS_ID (2)\r\n\r\n// ARMS\r\n#define BONE_LEFTSHOULDER_ID (9)\r\n#define BONE_RIGHTSHOULDER_ID (62)\r\n#define BONE_LEFTELBOW_ID (10)\r\n#define BONE_RIGHTELBOW_ID (38)\r\n#define BONE_LEFTHAND_ID (11)\r\n#define BONE_RIGHTHAND_ID (39)\r\n\r\n// LEGS\r\n#define BONE_LEFTLEG_ID (67)\r\n#define BONE_RIGHTLEG_ID (74)\r\n#define BONE_LEFTTHIGH_ID (73)\r\n#define BONE_RIGHTTHIGH_ID (80)\r\n#define BONE_LEFTFOOT_ID (68)\r\n#define BONE_RIGHTFOOT_ID (75)\r\n#define BONE_LEFTFEET_ID (71)\r\n#define BONE_RIGHTFEET_ID (78)\r\n#define BONE_LEFTFEETFINGER_ID (72)\r\n#define BONE_RIGHTFEETFINGER_ID (79)\r\n\r\n\r\nnamespace Core {\r\n\textern bool NoSpread;\r\n\textern PVOID LocalPlayerPawn;\r\n\textern PVOID LocalPlayerController;\r\n\textern PVOID TargetPawn;\r\n\textern PVOID(*ProcessEvent)(PVOID, PVOID, PVOID, PVOID);\r\n\r\n\tBOOLEAN Initialize();\r\n}"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/includes.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n#pragma once\n\n#define _CRT_SECURE_NO_WARNINGS\n\n#include <stdio.h>\n#include <Windows.h>\n#include <psapi.h>\n#include <intrin.h>\n\n#include <string>\n#include <vector>\n\n#include <imgui.h>\n#include <imgui_impl_dx11.h>\n#include <imgui_internal.h>\n\n\n#include <d3d11.h>\n#pragma comment(lib, \"d3d11.lib\")\n\n#include \"xor/xor.hpp\"\n#include \"Structs.h\"\n#include \"util/util.h\"\n#include \"offsets/offsets.h\"\n#include \"menu/menu.h\"\n#include \"core/core.h\"\n#include \"settings/settings.h\"\n\n\nImGuiWindow& BeginScene();\nVOID EndScene(ImGuiWindow& window);\n\ntemplate<typename T>\nT ReadMemory(DWORD_PTR address, const T& def = T())\n{\n\treturn *(T*)address;\n}\n\ntypedef struct\n{\n\tDWORD R;\n\tDWORD G;\n\tDWORD B;\n\tDWORD A;\n}RGBA;\n\nclass Color\n{\npublic:\n\n\tRGBA NiggaGreen = { 128, 224, 0, 200 };\n\tRGBA red = { 255,0,0,255 };\n\tRGBA Magenta = { 255,0,255,255 };\n\tRGBA yellow = { 255,255,0,255 };\n\tRGBA grayblue = { 128,128,255,255 };\n\tRGBA green = { 128,224,0,255 };\n\tRGBA darkgreen = { 0,224,128,255 };\n\tRGBA brown = { 192,96,0,255 };\n\tRGBA pink = { 255,168,255,255 };\n\tRGBA DarkYellow = { 216,216,0,255 };\n\tRGBA SilverWhite = { 236,236,236,255 };\n\tRGBA purple = { 144,0,255,255 };\n\tRGBA Navy = { 88,48,224,255 };\n\tRGBA skyblue = { 0,136,255,255 };\n\tRGBA graygreen = { 128,160,128,255 };\n\tRGBA blue = { 0,96,192,255 };\n\tRGBA orange = { 255,128,0,255 };\n\tRGBA peachred = { 255,80,128,255 };\n\tRGBA reds = { 255,128,192,255 };\n\tRGBA darkgray = { 96,96,96,255 };\n\tRGBA Navys = { 0,0,128,255 };\n\tRGBA darkgreens = { 0,128,0,255 };\n\tRGBA darkblue = { 0,128,128,255 };\n\tRGBA redbrown = { 128,0,0,255 };\n\tRGBA purplered = { 128,0,128,255 };\n\tRGBA greens = { 0,255,0,255 };\n\tRGBA envy = { 0,255,255,255 };\n\tRGBA black = { 0,0,0,255 };\n\tRGBA gray = { 128,128,128,255 };\n\tRGBA white = { 255,255,255,255 };\n\tRGBA blues = { 30,144,255,255 };\n\tRGBA lightblue = { 135,206,250,160 };\n\tRGBA Scarlet = { 220, 20, 60, 160 };\n\tRGBA white_ = { 255,255,255,200 };\n\tRGBA gray_ = { 128,128,128,200 };\n\tRGBA black_ = { 0,0,0,200 };\n\tRGBA red_ = { 255,0,0,200 };\n\tRGBA Magenta_ = { 255,0,255,200 };\n\tRGBA yellow_ = { 255,255,0,200 };\n\tRGBA grayblue_ = { 128,128,255,200 };\n\tRGBA green_ = { 128,224,0,200 };\n\tRGBA darkgreen_ = { 0,224,128,200 };\n\tRGBA brown_ = { 192,96,0,200 };\n\tRGBA pink_ = { 255,168,255,200 };\n\tRGBA darkyellow_ = { 216,216,0,200 };\n\tRGBA silverwhite_ = { 236,236,236,200 };\n\tRGBA purple_ = { 144,0,255,200 };\n\tRGBA Blue_ = { 88,48,224,200 };\n\tRGBA skyblue_ = { 0,136,255,200 };\n\tRGBA graygreen_ = { 128,160,128,200 };\n\tRGBA blue_ = { 0,96,192,200 };\n\tRGBA orange_ = { 255,128,0,200 };\n\tRGBA pinks_ = { 255,80,128,200 };\n\tRGBA Fuhong_ = { 255,128,192,200 };\n\tRGBA darkgray_ = { 96,96,96,200 };\n\tRGBA Navy_ = { 0,0,128,200 };\n\tRGBA darkgreens_ = { 0,128,0,200 };\n\tRGBA darkblue_ = { 0,128,128,200 };\n\tRGBA redbrown_ = { 128,0,0,200 };\n\tRGBA purplered_ = { 128,0,128,200 };\n\tRGBA greens_ = { 0,255,0,200 };\n\tRGBA envy_ = { 0,255,255,200 };\n\tRGBA glassblack = { 0, 0, 0, 160 };\n\tRGBA GlassBlue = { 65,105,225,80 };\n\tRGBA glassyellow = { 255,255,0,160 };\n\tRGBA glass = { 200,200,200,60 };\n\tRGBA Plum = { 221,160,221,160 };\n\n};\n\nclass Vector3\n{\npublic:\n\tVector3() : x(0.f), y(0.f), z(0.f)\n\t{\n\n\t}\n\n\tVector3(float _x, float _y, float _z) : x(_x), y(_y), z(_z)\n\t{\n\n\t}\n\t~Vector3()\n\t{\n\n\t}\n\n\tfloat x;\n\tfloat y;\n\tfloat z;\n\n\tinline float Dot(Vector3 v)\n\t{\n\t\treturn x * v.x + y * v.y + z * v.z;\n\t}\n\n\tinline float Distance(Vector3 v)\n\t{\n\t\treturn float(sqrtf(powf(v.x - x, 2.0) + powf(v.y - y, 2.0) + powf(v.z - z, 2.0)));\n\t}\n\n\tVector3 operator+(Vector3 v)\n\t{\n\t\treturn Vector3(x + v.x, y + v.y, z + v.z);\n\t}\n\n\tVector3 operator-(Vector3 v)\n\t{\n\t\treturn Vector3(x - v.x, y - v.y, z - v.z);\n\t}\n\n\tVector3 operator*(float number) const {\n\t\treturn Vector3(x * number, y * number, z * number);\n\t}\n};"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/menu/menu.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n\r\nnamespace Render {\r\n\tbool Initialize();\r\n}"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/offsets/offsets.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n#include \"../Header Files/includes.h\"\r\nnamespace Offsets {\r\n\ttypedef struct {\r\n\t\tLPCWSTR Name;\r\n\t\tDWORD& Offset;\r\n\t} OFFSET;\r\n\r\n\textern PVOID* uWorld;\r\n\r\n\tnamespace Engine {\r\n\t\tnamespace World {\r\n\t\t\textern DWORD OwningGameInstance;\r\n\t\t\textern DWORD Levels;\r\n\t\t}\r\n\r\n\t\tnamespace Level {\r\n\t\t\textern DWORD AActors;\r\n\t\t}\r\n\r\n\t\tnamespace GameInstance {\r\n\t\t\textern DWORD LocalPlayers;\r\n\t\t}\r\n\r\n\t\tnamespace Player {\r\n\t\t\textern DWORD PlayerController;\r\n\t\t}\r\n\r\n\t\tnamespace Controller {\r\n\t\t\textern DWORD ControlRotation;\r\n\t\t\textern PVOID SetControlRotation;\r\n\t\t\textern PVOID ClientSetRotation;\r\n\t\t}\r\n\r\n\t\tnamespace PlayerController {\r\n\t\t\textern DWORD AcknowledgedPawn;\r\n\t\t}\r\n\r\n\t\tnamespace Pawn {\r\n\t\t\textern DWORD PlayerState;\r\n\t\t}\r\n\r\n\t\tnamespace PlayerState {\r\n\t\t\textern PVOID GetPlayerName;\r\n\t\t}\r\n\r\n\t\tnamespace Actor {\r\n\t\t\textern DWORD RootComponent;\r\n\t\t}\r\n\r\n\t\tnamespace Character {\r\n\t\t\textern DWORD Mesh;\r\n\t\t}\r\n\r\n\t\tnamespace SceneComponent {\r\n\t\t\textern DWORD RelativeLocation;\r\n\t\t\textern DWORD ComponentVelocity;\r\n\t\t}\r\n\r\n\t\tnamespace StaticMeshComponent {\r\n\t\t\textern DWORD ComponentToWorld;\r\n\t\t\textern DWORD StaticMesh;\r\n\t\t}\r\n\r\n\t\tnamespace SkinnedMeshComponent {\r\n\t\t\textern DWORD CachedWorldSpaceBounds;\r\n\t\t}\r\n\t}\r\n\r\n\tnamespace FortniteGame {\r\n\t\tnamespace FortPawn {\r\n\t\t\textern DWORD bIsDBNO;\r\n\t\t\textern DWORD bIsDying;\r\n\t\t\textern DWORD CurrentWeapon;\r\n\t\t}\r\n\r\n\t\tnamespace FortPickup {\r\n\t\t\textern DWORD PrimaryPickupItemEntry;\r\n\t\t}\r\n\r\n\t\tnamespace FortItemEntry {\r\n\t\t\textern DWORD ItemDefinition;\r\n\t\t}\r\n\r\n\t\tnamespace FortItemDefinition {\r\n\t\t\textern DWORD DisplayName;\r\n\t\t\textern DWORD Tier;\r\n\t\t}\r\n\r\n\t\tnamespace FortPlayerStateAthena {\r\n\t\t\textern DWORD TeamIndex;\r\n\t\t}\r\n\r\n\t\tnamespace FortWeapon {\r\n\t\t\textern DWORD WeaponData;\r\n\t\t}\r\n\r\n\t\tnamespace FortWeaponItemDefinition {\r\n\t\t\textern DWORD WeaponStatHandle;\r\n\t\t}\r\n\r\n\t\tnamespace FortProjectileAthena {\r\n\t\t\textern DWORD FireStartLoc;\r\n\t\t}\r\n\r\n\t\tnamespace FortBaseWeaponStats {\r\n\t\t\textern DWORD ReloadTime;\r\n\t\t}\r\n\r\n\t\tnamespace BuildingContainer {\r\n\t\t\textern DWORD bAlreadySearched;\r\n\t\t}\r\n\t}\r\n\r\n\tBOOLEAN Initialize();\r\n}"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/settings/settings.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n#include <wtypes.h>\r\n\r\nnamespace SettingsHelper {\r\n\tVOID Initialize();\r\n\tVOID SaveSettings();\r\n}"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/util/util.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n#include \"../includes.h\"\r\n#define PI (3.141592653589793f)\r\n#define RELATIVE_ADDR(addr, size) ((PBYTE)((UINT_PTR)(addr) + *(PINT)((UINT_PTR)(addr) + ((size) - sizeof(INT))) + (size)))\r\n\r\n#define ReadPointer(base, offset) (*(PVOID *)(((PBYTE)base + offset)))\r\n#define ReadDWORD(base, offset) (*(PDWORD)(((PBYTE)base + offset)))\r\n#define ReadBYTE(base, offset) (*(((PBYTE)base + offset)))\r\n\r\nnamespace Util {\r\n\tBOOLEAN Initialize();\r\n\tVOID CreateConsole();\r\n\tPBYTE FindPattern(LPCSTR pattern, LPCSTR mask);\r\n\tstd::wstring GetObjectFirstName(UObject* object);\r\n\tstd::wstring GetObjectName(UObject* object);\r\n\tPVOID FindObject(LPCWSTR name);\r\n\tBOOLEAN WorldToScreen(float width, float height, float inOutPosition[3]);\r\n\tVOID ToMatrixWithScale(float* in, float out[4][4]);\r\n\tVOID GetBoneLocation(float compMatrix[4][4], PVOID bones, DWORD index, float out[3]);\r\n\tBOOLEAN LineOfSightTo(PVOID PlayerController, PVOID Actor, FVector* ViewPoint);\r\n\tFMinimalViewInfo& GetViewInfo();\r\n\tFVector* GetPawnRootLocation(PVOID pawn);\r\n\tVOID CalcAngle(float* src, float* dst, float* angles);\r\n\r\n\textern VOID(*FreeInternal)(PVOID);\r\n\r\n\tnamespace _SpoofCallInternal {\r\n\t\textern \"C\" PVOID RetSpoofStub();\r\n\r\n\t\ttemplate <typename Ret, typename... Args>\r\n\t\tinline Ret Wrapper(PVOID shell, Args... args) {\r\n\t\t\tauto fn = (Ret(*)(Args...))(shell);\r\n\t\t\treturn fn(args...);\r\n\t\t}\r\n\r\n\t\ttemplate <std::size_t Argc, typename>\r\n\t\tstruct Remapper {\r\n\t\t\ttemplate<typename Ret, typename First, typename Second, typename Third, typename Fourth, typename... Pack>\r\n\t\t\tstatic Ret Call(PVOID shell, PVOID shell_param, First first, Second second, Third third, Fourth fourth, Pack... pack) {\r\n\t\t\t\treturn Wrapper<Ret, First, Second, Third, Fourth, PVOID, PVOID, Pack...>(shell, first, second, third, fourth, shell_param, nullptr, pack...);\r\n\t\t\t}\r\n\t\t};\r\n\r\n\t\ttemplate <std::size_t Argc>\r\n\t\tstruct Remapper<Argc, std::enable_if_t<Argc <= 4>> {\r\n\t\t\ttemplate<typename Ret, typename First = PVOID, typename Second = PVOID, typename Third = PVOID, typename Fourth = PVOID>\r\n\t\t\tstatic Ret Call(PVOID shell, PVOID shell_param, First first = First{}, Second second = Second{}, Third third = Third{}, Fourth fourth = Fourth{}) {\r\n\t\t\t\treturn Wrapper<Ret, First, Second, Third, Fourth, PVOID, PVOID>(shell, first, second, third, fourth, shell_param, nullptr);\r\n\t\t\t}\r\n\t\t};\r\n\t}\r\n\r\n\ttemplate <typename Ret, typename... Args>\r\n\tRet SpoofCall(Ret(*fn)(Args...), Args... args) {\r\n\t\tstatic PVOID trampoline = nullptr;\r\n\t\tif (!trampoline) {\r\n\t\t\ttrampoline = Util::FindPattern(\"\\xFF\\x27\", \"xx\");\r\n\t\t\tif (!trampoline) {\r\n\t\t\t\tMessageBox(0, L\"Failed to find valid trampoline\", L\"Failure\", 0);\r\n\t\t\t\tExitProcess(0);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tstruct {\r\n\t\t\tPVOID Trampoline;\r\n\t\t\tPVOID Function;\r\n\t\t\tPVOID Reg;\r\n\t\t} params = {\r\n\t\t\ttrampoline,\r\n\t\t\treinterpret_cast<void*>(fn),\r\n\t\t};\r\n\r\n\t\treturn _SpoofCallInternal::Remapper<sizeof...(Args), void>::template Call<Ret, Args...>(&_SpoofCallInternal::RetSpoofStub, &params, args...);\r\n\t}\r\n}"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/xor/xor.hpp",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n\r\n#include <string>\r\n#include <utility>\r\n\r\nnamespace\r\n{\r\n\tconstexpr int const_atoi(char c)\r\n\t{\r\n\t\treturn c - '0';\r\n\t}\r\n}\r\n\r\n#ifdef _MSC_VER\r\n#define ALWAYS_INLINE __forceinline\r\n#else\r\n#define ALWAYS_INLINE __attribute__((always_inline))\r\n#endif\r\n\r\ntemplate<typename _string_type, size_t _length>\r\nclass _Basic_XorStr\r\n{\r\n\tusing value_type = typename _string_type::value_type;\r\n\tstatic constexpr auto _length_minus_one = _length - 1;\r\n\r\npublic:\r\n\tconstexpr ALWAYS_INLINE _Basic_XorStr(value_type const (&str)[_length])\r\n\t\t: _Basic_XorStr(str, std::make_index_sequence<_length_minus_one>())\r\n\t{\r\n\r\n\t}\r\n\r\n\tinline auto c_str() const\r\n\t{\r\n\t\tdecrypt();\r\n\r\n\t\treturn data;\r\n\t}\r\n\r\n\tinline auto str() const\r\n\t{\r\n\t\tdecrypt();\r\n\r\n\t\treturn _string_type(data, data + _length_minus_one);\r\n\t}\r\n\r\n\tinline operator _string_type() const\r\n\t{\r\n\t\treturn str();\r\n\t}\r\n\r\nprivate:\r\n\ttemplate<size_t... indices>\r\n\tconstexpr ALWAYS_INLINE _Basic_XorStr(value_type const (&str)[_length], std::index_sequence<indices...>)\r\n\t\t: data{ crypt(str[indices], indices)..., '\\0' },\r\n\t\tencrypted(true)\r\n\t{\r\n\r\n\t}\r\n\r\n\tstatic constexpr auto XOR_KEY = static_cast<value_type>(\r\n\t\tconst_atoi(__TIME__[7]) +\r\n\t\tconst_atoi(__TIME__[6]) * 10 +\r\n\t\tconst_atoi(__TIME__[4]) * 60 +\r\n\t\tconst_atoi(__TIME__[3]) * 600 +\r\n\t\tconst_atoi(__TIME__[1]) * 3600 +\r\n\t\tconst_atoi(__TIME__[0]) * 36000\r\n\t\t);\r\n\r\n\tstatic ALWAYS_INLINE constexpr auto crypt(value_type c, size_t i)\r\n\t{\r\n\t\treturn static_cast<value_type>(c ^ (XOR_KEY + i));\r\n\t}\r\n\r\n\tinline void decrypt() const\r\n\t{\r\n\t\tif (encrypted)\r\n\t\t{\r\n\t\t\tfor (size_t t = 0; t < _length_minus_one; t++)\r\n\t\t\t{\r\n\t\t\t\tdata[t] = crypt(data[t], t);\r\n\t\t\t}\r\n\t\t\tencrypted = false;\r\n\t\t}\r\n\t}\r\n\r\n\tmutable value_type data[_length];\r\n\tmutable bool encrypted;\r\n};\r\n//---------------------------------------------------------------------------\r\ntemplate<size_t _length>\r\nusing XorStrA = _Basic_XorStr<std::string, _length>;\r\ntemplate<size_t _length>\r\nusing XorStrW = _Basic_XorStr<std::wstring, _length>;\r\ntemplate<size_t _length>\r\nusing XorStrU16 = _Basic_XorStr<std::u16string, _length>;\r\ntemplate<size_t _length>\r\nusing XorStrU32 = _Basic_XorStr<std::u32string, _length>;\r\n//---------------------------------------------------------------------------\r\ntemplate<typename _string_type, size_t _length, size_t _length2>\r\ninline auto operator==(const _Basic_XorStr<_string_type, _length>& lhs, const _Basic_XorStr<_string_type, _length2>& rhs)\r\n{\r\n\tstatic_assert(_length == _length2, \"XorStr== different length\");\r\n\r\n\treturn _length == _length2 && lhs.str() == rhs.str();\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<typename _string_type, size_t _length>\r\ninline auto operator==(const _string_type& lhs, const _Basic_XorStr<_string_type, _length>& rhs)\r\n{\r\n\treturn lhs.size() == _length && lhs == rhs.str();\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<typename _stream_type, typename _string_type, size_t _length>\r\ninline auto& operator<<(_stream_type& lhs, const _Basic_XorStr<_string_type, _length>& rhs)\r\n{\r\n\tlhs << rhs.c_str();\r\n\r\n\treturn lhs;\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<typename _string_type, size_t _length, size_t _length2>\r\ninline auto operator+(const _Basic_XorStr<_string_type, _length>& lhs, const _Basic_XorStr<_string_type, _length2>& rhs)\r\n{\r\n\treturn lhs.str() + rhs.str();\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<typename _string_type, size_t _length>\r\ninline auto operator+(const _string_type& lhs, const _Basic_XorStr<_string_type, _length>& rhs)\r\n{\r\n\treturn lhs + rhs.str();\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<size_t _length>\r\nconstexpr ALWAYS_INLINE auto _xor_(char const (&str)[_length])\r\n{\r\n\treturn XorStrA<_length>(str);\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<size_t _length>\r\nconstexpr ALWAYS_INLINE auto _xor_(wchar_t const (&str)[_length])\r\n{\r\n\treturn XorStrW<_length>(str);\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<size_t _length>\r\nconstexpr ALWAYS_INLINE auto _xor_(char16_t const (&str)[_length])\r\n{\r\n\treturn XorStrU16<_length>(str);\r\n}\r\n//---------------------------------------------------------------------------\r\ntemplate<size_t _length>\r\nconstexpr ALWAYS_INLINE auto _xor_(char32_t const (&str)[_length])\r\n{\r\n\treturn XorStrU32<_length>(str);\r\n}\r\n//---------------------------------------------------------------------------"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Header Files/xorstr.h",
    "content": "#ifndef JM_XORSTR_HPP\n#define JM_XORSTR_HPP\n\n#include <immintrin.h>\n#include <cstdint>\n#include <cstddef>\n#include <utility>\n\n#define JM_XORSTR_DISABLE_AVX_INTRINSICS\n\n#define xorstr_(str)                                             \\\n    ::jm::make_xorstr(                                           \\\n        []() { return str; },                                    \\\n        std::make_index_sequence<sizeof(str) / sizeof(*str)>{},  \\\n        std::make_index_sequence<::jm::detail::_buffer_size<sizeof(str)>()>{})\n#define xorstr(str) xorstr_(str).crypt_get()\n\n#ifdef _MSC_VER\n#define XORSTR_FORCEINLINE __forceinline\n#else\n#define XORSTR_FORCEINLINE __attribute__((always_inline))\n#endif\n\n// you can define this macro to get possibly faster code on gcc/clang\n// at the expense of constants being put into data section.\n#if !defined(XORSTR_ALLOW_DATA)\n// MSVC - no volatile\n// GCC and clang - volatile everywhere\n#if defined(__clang__) || defined(__GNUC__)\n#define XORSTR_VOLATILE volatile\n#endif\n\n#endif\n#ifndef XORSTR_VOLATILE\n#define XORSTR_VOLATILE\n#endif\n\nnamespace jm {\n\n    namespace detail {\n\n        template<std::size_t S>\n        struct unsigned_;\n\n        template<>\n        struct unsigned_<1> {\n            using type = std::uint8_t;\n        };\n        template<>\n        struct unsigned_<2> {\n            using type = std::uint16_t;\n        };\n        template<>\n        struct unsigned_<4> {\n            using type = std::uint32_t;\n        };\n\n        template<auto C, auto...>\n        struct pack_value_type {\n            using type = decltype(C);\n        };\n\n        template<std::size_t Size>\n        constexpr std::size_t _buffer_size() {\n            return ((Size / 16) + (Size % 16 != 0)) * 2;\n        }\n\n        template<auto... Cs>\n        struct tstring_ {\n            using value_type = typename pack_value_type<Cs...>::type;\n            constexpr static std::size_t size = sizeof...(Cs);\n            constexpr static value_type  str[size] = { Cs... };\n\n            constexpr static std::size_t buffer_size = _buffer_size<sizeof(str)>();\n            constexpr static std::size_t buffer_align =\n#ifndef JM_XORSTR_DISABLE_AVX_INTRINSICS\n            ((sizeof(str) > 16) ? 32 : 16);\n#else\n                16;\n#endif\n        };\n\n        template<std::size_t I, std::uint64_t K>\n        struct _ki {\n            constexpr static std::size_t   idx = I;\n            constexpr static std::uint64_t key = K;\n        };\n\n        template<std::uint32_t Seed>\n        constexpr std::uint32_t key4() noexcept {\n            std::uint32_t value = Seed;\n            for (char c : __TIME__)\n                value = static_cast<std::uint32_t>((value ^ c) * 16777619ull);\n            return value;\n        }\n\n        template<std::size_t S>\n        constexpr std::uint64_t key8() {\n            constexpr auto first_part = key4<2166136261 + S>();\n            constexpr auto second_part = key4<first_part>();\n            return (static_cast<std::uint64_t>(first_part) << 32) | second_part;\n        }\n\n        // clang and gcc try really hard to place the constants in data\n        // sections. to counter that there was a need to create an intermediate\n        // constexpr string and then copy it into a non constexpr container with\n        // volatile storage so that the constants would be placed directly into\n        // code.\n        template<class T, std::uint64_t... Keys>\n        struct string_storage {\n            std::uint64_t storage[T::buffer_size];\n\n            XORSTR_FORCEINLINE constexpr string_storage() noexcept : storage{ Keys... } {\n                using cast_type =\n                    typename unsigned_<sizeof(typename T::value_type)>::type;\n                constexpr auto value_size = sizeof(typename T::value_type);\n                // puts the string into 64 bit integer blocks in a constexpr\n                // fashion\n                for (std::size_t i = 0; i < T::size; ++i)\n                    storage[i / (8 / value_size)] ^=\n                    (std::uint64_t{ static_cast<cast_type>(T::str[i]) }\n                << ((i % (8 / value_size)) * 8 * value_size));\n            }\n        };\n\n    } // namespace detail\n\n    template<class T, class... Keys>\n    class xor_string {\n        alignas(T::buffer_align) std::uint64_t _storage[T::buffer_size];\n\n        // _single functions needed because MSVC crashes without them\n        XORSTR_FORCEINLINE void _crypt_256_single(const std::uint64_t* keys,\n            std::uint64_t* storage) noexcept\n\n        {\n            _mm256_store_si256(\n                reinterpret_cast<__m256i*>(storage),\n                _mm256_xor_si256(\n                    _mm256_load_si256(reinterpret_cast<const __m256i*>(storage)),\n                    _mm256_load_si256(reinterpret_cast<const __m256i*>(keys))));\n        }\n\n        template<std::size_t... Idxs>\n        XORSTR_FORCEINLINE void _crypt_256(const std::uint64_t* keys,\n            std::index_sequence<Idxs...>) noexcept {\n            (_crypt_256_single(keys + Idxs * 4, _storage + Idxs * 4), ...);\n        }\n\n        XORSTR_FORCEINLINE void _crypt_128_single(const std::uint64_t* keys,\n            std::uint64_t* storage) noexcept {\n            _mm_store_si128(\n                reinterpret_cast<__m128i*>(storage),\n                _mm_xor_si128(_mm_load_si128(reinterpret_cast<const __m128i*>(storage)),\n                    _mm_load_si128(reinterpret_cast<const __m128i*>(keys))));\n        }\n\n        template<std::size_t... Idxs>\n        XORSTR_FORCEINLINE void _crypt_128(const std::uint64_t* keys,\n            std::index_sequence<Idxs...>) noexcept {\n            (_crypt_128_single(keys + Idxs * 2, _storage + Idxs * 2), ...);\n        }\n\n        // loop generates vectorized code which places constants in data dir\n        XORSTR_FORCEINLINE constexpr void _copy() noexcept {\n            constexpr detail::string_storage<T, Keys::key...> storage;\n            static_cast<void>(std::initializer_list<std::uint64_t>{\n                (const_cast<XORSTR_VOLATILE std::uint64_t*>(_storage))[Keys::idx] =\n                    storage.storage[Keys::idx]... });\n        }\n\n    public:\n        using value_type = typename T::value_type;\n        using size_type = std::size_t;\n        using pointer = value_type*;\n        using const_pointer = const pointer;\n\n        XORSTR_FORCEINLINE xor_string() noexcept { _copy(); }\n\n        XORSTR_FORCEINLINE constexpr size_type size() const noexcept {\n            return T::size - 1;\n        }\n\n        XORSTR_FORCEINLINE void crypt() noexcept {\n            alignas(T::buffer_align) std::uint64_t keys[T::buffer_size];\n            static_cast<void>(std::initializer_list<std::uint64_t>{\n                (const_cast<XORSTR_VOLATILE std::uint64_t*>(keys))[Keys::idx] =\n                    Keys::key... });\n\n            _copy();\n\n#ifndef JM_XORSTR_DISABLE_AVX_INTRINSICS\n            _crypt_256(keys, std::make_index_sequence<T::buffer_size / 4>{});\n            if constexpr (T::buffer_size % 4 != 0)\n                _crypt_128(keys, std::index_sequence<T::buffer_size / 2 - 1>{});\n#else\n            _crypt_128(keys, std::make_index_sequence<T::buffer_size / 2>{});\n#endif\n        }\n\n        XORSTR_FORCEINLINE const_pointer get() const noexcept {\n            return reinterpret_cast<const_pointer>(_storage);\n        }\n\n        XORSTR_FORCEINLINE const_pointer crypt_get() noexcept {\n            crypt();\n            return reinterpret_cast<const_pointer>(_storage);\n        }\n    };\n\n    template<class Tstr, std::size_t... StringIndices, std::size_t... KeyIndices>\n    XORSTR_FORCEINLINE constexpr auto\n        make_xorstr(Tstr str_lambda,\n            std::index_sequence<StringIndices...>,\n            std::index_sequence<KeyIndices...>) noexcept {\n        return xor_string<detail::tstring_<str_lambda()[StringIndices]...>,\n            detail::_ki<KeyIndices, detail::key8<KeyIndices>()>...>{};\n    }\n\n} // namespace jm\n\n#endif // include guard\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Helper/Helper.cpp",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#include <cstdlib>\r\n#include <Windows.h>\r\n#include \"Helper.h\"\r\n\r\n\r\nvoid Helper::OpenConsole()\r\n{\r\n    AllocConsole();\r\n    freopen(\"CONOUT$\", \"w\", stdout);\r\n}\r\n\r\nuintptr_t Helper::PatternScan(uintptr_t moduleAdress, const char* signature)\r\n{\r\n    static auto patternToByte = [](const char* pattern)\r\n    {\r\n        auto       bytes = std::vector<int>{};\r\n        const auto start = const_cast<char*>(pattern);\r\n        const auto end = const_cast<char*>(pattern) + strlen(pattern);\r\n\r\n        for (auto current = start; current < end; ++current)\r\n        {\r\n            if (*current == '?')\r\n            {\r\n                ++current;\r\n                if (*current == '?')\r\n                    ++current;\r\n                bytes.push_back(-1);\r\n            }\r\n            else { bytes.push_back(strtoul(current, &current, 16)); }\r\n        }\r\n        return bytes;\r\n    };\r\n\r\n    const auto dosHeader = (PIMAGE_DOS_HEADER)moduleAdress;\r\n    const auto ntHeaders = (PIMAGE_NT_HEADERS)((std::uint8_t*)moduleAdress + dosHeader->e_lfanew);\r\n\r\n    const auto sizeOfImage = ntHeaders->OptionalHeader.SizeOfImage;\r\n    auto       patternBytes = patternToByte(signature);\r\n    const auto scanBytes = reinterpret_cast<std::uint8_t*>(moduleAdress);\r\n\r\n    const auto s = patternBytes.size();\r\n    const auto d = patternBytes.data();\r\n\r\n    for (auto i = 0ul; i < sizeOfImage - s; ++i)\r\n    {\r\n        bool found = true;\r\n        for (auto j = 0ul; j < s; ++j)\r\n        {\r\n            if (scanBytes[i + j] != d[j] && d[j] != -1)\r\n            {\r\n                found = false;\r\n                break;\r\n            }\r\n        }\r\n        if (found) { return reinterpret_cast<uintptr_t>(&scanBytes[i]); }\r\n    }\r\n    return NULL;\r\n}\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Helper/Helper.h",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#pragma once\r\n\r\n#include <vector>\r\n\r\nclass Helper\r\n{\r\npublic:\r\n    /// <summary>\r\n    /// Scan for a given byte pattern on a moduleAdress.\\n\r\n    /// Example: PatternScan(GetModuleHandleW(L\"engine.dll\"), \"53 56 57 8B DA 8B F9 FF 15\")\r\n    /// </summary>\r\n    /// <param name=\"moduleAdress\">Base of the moduleAdress to search</param>\r\n    /// <param name=\"signature\">signature IDA-style byte array pattern</param>\r\n    /// <returns>Address of the first occurence</returns>\r\n    static uintptr_t PatternScan(uintptr_t moduleAdress, const char* signature);\r\n\r\n    // ********************************************************************************\r\n    /// <summary>\r\n    /// Open console CMD\r\n    /// </summary>\r\n    // ********************************************************************************\r\n    static void OpenConsole();\r\n};\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/Config/Config.cpp",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n#include <fstream>\n#include <ShlObj.h>\n#include \"../../Header Files/Config/Archivex.h\"\n#include \"../../Header Files/Config/config.h\"\n\nc_config config_system;\n\nvoid c_config::run(const char* name) noexcept {\n\tPWSTR pathToDocuments;\n\tif (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &pathToDocuments))) {\n\t\tpath = pathToDocuments;\n\t\tpath /= name;\n\t\tCoTaskMemFree(pathToDocuments);\n\t}\n\n\tif (!std::filesystem::is_directory(path)) {\n\t\tstd::filesystem::remove(path);\n\t\tstd::filesystem::create_directory(path);\n\t}\n\n\tstd::transform(std::filesystem::directory_iterator{ path },\n\t\tstd::filesystem::directory_iterator{ },\n\t\tstd::back_inserter(configs),\n\t\t[](const auto& entry) { return entry.path().filename().string(); });\n}\n\nvoid c_config::load(size_t id) noexcept {\n\tif (!std::filesystem::is_directory(path)) {\n\t\tstd::filesystem::remove(path);\n\t\tstd::filesystem::create_directory(path);\n\t}\n\n\tstd::ifstream in{ path / configs[id] };\n\n\tif (!in.good())\n\t\treturn;\n\n\tArchiveX<std::ifstream>{ in } >> item;\n\tin.close();\n}\n\nvoid c_config::save(size_t id) const noexcept {\n\tif (!std::filesystem::is_directory(path)) {\n\t\tstd::filesystem::remove(path);\n\t\tstd::filesystem::create_directory(path);\n\t}\n\n\tstd::ofstream out{ path / configs[id] };\n\n\tif (!out.good())\n\t\treturn;\n\n\tArchiveX<std::ofstream>{ out } << item;\n\tout.close();\n}\n\nvoid c_config::add(const char* name) noexcept {\n\tif (*name && std::find(std::cbegin(configs), std::cend(configs), name) == std::cend(configs))\n\t\tconfigs.emplace_back(name);\n}\n\nvoid c_config::remove(size_t id) noexcept {\n\tstd::filesystem::remove(path / configs[id]);\n\tconfigs.erase(configs.cbegin() + id);\n}\n\nvoid c_config::rename(size_t item, const char* newName) noexcept {\n\tstd::filesystem::rename(path / configs[item], path / newName);\n\tconfigs[item] = newName;\n}\n\nvoid c_config::reset() noexcept {\n\titem = { };\n}\n\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/FortUpdaters/FortUpdaters.cpp",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n\r\n#include \"../../Header Files/FortUpdaters/FortUpdaters.h\"\r\n#include \"../../Header Files/xorstr.h\"\r\n#include \"../../imgui/imgui_xorstr.h\"\r\n\r\ntemplate<class T>\r\nstruct TArray\r\n{\r\n\tfriend struct FString;\r\n\r\npublic:\r\n\tinline TArray()\r\n\t{\r\n\t\tData = nullptr;\r\n\t\tCount = Max = 0;\r\n\t};\r\n\r\n\tinline int Num() const\r\n\t{\r\n\t\treturn Count;\r\n\t};\r\n\r\n\tinline T& operator[](int i)\r\n\t{\r\n\t\treturn Data[i];\r\n\t};\r\n\r\n\tinline const T& operator[](int i) const\r\n\t{\r\n\t\treturn Data[i];\r\n\t};\r\n\r\n\tinline bool IsValidIndex(int i) const\r\n\t{\r\n\t\treturn i < Num();\r\n\t}\r\n\r\nprivate:\r\n\tT* Data;\r\n\tint Count;\r\n\tint Max;\r\n};\r\n\r\nstruct FString : private TArray<wchar_t>\r\n{\r\n\tinline FString()\r\n\t{\r\n\t};\r\n\r\n\tinline bool IsValid() const\r\n\t{\r\n\t\treturn Data != nullptr;\r\n\t}\r\n\r\n\tinline const wchar_t* c_str() const\r\n\t{\r\n\t\treturn Data;\r\n\t}\r\n\r\n\tstd::string ToString() const\r\n\t{\r\n\t\tauto length = std::wcslen(Data);\r\n\r\n\t\tstd::string str(length, '\\0');\r\n\r\n\t\tstd::use_facet<std::ctype<wchar_t>>(std::locale()).narrow(Data, Data + length, '?', &str[0]);\r\n\r\n\t\treturn str;\r\n\t}\r\n};\r\n\r\nstruct FName\r\n{\r\n\tint32_t ComparisonIndex;\r\n\tint32_t Number;\r\n};\r\n\r\nbool FortUpdater::Init(uintptr_t UObjectArray, uintptr_t GetObjectName, uintptr_t GetNameByIndex, uintptr_t FnFree)\r\n{\r\n\tif (!UObjectArray || !GetObjectName || !GetNameByIndex || !FnFree) return false;\r\n\r\n\tuintptr_t deref_1 = *(uintptr_t*)UObjectArray;\r\n\tif (IsBadReadPtr((void*)deref_1, sizeof(uintptr_t))) return false;\r\n\r\n\tuintptr_t deref_2 = *(uintptr_t*)deref_1;\r\n\tif (IsBadReadPtr((void*)deref_2, sizeof(uintptr_t))) return false;\r\n\r\n\tthis->UObjectArray = deref_2;\r\n\tthis->GetObjectName = GetObjectName;\r\n\tthis->GetNameByIndex = GetNameByIndex;\r\n\tthis->FnFree = FnFree;\r\n\r\n\treturn true;\r\n}\r\n\r\nDWORD FortUpdater::FindOffset(const char* Class, const char* varName)\r\n{\r\n\tfor (DWORD i = 0x0; i < 0x9000; i++)\r\n\t{\r\n\t\tauto CurrentObject = *(uintptr_t*)(this->UObjectArray + (i * 0x18));\r\n\r\n\t\tif (!CurrentObject) return NULL;\r\n\t\tif (!(*(uintptr_t*)(CurrentObject + 0x50)) || *(DWORD*)(CurrentObject + 0x54) == 0xFFFFFFFF) continue;\r\n\r\n\t\tchar* CurObjectName = this->fGetObjectName(CurrentObject);\r\n\r\n\t\tif (!strcmp(CurObjectName, Class)) //Same class\r\n\t\t{\r\n\t\t\tfor (auto Property = *(uint64_t*)(CurrentObject + 0x50); !IsBadReadPtr((void*)Property, 8); Property = *(uint64_t*)(Property + 0x20))\r\n\t\t\t{\r\n\t\t\t\tauto Type = *(uint64_t*)(Property + 0x8);\r\n\r\n\t\t\t\tif (!IsBadReadPtr((void*)Type, 8) && Type)\r\n\t\t\t\t{\r\n\t\t\t\t\tauto Property_FName = *(FName*)(Property + 0x28);\r\n\t\t\t\t\tauto Offset = *(DWORD*)(Property + 0x4C);\r\n\r\n\t\t\t\t\tif (Offset != 0)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tauto Property_idx = Property_FName.ComparisonIndex;\r\n\r\n\t\t\t\t\t\tif (Property_idx)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tchar* PropertyName = this->fGetNameByIndex(Property_idx);\r\n\r\n\t\t\t\t\t\t\tif (!strcmp(PropertyName, varName))\r\n\t\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\t\treturn Offset;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tprintf(xorstr(\" % X\", Offset));\r\n\t\t\t\t\t\tsystem(xorstr(\"pause\"));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n\r\nvoid FortUpdater::cFixName(char* Name)\r\n{\r\n\tfor (int i = 0; Name[i] != '\\0'; i++)\r\n\t{\r\n\t\tif (Name[i] == '_')\r\n\t\t{\r\n\t\t\tif (Name[i + 1] == '0' ||\r\n\t\t\t\tName[i + 1] == '1' ||\r\n\t\t\t\tName[i + 1] == '2' ||\r\n\t\t\t\tName[i + 1] == '3' ||\r\n\t\t\t\tName[i + 1] == '4' ||\r\n\t\t\t\tName[i + 1] == '5' ||\r\n\t\t\t\tName[i + 1] == '6' ||\r\n\t\t\t\tName[i + 1] == '7' ||\r\n\t\t\t\tName[i + 1] == '8' ||\r\n\t\t\t\tName[i + 1] == '9')\r\n\t\t\t\tName[i] = '\\0';\r\n\t\t}\r\n\t}\r\n\r\n\treturn;\r\n}\r\n\r\nvoid FortUpdater::FreeObjName(uintptr_t Address)\r\n{\r\n\tif (Address == NULL) return;\r\n\r\n\tauto func = reinterpret_cast<__int64(__fastcall*)(__int64)>(this->FnFree);\r\n\r\n\tfunc(Address);\r\n}\r\n\r\nchar* FortUpdater::fGetObjectName(uintptr_t Object)\r\n{\r\n\tif (Object == NULL) return (char*)\"\";\r\n\r\n\tauto fGetObjName = reinterpret_cast<FString * (__fastcall*)(FString*, uintptr_t)>(this->GetObjectName);\r\n\r\n\tFString result;\r\n\tfGetObjName(&result, Object);\r\n\r\n\tif (result.c_str() == NULL) return (char*)\"\";\r\n\r\n\tauto tmp = result.ToString();\r\n\r\n\tchar return_string[1024];\r\n\tmemcpy(return_string, std::string(tmp.begin(), tmp.end()).c_str(), 1024);\r\n\r\n\tthis->FreeObjName((uintptr_t)result.c_str());\r\n\r\n\tcFixName(return_string);\r\n\r\n\treturn (char*)std::string(tmp.begin(), tmp.end()).c_str();\r\n}\r\n\r\nchar* FortUpdater::fGetNameByIndex(int Index)\r\n{\r\n\tif (Index == 0) return (char*)\"\";\r\n\r\n\tauto fGetNameByIdx = reinterpret_cast<FString * (__fastcall*)(int*, FString*)>(this->GetNameByIndex);\r\n\r\n\tFString result;\r\n\tfGetNameByIdx(&Index, &result);\r\n\r\n\tif (result.c_str() == NULL) return (char*)\"\";\r\n\r\n\tauto tmp = result.ToString();\r\n\r\n\tchar return_string[1024];\r\n\tmemcpy(return_string, std::string(tmp.begin(), tmp.end()).c_str(), 1024);\r\n\r\n\tFreeObjName((uintptr_t)result.c_str());\r\n\r\n\tcFixName(return_string);\r\n\r\n\treturn return_string;\r\n}\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/core/core.cpp",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n#include \"../../Header Files/menu/menu.h\"\r\n#include \"../../Header Files/Config/config.h\"\r\n#include \"../../Header Files/includes.h\"\r\n#include \"../../DiscordHook/Discord.h\"\r\n#include \"../../Header Files/xorstr.h\"\r\n#include \"../../imgui/imgui_xorstr.h\"\r\n#include <iostream>\r\n\r\nnamespace Core {\r\n\tbool NoSpread = true;\r\n\tbool IsAirstuck = true;\r\n\tint Current = 1;\r\n\tPVOID LocalPlayerPawn = nullptr;\r\n\tPVOID LocalPlayerController = nullptr;\r\n\tPVOID TargetPawn = nullptr;\r\n\tBYTE FreeCamDirection[6] = { 0 };\r\n\tFRotator FreeCamRotation[6] = { 0 };\r\n\tFVector FreeCamPosition = { 0 };\r\n\tFVector PlayerPosition = { 0 };\r\n\tPVOID(*ProcessEvent)(PVOID, PVOID, PVOID, PVOID) = nullptr;\r\n\tPVOID(*CalculateSpread)(PVOID, float*, float*) = nullptr;\r\n\tfloat* (*CalculateShot)(PVOID, PVOID, PVOID) = nullptr;\r\n\tVOID(*ReloadOriginal)(PVOID, PVOID) = nullptr;\r\n\tPVOID(*GetWeaponStats)(PVOID) = nullptr;\r\n\tINT(*GetViewPoint)(PVOID, FMinimalViewInfo*, BYTE) = nullptr;\r\n\tauto CurrentLocation = Core::FreeCamPosition;\r\n\tauto CurrentYaw = 0;\r\n\tauto CurrentPitch = 0;\r\n\tauto CurrenRoll = 0;\r\n\tauto OriginalAitstuck = 0;\r\n\r\n\tPVOID calculateSpreadCaller = nullptr;\r\n\tfloat originalReloadTime = 0.0f;\r\n\r\n\tBOOLEAN GetTarget(FVector& out) {\r\n\t\tif (!Core::TargetPawn) {\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tauto mesh = ReadPointer(Core::TargetPawn, 0x280);\r\n\t\tif (!mesh) {\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tauto bones = ReadPointer(mesh, 0x488);\r\n\t\tif (!bones) bones = ReadPointer(mesh, 0x488 + 0x10);\r\n\t\tif (!bones) {\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tfloat compMatrix[4][4] = { 0 };\r\n\t\tUtil::ToMatrixWithScale(reinterpret_cast<float*>(reinterpret_cast<PBYTE>(mesh) + 0x1C0), compMatrix);\r\n\r\n\t\tfloat AimPointer;\r\n\t\tif (config_system.item.AimPoint == 0) {\r\n\t\t\tAimPointer = BONE_HEAD_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 1) {\r\n\t\t\tAimPointer = BONE_NECK_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 2) {\r\n\t\t\tAimPointer = BONE_CHEST_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 3) {\r\n\t\t\tAimPointer = BONE_PELVIS_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 4) {\r\n\t\t\tAimPointer = BONE_RIGHTELBOW_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 5) {\r\n\t\t\tAimPointer = BONE_LEFTELBOW_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 6) {\r\n\t\t\tAimPointer = BONE_RIGHTTHIGH_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 7) {\r\n\t\t\tAimPointer = BONE_LEFTTHIGH_ID;\r\n\t\t}\r\n\t\telse if (config_system.item.AimPoint == 8) {\r\n\t\t\tAimPointer = BONE_PELVIS_ID;\r\n\t\t}\r\n\t\tUtil::GetBoneLocation(compMatrix, bones, AimPointer, &out.X);\r\n\r\n\t\treturn TRUE;\r\n\t}\r\n\tPVOID ProcessEventHook(UObject* object, UObject* func, PVOID params, PVOID result) {\r\n\t\tif (object && func) {\r\n\t\t\tauto objectName = Util::GetObjectFirstName(object);\r\n\t\t\tauto funcName = Util::GetObjectFirstName(func);\r\n\t\t\t\r\n\r\n\r\n\t\t\tdo {\r\n\t\t\t\tif (Core::TargetPawn && Core::LocalPlayerController) {\r\n\t\t\t\t\tif (wcsstr(objectName.c_str(), xorstr(L\"B_Prj_Bullet_Sniper\")) && funcName == xorstr(L\"OnRep_FireStart\")) {\r\n\t\t\t\t\t\tFVector CurrentAimPointer = { 0 };\r\n\t\t\t\t\t\tif (!GetTarget(CurrentAimPointer)) {\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t*reinterpret_cast<FVector*>(reinterpret_cast<PBYTE>(object) + Offsets::FortniteGame::FortProjectileAthena::FireStartLoc) = CurrentAimPointer;\r\n\r\n\t\t\t\t\t\tauto root = reinterpret_cast<PBYTE>(ReadPointer(object, Offsets::Engine::Actor::RootComponent));\r\n\t\t\t\t\t\t*reinterpret_cast<FVector*>(root + Offsets::Engine::SceneComponent::RelativeLocation) = CurrentAimPointer;\r\n\t\t\t\t\t\tmemset(root + Offsets::Engine::SceneComponent::ComponentVelocity, 0, sizeof(FVector));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse if (!config_system.item.SilentAimbot && wcsstr(funcName.c_str(), xorstr(L\"Tick\"))) {\r\n\t\t\t\t\t\tFVector CurrentAimPointer;\r\n\t\t\t\t\t\tif (!GetTarget(CurrentAimPointer)) { //head\r\n\t\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\tfloat angles[2] = { 0 };\r\n\t\t\t\t\t\tUtil::CalcAngle(&Util::GetViewInfo().Location.X, &CurrentAimPointer.X, angles); //head instead of neck.X\r\n\r\n\t\t\t\t\t\tif (config_system.item.AimbotSlow <= 0.0f) {\r\n\t\t\t\t\t\t\tif (config_system.item.TriggerAimbot) {\r\n\t\t\t\t\t\t\t\tFRotator args = { 0 };\r\n\t\t\t\t\t\t\t\targs.Pitch = angles[0];\r\n\t\t\t\t\t\t\t\targs.Yaw = angles[1];\r\n\t\t\t\t\t\t\t\tProcessEvent(Core::LocalPlayerController, Offsets::Engine::Controller::ClientSetRotation, &args, 0);\r\n\t\t\t\t\t\t\t\tmouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);\r\n\t\t\t\t\t\t\t\tmouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);\r\n\t\t\t\t\t\t\t\tint x = 0;\r\n\t\t\t\t\t\t\t\twhile (x < config_system.item.TriggerSpeed * 10) {\r\n\t\t\t\t\t\t\t\t\tx++;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tx = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tauto scale = config_system.item.AimbotSlow + 1.0f;\r\n\t\t\t\t\t\t\t\tauto currentRotation = Util::GetViewInfo().Rotation;\r\n\r\n\t\t\t\t\t\t\t\tFRotator args = { 0 };\r\n\t\t\t\t\t\t\t\targs.Pitch = (angles[0] - currentRotation.Pitch) / scale + currentRotation.Pitch;\r\n\t\t\t\t\t\t\t\targs.Yaw = (angles[1] - currentRotation.Yaw) / scale + currentRotation.Yaw;\r\n\t\t\t\t\t\t\t\tProcessEvent(Core::LocalPlayerController, Offsets::Engine::Controller::ClientSetRotation, &args, 0);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tif (config_system.item.TriggerAimbot) {\r\n\t\t\t\t\t\t\t\tauto scale = config_system.item.AimbotSlow + 1.0f;\r\n\t\t\t\t\t\t\t\tauto currentRotation = Util::GetViewInfo().Rotation;\r\n\r\n\t\t\t\t\t\t\t\tFRotator args = { 0 };\r\n\t\t\t\t\t\t\t\targs.Pitch = (angles[0] - currentRotation.Pitch) / scale + currentRotation.Pitch;\r\n\t\t\t\t\t\t\t\targs.Yaw = (angles[1] - currentRotation.Yaw) / scale + currentRotation.Yaw;\r\n\t\t\t\t\t\t\t\tProcessEvent(Core::LocalPlayerController, Offsets::Engine::Controller::ClientSetRotation, &args, 0);\r\n\t\t\t\t\t\t\t\tmouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);\r\n\t\t\t\t\t\t\t\tmouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);\r\n\t\t\t\t\t\t\t\tint v = 0;\r\n\t\t\t\t\t\t\t\twhile (v < config_system.item.TriggerSpeed * 10) {\r\n\t\t\t\t\t\t\t\t\tv++;\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\tv = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\t\tauto scale = config_system.item.AimbotSlow + 1.0f;\r\n\t\t\t\t\t\t\t\tauto currentRotation = Util::GetViewInfo().Rotation;\r\n\r\n\t\t\t\t\t\t\t\tFRotator args = { 0 };\r\n\t\t\t\t\t\t\t\targs.Pitch = (angles[0] - currentRotation.Pitch) / scale + currentRotation.Pitch;\r\n\t\t\t\t\t\t\t\targs.Yaw = (angles[1] - currentRotation.Yaw) / scale + currentRotation.Yaw;\r\n\t\t\t\t\t\t\t\tProcessEvent(Core::LocalPlayerController, Offsets::Engine::Controller::ClientSetRotation, &args, 0);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} while (FALSE);\r\n\t\t}\r\n\r\n\t\treturn ProcessEvent(object, func, params, result);\r\n\t}\r\n\t\r\n\tPVOID CalculateSpreadHook(PVOID arg0, float* arg1, float* arg2) {\r\n\t\tif (originalReloadTime != 0.0f) {\r\n\t\t\tauto localPlayerWeapon = ReadPointer(Core::LocalPlayerPawn, Offsets::FortniteGame::FortPawn::CurrentWeapon);\r\n\t\t\tif (localPlayerWeapon) {\r\n\t\t\t\tauto stats = GetWeaponStats(localPlayerWeapon);\r\n\t\t\t\tif (stats) {\r\n\t\t\t\t\t*reinterpret_cast<float*>(reinterpret_cast<PBYTE>(stats) + Offsets::FortniteGame::FortBaseWeaponStats::ReloadTime) = originalReloadTime;\r\n\t\t\t\t\toriginalReloadTime = 0.0f;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif (config_system.item.NoSpreadAimbot && Core::NoSpread && _ReturnAddress() == calculateSpreadCaller) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\r\n\t\treturn CalculateSpread(arg0, arg1, arg2);\r\n\t}\r\n\r\n\tfloat* CalculateShotHook(PVOID arg0, PVOID arg1, PVOID arg2) {\r\n\t\tauto ret = CalculateShot(arg0, arg1, arg2);\r\n\t\tif (ret && config_system.item.SilentAimbot && Core::TargetPawn && Core::LocalPlayerPawn) {\r\n\t\t\tauto mesh = ReadPointer(Core::TargetPawn, Offsets::Engine::Character::Mesh);\r\n\t\t\tif (!mesh) return ret;\r\n\r\n\t\t\tauto bones = ReadPointer(mesh, Offsets::Engine::StaticMeshComponent::StaticMesh);\r\n\t\t\tif (!bones) bones = ReadPointer(mesh, Offsets::Engine::StaticMeshComponent::StaticMesh + 0x10);\r\n\t\t\tif (!bones) return ret;\r\n\r\n\t\t\tfloat compMatrix[4][4] = { 0 };\r\n\t\t\tUtil::ToMatrixWithScale(reinterpret_cast<float*>(reinterpret_cast<PBYTE>(mesh) + Offsets::Engine::StaticMeshComponent::ComponentToWorld), compMatrix);\r\n\r\n\t\t\tFVector CurrentAimPoint = { 0 };\r\n\t\t\tint CurrentAimPointer = BONE_HEAD_ID;\r\n\t\t\tif (config_system.item.AimPoint == 0) {\r\n\t\t\t\tCurrentAimPointer = BONE_HEAD_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 1) {\r\n\t\t\t\tCurrentAimPointer = BONE_NECK_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 2) {\r\n\t\t\t\tCurrentAimPointer = BONE_CHEST_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 3) {\r\n\t\t\t\tCurrentAimPointer = BONE_PELVIS_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 4) {\r\n\t\t\t\tCurrentAimPointer = BONE_RIGHTELBOW_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 5) {\r\n\t\t\t\tCurrentAimPointer = BONE_LEFTELBOW_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 6) {\r\n\t\t\t\tCurrentAimPointer = BONE_RIGHTTHIGH_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 7) {\r\n\t\t\t\tCurrentAimPointer = BONE_LEFTTHIGH_ID;\r\n\t\t\t}\r\n\t\t\telse if (config_system.item.AimPoint == 8) {\r\n\t\t\t\tCurrentAimPointer = BONE_PELVIS_ID;\r\n\t\t\t}\r\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, CurrentAimPointer, &CurrentAimPoint.X);\r\n\r\n\t\t\tauto rootPtr = Util::GetPawnRootLocation(Core::LocalPlayerPawn);\r\n\t\t\tif (!rootPtr) return ret;\r\n\t\t\tauto root = *rootPtr;\r\n\r\n\t\t\tauto dx = CurrentAimPoint.X - root.X;\r\n\t\t\tauto dy = CurrentAimPoint.Y - root.Y;\r\n\t\t\tauto dz = CurrentAimPoint.Z - root.Z;\r\n\t\t\tif (dx * dx + dy * dy + dz * dz < 125000.0f) {\r\n\t\t\t\tret[4] = CurrentAimPoint.X;\r\n\t\t\t\tret[5] = CurrentAimPoint.Y;\r\n\t\t\t\tret[6] = CurrentAimPoint.Z;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tCurrentAimPoint.Z -= 16.0f;\r\n\t\t\t\troot.Z += 45.0f;\r\n\r\n\t\t\t\tauto y = atan2f(CurrentAimPoint.Y - root.Y, CurrentAimPoint.X - root.X);\r\n\r\n\t\t\t\troot.X += cosf(y + 1.5708f) * 32.0f;\r\n\t\t\t\troot.Y += sinf(y + 1.5708f) * 32.0f;\r\n\r\n\t\t\t\tauto length = Util::SpoofCall(sqrtf, powf(CurrentAimPoint.X - root.X, 2) + powf(CurrentAimPoint.Y - root.Y, 2));\r\n\t\t\t\tauto x = -atan2f(CurrentAimPoint.Z - root.Z, length);\r\n\t\t\t\ty = atan2f(CurrentAimPoint.Y - root.Y, CurrentAimPoint.X - root.X);\r\n\r\n\t\t\t\tx /= 2.0f;\r\n\t\t\t\ty /= 2.0f;\r\n\r\n\t\t\t\tret[0] = -(sinf(x) * sinf(y));\r\n\t\t\t\tret[1] = sinf(x) * cosf(y);\r\n\t\t\t\tret[2] = cosf(x) * sinf(y);\r\n\t\t\t\tret[3] = cosf(x) * cosf(y);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn ret;\r\n\t}\r\n\r\n\tINT GetViewPointHook(PVOID player, FMinimalViewInfo* viewInfo, BYTE stereoPass) \r\n\t{\r\n\t\tstatic HWND TargetWindow = 0;\r\n\t\tfloat CurrentSpeed = config_system.item.FreeCamSpeed;\r\n\t\tTargetWindow = FindWindow(xorstr(L\"UnrealWindow\"), xorstr(L\"Fortnite  \"));\r\n\r\n\r\n\t\tauto RotationYaw = viewInfo->Rotation.Yaw * PI / 180.0f;\r\n\t\tconst float FlySpeed = 0.10f;\r\n\t\tconst float HighFOV = 50.534008f;\r\n\t\tconst float LowFOV = 40.0f;\r\n\t\tstatic FVector FreecamPoint = { 0 };\r\n\t\tstatic FRotator FreeCamRotation = { 0 };\r\n\r\n\t\tFVector DirectionPoint = {\r\n\t\t\t\tstatic_cast<float>(Core::FreeCamDirection[0] - Core::FreeCamDirection[1]),\r\n\t\t\t\tstatic_cast<float>(Core::FreeCamDirection[2] - Core::FreeCamDirection[3]),\r\n\t\t\t\tstatic_cast<float>(Core::FreeCamDirection[4] - Core::FreeCamDirection[5]),\r\n\t\t};\r\n\r\n\t\tauto CurrentViewPoint = GetViewPoint(player, viewInfo, stereoPass);\r\n\r\n\t\tauto CurrentFOV = viewInfo->FOV;\r\n\t\tauto NormalFOV = (((180.0f - HighFOV) / (180.0f - 80.0f)) * (config_system.item.FOV - 80.0f)) + HighFOV;\r\n\r\n\t\tif (CurrentFOV > HighFOV) {\r\n\t\t\tCurrentFOV = NormalFOV;\r\n\t\t}\r\n\t\telse if (CurrentFOV > LowFOV) {\r\n\t\t\tCurrentFOV = (((CurrentFOV - LowFOV) / (HighFOV - LowFOV)) * (NormalFOV - LowFOV)) + LowFOV;\r\n\t\t}\r\n\r\n\t\tauto master = Util::SpoofCall(sqrtf, DirectionPoint.X * DirectionPoint.X + DirectionPoint.Y * DirectionPoint.Y + DirectionPoint.Z * DirectionPoint.Z);\r\n\t\tif (master != 0) {\r\n\t\t\tDirectionPoint.X /= master;\r\n\t\t\tDirectionPoint.Y /= master;\r\n\t\t\tDirectionPoint.Z /= master;\r\n\t\t}\r\n\r\n\t\tif (config_system.item.FOVSlider) {\r\n\t\t\tviewInfo->FOV = CurrentFOV;\r\n\t\t}\r\n\t\t\r\n\t\tif (config_system.item.SpinBot) {\r\n\t\t\tif (Util::SpoofCall(GetAsyncKeyState, config_system.keybind.Spinbot) && Util::SpoofCall(GetForegroundWindow) == TargetWindow) {\r\n\r\n\t\t\t\t// Freeze Cam\r\n\t\t\t\tviewInfo->Location = CurrentLocation;\r\n\t\t\t\tviewInfo->Rotation.Yaw = CurrentYaw;\r\n\t\t\t\tviewInfo->Rotation.Pitch = CurrentPitch;\r\n\t\t\t\tviewInfo->Rotation.Roll = CurrenRoll;\r\n\t\t\t\treturn CurrentViewPoint;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t// \r\n\t\t\t\tCurrentLocation = Util::GetViewInfo().Location;\r\n\t\t\t\tCurrentYaw = viewInfo->Rotation.Yaw;\r\n\t\t\t\tCurrentPitch = viewInfo->Rotation.Pitch;\r\n\t\t\t\tCurrenRoll = viewInfo->Rotation.Roll;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn CurrentViewPoint;\r\n\t}\r\n\r\n\tVOID ReloadHook(PVOID arg0, PVOID arg1) {\r\n\t\tif (config_system.item.InstantReload && Core::LocalPlayerPawn) {\r\n\t\t\tauto localPlayerWeapon = ReadPointer(Core::LocalPlayerPawn, Offsets::FortniteGame::FortPawn::CurrentWeapon);\r\n\t\t\tif (localPlayerWeapon) {\r\n\t\t\t\tauto stats = GetWeaponStats(localPlayerWeapon);\r\n\t\t\t\tif (stats) {\r\n\t\t\t\t\tauto& reloadTime = *reinterpret_cast<float*>(reinterpret_cast<PBYTE>(stats) + Offsets::FortniteGame::FortBaseWeaponStats::ReloadTime);\r\n\t\t\t\t\tif (reloadTime != 0.01f) {\r\n\t\t\t\t\t\toriginalReloadTime = reloadTime;\r\n\t\t\t\t\t\treloadTime = 0.01f;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tReloadOriginal(arg0, arg1);\r\n\t}\r\n\r\n\tBOOLEAN Initialize() {\r\n\r\n\t\t// GetWeaponStats\r\n\t\tauto addr = Util::FindPattern(xorstr(\"\\x48\\x83\\xEC\\x58\\x48\\x8B\\x91\\x00\\x00\\x00\\x00\\x48\\x85\\xD2\\x0F\\x84\\x00\\x00\\x00\\x00\\xF6\\x81\\x00\\x00\\x00\\x00\\x00\\x74\\x10\\x48\\x8B\\x81\\x00\\x00\\x00\\x00\\x48\\x85\\xC0\\x0F\\x85\\x00\\x00\\x00\\x00\\x48\\x8B\\x8A\\x00\\x00\\x00\\x00\\x48\\x89\\x5C\\x24\\x00\\x48\\x8D\\x9A\\x00\\x00\\x00\\x00\\x48\\x85\\xC9\"), xorstr(\"xxxxxxx????xxxxx????xx?????xxxxx????xxxxx????xxx????xxxx?xxx????xxx\"));\r\n\t\tif (!addr) {\r\n\t\t\tMessageBox(0, xorstr(L\"Failed to find GetWeaponStats.\"), xorstr(L\"github.com/visual9999\"), 0);\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tGetWeaponStats = reinterpret_cast<decltype(GetWeaponStats)>(addr);\r\n\r\n\t\t// ProcessEvent\r\n\t\taddr = Util::FindPattern(xorstr(\"\\x40\\x55\\x56\\x57\\x41\\x54\\x41\\x55\\x41\\x56\\x41\\x57\\x48\\x81\\xEC\\x00\\x00\\x00\\x00\\x48\\x8D\\x6C\\x24\\x00\\x48\\x89\\x9D\\x00\\x00\\x00\\x00\\x48\\x8B\\x05\\x00\\x00\\x00\\x00\\x48\\x33\\xC5\\x48\\x89\\x85\\x00\\x00\\x00\\x00\\x8B\\x41\\x0C\\x45\\x33\\xF6\\x3B\\x05\\x00\\x00\\x00\\x00\\x4D\\x8B\\xF8\\x48\\x8B\\xF2\\x4C\\x8B\\xE1\\x41\\xB8\\x00\\x00\\x00\\x00\\x7D\\x2A\"), xorstr(\"xxxxxxxxxxxxxxx????xxxx?xxx????xxx????xxxxxx????xxxxxxxx????xxxxxxxxxxx????xx\"));\r\n\t\tif (!addr) {\r\n\t\t\tMessageBox(0, xorstr(L\"Failed to find ProcessEvent.\"), xorstr(L\"github.com/visual9999\"), 0);\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tDISCORD.HookFunction((uintptr_t)addr, (uintptr_t)ProcessEventHook, (uintptr_t)&ProcessEvent);;\r\n\r\n\t\t//CalculateShot\r\n\t\taddr = Util::FindPattern(xorstr(\"\\x48\\x89\\x5C\\x24\\x00\\x4C\\x89\\x4C\\x24\\x00\\x55\\x56\\x57\\x41\\x54\\x41\\x55\\x41\\x56\\x41\\x57\\x48\\x8D\\x6C\\x24\\x00\\x48\\x81\\xEC\\x00\\x00\\x00\\x00\\x48\\x8B\\xF9\\x4C\\x8D\\x6C\\x24\\x00\"), xorstr(\"xxxx?xxxx?xxxxxxxxxxxxxxx?xxx????xxxxxxx?\"));\r\n\t\tif (!addr) {\r\n\t\t\tMessageBox(0, xorstr(L\"Failed to find CalculateShot.\"), xorstr(L\"github.com/visual9999\"), 0);\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tDISCORD.HookFunction((uintptr_t)addr, (uintptr_t)CalculateShotHook, (uintptr_t)&CalculateShot);\r\n\r\n\t\t// GetViewPoint\r\n\t\taddr = Util::FindPattern(xorstr(\"\\x48\\x89\\x5C\\x24\\x00\\x48\\x89\\x74\\x24\\x00\\x57\\x48\\x83\\xEC\\x20\\x48\\x8B\\xD9\\x41\\x8B\\xF0\\x48\\x8B\\x49\\x30\\x48\\x8B\\xFA\\xE8\\x00\\x00\\x00\\x00\\xBA\\x00\\x00\\x00\\x00\\x48\\x8B\\xC8\"), xorstr(\"xxxx?xxxx?xxxxxxxxxxxxxxxxxxx????x????xxx\"));\r\n\t\tif (!addr) {\r\n\t\t\tMessageBox(0, xorstr(L\"Failed to find GetViewPoint.\"), xorstr(L\"github.com/visual9999\"), 0);\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tDISCORD.HookFunction((uintptr_t)addr, (uintptr_t)GetViewPointHook, (uintptr_t)&GetViewPoint);\r\n\r\n\r\n\t\t//CalculateSpread\r\n\t\taddr = Util::FindPattern(xorstr(\"\\x83\\x79\\x78\\x00\\x4C\\x8B\\xC9\\x75\\x0F\\x0F\\x57\\xC0\\xC7\\x02\\x00\\x00\\x00\\x00\\xF3\\x41\\x0F\\x11\\x00\\xC3\\x48\\x8B\\x41\\x70\\x8B\\x48\\x04\\x89\\x0A\\x49\\x63\\x41\\x78\\x48\\x6B\\xC8\\x1C\\x49\\x8B\\x41\\x70\\xF3\\x0F\\x10\\x44\\x01\\x00\\xF3\\x41\\x0F\\x11\\x00\\xC3\"), xorstr(\"xxxxxxxxxxxxxx????xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx?xxxxxx\"));\r\n\t\tif (!addr) {\r\n\t\t\tMessageBox(0, xorstr(L\"Failed To find CalculateSpread.\"), xorstr(L\"github.com/visual9999\"), MB_OK | MB_ICONERROR);\r\n\t\t\treturn FALSE;\r\n\t\t}\r\n\r\n\t\tDISCORD.HookFunction((uintptr_t)addr, (uintptr_t)CalculateSpreadHook, (uintptr_t)&CalculateSpread);\r\n\r\n\t}\r\n}\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/menu/menu.cpp",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n#include \"../../Header Files/menu/menu.h\"\n#include \"../../Header Files/includes.h\"\n#include \"../../Header Files/Config/config.h\"\n#include \"../../DiscordHook/Discord.h\"\n#include \"../../Helper/Helper.h\"\n#include \"../../Header Files/xorstr.h\"\n#include \"../../imgui/imgui_xorstr.h\"\n#include <iostream>\nID3D11Device* device = nullptr;\nID3D11DeviceContext* immediateContext = nullptr;\nID3D11RenderTargetView* renderTargetView = nullptr;\n\nHRESULT(*PresentOriginal)(IDXGISwapChain* swapChain, UINT syncInterval, UINT flags) = nullptr;\nHRESULT(*ResizeOriginal)(IDXGISwapChain* swapChain, UINT bufferCount, UINT width, UINT height, DXGI_FORMAT newFormat, UINT swapChainFlags) = nullptr;\nWNDPROC oWndProc;\n\nextern LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);\nstatic bool ShowMenu = true;\n\nvoid ToggleButton(const char* str_id, bool* v)\n{\n\tImVec2 p = ImGui::GetCursorScreenPos();\n\tImDrawList* draw_list = ImGui::GetWindowDrawList();\n\n\tfloat height = 16.0f;\n\tfloat width = height * 1.60f;\n\tfloat radius = height * 0.50f;\n\n\tImGui::InvisibleButton(str_id, ImVec2(width, height));\n\tif (ImGui::IsItemClicked())\n\t\t*v = !*v;\n\n\tfloat t = *v ? 1.0f : 0.0f;\n\n\tImGuiContext& g = *GImGui;\n\tfloat ANIM_SPEED = 0.20f;\n\tif (g.LastActiveId == g.CurrentWindow->GetID(str_id))\n\t{\n\t\tfloat t_anim = ImSaturate(g.LastActiveIdTimer / ANIM_SPEED);\n\t\tt = *v ? (t_anim) : (1.0f - t_anim);\n\t}\n\n\tImU32 col_bg;\n\tif (ImGui::IsItemHovered())\n\t\tcol_bg = ImGui::GetColorU32(ImLerp(ImVec4(0.0f, 0.0f, 0.80f, 1.0f), ImVec4(0.0f, 0.0f, 0.80f, 1.0f), t));\n\telse\n\t\tcol_bg = ImGui::GetColorU32(ImLerp(ImVec4(0.85f, 0.0f, 0.0f, 1.0f), ImVec4(0.0f, 0.85f, 0.0f, 1.0f), t));\n\n\tdraw_list->AddRectFilled(p, ImVec2(p.x + width, p.y + height), col_bg, height * 0.5f);\n\tdraw_list->AddCircleFilled(ImVec2(p.x + radius + t * (width - radius * 2.0f), p.y + radius), radius + 0.80f, IM_COL32(255, 255, 255, 255));\n}\n\n\nVOID AddMarker(ImGuiWindow& window, float width, float height, float* start, PVOID pawn, LPCSTR text, ImU32 color) {\n\tauto root = Util::GetPawnRootLocation(pawn);\n\tif (root) {\n\t\tauto pos = *root;\n\t\tfloat dx = start[0] - pos.X;\n\t\tfloat dy = start[1] - pos.Y;\n\t\tfloat dz = start[2] - pos.Z;\n\n\t\tif (Util::WorldToScreen(width, height, &pos.X)) {\n\t\t\tfloat dist = Util::SpoofCall(sqrtf, dx * dx + dy * dy + dz * dz) / 1000.0f;\n\n\t\t\tCHAR modified[0xFF] = { 0 };\n\t\t\tsnprintf(modified, sizeof(modified), xorstr(\"%s\\n| %dm |\"), text, static_cast<INT>(dist));\n\n\t\t\tauto size = ImGui::GetFont()->CalcTextSizeA(window.DrawList->_Data->FontSize, FLT_MAX, 0, modified);\n\t\t\twindow.DrawList->AddText(ImVec2(pos.X - size.x / 2.0f, pos.Y - size.y / 2.0f), color, modified);\n\t\t}\n\t}\n}\n\nFLOAT GetDistance(ImGuiWindow& window, float width, float height, float* start, PVOID pawn) {\n\tauto root = Util::GetPawnRootLocation(pawn);\n\tfloat dist;\n\tif (root) {\n\t\tauto pos = *root;\n\t\tfloat dx = start[0] - pos.X;\n\t\tfloat dy = start[1] - pos.Y;\n\t\tfloat dz = start[2] - pos.Z;\n\n\t\tif (Util::WorldToScreen(width, height, &pos.X)) {\n\t\t\tdist = Util::SpoofCall(sqrtf, dx * dx + dy * dy + dz * dz) / 1000.0f;\n\t\t\treturn dist;\n\t\t}\n\t}\n\n}\n\n__declspec(dllexport) LRESULT CALLBACK WndProcHook(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {\n\tif (msg == WM_KEYUP && (wParam == config_system.keybind.Menu || (ShowMenu && wParam == VK_ESCAPE))) {\n\t\tShowMenu = !ShowMenu;\n\t\tImGui::GetIO().MouseDrawCursor = ShowMenu;\n\n\t}\n\telse if (msg == WM_QUIT && ShowMenu) {\n\t\tExitProcess(0);\n\t}\n\n\tif (ShowMenu) {\n\t\tImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);\n\t\treturn TRUE;\n\t}\n\n\treturn CallWindowProc(oWndProc, hWnd, msg, wParam, lParam);\n}\n\nextern uint64_t base_address = 0;\nDWORD processID;\nconst ImVec4 color = { 255.0,255.0,255.0,1 };\nconst ImVec4 red = { 0.65,0,0,1 };\nconst ImVec4 white = { 255.0,255.0,255.0,1 };\nconst ImVec4 green = { 0.03,0.81,0.14,1 };\nconst ImVec4 blue = { 0.21960784313,0.56470588235,0.90980392156,1.0 };\n\nImGuiWindow& BeginScene() {\n\tImGui_ImplDX11_NewFrame();\n\tImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0);\n\tImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));\n\tImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));\n\tImGui::Begin(xorstr(\"##scene\"), nullptr, ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoTitleBar);\n\n\tauto& io = ImGui::GetIO();\n\tImGui::SetWindowPos(ImVec2(0, 0), ImGuiCond_Always);\n\tImGui::SetWindowSize(ImVec2(io.DisplaySize.x, io.DisplaySize.y), ImGuiCond_Always);\n\n\treturn *ImGui::GetCurrentWindow();\n}\n\nchar streamsnipena[256] = \"Username\";\n\nVOID EndScene(ImGuiWindow& window) {\n\twindow.DrawList->PushClipRectFullScreen();\n\tImGui::End();\n\tImGui::PopStyleColor();\n\tImGui::PopStyleVar(2);\n\tImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.17f, 0.18f, 0.2f, 1.0f));\n\n\tif (ShowMenu) {\n\n\t\tImVec4* colors = ImGui::GetStyle().Colors;\n\t\tcolors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n\t\tcolors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);\n\t\tcolors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 1.0f);\n\t\tcolors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\t\tcolors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);\n\t\tcolors[ImGuiCol_Border] = ImVec4(1.00f, 0.00f, 0.00f, 0.50f);\n\t\tcolors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\t\tcolors[ImGuiCol_FrameBg] = ImVec4(0.41f, 0.00f, 0.03f, 0.54f);\n\t\tcolors[ImGuiCol_FrameBgHovered] = ImVec4(0.48f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n\t\tcolors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);\n\t\tcolors[ImGuiCol_TitleBgActive] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);\n\t\tcolors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);\n\t\tcolors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);\n\t\tcolors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);\n\t\tcolors[ImGuiCol_ScrollbarGrab] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_CheckMark] = ImVec4(0.75f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_SliderGrabActive] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_Button] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_ButtonHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_ButtonActive] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_Header] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_HeaderHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_HeaderActive] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_Separator] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);\n\t\tcolors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);\n\t\tcolors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);\n\t\tcolors[ImGuiCol_ResizeGrip] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_ResizeGripHovered] = ImVec4(1.00f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_ResizeGripActive] = ImVec4(0.46f, 0.00f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);\n\t\tcolors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);\n\t\tcolors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);\n\t\tcolors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);\n\t\tcolors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);\n\n\t\tImGui::GetStyle().WindowTitleAlign = ImVec2(0.5, 0.5);\n\t\tImGui::GetStyle().FramePadding = ImVec2(4.0, 2.0);\n\t\tImGui::GetStyle().WindowRounding = 0;\n\t\tImGui::GetStyle().GrabMinSize = 12;\n\t\tImGui::GetStyle().ScrollbarSize = 14;\n\t\tImGui::GetStyle().ScrollbarRounding = 0;\n\t\tImGui::GetStyle().FrameRounding = 4.0f;\n\n\n\t\t\tImGui::Begin(xorstr(\"github.com/Visual9999\"), 0, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize); {\n\t\t\tImGui::SetWindowSize(ImVec2(550, 450), ImGuiCond_FirstUseEver);\n\n\t\t\tImVec2 size = ImGui::GetItemRectSize();\n\n\t\t\tif (ImGui::CollapsingHeader(xorstr(\"Aimbot\")))\n\t\t\t{\n\t\t\t\tImGui::Text(xorstr(\"Memory\"));\n\t\t\t\tToggleButton(xorstr(\"Memory\"), &config_system.item.Aimbot);\n\t\t\t\tImGui::Text(xorstr(\"Silent Aimbot\"));\n\t\t\t\tToggleButton(xorstr(\"Silent\"), &config_system.item.SilentAimbot);\n\t\t\t\tImGui::Text(xorstr(\"Trigger Aimbot\"));\n\t\t\t\tToggleButton(xorstr(\"Trigger\"), &config_system.item.TriggerAimbot);\n\t\t\t\tconst char* Points[] = { \" Head\", \" Chest\", \" Pelvis\" };\n\t\t\t\tstatic int AimPoint = 0;\n\t\t\t\tImGui::Combo(xorstr(\"Aim Point\"), &AimPoint, Points, IM_ARRAYSIZE(Points));\n\t\t\t\tconfig_system.item.AimPoint = AimPoint;\n\t\t\t\tif (config_system.item.AutoAimbot) {\n\t\t\t\t\tconfig_system.item.AutoAimbot = 2000.0f;\n\t\t\t\t}\n\t\t\t\tImGui::Text(xorstr(\"Fov\"));\n\t\t\t\tToggleButton(xorstr(\"Fov\"), &config_system.item.DrawAimbotFOV);\n\t\t\t\tif (config_system.item.DrawAimbotFOV)\n\t\t\t\t{\n\t\t\t\t\tImGui::Text(xorstr(\"Filled FOV\"));\n\t\t\t\t\tToggleButton(xorstr(\"Filled\"), &config_system.item.DrawFilledAimbotFOV);\n\t\t\t\t}\n\t\t\t\tImGui::SliderFloat(xorstr(\"Circle FOV\"), &config_system.item.AimbotFOV, 100.0f, 1000.0f);\n\t\t\t}\n\n\t\t\tif (ImGui::CollapsingHeader(xorstr(\"Misc\")))\n\t\t\t{\n\t\t\t\tImGui::Text(xorstr(\"Spin Bot [CAPSLOCK]\"));\n\t\t\t\tToggleButton(xorstr(\"Spin\"), &config_system.item.SpinBot);\n\t\t\t\t\n\t\t\t\tImGui::Text(xorstr(\"NoSpread\"));\n\t\t\t\tToggleButton(xorstr(\"NoSpread\"), &config_system.item.NoSpreadAimbot);\n\n\t\t\t\tImGui::Text(xorstr(\"Camera FOV\"));\n\t\t\t\tToggleButton(xorstr(\"Camera\"), &config_system.item.FOVSlider);\n\n\t\t\t\tif (config_system.item.FOVSlider)\n\t\t\t\t{\n\t\t\t\t\tImGui::SliderFloat(xorstr(\"Camera FOV Slider\"), &config_system.item.FOV, 0.0f, 150.0f, xorstr(\"%.2f\"));\n\t\t\t\t}\n\t\t\t\tImGui::Text(xorstr(\"Stream Snipe Player Name\"));\n\t\t\t\tImGui::InputText(xorstr(\"       \"), streamsnipena, 256, ImGuiInputTextFlags_EnterReturnsTrue);\n\t\t\t}\n\n\t\t\tif (ImGui::CollapsingHeader(xorstr(\"ESP\")))\n\t\t\t{\n\t\t\t\tImGui::Text(xorstr(\"Chest ESP\"));\n\t\t\t\tToggleButton(xorstr(\"Chest\"), &config_system.item.Chest);\n\t\t\t\tImGui::Text(xorstr(\"Llama ESP\"));\n\t\t\t\tToggleButton(xorstr(\"Llama\"), &config_system.item.Llama);\n\t\t\t\tImGui::Text(xorstr(\"Ammo ESP\"));\n\t\t\t\tToggleButton(xorstr(\"Ammo\"), &config_system.item.Ammo);\n\t\t\t\tImGui::Text(xorstr(\"Boat ESP\"));\n\t\t\t\tToggleButton(xorstr(\"Boat\"), &config_system.item.boat);\n\t\t\t\tImGui::Text(xorstr(\"Chopper ESP\"));\n\t\t\t\tToggleButton(xorstr(\"Chopper\"), &config_system.item.chopper);\n\t\t\t\tImGui::Text(xorstr(\"Player Names ESP\"));\n\t\t\t\tToggleButton(xorstr(\"Names\"), &config_system.item.PlayerNames);\n\t\t\t\tImGui::Text(xorstr(\"Box ESP\"));\n\t\t\t\tToggleButton(xorstr(\"BOX\"), &config_system.item.PlayerBox);\n\t\t\t\tImGui::Text(xorstr(\"Player Lines\"));\n\t\t\t\tToggleButton(xorstr(\"Lines\"), &config_system.item.PlayerLines);\n\t\t\t\tImGui::Text(xorstr(\"Players Corner\"));\n\t\t\t\tToggleButton(xorstr(\"Corner\"), &config_system.item.PlayersCorner);\n\t\t\t}\n\n\t\t\tif (ImGui::CollapsingHeader(xorstr(\"Colors\")))\n\t\t\t{\n\t\t\t\tImGui::PushItemWidth(100.0f);\n\t\t\t\tImGui::Text(xorstr(\"ESP\"));\n\t\t\t\tImGui::SameLine();\n\t\t\t\tImGui::ColorPicker3(xorstr(\"Box\"), config_system.item.BoxESP, ImGuiColorEditFlags_NoInputs);\n\t\t\t\tImGui::SameLine();\n\t\t\t\tImGui::ColorPicker3(xorstr(\"Lines\"), config_system.item.LineESP, ImGuiColorEditFlags_NoInputs);\n\t\t\t\tImGui::SameLine();\n\t\t\t\tImGui::ColorPicker3(xorstr(\"Aim\\nFOV\"), config_system.item.FOVCircleColor, ImGuiColorEditFlags_NoInputs);\n\t\t\t\tImGui::Text(xorstr(\"Skeleton ESP\"));\n\t\t\t\tImGui::ColorPicker3(xorstr(\"Is\\nVisible\"), config_system.item.PlayerVisibleColor, ImGuiColorEditFlags_NoInputs);\n\t\t\t\tImGui::SameLine();\n\t\t\t\tImGui::ColorPicker3(xorstr(\"Not\\nVisible\"), config_system.item.PlayerNotVisibleColor, ImGuiColorEditFlags_NoInputs);\n\t\t\t\tImGui::SameLine();\n\t\t\t\tImGui::ColorPicker3(xorstr(\"Teammates\"), config_system.item.PlayerTeammate, ImGuiColorEditFlags_NoInputs);\n\t\t\t}\n\t\t}\n\t\tImGui::End();\n\t}\n\n\tImGui::PopStyleColor();\n\n\tImGui::Render();\n}\n\nVOID AddLine(ImGuiWindow& window, float width, float height, float a[3], float b[3], ImU32 color, float& minX, float& maxX, float& minY, float& maxY) {\n\tfloat ac[3] = { a[0], a[1], a[2] };\n\tfloat bc[3] = { b[0], b[1], b[2] };\n\tif (Util::WorldToScreen(width, height, ac) && Util::WorldToScreen(width, height, bc)) {\n\t\twindow.DrawList->AddLine(ImVec2(ac[0], ac[1]), ImVec2(bc[0], bc[1]), color, 2.0f);\n\n\t\tminX = min(ac[0], minX);\n\t\tminX = min(bc[0], minX);\n\n\t\tmaxX = max(ac[0], maxX);\n\t\tmaxX = max(bc[0], maxX);\n\n\t\tminY = min(ac[1], minY);\n\t\tminY = min(bc[1], minY);\n\n\t\tmaxY = max(ac[1], maxY);\n\t\tmaxY = max(bc[1], maxY);\n\t}\n}\n\n\n__declspec(dllexport) HRESULT PresentHook(IDXGISwapChain* swapChain, UINT syncInterval, UINT flags) {\n\tstatic float width = 0;\n\tstatic float height = 0;\n\tstatic HWND hWnd = 0;\n\tif (!device) {\n\t\tswapChain->GetDevice(__uuidof(device), reinterpret_cast<PVOID*>(&device));\n\t\tdevice->GetImmediateContext(&immediateContext);\n\n\t\tID3D11Texture2D* renderTarget = nullptr;\n\t\tswapChain->GetBuffer(0, __uuidof(renderTarget), reinterpret_cast<PVOID*>(&renderTarget));\n\t\tdevice->CreateRenderTargetView(renderTarget, nullptr, &renderTargetView);\n\t\trenderTarget->Release();\n\n\t\tID3D11Texture2D* backBuffer = 0;\n\t\tswapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (PVOID*)&backBuffer);\n\t\tD3D11_TEXTURE2D_DESC backBufferDesc = { 0 };\n\t\tbackBuffer->GetDesc(&backBufferDesc);\n\n\t\thWnd = FindWindow(xorstr(L\"UnrealWindow\"), xorstr(L\"Fortnite  \"));\n\t\tif (!width) {\n\t\t\toWndProc = reinterpret_cast<WNDPROC>(SetWindowLongPtr(hWnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(WndProcHook)));\n\t\t}\n\n\t\twidth = (float)backBufferDesc.Width;\n\t\theight = (float)backBufferDesc.Height;\n\t\tbackBuffer->Release();\n\n\t\tImGui::GetIO().Fonts->AddFontFromFileTTF(xorstr(\"C:\\\\Windows\\\\Fonts\\\\trebucbd.ttf\"), 13.0f); //your font here\n\n\t\tImGui_ImplDX11_Init(hWnd, device, immediateContext);\n\t\tImGui_ImplDX11_CreateDeviceObjects();\n\t}\n\timmediateContext->OMSetRenderTargets(1, &renderTargetView, nullptr);\n\t////// reading\n\tauto& window = BeginScene();\n\t////// readin\n\tauto success = FALSE;\n\tdo {\n\t\tfloat closestDistance = FLT_MAX;\n\t\tPVOID closestPawn = NULL;\n\n\t\tauto world = *Offsets::uWorld;\n\t\tif (!world) break;\n\n\t\tauto gameInstance = ReadPointer(world, Offsets::Engine::World::OwningGameInstance);\n\t\tif (!gameInstance) break;\n\n\t\tauto localPlayers = ReadPointer(gameInstance, Offsets::Engine::GameInstance::LocalPlayers);\n\t\tif (!localPlayers) break;\n\n\t\tauto localPlayer = ReadPointer(localPlayers, 0);\n\t\tif (!localPlayer) break;\n\n\t\tauto localPlayerController = ReadPointer(localPlayer, Offsets::Engine::Player::PlayerController);\n\t\tif (!localPlayerController) break;\n\n\t\tauto localPlayerPawn = reinterpret_cast<UObject*>(ReadPointer(localPlayerController, Offsets::Engine::PlayerController::AcknowledgedPawn));\n\t\tif (!localPlayerPawn) break;\n\n\t\tauto localPlayerWeapon = ReadPointer(localPlayerPawn, Offsets::FortniteGame::FortPawn::CurrentWeapon);\n\t\tif (!localPlayerWeapon) break;\n\n\t\tauto localPlayerRoot = ReadPointer(localPlayerPawn, Offsets::Engine::Actor::RootComponent);\n\t\tif (!localPlayerRoot) break;\n\n\t\tauto localPlayerState = ReadPointer(localPlayerPawn, Offsets::Engine::Pawn::PlayerState);\n\t\tif (!localPlayerState) break;\n\n\t\tauto localPlayerLocation = reinterpret_cast<float*>(reinterpret_cast<PBYTE>(localPlayerRoot) + Offsets::Engine::SceneComponent::RelativeLocation);\n\t\tauto localPlayerTeamIndex = ReadDWORD(localPlayerState, Offsets::FortniteGame::FortPlayerStateAthena::TeamIndex);\n\n\t\tauto weaponName = Util::GetObjectFirstName((UObject*)localPlayerWeapon);\n\t\tauto isProjectileWeapon = wcsstr(weaponName.c_str(), xorstr(L\"Rifle_Sniper\"));\n\n\t\tCore::LocalPlayerPawn = localPlayerPawn;\n\t\tCore::LocalPlayerController = localPlayerController;\n\n\n\t\tstd::vector<PVOID> playerPawns;\n\t\tfor (auto li = 0UL; li < ReadDWORD(world, Offsets::Engine::World::Levels + sizeof(PVOID)); ++li) {\n\t\t\tauto levels = ReadPointer(world, 0x138); //keks\n\t\t\tif (!levels) break;\n\n\t\t\tauto level = ReadPointer(levels, li * sizeof(PVOID));\n\t\t\tif (!level) continue;\n\n\t\t\tfor (auto ai = 0UL; ai < ReadDWORD(level, Offsets::Engine::Level::AActors + sizeof(PVOID)); ++ai) {\n\t\t\t\tauto actors = ReadPointer(level, Offsets::Engine::Level::AActors);\n\t\t\t\tif (!actors) break;\n\n\t\t\t\tauto pawn = reinterpret_cast<UObject*>(ReadPointer(actors, ai * sizeof(PVOID)));\n\t\t\t\tif (!pawn || pawn == localPlayerPawn) continue;\n\n\t\t\t\tauto name = Util::GetObjectFirstName(pawn);\n\t\t\t\tif (wcsstr(name.c_str(), xorstr(L\"PlayerPawn_Athena_C\")) || wcsstr(name.c_str(), xorstr(L\"PlayerPawn_Athena_Phoebe_C\")) || wcsstr(name.c_str(), xorstr(L\"BP_MangPlayerPawn\")) || wcsstr(name.c_str(), xorstr(L\"HoagieVehicle_C\"))) {\n\t\t\t\t\tplayerPawns.push_back(pawn);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if (config_system.item.Llama && wcsstr(name.c_str(), xorstr(L\"AthenaSupplyDrop_Llama\"))) {\n\t\t\t\t\tAddMarker(window, width, height, localPlayerLocation, pawn, xorstr(\"Llama\"), ImGui::GetColorU32({ 0.03f, 0.78f, 0.91f, 1.0f }));\n\t\t\t\t}\n\t\t\t\tif (config_system.item.Chest && wcsstr(name.c_str(), xorstr(L\"Tiered_Chest\")) && !((ReadBYTE(pawn, Offsets::FortniteGame::BuildingContainer::bAlreadySearched) >> 7) & 1)) {\n\t\t\t\t\tAddMarker(window, width, height, localPlayerLocation, pawn, xorstr(\"Chest\"), ImGui::GetColorU32({ 255,255,0,255 }));\n\t\t\t\t}\n\t\t\t\telse if (config_system.item.Ammo && wcsstr(name.c_str(), xorstr(L\"Tiered_Ammo\")) && !((ReadBYTE(pawn, Offsets::FortniteGame::BuildingContainer::bAlreadySearched) >> 7) & 1)) {\n\t\t\t\t\tAddMarker(window, width, height, localPlayerLocation, pawn, xorstr(\"Ammo Box\"), ImGui::GetColorU32({ 0.75f, 0.75f, 0.75f, 1.0f }));\n\t\t\t\t}\n\t\t\t\telse if (config_system.item.chopper && wcsstr(name.c_str(), xorstr(L\"HoagieVehicle_C\"))) {\n\n\t\t\t\t\tAddMarker(window, width, height, localPlayerLocation, pawn, xorstr(\"Chopper\"), ImGui::GetColorU32({ 1.0f, 0.0f, 0.0f, 1.0f }));\n\t\t\t\t}\n\t\t\t\telse if (config_system.item.boat && wcsstr(name.c_str(), xorstr(L\"MeatballVehicle_L\"))) {\n\n\t\t\t\t\tAddMarker(window, width, height, localPlayerLocation, pawn, xorstr(\"Boat\"), ImGui::GetColorU32({ 1.0f, 0.0f, 0.0f, 1.0f }));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfloat CurrentAimPointer[3] = { 0 };\n\t\tfloat AimPointer;\n\t\tif (config_system.item.AimPoint == 0) {\n\t\t\tAimPointer = BONE_HEAD_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 1) {\n\t\t\tAimPointer = BONE_NECK_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 2) {\n\t\t\tAimPointer = BONE_CHEST_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 3) {\n\t\t\tAimPointer = BONE_PELVIS_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 4) {\n\t\t\tAimPointer = BONE_RIGHTELBOW_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 5) {\n\t\t\tAimPointer = BONE_LEFTELBOW_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 6) {\n\t\t\tAimPointer = BONE_RIGHTTHIGH_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 7) {\n\t\t\tAimPointer = BONE_LEFTTHIGH_ID;\n\t\t}\n\t\telse if (config_system.item.AimPoint == 8) { // automatic\n\n\t\t}\n\n\t\tfor (auto pawn : playerPawns)\n\t\t{\n\t\t\tauto state = ReadPointer(pawn, Offsets::Engine::Pawn::PlayerState);\n\t\t\tif (!state) continue;\n\n\t\t\tauto mesh = ReadPointer(pawn, Offsets::Engine::Character::Mesh);\n\t\t\tif (!mesh) continue;\n\n\t\t\tauto bones = ReadPointer(mesh, Offsets::Engine::StaticMeshComponent::StaticMesh);\n\t\t\tif (!bones) bones = ReadPointer(mesh, Offsets::Engine::StaticMeshComponent::StaticMesh + 0x10);\n\t\t\tif (!bones) continue;\n\t\t\tfloat compMatrix[4][4] = { 0 };\n\t\t\tUtil::ToMatrixWithScale(reinterpret_cast<float*>(reinterpret_cast<PBYTE>(mesh) + 0x1C0), compMatrix);\n\n\t\t\t// Top\n\t\t\tfloat head[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 66, head);\n\n\t\t\tfloat neck[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 65, neck);\n\n\t\t\tfloat chest[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 36, chest);\n\n\t\t\tfloat pelvis[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 2, pelvis);\n\n\t\t\t// Arms\n\t\t\tfloat leftShoulder[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 9, leftShoulder);\n\n\t\t\tfloat rightShoulder[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 62, rightShoulder);\n\n\t\t\tfloat leftElbow[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 10, leftElbow);\n\n\t\t\tfloat rightElbow[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 38, rightElbow);\n\n\t\t\tfloat leftHand[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 11, leftHand);\n\n\t\t\tfloat rightHand[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 39, rightHand);\n\n\t\t\t// Legs\n\t\t\tfloat leftLeg[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 67, leftLeg);\n\n\t\t\tfloat rightLeg[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 74, rightLeg);\n\n\t\t\tfloat leftThigh[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 73, leftThigh);\n\n\t\t\tfloat rightThigh[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 80, rightThigh);\n\n\t\t\tfloat leftFoot[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 68, leftFoot);\n\n\t\t\tfloat rightFoot[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 75, rightFoot);\n\n\t\t\tfloat leftFeet[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 71, leftFeet);\n\n\t\t\tfloat rightFeet[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 78, rightFeet);\n\n\t\t\tfloat leftFeetFinger[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 72, leftFeetFinger);\n\n\t\t\tfloat rightFeetFinger[3] = { 0 };\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, 79, rightFeetFinger);\n\n\t\t\tUtil::GetBoneLocation(compMatrix, bones, AimPointer, CurrentAimPointer);\n\n\t\t\tauto color = ImGui::GetColorU32({ config_system.item.PlayerNotVisibleColor[0], config_system.item.PlayerNotVisibleColor[1], config_system.item.PlayerNotVisibleColor[2], 1.0f });\n\t\t\tFVector viewPoint = { 0 };\n\n\n\t\t\tif (ReadDWORD(state, 0xE60) == localPlayerTeamIndex) {\n\t\t\t\tcolor = ImGui::GetColorU32({ config_system.item.PlayerTeammate[0], config_system.item.PlayerTeammate[1], config_system.item.PlayerTeammate[2], 1.0f });\n\t\t\t}\n\t\t\telse if (!config_system.item.CheckVisible) {\n\t\t\t\tauto w2s = *reinterpret_cast<FVector*>(CurrentAimPointer);\n\t\t\t\tif (Util::WorldToScreen(width, height, &w2s.X)) {\n\t\t\t\t\tauto dx = w2s.X - (width / 2);\n\t\t\t\t\tauto dy = w2s.Y - (height / 2);\n\t\t\t\t\tauto dist = Util::SpoofCall(sqrtf, dx * dx + dy * dy);\n\t\t\t\t\tif (dist < config_system.item.AimbotFOV && dist < closestDistance) {\n\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if ((ReadBYTE(pawn, Offsets::FortniteGame::FortPawn::bIsDBNO) & 1) && (isProjectileWeapon || Util::LineOfSightTo(localPlayerController, pawn, &viewPoint))) {\n\t\t\t\tcolor = ImGui::GetColorU32({ config_system.item.PlayerVisibleColor[0], config_system.item.PlayerVisibleColor[1], config_system.item.PlayerVisibleColor[2], 1.0f });\n\t\t\t\tif (config_system.item.AutoAimbot) {\n\t\t\t\t\tif (config_system.item.AimPoint = 8) {\n\t\t\t\t\t\tUtil::GetBoneLocation(compMatrix, bones, BONE_HEAD_ID, CurrentAimPointer);\n\t\t\t\t\t\tauto dx = CurrentAimPointer[0] - localPlayerLocation[0];\n\t\t\t\t\t\tauto dy = CurrentAimPointer[1] - localPlayerLocation[1];\n\t\t\t\t\t\tauto dz = CurrentAimPointer[2] - localPlayerLocation[2];\n\t\t\t\t\t\tauto dist = dx * dx + dy * dy + dz * dz;\n\t\t\t\t\t\tif (dist < closestDistance) {\n\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tUtil::GetBoneLocation(compMatrix, bones, BONE_NECK_ID, CurrentAimPointer);\n\t\t\t\t\t\t\tauto dx = CurrentAimPointer[0] - localPlayerLocation[0];\n\t\t\t\t\t\t\tauto dy = CurrentAimPointer[1] - localPlayerLocation[1];\n\t\t\t\t\t\t\tauto dz = CurrentAimPointer[2] - localPlayerLocation[2];\n\t\t\t\t\t\t\tauto dist = dx * dx + dy * dy + dz * dz;\n\t\t\t\t\t\t\tif (dist < closestDistance) {\n\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tUtil::GetBoneLocation(compMatrix, bones, BONE_CHEST_ID, CurrentAimPointer);\n\t\t\t\t\t\t\t\tauto dx = CurrentAimPointer[0] - localPlayerLocation[0];\n\t\t\t\t\t\t\t\tauto dy = CurrentAimPointer[1] - localPlayerLocation[1];\n\t\t\t\t\t\t\t\tauto dz = CurrentAimPointer[2] - localPlayerLocation[2];\n\t\t\t\t\t\t\t\tauto dist = dx * dx + dy * dy + dz * dz;\n\t\t\t\t\t\t\t\tif (dist < closestDistance) {\n\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\tUtil::GetBoneLocation(compMatrix, bones, BONE_PELVIS_ID, CurrentAimPointer);\n\t\t\t\t\t\t\t\t\tauto dx = CurrentAimPointer[0] - localPlayerLocation[0];\n\t\t\t\t\t\t\t\t\tauto dy = CurrentAimPointer[1] - localPlayerLocation[1];\n\t\t\t\t\t\t\t\t\tauto dz = CurrentAimPointer[2] - localPlayerLocation[2];\n\t\t\t\t\t\t\t\t\tauto dist = dx * dx + dy * dy + dz * dz;\n\t\t\t\t\t\t\t\t\tif (dist < closestDistance) {\n\t\t\t\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tauto dx = CurrentAimPointer[0] - localPlayerLocation[0];\n\t\t\t\t\t\tauto dy = CurrentAimPointer[1] - localPlayerLocation[1];\n\t\t\t\t\t\tauto dz = CurrentAimPointer[2] - localPlayerLocation[2];\n\t\t\t\t\t\tauto dist = dx * dx + dy * dy + dz * dz;\n\t\t\t\t\t\tif (dist < closestDistance) {\n\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tauto w2s = *reinterpret_cast<FVector*>(CurrentAimPointer);\n\t\t\t\t\tif (Util::WorldToScreen(width, height, &w2s.X)) {\n\t\t\t\t\t\tauto dx = w2s.X - (width / 2);\n\t\t\t\t\t\tauto dy = w2s.Y - (height / 2);\n\t\t\t\t\t\tauto dist = Util::SpoofCall(sqrtf, dx * dx + dy * dy);\n\t\t\t\t\t\tif (dist < config_system.item.AimbotFOV && dist < closestDistance) {\n\t\t\t\t\t\t\tclosestDistance = dist;\n\t\t\t\t\t\t\tclosestPawn = pawn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\n\t\t\t//if (!config_system.item.Players) continue;\n\n\t\t\tif (config_system.item.PlayerLines) {\n\t\t\t\tauto end = *reinterpret_cast<FVector*>(CurrentAimPointer);\n\t\t\t\tif (Util::WorldToScreen(width, height, &end.X)) {\n\t\t\t\t\tif (ReadDWORD(state, 0xE60) != localPlayerTeamIndex) {\n\t\t\t\t\t\tif (config_system.item.LineESP) {\n\t\t\t\t\t\t\twindow.DrawList->AddLine(ImVec2(width / 2, height / 2), ImVec2(end.X, end.Y), ImGui::GetColorU32({ config_system.item.LineESP[0], config_system.item.LineESP[1], config_system.item.LineESP[2], 1.0f }));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfloat minX = FLT_MAX;\n\t\t\tfloat maxX = -FLT_MAX;\n\t\t\tfloat minY = FLT_MAX;\n\t\t\tfloat maxY = -FLT_MAX;\n\n\t\t\tif (config_system.item.Players) {\n\t\t\t\tAddLine(window, width, height, head, neck, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, neck, pelvis, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, chest, leftShoulder, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, chest, rightShoulder, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, leftShoulder, leftElbow, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, rightShoulder, rightElbow, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, leftElbow, leftHand, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, rightElbow, rightHand, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, pelvis, leftLeg, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, pelvis, rightLeg, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, leftLeg, leftThigh, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, rightLeg, rightThigh, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, leftThigh, leftFoot, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, rightThigh, rightFoot, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, leftFoot, leftFeet, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, rightFoot, rightFeet, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, leftFeet, leftFeetFinger, color, minX, maxX, minY, maxY);\n\t\t\t\tAddLine(window, width, height, rightFeet, rightFeetFinger, color, minX, maxX, minY, maxY);\n\t\t\t\t\n\t\t\t}\n\n\t\t\t/*float dist;\n\t\t\tif (dist >= 100)\n\t\t\t\tdist = 75;*/\n\n\t\t\tif (minX < width && maxX > 0 && minY < height && maxY > 0) {\n\n\t\t\t\t//ALL CORRECT\n\t\t\t\tauto topLeft = ImVec2(minX - 3.0f, minY - 3.0f);\n\t\t\t\tauto bottomRight = ImVec2(maxX + 3.0f, maxY);\n\t\t\t\tauto topRight = ImVec2(maxX + 3.0f, minY - 3.0f);\n\t\t\t\tauto bottomLeft = ImVec2(minX - 3.0f, maxY);\n\n\n\t\t\t\tif (config_system.item.PlayerBox) {\n\n\t\t\t\t\twindow.DrawList->AddRectFilled(topLeft, bottomRight, ImGui::GetColorU32({ 0.0f, 0.0f, 0.0f, 0.70f }));\n\t\t\t\t\twindow.DrawList->AddRect(topLeft, bottomRight, color, 0.2, 0, 0.1f);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\telse if (config_system.item.PlayersCorner) {\n\t\t\t\t\tauto bottomRightLEFT = ImVec2(maxX - 7.f + 75, maxY + 2.5f);\n\t\t\t\t\tauto bottomRightUP = ImVec2(maxX + 3.0f, maxY - 7.f + 75);\n\t\t\t\t\tauto topRight = ImVec2(maxX + 3.0f, minY - 3.0f);\n\t\t\t\t\tauto topRightLEFT = ImVec2(maxX - 7.f + 75, minY - 3.0f);\n\t\t\t\t\tauto topRightDOWN = ImVec2(maxX + 3.0f, minY + 7.f - 75);\n\n\t\t\t\t\tauto bottomLeft = ImVec2(minX - 3.0f, maxY + 3.f);\n\t\t\t\t\tauto bottomLeftRIGHT = ImVec2(minX + 7.f - 75, maxY + 3.f);\n\t\t\t\t\tauto bottomLeftUP = ImVec2(minX - 3.0f, maxY - 7.f + 75);\n\t\t\t\t\tauto topLeftRIGHT = ImVec2(minX + 7.f - 75, minY - 3.0f);\n\t\t\t\t\tauto topLeftDOWN = ImVec2(minX - 3.0f, minY + 7.f - 75);\n\n\n\t\t\t\t\twindow.DrawList->AddRectFilled(topLeft, bottomRight, ImGui::GetColorU32({ 0.0f, 0.0f, 0.0f, 0.70f }));\n\t\t\t\t\tImU32 kek = ImGui::GetColorU32({ ImGui::GetColorU32({ 1.f, 0.f, 0.f, 1.0f }) });\n\t\t\t\t\twindow.DrawList->AddLine(topLeft, topLeftRIGHT, color, 1.00f);\n\t\t\t\t\twindow.DrawList->AddLine(topLeft, topLeftDOWN, color, 1.00f);\n\n\t\t\t\t\twindow.DrawList->AddLine(bottomRight, bottomRightLEFT, color, 1.5f);\n\t\t\t\t\twindow.DrawList->AddLine(bottomRight, bottomRightUP, color, 1.5f);\n\n\t\t\t\t\twindow.DrawList->AddLine(topRight, topRightLEFT, color, 1.5f);\n\t\t\t\t\twindow.DrawList->AddLine(topRight, topRightDOWN, color, 1.5f);\n\n\t\t\t\t\twindow.DrawList->AddLine(bottomLeft, bottomLeftRIGHT, color, 1.5f);\n\t\t\t\t\twindow.DrawList->AddLine(bottomLeft, bottomLeftUP, color, 1.5f);\n\t\t\t\t}\n\t\t\t\tif (config_system.item.PlayerNames) {\n\t\t\t\t\tFString playerName;\n\t\t\t\t\tCore::ProcessEvent(state, Offsets::Engine::PlayerState::GetPlayerName, &playerName, 0);\n\t\t\t\t\tif (playerName.c_str()) {\n\t\t\t\t\t\tCHAR copy[0xFF] = { 0 };\n\t\t\t\t\t\tauto w2s = *reinterpret_cast<FVector*>(head);\n\t\t\t\t\t\tfloat dist;\n\t\t\t\t\t\tif (Util::WorldToScreen(width, height, &w2s.X)) {\n\t\t\t\t\t\t\tauto dx = w2s.X;\n\t\t\t\t\t\t\tauto dy = w2s.Y;\n\t\t\t\t\t\t\tauto dz = w2s.Z;\n\t\t\t\t\t\t\tdist = Util::SpoofCall(sqrtf, dx * dx + dy * dy + dz * dz) / 100.0f;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tCHAR lel[0xFF] = { 0 };\n\t\t\t\t\t\twcstombs(lel, playerName.c_str(), sizeof(lel));\n\t\t\t\t\t\tUtil::FreeInternal(playerName.c_str());\n\t\t\t\t\t\tsnprintf(copy, sizeof(copy), xorstr(\"%s [%dm]\"), lel, static_cast<INT>(dist));\n\t\t\t\t\t\tauto centerTop = ImVec2((topLeft.x + bottomRight.x) / 2.0f, topLeft.y);\n\t\t\t\t\t\tauto size = ImGui::GetFont()->CalcTextSizeA(window.DrawList->_Data->FontSize, FLT_MAX, 0, copy);\n\t\t\t\t\t\t//\twindow.DrawList->AddRectFilled(ImVec2(centerTop.x - size.x / 2.0f, centerTop.y - size.y + 3.0f), ImVec2(centerTop.x + size.x / 2.0f, centerTop.y), ImGui::GetColorU32({ 0.0f, 0.0f, 0.0f, 0.4f }));\n\t\t\t\t\t\tImVec2 kek = ImVec2(centerTop.x - size.x / 2.0f + 10, centerTop.y - size.y);\n\t\t\t\t\t\t//\twindow.DrawList->AddRectFilled(kek, ImVec2(centerTop.y - size.y), ImGui::GetColorU32({ 0.0f, 0.0f, 0.0f, 0.20f }));\n\t\t\t\t\t\tstd::string jsj = copy;\n\t\t\t\t\t\tif (jsj.find(streamsnipena) != std::string::npos) {\n\t\t\t\t\t\t\twindow.DrawList->AddText(ImVec2(centerTop.x - size.x / 2.0f + 10, centerTop.y - size.y), ImGui::GetColorU32({ 1.0f, 0.0f, 1.0f, 1.0f }), copy);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\twindow.DrawList->AddText(ImVec2(centerTop.x - size.x / 2.0f + 10, centerTop.y - size.y), color, copy);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (config_system.item.Aimbot && closestPawn && Util::SpoofCall(GetAsyncKeyState, config_system.keybind.AimbotLock) < 0 && Util::SpoofCall(GetForegroundWindow) == hWnd) {\n\t\t\tCore::TargetPawn = closestPawn;\n\t\t\tCore::NoSpread = TRUE;\n\t\t\tif (config_system.item.Aimbot && config_system.item.AntiAim && Util::SpoofCall(GetAsyncKeyState, config_system.keybind.AntiAim)) {\n\t\t\t\tint rnd = rand();\n\t\t\t\tFRotator args = { 0 };\n\t\t\t\targs.Yaw = rnd;\n\t\t\t\tCore::ProcessEvent(Core::LocalPlayerController, Offsets::Engine::Controller::ClientSetRotation, &args, 0);\n\t\t\t\t//mouse_event(000001, rnd, NULL, NULL, NULL); old anti aim\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tCore::TargetPawn = nullptr;\n\t\t\tCore::NoSpread = FALSE;\n\t\t}\n\n\t\tbool isSilent = config_system.item.SilentAimbot;\n\t\tbool isRage = config_system.item.AutoAimbot;\n\t\tif (config_system.item.SpinBot && Util::SpoofCall(GetAsyncKeyState, config_system.keybind.Spinbot) && Util::SpoofCall(GetForegroundWindow) == hWnd) {\n\t\t\tint rnd = rand();\n\t\t\tFRotator args = { 0 };\n\t\t\targs.Yaw = rnd;\n\t\t\tif (closestPawn) {\n\t\t\t\tCore::TargetPawn = closestPawn;\n\t\t\t\tCore::NoSpread = TRUE;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tCore::ProcessEvent(Core::LocalPlayerController, Offsets::Engine::Controller::ClientSetRotation, &args, 0);\n\t\t\t}\n\t\t\tconfig_system.item.AutoAimbot = true;\n\t\t\tconfig_system.item.SilentAimbot = true;\n\t\t}\n\t\telse {\n\t\t\tif (!isSilent) {\n\t\t\t\tconfig_system.item.SilentAimbot = false;\n\t\t\t}\n\t\t\tif (!isRage) {\n\t\t\t\tconfig_system.item.AutoAimbot = false;\n\t\t\t}\n\n\t\t\tif (config_system.item.SilentAimbot) {\n\t\t\t\tisSilent = true;\n\t\t\t}\n\t\t\tif (config_system.item.AutoAimbot) {\n\t\t\t\tisRage = true;\n\t\t\t}\n\t\t}\n\n\t\tif (config_system.item.FlickAimbot && closestPawn && Util::SpoofCall(GetAsyncKeyState, config_system.keybind.AimbotShoot) < 0 && Util::SpoofCall(GetForegroundWindow) == hWnd) {\n\t\t\tCore::TargetPawn = closestPawn;\n\t\t\tCore::NoSpread = TRUE;\n\t\t}\n\n\t\tif (config_system.item.AutoAim && closestPawn && Util::SpoofCall(GetForegroundWindow) == hWnd) {\n\t\t\t//mouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);\n\t\t\tCore::TargetPawn = closestPawn;\n\t\t\tCore::NoSpread = TRUE;\n\t\t}\n\n\t\tif (config_system.item.SpamAutoAim && closestPawn && Util::SpoofCall(GetForegroundWindow) == hWnd) {\n\t\t\tmouse_event(MOUSEEVENTF_RIGHTDOWN, 0, 0, 0, 0);\n\t\t\tCore::TargetPawn = closestPawn;\n\t\t\tCore::NoSpread = TRUE;\n\t\t\tmouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, 0);\n\t\t\tCore::TargetPawn = nullptr;\n\t\t\tCore::NoSpread = FALSE;\n\t\t}\n\n\t\tif (config_system.item.DrawAimbotFOV) {\n\t\t\twindow.DrawList->AddCircle(ImVec2(width / 2, height / 2), config_system.item.AimbotFOV, ImGui::GetColorU32({ config_system.item.FOVCircleColor[0], config_system.item.FOVCircleColor[1], config_system.item.FOVCircleColor[2], config_system.item.FOVCircleOpacity }), 128);\n\t\t\tif (config_system.item.DrawFilledAimbotFOV) {\n\t\t\t\twindow.DrawList->AddCircleFilled(ImVec2(width / 2, height / 2), config_system.item.AimbotFOV, ImGui::GetColorU32({ 0.0f, 0.0f, 0.0f, config_system.item.FOVCircleFilledOpacity }), 128);\n\t\t\t}\n\t\t}\n\n\t\tif (&config_system.item.CrosshairSize) {\n\t\t\t//base crosshair\n\t\t\twindow.DrawList->AddLine(ImVec2(width / 2 + config_system.item.CrosshairSize, height / 2), ImVec2(width / 2 - config_system.item.CrosshairSize, height / 2), ImGui::GetColorU32({ config_system.item.FOVCircleColor[0], config_system.item.FOVCircleColor[1], config_system.item.FOVCircleColor[2], 1.0f }), config_system.item.CrosshairThickness);\n\t\t\twindow.DrawList->AddLine(ImVec2(width / 2, height / 2 + config_system.item.CrosshairSize), ImVec2(width / 2, height / 2 - config_system.item.CrosshairSize), ImGui::GetColorU32({ config_system.item.FOVCircleColor[0], config_system.item.FOVCircleColor[1], config_system.item.FOVCircleColor[2], 1.0f }), config_system.item.CrosshairThickness);\n\n\t\t\t//fancy crosshair\n\t\t\twindow.DrawList->AddLine(ImVec2(width / 2 + config_system.item.CrosshairSize / 2, height / 2), ImVec2(width / 2 - config_system.item.CrosshairSize / 2, height / 2), ImGui::GetColorU32({ 1.0f, 0.0f, 0.0f, 1.0f }), config_system.item.CrosshairThickness);\n\t\t\twindow.DrawList->AddLine(ImVec2(width / 2, height / 2 + config_system.item.CrosshairSize / 2), ImVec2(width / 2, height / 2 - config_system.item.CrosshairSize / 2), ImGui::GetColorU32({ 1.0f, 0.0f, 1.0f, 0.0f }), config_system.item.CrosshairThickness);\n\t\t}\n\n\t\tsuccess = TRUE;\n\t} while (FALSE);\n\n\tif (!success) {\n\t\tCore::LocalPlayerController = Core::LocalPlayerPawn = Core::TargetPawn = nullptr;\n\t}\n\tEndScene(window);\n\treturn PresentOriginal(swapChain, syncInterval, flags);\n}\n\n\n\n__declspec(dllexport) HRESULT ResizeHook(IDXGISwapChain* swapChain, UINT bufferCount, UINT width, UINT height, DXGI_FORMAT newFormat, UINT swapChainFlags) {\n\tImGui_ImplDX11_Shutdown();\n\trenderTargetView->Release();\n\timmediateContext->Release();\n\tdevice->Release();\n\tdevice = nullptr;\n\n\treturn ResizeOriginal(swapChain, bufferCount, width, height, newFormat, swapChainFlags);\n}\n\n\nbool Render::Initialize() {\n\tIDXGISwapChain* swapChain = nullptr;\n\tID3D11Device* device = nullptr;\n\tID3D11DeviceContext* context = nullptr;\n\tauto featureLevel = D3D_FEATURE_LEVEL_11_0;\n\n\tDXGI_SWAP_CHAIN_DESC sd = { 0 };\n\tsd.BufferCount = 1;\n\tsd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;\n\tsd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;\n\tsd.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;\n\tsd.OutputWindow = FindWindow(xorstr(L\"UnrealWindow\"), xorstr(L\"Fortnite  \"));\n\tsd.SampleDesc.Count = 1;\n\tsd.Windowed = TRUE;\n\n\tif (FAILED(D3D11CreateDeviceAndSwapChain(nullptr, D3D_DRIVER_TYPE_HARDWARE, 0, 0, &featureLevel, 1, D3D11_SDK_VERSION, &sd, &swapChain, &device, nullptr, &context))) {\n\t\tMessageBox(0, xorstr(L\"Critical error have happened\\nPlease contact an admin with the error code:\\n0x0001b\"), xorstr(L\"Error\"), MB_ICONERROR);\n\t\treturn FALSE;\n\t}\n\n\tauto table = *reinterpret_cast<PVOID**>(swapChain);\n\tauto present = table[8];\n\tauto resize = table[13];\n\n\tcontext->Release();\n\tdevice->Release();\n\tswapChain->Release();\n\n\tconst auto pcall_present_discord = Helper::PatternScan(Discord::GetDiscordModuleBase(), xorstr(\"FF 15 ? ? ? ? 8B D8 E8 ? ? ? ? E8 ? ? ? ? EB 10\"));\n\tauto presentSceneAdress = Helper::PatternScan(Discord::GetDiscordModuleBase(),\n\t\txorstr(\"56 57 53 48 83 EC 30 44 89 C6\"));\n\n\tDISCORD.HookFunction(presentSceneAdress, (uintptr_t)PresentHook, (uintptr_t)&PresentOriginal);\n\n\tDISCORD.HookFunction(presentSceneAdress, (uintptr_t)ResizeHook, (uintptr_t)&PresentOriginal);\n\treturn TRUE;\n}\n\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/offsets/offsets.cpp",
    "content": "/*\n\nVisual#9999\n*/\n\n#include \"../../Header Files/xorstr.h\"\n#include \"../../imgui/imgui_xorstr.h\"\n#include \"../Header Files/includes.h\"\nnamespace Offsets {\n\tPVOID* uWorld = 0;\n\n\tnamespace Engine {\n\t\tnamespace World {\n\t\t\tDWORD OwningGameInstance = 0;\n\t\t\tDWORD Levels = 0;\n\t\t}\n\n\t\tnamespace Level {\n\t\t\tDWORD AActors = 0;\n\t\t}\n\n\t\tnamespace GameInstance {\n\t\t\tDWORD LocalPlayers = 0;\n\t\t}\n\n\t\tnamespace Player {\n\t\t\tDWORD PlayerController = 0;\n\t\t}\n\n\t\tnamespace Controller {\n\t\t\tDWORD ControlRotation = 0;\n\t\t\tPVOID SetControlRotation = 0;\n\t\t\tPVOID ClientSetRotation;\n\t\t}\n\n\t\tnamespace PlayerController {\n\t\t\tDWORD AcknowledgedPawn = 0;\n\t\t\tDWORD PlayerCameraManager = 0;\n\t\t}\n\n\t\tnamespace Pawn {\n\t\t\tDWORD PlayerState = 0;\n\t\t}\n\n\t\tnamespace PlayerState {\n\t\t\tPVOID GetPlayerName = 0;\n\t\t}\n\n\t\tnamespace Actor {\n\t\t\tDWORD RootComponent = 0;\n\t\t\tDWORD CustomTimeDilation = 0;\n\t\t}\n\n\t\tnamespace Character {\n\t\t\tDWORD Mesh = 0;\n\t\t}\n\n\t\tnamespace SceneComponent {\n\t\t\tDWORD RelativeLocation = 0;\n\t\t\tDWORD ComponentVelocity = 0;\n\t\t}\n\n\t\tnamespace StaticMeshComponent {\n\t\t\tDWORD ComponentToWorld = 0;\n\t\t\tDWORD StaticMesh = 0;\n\t\t}\n\n\t\tnamespace SkinnedMeshComponent {\n\t\t\tDWORD CachedWorldSpaceBounds = 0;\n\t\t}\n\t}\n\n\tnamespace FortniteGame {\n\t\tnamespace FortPawn {\n\t\t\tDWORD bIsDBNO = 0;\n\t\t\tDWORD bIsDying = 0;\n\t\t\tDWORD CurrentWeapon = 0;\n\t\t}\n\n\t\tnamespace FortPickup {\n\t\t\tDWORD PrimaryPickupItemEntry = 0;\n\t\t}\n\n\t\tnamespace FortItemEntry {\n\t\t\tDWORD ItemDefinition = 0;\n\t\t}\n\n\t\tnamespace FortItemDefinition {\n\t\t\tDWORD DisplayName = 0;\n\t\t\tDWORD Tier = 0;\n\t\t}\n\n\t\tnamespace FortPlayerStateAthena {\n\t\t\tDWORD TeamIndex = 0;\n\t\t}\n\n\t\tnamespace FortWeapon {\n\t\t\tDWORD WeaponData = 0;\n\t\t\tDWORD AmmoCount = 0;\n\t\t}\n\n\t\tnamespace FortHoagieVehicle {\n\t\t\tDWORD BoostCooldown = 0;\n\t\t}\n\n\t\tnamespace FortWeaponItemDefinition {\n\t\t\tDWORD WeaponStatHandle = 0;\n\t\t}\n\n\t\tnamespace FortProjectileAthena {\n\t\t\tDWORD FireStartLoc = 0;\n\t\t}\n\n\t\tnamespace FortBaseWeaponStats {\n\t\t\tDWORD ReloadTime = 0;\n\t\t}\n\n\t\tnamespace BuildingContainer {\n\t\t\tDWORD bAlreadySearched = 0;\n\t\t}\n\t}\n\n\tnamespace UI {\n\t\tnamespace ItemCount {\n\t\t\tDWORD ItemDefinition = 0;\n\t\t}\n\t}\n\n\tBOOLEAN Initialize() {\n\t\tauto addr = Util::FindPattern(xorstr(\"\\x48\\x89\\x05\\x00\\x00\\x00\\x00\\x48\\x8B\\x4B\\x78\"), xorstr(\"xxx????xxxx\"));\n\t\tif (!addr) {\n\t\t\tMessageBox(0, xorstr(L\"Please contact an administrator and give the error code:\\n0x08\"), xorstr(L\"Error\"), 0);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tuWorld = reinterpret_cast<decltype(uWorld)>(RELATIVE_ADDR(addr, 7));\n\n\t\t// SetControlRotation\n\t\tEngine::Controller::SetControlRotation = Util::FindObject(xorstr(L\"/Script/Engine.Controller.SetControlRotation\"));\n\t\tif (!Engine::Controller::SetControlRotation) {\n\t\t\tMessageBox(0, xorstr(L\"Please contact an administrator and give the error code:\\n0x09\"), xorstr(L\"Error\"), 0);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// ClientSetRotation\n\t\tEngine::Controller::ClientSetRotation = Util::FindObject(xorstr(L\"/Script/Engine.Controller.ClientSetRotation\"));\n\t\tif (!Engine::Controller::ClientSetRotation) {\n\t\t\tMessageBox(0, xorstr(L\"Please contact an administrator and give the error code:\\n0x10\"), xorstr(L\"Error\"), 0);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\t// GetPlayerName\n\t\tEngine::PlayerState::GetPlayerName = Util::FindObject(xorstr(L\"/Script/Engine.PlayerState.GetPlayerName\"));\n\t\tif (!Engine::PlayerState::GetPlayerName) {\n\t\t\tMessageBox(0, xorstr(L\"Please contact an administrator and give the error code:\\n0x11\"), xorstr(L\"Error\"), 0);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tEngine::World::Levels = 0x148;\n\t\tEngine::GameInstance::LocalPlayers = 0x38;\n\t\tEngine::World::OwningGameInstance = 0x190;\n\t\tEngine::Controller::ControlRotation = 0x290;\n\t\tEngine::PlayerController::PlayerCameraManager = 0x2C0;\n\t\tEngine::PlayerController::AcknowledgedPawn = 0x2B0;\n\t\tEngine::Pawn::PlayerState = 0x240;\n\t\tEngine::Actor::RootComponent = 0x138;\n\t\tEngine::Character::Mesh = 0x288;\n\t\tEngine::SceneComponent::RelativeLocation = 0x11C;\n\t\tEngine::SceneComponent::ComponentVelocity = 0x140;\n\t\tEngine::StaticMeshComponent::StaticMesh = 0x488;\n\t\tEngine::SkinnedMeshComponent::CachedWorldSpaceBounds = 0x638;\n\t\tEngine::Actor::CustomTimeDilation = 0x98;\n\t\tFortniteGame::FortPawn::bIsDBNO = 0x572;\n\t\tFortniteGame::FortPawn::bIsDying = 0x548;\n\t\tFortniteGame::FortPlayerStateAthena::TeamIndex = 0xF50;\n\t\tFortniteGame::FortPickup::PrimaryPickupItemEntry = 0x2A8;\n\t\tFortniteGame::FortItemDefinition::DisplayName = 0x88;\n\t\tFortniteGame::FortItemDefinition::Tier = 0x6C;\n\t\tFortniteGame::FortItemEntry::ItemDefinition = 0x18;\n\t\tFortniteGame::FortPawn::CurrentWeapon = 0x5F8;\n\t\tFortniteGame::FortWeapon::WeaponData = 0x380;\n\t\tFortniteGame::FortWeaponItemDefinition::WeaponStatHandle = 0x8B8;\n\t\tFortniteGame::FortProjectileAthena::FireStartLoc = 0x8C8;\n\t\tFortniteGame::FortBaseWeaponStats::ReloadTime = 0xFC;\n\t\tFortniteGame::BuildingContainer::bAlreadySearched = 0xE01; \n\n\n\t\treturn TRUE;\n\n\n\n\t}\n}\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/settings/settings.cpp",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n#include \"../../Header Files/includes.h\"\n#include \"../../Header Files/Config/config.h\"\n#include \"../../Header Files/xorstr.h\"\n#include \"../../imgui/imgui_xorstr.h\"\n\n//config_system Settings = { 0 };\n\nnamespace SettingsHelper {\n\tVOID SaveSettings() {\n\t\tCHAR path[0xFF];\n\t\tGetTempPathA(sizeof(path) / sizeof(path[0]), path);\n\t\tstrcat(path, (xorstr(\"fnambt.settings\")));\n\n\t\tauto file = fopen(path, (xorstr(\"wb\")));\n\t\tif (file) {\n\t\t\tfwrite(&config_system.item, sizeof(config_system.item), 1, file);\n\t\t\tfclose(file);\n\t\t}\n\t}\n\n\tVOID ResetSettings() {\n\t\tconfig_system.item = { 0 };\n\t\tconfig_system.item.Page = 1;\n\t\tconfig_system.item.AimPoint = 0;\n\t\tconfig_system.item.Aimbot = true;\n\t\tconfig_system.item.SilentAimbot = false;\n\t\tconfig_system.item.FlickAimbot = false;\n\t\tconfig_system.item.SpinBot = false;\n\t\tconfig_system.item.AutoAim = false;\n\t\tconfig_system.item.SpamAutoAim = false;\n\t\tconfig_system.item.TriggerAimbot = false;\n\t\tconfig_system.item.TriggerSpeed = 0;\n\t\tconfig_system.item.AutoAimbot = false;\n\t\tconfig_system.item.NoSpreadAimbot = false;\n\t\tconfig_system.item.RapidFire = false;\n\t\tconfig_system.item.BulletTP = false;\n\t\tconfig_system.item.ARTP = false;\n\t\tconfig_system.item.BoatRocketTP = false;\n\t\tconfig_system.item.RocketTP = false;\n\t\tconfig_system.item.BetterMap = false;\n\t\tconfig_system.item.ThirdPerson = true;\n\t\tconfig_system.item.AirStuck = false;\n\t\tconfig_system.item.AntiAim = false;\n\t\tconfig_system.item.FreeCamRotationLock = false;\n\t\tconfig_system.item.FreeCam = false;\n\t\tconfig_system.item.FreeCamSpeed = 1.00f;\n\t\tconfig_system.item.CheckVisible = false;\n\t\tconfig_system.item.AimbotFOV = 200.0f;\n\t\tconfig_system.item.AimbotSlow = 0.0f;\n\t\tconfig_system.item.InstantReload = false;\n\t\tconfig_system.item.StreamSnipe = false;\n\t\tconfig_system.item.FOVSlider = true;\n\t\tconfig_system.item.FOV = 120.0f;\n\t\tconfig_system.item.FOV = true;\n\t\tconfig_system.item.DrawAimbotFOV = true;\n\t\tconfig_system.item.DrawFilledAimbotFOV = true;\n\t\tconfig_system.item.CrosshairSize = 0.0f;\n\t\tconfig_system.item.CrosshairThickness = 0.0f;\n\t\tconfig_system.item.AimbotFOV = true;\n\t\tconfig_system.item.Players = true;\n\t\tconfig_system.item.PlayerBox = true;\n\t\tconfig_system.item.PlayersCorner = false;\n\t\tconfig_system.item.PlayerLines = true;\n\t\tconfig_system.item.ClosestLineESP = true;\n\t\tconfig_system.item.PlayerLinesLocation = 1;\n\t\tconfig_system.item.PlayerNames = true;\n\t\tconfig_system.item.BoxESPOpacity = 0.20f;\n\t\tconfig_system.item.FOVCircleOpacity = 1.00f;\n\t\tconfig_system.item.FOVCircleFilledOpacity = 0.20f;\n\t\tconfig_system.item.PlayerVisibleColor[0] = 0.0f;\n\t\tconfig_system.item.PlayerVisibleColor[1] = 0.0f;\n\t\tconfig_system.item.PlayerVisibleColor[2] = 1.0f;\n\t\tconfig_system.item.PlayerNotVisibleColor[0] = 0.0f;\n\t\tconfig_system.item.PlayerNotVisibleColor[1] = 0.0f;\n\t\tconfig_system.item.PlayerNotVisibleColor[2] = 0.0f;\n\t\tconfig_system.item.PlayerTeammate[0] = 0.0f;\n\t\tconfig_system.item.PlayerTeammate[1] = 0.75f;\n\t\tconfig_system.item.PlayerTeammate[2] = 0.0f;\n\t\tconfig_system.item.FOVCircleColor[0] = 0.0f;\n\t\tconfig_system.item.FOVCircleColor[1] = 0.20f;\n\t\tconfig_system.item.FOVCircleColor[2] = 0.0f;\n\t\tconfig_system.item.BoxESP[0] = 0.0f;\n\t\tconfig_system.item.BoxESP[1] = 0.0f;\n\t\tconfig_system.item.BoxESP[2] = 0.0f;\n\t\tconfig_system.item.LineESP[0] = 0.46f;\n\t\tconfig_system.item.LineESP[1] = 0.0f;\n\t\tconfig_system.item.LineESP[2] = 0.0f;\n\t\tconfig_system.item.Ammo = true;\n\t\tconfig_system.item.Chest = true;\n\t\tconfig_system.item.Llama = true;\n\t\tconfig_system.item.boat = true;\n\t\tconfig_system.item.chopper = true;\n\t\tconfig_system.item.Extra = true;\n\n\t\t// keybinds\n\t\tconfig_system.keybind.Menu = 0x2D;\n\t\tconfig_system.keybind.AimbotLock = 0x02;\n\t\tconfig_system.keybind.AimbotShoot = 0x01;\n\t\tconfig_system.keybind.AntiAim = 0x01;\n\t\tconfig_system.keybind.Spinbot = 0x14;\n\t\tconfig_system.keybind.Freecam = 0;\n\t\tconfig_system.keybind.StreamSnipe = 0;\n\t\tconfig_system.keybind.ThirdPerson = 0;\n\t\tconfig_system.keybind.Airstuck1 = 0;\n\t\tconfig_system.keybind.Airstuck2 = 0;\n\n\t\tSaveSettings();\n\t}\n\n\tVOID Initialize() {\n\t\tCHAR path[0xFF] = { 0 };\n\t\tGetTempPathA(sizeof(path) / sizeof(path[0]), path);\n\t\tstrcat(path, (xorstr(\"fnambt.settings\")));\n\n\t\tauto file = fopen(path, (xorstr(\"rb\")));\n\t\tif (file) {\n\t\t\tfseek(file, 0, SEEK_END);\n\t\t\tauto size = ftell(file);\n\n\t\t\tif (size == sizeof(config_system.item)) {\n\t\t\t\tfseek(file, 0, SEEK_SET);\n\t\t\t\tfread(&config_system.item, sizeof(config_system.item), 1, file);\n\t\t\t\tfclose(file);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tfclose(file);\n\t\t\t\tResetSettings();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tResetSettings();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/Source Files/util/Util.cpp",
    "content": "/*\n\nVisual#9999\n\n*/\n\n#include \"../../Header Files/includes.h\"\n#include \"../../DiscordHook/Discord.h\"\n#include \"../../Header Files/xorstr.h\"\n#include \"../../imgui/imgui_xorstr.h\"\n#include <corecrt_math.h>\n\nnamespace Util {\n\tGObjects* objects = nullptr;\n\tFString(*GetObjectNameInternal)(PVOID) = nullptr;\n\tVOID(*FreeInternal)(PVOID) = nullptr;\n\tBOOL(*LineOfSightToInternal)(PVOID PlayerController, PVOID Actor, FVector* ViewPoint) = nullptr;\n\tVOID(*CalculateProjectionMatrixGivenView)(FMinimalViewInfo* viewInfo, BYTE aspectRatioAxisConstraint, PBYTE viewport, FSceneViewProjectionData* inOutProjectionData) = nullptr;\n\n\tstruct {\n\t\tFMinimalViewInfo Info;\n\t\tfloat ProjectionMatrix[4][4];\n\t} view = { 0 };\n\n\tVOID CreateConsole() {\n\t\tAllocConsole();\n\t\tstatic_cast<VOID>(freopen(\"CONIN$\", xorstr(\"r\"), stdin));\n\t\tstatic_cast<VOID>(freopen(\"CONOUT$\", xorstr(\"w\"), stdout));\n\t\tstatic_cast<VOID>(freopen(\"CONOUT$\", xorstr(\"w\"), stderr));\n\t}\n\n\tBOOLEAN MaskCompare(PVOID buffer, LPCSTR pattern, LPCSTR mask) {\n\t\tfor (auto b = reinterpret_cast<PBYTE>(buffer); *mask; ++pattern, ++mask, ++b) {\n\t\t\tif (*mask == ('x') && *reinterpret_cast<LPCBYTE>(pattern) != *b) {\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\n\t\treturn TRUE;\n\t}\n\n\tPBYTE FindPattern(PVOID base, DWORD size, LPCSTR pattern, LPCSTR mask) {\n\t\tsize -= static_cast<DWORD>(strlen(mask));\n\n\t\tfor (auto i = 0UL; i < size; ++i) {\n\t\t\tauto addr = reinterpret_cast<PBYTE>(base) + i;\n\t\t\tif (MaskCompare(addr, pattern, mask)) {\n\t\t\t\treturn addr;\n\t\t\t}\n\t\t}\n\n\t\treturn NULL;\n\t}\n\n\tPBYTE FindPattern(LPCSTR pattern, LPCSTR mask) {\n\t\tMODULEINFO info = { 0 };\n\t\tGetModuleInformation(GetCurrentProcess(), GetModuleHandle(0), &info, sizeof(info));\n\n\t\treturn FindPattern(info.lpBaseOfDll, info.SizeOfImage, pattern, mask);\n\t}\n\n\tVOID Free(PVOID buffer) {\n\t\tFreeInternal(buffer);\n\t}\n\n\tstd::wstring GetObjectFirstName(UObject* object) {\n\t\tauto internalName = GetObjectNameInternal(object);\n\t\tif (!internalName.c_str()) {\n\t\t\treturn L\"\";\n\t\t}\n\n\t\tstd::wstring name(internalName.c_str());\n\t\tFree(internalName.c_str());\n\n\t\treturn name;\n\t}\n\n\tstd::wstring GetObjectName(UObject* object) {\n\t\tstd::wstring name(L\"\");\n\t\tfor (auto i = 0; object; object = object->Outer, ++i) {\n\t\t\tauto internalName = GetObjectNameInternal(object);\n\t\t\tif (!internalName.c_str()) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tname = internalName.c_str() + std::wstring(i > 0 ? (xorstr(L\".\")) : xorstr(L\"\")) + name;\n\t\t\tFree(internalName.c_str());\n\t\t}\n\n\t\treturn name;\n\t}\n\n\tBOOLEAN GetOffsets(std::vector<Offsets::OFFSET>& offsets) {\n\t\tauto current = 0ULL;\n\t\tauto size = offsets.size();\n\n\t\tfor (auto array : objects->ObjectArray->Objects) {\n\t\t\tauto fuObject = array;\n\t\t\tfor (auto i = 0; i < 0x10000 && fuObject->Object; ++i, ++fuObject) {\n\t\t\t\tauto object = fuObject->Object;\n\t\t\t\tif (object->ObjectFlags != 0x41) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tauto name = GetObjectName(object);\n\t\t\t\tfor (auto& o : offsets) {\n\t\t\t\t\tif (!o.Offset && name == o.Name) {\n\t\t\t\t\t\to.Offset = *reinterpret_cast<PDWORD>(reinterpret_cast<PBYTE>(object) + 0x44);\n\n\t\t\t\t\t\tif (++current == size) {\n\t\t\t\t\t\t\treturn TRUE;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (auto& o : offsets) {\n\t\t\tif (!o.Offset) {\n\t\t\t\tWCHAR buffer[0xFF] = { 0 };\n\t\t\t\twsprintf(buffer, xorstr(L\"Offset %ws not found\"), o.Name);\n\t\t\t\tMessageBox(0, buffer, xorstr(L\"Failure\"), 0);\n\t\t\t}\n\t\t}\n\n\t\treturn FALSE;\n\t}\n\n\tPVOID FindObject(LPCWSTR name) {\n\t\tfor (auto array : objects->ObjectArray->Objects) {\n\t\t\tauto fuObject = array;\n\t\t\tfor (auto i = 0; i < 0x10000 && fuObject->Object; ++i, ++fuObject) {\n\t\t\t\tauto object = fuObject->Object;\n\t\t\t\tif (object->ObjectFlags != 0x41) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif (GetObjectName(object) == name) {\n\t\t\t\t\treturn object;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tVOID ToMatrixWithScale(float* in, float out[4][4])\n\t{\n\t\tauto* rotation = &in[0];\n\t\tauto* translation = &in[4];\n\t\tauto* scale = &in[8];\n\n\t\tout[3][0] = translation[0];\n\t\tout[3][1] = translation[1];\n\t\tout[3][2] = translation[2];\n\n\t\tauto x2 = rotation[0] + rotation[0];\n\t\tauto y2 = rotation[1] + rotation[1];\n\t\tauto z2 = rotation[2] + rotation[2];\n\n\t\tauto xx2 = rotation[0] * x2;\n\t\tauto yy2 = rotation[1] * y2;\n\t\tauto zz2 = rotation[2] * z2;\n\t\tout[0][0] = (1.0f - (yy2 + zz2)) * scale[0];\n\t\tout[1][1] = (1.0f - (xx2 + zz2)) * scale[1];\n\t\tout[2][2] = (1.0f - (xx2 + yy2)) * scale[2];\n\n\t\tauto yz2 = rotation[1] * z2;\n\t\tauto wx2 = rotation[3] * x2;\n\t\tout[2][1] = (yz2 - wx2) * scale[2];\n\t\tout[1][2] = (yz2 + wx2) * scale[1];\n\n\t\tauto xy2 = rotation[0] * y2;\n\t\tauto wz2 = rotation[3] * z2;\n\t\tout[1][0] = (xy2 - wz2) * scale[1];\n\t\tout[0][1] = (xy2 + wz2) * scale[0];\n\n\t\tauto xz2 = rotation[0] * z2;\n\t\tauto wy2 = rotation[3] * y2;\n\t\tout[2][0] = (xz2 + wy2) * scale[2];\n\t\tout[0][2] = (xz2 - wy2) * scale[0];\n\n\t\tout[0][3] = 0.0f;\n\t\tout[1][3] = 0.0f;\n\t\tout[2][3] = 0.0f;\n\t\tout[3][3] = 1.0f;\n\t}\n\n\tVOID MultiplyMatrices(float a[4][4], float b[4][4], float out[4][4]) {\n\t\tfor (auto r = 0; r < 4; ++r) {\n\t\t\tfor (auto c = 0; c < 4; ++c) {\n\t\t\t\tauto sum = 0.0f;\n\n\t\t\t\tfor (auto i = 0; i < 4; ++i) {\n\t\t\t\t\tsum += a[r][i] * b[i][c];\n\t\t\t\t}\n\n\t\t\t\tout[r][c] = sum;\n\t\t\t}\n\t\t}\n\t}\n\n\tVOID GetBoneLocation(float compMatrix[4][4], PVOID bones, DWORD index, float out[3]) {\n\t\tfloat boneMatrix[4][4];\n\t\tToMatrixWithScale((float*)((PBYTE)bones + (index * 0x30)), boneMatrix);\n\n\t\tfloat result[4][4];\n\t\tMultiplyMatrices(boneMatrix, compMatrix, result);\n\n\t\tout[0] = result[3][0];\n\t\tout[1] = result[3][1];\n\t\tout[2] = result[3][2];\n\t}\n\n\tVOID GetViewProjectionMatrix(FSceneViewProjectionData* projectionData, float out[4][4]) {\n\t\tauto loc = &projectionData->ViewOrigin;\n\n\t\tfloat translation[4][4] = {\n\t\t\t{ 1.0f, 0.0f, 0.0f, 0.0f, },\n\t\t\t{ 0.0f, 1.0f, 0.0f, 0.0f, },\n\t\t\t{ 0.0f, 0.0f, 1.0f, 0.0f, },\n\t\t\t{ -loc->X, -loc->Y, -loc->Z, 0.0f, },\n\t\t};\n\n\t\tfloat temp[4][4];\n\t\tMultiplyMatrices(translation, projectionData->ViewRotationMatrix.M, temp);\n\t\tMultiplyMatrices(temp, projectionData->ProjectionMatrix.M, out);\n\t}\n\n\tBOOLEAN ProjectWorldToScreen(float viewProjection[4][4], float width, float height, float inOutPosition[3]) {\n\t\tfloat res[4] = {\n\t\t\tviewProjection[0][0] * inOutPosition[0] + viewProjection[1][0] * inOutPosition[1] + viewProjection[2][0] * inOutPosition[2] + viewProjection[3][0],\n\t\t\tviewProjection[0][1] * inOutPosition[0] + viewProjection[1][1] * inOutPosition[1] + viewProjection[2][1] * inOutPosition[2] + viewProjection[3][1],\n\t\t\tviewProjection[0][2] * inOutPosition[0] + viewProjection[1][2] * inOutPosition[1] + viewProjection[2][2] * inOutPosition[2] + viewProjection[3][2],\n\t\t\tviewProjection[0][3] * inOutPosition[0] + viewProjection[1][3] * inOutPosition[1] + viewProjection[2][3] * inOutPosition[2] + viewProjection[3][3],\n\t\t};\n\n\t\tauto r = res[3];\n\t\tif (r > 0) {\n\t\t\tauto rhw = 1.0f / r;\n\n\t\t\tinOutPosition[0] = (((res[0] * rhw) / 2.0f) + 0.5f) * width;\n\t\t\tinOutPosition[1] = (0.5f - ((res[1] * rhw) / 2.0f)) * height;\n\t\t\tinOutPosition[2] = r;\n\n\t\t\treturn TRUE;\n\t\t}\n\n\t\treturn FALSE;\n\t}\n\n\tVOID CalculateProjectionMatrixGivenViewHook(FMinimalViewInfo* viewInfo, BYTE aspectRatioAxisConstraint, PBYTE viewport, FSceneViewProjectionData* inOutProjectionData) {\n\t\tCalculateProjectionMatrixGivenView(viewInfo, aspectRatioAxisConstraint, viewport, inOutProjectionData);\n\n\t\tview.Info = *viewInfo;\n\t\tGetViewProjectionMatrix(inOutProjectionData, view.ProjectionMatrix);\n\t}\n\n\tBOOLEAN WorldToScreen(float width, float height, float inOutPosition[3]) {\n\t\treturn ProjectWorldToScreen(view.ProjectionMatrix, width, height, inOutPosition);\n\t}\n\n\tBOOLEAN LineOfSightTo(PVOID PlayerController, PVOID Actor, FVector* ViewPoint) {\n\t\treturn SpoofCall(LineOfSightToInternal, PlayerController, Actor, ViewPoint);\n\t}\n\n\tFMinimalViewInfo& GetViewInfo() {\n\t\treturn view.Info;\n\t}\n\n\tFVector* GetPawnRootLocation(PVOID pawn) {\n\t\tauto root = ReadPointer(pawn, Offsets::Engine::Actor::RootComponent);\n\t\tif (!root) {\n\t\t\treturn nullptr;\n\t\t}\n\n\t\treturn reinterpret_cast<FVector*>(reinterpret_cast<PBYTE>(root) + Offsets::Engine::SceneComponent::RelativeLocation);\n\t}\n\n\tfloat Normalize(float angle) {\n\t\tfloat a = (float)fmod(fmod(angle, 360.0) + 360.0, 360.0);\n\t\tif (a > 180.0f) {\n\t\t\ta -= 360.0f;\n\t\t}\n\t\treturn a;\n\t}\n\n\tVOID CalcAngle(float* src, float* dst, float* angles) {\n\t\tfloat rel[3] = {\n\t\t\tdst[0] - src[0],\n\t\t\tdst[1] - src[1],\n\t\t\tdst[2] - src[2],\n\t\t};\n\n\t\tauto dist = sqrtf(rel[0] * rel[0] + rel[1] * rel[1] + rel[2] * rel[2]);\n\t\tauto yaw = atan2f(rel[1], rel[0]) * (180.0f / PI);\n\t\tauto pitch = (-((acosf((rel[2] / dist)) * 180.0f / PI) - 90.0f));\n\n\t\tangles[0] = Normalize(pitch);\n\t\tangles[1] = Normalize(yaw);\n\t}\n\n\tBOOLEAN Initialize() {\n\t\t\n        addr = FindPattern(xorstr(\"\\x48\\x89\\x5C\\x24\\x08\\x48\\x89\\x74\\x24\\x20\\x55\\x57\\x41\\x56\\x48\\x8B\\xEC\\x48\\x83\\xEC\\x30\\x48\\x83\\x65\\x28\\x00\\x49\\x8B\\xF0\\x48\\x8B\\xDA\\xE8\\x4F\\x4B\\xFD\\xFE\\x48\\x83\\x7B\\x20\\x00\\x48\\x8B\\xCB\\x0F\\x84\\xB3\\x00\\x00\\x00\\x48\\x8B\\x53\\x18\\x4C\\x8D\\x45\\x28\\xE8\\x40\\x89\\xE7\\xFE\"), xorstr(\"xxxxxxxxxxxxxxxxxxxxxxxxx?xxxxxxxxxxxxxxx?xxxxxx???xxxxxxxxxxxxx\"));\n        if (!addr) {\n            MessageBox(0, xorstr(L\"Failed to find GetObjectNameInternal.\"), xorstr(L\"github.com/visual9999\"), 0);\n            return FALSE;\n        }\n\n        GetObjectNameInternal = reinterpret_cast<decltype(GetObjectNameInternal)>(addr);\n\n        addr = FindPattern(xorstr(\"\\x48\\x85\\xC9\\x0F\\x84\\x00\\x00\\x00\\x00\\x53\\x48\\x83\\xEC\\x20\\x48\\x89\\x7C\\x24\\x30\\x48\\x8B\\xD9\\x48\\x8B\\x3D\\x00\\x00\\x00\\x00\\x48\\x85\\xFF\\x0F\\x84\\x00\\x00\\x00\\x00\\x48\\x8B\\x07\\x4C\\x8B\\x40\\x30\\x48\\x8D\\x05\\x00\\x00\\x00\\x00\\x4C\\x3B\\xC0\"), xorstr(\"xxxxx????xxxxxxxxxxxxxxxx????xxxxx????xxxxxxxxxxxxx????xxx\"));\n        if (!addr) {\n            MessageBox(0, xorstr(L\"Failed to find FreeInternal.\"), xorstr(L\"github.com/visual9999\"), 0);\n            return FALSE;\n        }\n\n        FreeInternal = reinterpret_cast<decltype(FreeInternal)>(addr);\n\n        addr = FindPattern(xorstr(\"\\xE8\\x00\\x00\\x00\\x00\\x41\\x88\\x07\\x48\\x83\\xC4\\x30\"), xorstr(\"x????xxxxxxx\"));\n        if (!addr) {\n            MessageBox(0, xorstr(L\"Failed to find ProjectionMatrixGivenView.\"), xorstr(L\"github.com/visual9999\"), 0);\n            return FALSE;\n        }\n\n        addr -= 0x280;\n        DISCORD.HookFunction((uintptr_t)addr, (uintptr_t)CalculateProjectionMatrixGivenViewHook, (uintptr_t)&CalculateProjectionMatrixGivenView);\n        addr = FindPattern(xorstr(\"\\x48\\x8B\\xC4\\x48\\x89\\x58\\x20\\x55\\x56\\x57\\x41\\x54\\x41\\x55\\x41\\x56\\x41\\x57\\x48\\x8D\\x6C\\x24\\x00\\x48\\x81\\xEC\\x00\\x00\\x00\\x00\\x0F\\x29\\x70\\xB8\\x0F\\x29\\x78\\xA8\\x44\\x0F\\x29\\x40\\x00\\x48\\x8B\\x05\\x00\\x00\\x00\\x00\\x48\\x33\\xC4\\x48\\x89\\x45\\x20\"), xorstr(\"xxxxxxxxxxxxxxxxxxxxxx?xxx????xxxxxxxxxxx?xxx????xxxxxx\"));\n        if (!addr) {\n            MessageBox(0, xorstr(L\"Failed to find LineOfSightTo.\"), xorstr(L\"github.com/visual9999\"), 0);\n            return FALSE;\n        }\n\n\t\tLineOfSightToInternal = reinterpret_cast<decltype(LineOfSightToInternal)>(addr);\n\n\t\treturn TRUE;\n\t}\n}\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/dllmain.cpp",
    "content": "/*\r\n\r\nVisual#9999, Updated by bunyip24#9999 \r\n*/\r\n\r\n#include \"Header Files/includes.h\"\r\n#include \"Header Files/menu/menu.h\"\r\n#include \"Header Files/config/Config.h\"\r\n\r\nVOID Main() {\r\n    SettingsHelper::Initialize();\r\n    if (!Util::Initialize()) {\r\n        return;\r\n    }\r\n\r\n    if (!Offsets::Initialize()) {\r\n        return;\r\n    }\r\n\r\n    if (!Core::Initialize()) {\r\n        return;\r\n    }\r\n\r\n    if (!Render::Initialize()) {\r\n        return;\r\n    }\r\n}\r\n\r\nBOOL APIENTRY DllMain(HMODULE module, DWORD reason, LPVOID reserved) {\r\n    if (reason == DLL_PROCESS_ATTACH) {\r\n        Main();\r\n    }\r\n\r\n    return TRUE;\r\n}\r\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/Instructions.txt",
    "content": "/*\r\n\r\nVisual#9999\r\n*/"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/LICENSE.txt",
    "content": "/*\n\nVisual#9999\n*/\nThe MIT License (MIT)\n\nCopyright (c) 2014-2019 Omar Cornut\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE."
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imconfig.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n\n//-----------------------------------------------------------------------------\n// USER IMPLEMENTATION\n// This file contains compile-time options for ImGui.\n// Other options (memory allocation overrides, callbacks, etc.) can be set at runtime via the ImGuiIO structure - ImGui::GetIO().\n//-----------------------------------------------------------------------------\n\n#pragma once\n\n//---- Define assertion handler. Defaults to calling assert().\n//#define IM_ASSERT(_EXPR)  MyAssert(_EXPR)\n\n//---- Define attributes of all API symbols declarations, e.g. for DLL under Windows.\n//#define IMGUI_API __declspec( dllexport )\n//#define IMGUI_API __declspec( dllimport )\n\n//---- Don't define obsolete functions names. Consider enabling from time to time or when updating to reduce like hood of using already obsolete function/names\n//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\n//---- Include imgui_user.h at the end of imgui.h\n//#define IMGUI_INCLUDE_IMGUI_USER_H\n\n//---- Don't implement default handlers for Windows (so as not to link with OpenClipboard() and others Win32 functions)\n//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS\n//#define IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS\n\n//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)\n//---- It is very strongly recommended to NOT disable the demo windows. Please read the comment at the top of imgui_demo.cpp to learn why.\n//#define IMGUI_DISABLE_DEMO_WINDOWS\n\n//---- Don't implement ImFormatString(), ImFormatStringV() so you can reimplement them yourself.\n//#define IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS\n\n//---- Pack colors to BGRA instead of RGBA (remove need to post process vertex buffer in back ends)\n//#define IMGUI_USE_BGRA_PACKED_COLOR\n\n//---- Implement STB libraries in a namespace to avoid linkage conflicts\n//#define IMGUI_STB_NAMESPACE     ImGuiStb\n\n//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.\n/*\n#define IM_VEC2_CLASS_EXTRA                                                 \\\nImVec2(const MyVec2& f) { x = f.x; y = f.y; }                       \\\noperator MyVec2() const { return MyVec2(x,y); }\n\n#define IM_VEC4_CLASS_EXTRA                                                 \\\nImVec4(const MyVec4& f) { x = f.x; y = f.y; z = f.z; w = f.w; }     \\\noperator MyVec4() const { return MyVec4(x,y,z,w); }\n*/\n\n//---- Use 32-bit vertex indices (instead of default: 16-bit) to allow meshes with more than 64K vertices\n//#define ImDrawIdx unsigned int\n\n//---- Tip: You can add extra functions within the ImGui:: namespace, here or in your own headers files.\n//---- e.g. create variants of the ImGui::Value() helper for your low-level math types, or your own widgets/helpers.\n/*\nnamespace ImGui\n{\nvoid    Value(const char* prefix, const MyMatrix44& v, const char* float_format = NULL);\n}\n*/\n\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui.cpp",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n// dear imgui, v1.54 WIP\n// (main code and documentation)\n\n// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.\n// Newcomers, read 'Programmer guide' below for notes on how to setup Dear ImGui in your codebase.\n// Get latest version at https://github.com/ocornut/imgui\n// Releases change-log at https://github.com/ocornut/imgui/releases\n// Gallery (please post your screenshots/video there!): https://github.com/ocornut/imgui/issues/1269\n// Developed by Omar Cornut and every direct or indirect contributors to the GitHub.\n// This library is free but I need your support to sustain development and maintenance.\n// If you work for a company, please consider financial support, see Readme. For individuals: https://www.patreon.com/imgui\n\n/*\n\nIndex\n- MISSION STATEMENT\n- END-USER GUIDE\n- PROGRAMMER GUIDE (read me!)\n- Read first\n- How to update to a newer version of Dear ImGui\n- Getting started with integrating Dear ImGui in your code/engine\n- API BREAKING CHANGES (read me when you update!)\n- ISSUES & TODO LIST\n- FREQUENTLY ASKED QUESTIONS (FAQ), TIPS\n- How can I help?\n- What is ImTextureID and how do I display an image?\n- I integrated Dear ImGui in my engine and the text or lines are blurry..\n- I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around..\n- How can I have multiple widgets with the same label? Can I have widget without a label? (Yes). A primer on labels/IDs.\n- How can I tell when Dear ImGui wants my mouse/keyboard inputs VS when I can pass them to my application?\n- How can I load a different font than the default?\n- How can I easily use icons in my application?\n- How can I load multiple fonts?\n- How can I display and input non-latin characters such as Chinese, Japanese, Korean, Cyrillic?\n- How can I preserve my Dear ImGui context across reloading a DLL? (loss of the global/static variables)\n- How can I use the drawing facilities without an ImGui window? (using ImDrawList API)\n- ISSUES & TODO-LIST\n- CODE\n\n\nMISSION STATEMENT\n=================\n\n- Easy to use to create code-driven and data-driven tools\n- Easy to use to create ad hoc short-lived tools and long-lived, more elaborate tools\n- Easy to hack and improve\n- Minimize screen real-estate usage\n- Minimize setup and maintenance\n- Minimize state storage on user side\n- Portable, minimize dependencies, run on target (consoles, phones, etc.)\n- Efficient runtime and memory consumption (NB- we do allocate when \"growing\" content e.g. creating a window, opening a tree node\nfor the first time, etc. but a typical frame won't allocate anything)\n\nDesigned for developers and content-creators, not the typical end-user! Some of the weaknesses includes:\n- Doesn't look fancy, doesn't animate\n- Limited layout features, intricate layouts are typically crafted in code\n\n\nEND-USER GUIDE\n==============\n\n- Double-click on title bar to collapse window.\n- Click upper right corner to close a window, available when 'bool* p_open' is passed to ImGui::Begin().\n- Click and drag on lower right corner to resize window (double-click to auto fit window to its contents).\n- Click and drag on any empty space to move window.\n- TAB/SHIFT+TAB to cycle through keyboard editable fields.\n- CTRL+Click on a slider or drag box to input value as text.\n- Use mouse wheel to scroll.\n- Text editor:\n- Hold SHIFT or use mouse to select text.\n- CTRL+Left/Right to word jump.\n- CTRL+Shift+Left/Right to select words.\n- CTRL+A our Double-Click to select all.\n- CTRL+X,CTRL+C,CTRL+V to use OS clipboard/\n- CTRL+Z,CTRL+Y to undo/redo.\n- ESCAPE to revert text to its original value.\n- You can apply arithmetic operators +,*,/ on numerical values. Use +- to subtract (because - would set a negative value!)\n- Controls are automatically adjusted for OSX to match standard OSX text editing operations.\n\n\nPROGRAMMER GUIDE\n================\n\nREAD FIRST\n\n- Read the FAQ below this section!\n- Your code creates the UI, if your code doesn't run the UI is gone! == very dynamic UI, no construction/destructions steps, less data retention\non your side, no state duplication, less sync, less bugs.\n- Call and read ImGui::ShowDemoWindow() for demo code demonstrating most features.\n- You can learn about immediate-mode gui principles at http://www.johno.se/book/imgui.html or watch http://mollyrocket.com/861\n\nHOW TO UPDATE TO A NEWER VERSION OF DEAR IMGUI\n\n- Overwrite all the sources files except for imconfig.h (if you have made modification to your copy of imconfig.h)\n- Read the \"API BREAKING CHANGES\" section (below). This is where we list occasional API breaking changes.\nIf a function/type has been renamed / or marked obsolete, try to fix the name in your code before it is permanently removed from the public API.\nIf you have a problem with a missing function/symbols, search for its name in the code, there will likely be a comment about it.\nPlease report any issue to the GitHub page!\n- Try to keep your copy of dear imgui reasonably up to date.\n\nGETTING STARTED WITH INTEGRATING DEAR IMGUI IN YOUR CODE/ENGINE\n\n- Add the Dear ImGui source files to your projects, using your preferred build system.\nIt is recommended you build the .cpp files as part of your project and not as a library.\n- You can later customize the imconfig.h file to tweak some compilation time behavior, such as integrating imgui types with your own maths types.\n- See examples/ folder for standalone sample applications.\n- You may be able to grab and copy a ready made imgui_impl_*** file from the examples/.\n- When using Dear ImGui, your programming IDE is your friend: follow the declaration of variables, functions and types to find comments about them.\n\n- Init: retrieve the ImGuiIO structure with ImGui::GetIO() and fill the fields marked 'Settings': at minimum you need to set io.DisplaySize\n(application resolution). Later on you will fill your keyboard mapping, clipboard handlers, and other advanced features but for a basic\nintegration you don't need to worry about it all.\n- Init: call io.Fonts->GetTexDataAsRGBA32(...), it will build the font atlas texture, then load the texture pixels into graphics memory.\n- Every frame:\n- In your main loop as early a possible, fill the IO fields marked 'Input' (e.g. mouse position, buttons, keyboard info, etc.)\n- Call ImGui::NewFrame() to begin the frame\n- You can use any ImGui function you want between NewFrame() and Render()\n- Call ImGui::Render() as late as you can to end the frame and finalize render data. it will call your io.RenderDrawListFn handler.\n(Even if you don't render, call Render() and ignore the callback, or call EndFrame() instead. Otherwhise some features will break)\n- All rendering information are stored into command-lists until ImGui::Render() is called.\n- Dear ImGui never touches or knows about your GPU state. the only function that knows about GPU is the RenderDrawListFn handler that you provide.\n- Effectively it means you can create widgets at any time in your code, regardless of considerations of being in \"update\" vs \"render\" phases\nof your own application.\n- Refer to the examples applications in the examples/ folder for instruction on how to setup your code.\n- A minimal application skeleton may be:\n\n// Application init\nImGuiIO& io = ImGui::GetIO();\nio.DisplaySize.x = 1920.0f;\nio.DisplaySize.y = 1280.0f;\nio.RenderDrawListsFn = MyRenderFunction;  // Setup a render function, or set to NULL and call GetDrawData() after Render() to access render data.\n// TODO: Fill others settings of the io structure later.\n\n// Load texture atlas (there is a default font so you don't need to care about choosing a font yet)\nunsigned char* pixels;\nint width, height;\nio.Fonts->GetTexDataAsRGBA32(pixels, &width, &height);\n// TODO: At this points you've got the texture data and you need to upload that your your graphic system:\nMyTexture* texture = MyEngine::CreateTextureFromMemoryPixels(pixels, width, height, TEXTURE_TYPE_RGBA)\n// TODO: Store your texture pointer/identifier (whatever your engine uses) in 'io.Fonts->TexID'. This will be passed back to your via the renderer.\nio.Fonts->TexID = (void*)texture;\n\n// Application main loop\nwhile (true)\n{\n// Setup low-level inputs (e.g. on Win32, GetKeyboardState(), or write to those fields from your Windows message loop handlers, etc.)\nImGuiIO& io = ImGui::GetIO();\nio.DeltaTime = 1.0f/60.0f;\nio.MousePos = mouse_pos;\nio.MouseDown[0] = mouse_button_0;\nio.MouseDown[1] = mouse_button_1;\n\n// Call NewFrame(), after this point you can use ImGui::* functions anytime\nImGui::NewFrame();\n\n// Most of your application code here\nMyGameUpdate(); // may use any ImGui functions, e.g. ImGui::Begin(\"My window\"); ImGui::Text(\"Hello, world!\"); ImGui::End();\nMyGameRender(); // may use any ImGui functions as well!\n\n// Render & swap video buffers\nImGui::Render();\nSwapBuffers();\n}\n\n- A minimal render function skeleton may be:\n\nvoid void MyRenderFunction(ImDrawData* draw_data)(ImDrawData* draw_data)\n{\n// TODO: Setup render state: alpha-blending enabled, no face culling, no depth testing, scissor enabled\n// TODO: Setup viewport, orthographic projection matrix\n// TODO: Setup shader: vertex { float2 pos, float2 uv, u32 color }, fragment shader sample color from 1 texture, multiply by vertex color.\nfor (int n = 0; n < draw_data->CmdListsCount; n++)\n{\nconst ImDrawVert* vtx_buffer = cmd_list->VtxBuffer.Data;  // vertex buffer generated by ImGui\nconst ImDrawIdx* idx_buffer = cmd_list->IdxBuffer.Data;   // index buffer generated by ImGui\nfor (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)\n{\nconst ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];\nif (pcmd->UserCallback)\n{\npcmd->UserCallback(cmd_list, pcmd);\n}\nelse\n{\n// The texture for the draw call is specified by pcmd->TextureId.\n// The vast majority of draw calls with use the imgui texture atlas, which value you have set yourself during initialization.\nMyEngineBindTexture(pcmd->TextureId);\n\n// We are using scissoring to clip some objects. All low-level graphics API supports it.\n// If your engine doesn't support scissoring yet, you will get some small glitches (some elements outside their bounds) which you can fix later.\nMyEngineScissor((int)pcmd->ClipRect.x, (int)pcmd->ClipRect.y, (int)(pcmd->ClipRect.z - pcmd->ClipRect.x), (int)(pcmd->ClipRect.w - pcmd->ClipRect.y));\n\n// Render 'pcmd->ElemCount/3' indexed triangles.\n// By default the indices ImDrawIdx are 16-bits, you can change them to 32-bits if your engine doesn't support 16-bits indices.\nMyEngineDrawIndexedTriangles(pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer, vtx_buffer);\n}\nidx_buffer += pcmd->ElemCount;\n}\n}\n}\n\n- The examples/ folders contains many functional implementation of the pseudo-code above.\n- When calling NewFrame(), the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'io.WantTextInput' flags are updated.\nThey tell you if ImGui intends to use your inputs. So for example, if 'io.WantCaptureMouse' is set you would typically want to hide\nmouse inputs from the rest of your application. Read the FAQ below for more information about those flags.\n\n\n\nAPI BREAKING CHANGES\n====================\n\nOccasionally introducing changes that are breaking the API. The breakage are generally minor and easy to fix.\nHere is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.\nAlso read releases logs https://github.com/ocornut/imgui/releases for more details.\n\n- 2018/01/11 (1.54) - obsoleted IsAnyWindowHovered() in favor of IsWindowHovered(ImGuiHoveredFlags_AnyWindow). Kept redirection function (will obsolete).\n- 2018/01/11 (1.54) - obsoleted IsAnyWindowFocused() in favor of IsWindowFocused(ImGuiFocusedFlags_AnyWindow). Kept redirection function (will obsolete).\n- 2018/01/03 (1.54) - renamed ImGuiSizeConstraintCallback to ImGuiSizeCallback, ImGuiSizeConstraintCallbackData to ImGuiSizeCallbackData.\n- 2017/12/29 (1.54) - removed CalcItemRectClosestPoint() which was weird and not really used by anyone except demo code. If you need it it's easy to replicate on your side.\n- 2017/12/24 (1.53) - renamed the emblematic ShowTestWindow() function to ShowDemoWindow(). Kept redirection function (will obsolete).\n- 2017/12/21 (1.53) - ImDrawList: renamed style.AntiAliasedShapes to style.AntiAliasedFill for consistency and as a way to explicitly break code that manipulate those flag at runtime. You can now manipulate ImDrawList::Flags\n- 2017/12/21 (1.53) - ImDrawList: removed 'bool anti_aliased = true' final parameter of ImDrawList::AddPolyline() and ImDrawList::AddConvexPolyFilled(). Prefer manipulating ImDrawList::Flags if you need to toggle them during the frame.\n- 2017/12/14 (1.53) - using the ImGuiWindowFlags_NoScrollWithMouse flag on a child window forwards the mouse wheel event to the parent window, unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set.\n- 2017/12/13 (1.53) - renamed GetItemsLineHeightWithSpacing() to GetFrameHeightWithSpacing(). Kept redirection function (will obsolete).\n- 2017/12/13 (1.53) - obsoleted IsRootWindowFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootWindow). Kept redirection function (will obsolete).\n- obsoleted IsRootWindowOrAnyChildFocused() in favor of using IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows). Kept redirection function (will obsolete).\n- 2017/12/12 (1.53) - renamed ImGuiTreeNodeFlags_AllowOverlapMode to ImGuiTreeNodeFlags_AllowItemOverlap. Kept redirection enum (will obsolete).\n- 2017/12/10 (1.53) - removed SetNextWindowContentWidth(), prefer using SetNextWindowContentSize(). Kept redirection function (will obsolete).\n- 2017/11/27 (1.53) - renamed ImGuiTextBuffer::append() helper to appendf(), appendv() to appendfv(). If you copied the 'Log' demo in your code, it uses appendv() so that needs to be renamed.\n- 2017/11/18 (1.53) - Style, Begin: removed ImGuiWindowFlags_ShowBorders window flag. Borders are now fully set up in the ImGuiStyle structure (see e.g. style.FrameBorderSize, style.WindowBorderSize). Use ImGui::ShowStyleEditor() to look them up.\nPlease note that the style system will keep evolving (hopefully stabilizing in Q1 2018), and so custom styles will probably subtly break over time. It is recommended you use the StyleColorsClassic(), StyleColorsDark(), StyleColorsLight() functions.\n- 2017/11/18 (1.53) - Style: removed ImGuiCol_ComboBg in favor of combo boxes using ImGuiCol_PopupBg for consistency.\n- 2017/11/18 (1.53) - Style: renamed ImGuiCol_ChildWindowBg to ImGuiCol_ChildBg.\n- 2017/11/18 (1.53) - Style: renamed style.ChildWindowRounding to style.ChildRounding, ImGuiStyleVar_ChildWindowRounding to ImGuiStyleVar_ChildRounding.\n- 2017/11/02 (1.53) - obsoleted IsRootWindowOrAnyChildHovered() in favor of using IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);\n- 2017/10/24 (1.52) - renamed IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCS to IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS/IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS for consistency.\n- 2017/10/20 (1.52) - changed IsWindowHovered() default parameters behavior to return false if an item is active in another window (e.g. click-dragging item from another window to this window). You can use the newly introduced IsWindowHovered() flags to requests this specific behavior if you need it.\n- 2017/10/20 (1.52) - marked IsItemHoveredRect()/IsMouseHoveringWindow() as obsolete, in favor of using the newly introduced flags for IsItemHovered() and IsWindowHovered(). See https://github.com/ocornut/imgui/issues/1382 for details.\nremoved the IsItemRectHovered()/IsWindowRectHovered() names introduced in 1.51 since they were merely more consistent names for the two functions we are now obsoleting.\n- 2017/10/17 (1.52) - marked the old 5-parameters version of Begin() as obsolete (still available). Use SetNextWindowSize()+Begin() instead!\n- 2017/10/11 (1.52) - renamed AlignFirstTextHeightToWidgets() to AlignTextToFramePadding(). Kept inline redirection function (will obsolete).\n- 2017/09/25 (1.52) - removed SetNextWindowPosCenter() because SetNextWindowPos() now has the optional pivot information to do the same and more. Kept redirection function (will obsolete).\n- 2017/08/25 (1.52) - io.MousePos needs to be set to ImVec2(-FLT_MAX,-FLT_MAX) when mouse is unavailable/missing. Previously ImVec2(-1,-1) was enough but we now accept negative mouse coordinates. In your binding if you need to support unavailable mouse, make sure to replace \"io.MousePos = ImVec2(-1,-1)\" with \"io.MousePos = ImVec2(-FLT_MAX,-FLT_MAX)\".\n- 2017/08/22 (1.51) - renamed IsItemHoveredRect() to IsItemRectHovered(). Kept inline redirection function (will obsolete). -> (1.52) use IsItemHovered(ImGuiHoveredFlags_RectOnly)!\n- renamed IsMouseHoveringAnyWindow() to IsAnyWindowHovered() for consistency. Kept inline redirection function (will obsolete).\n- renamed IsMouseHoveringWindow() to IsWindowRectHovered() for consistency. Kept inline redirection function (will obsolete).\n- 2017/08/20 (1.51) - renamed GetStyleColName() to GetStyleColorName() for consistency.\n- 2017/08/20 (1.51) - added PushStyleColor(ImGuiCol idx, ImU32 col) overload, which _might_ cause an \"ambiguous call\" compilation error if you are using ImColor() with implicit cast. Cast to ImU32 or ImVec4 explicily to fix.\n- 2017/08/15 (1.51) - marked the weird IMGUI_ONCE_UPON_A_FRAME helper macro as obsolete. prefer using the more explicit ImGuiOnceUponAFrame.\n- 2017/08/15 (1.51) - changed parameter order for BeginPopupContextWindow() from (const char*,int buttons,bool also_over_items) to (const char*,int buttons,bool also_over_items). Note that most calls relied on default parameters completely.\n- 2017/08/13 (1.51) - renamed ImGuiCol_Columns*** to ImGuiCol_Separator***. Kept redirection enums (will obsolete).\n- 2017/08/11 (1.51) - renamed ImGuiSetCond_*** types and flags to ImGuiCond_***. Kept redirection enums (will obsolete).\n- 2017/08/09 (1.51) - removed ValueColor() helpers, they are equivalent to calling Text(label) + SameLine() + ColorButton().\n- 2017/08/08 (1.51) - removed ColorEditMode() and ImGuiColorEditMode in favor of ImGuiColorEditFlags and parameters to the various Color*() functions. The SetColorEditOptions() allows to initialize default but the user can still change them with right-click context menu.\n- changed prototype of 'ColorEdit4(const char* label, float col[4], bool show_alpha = true)' to 'ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0)', where passing flags = 0x01 is a safe no-op (hello dodgy backward compatibility!). - check and run the demo window, under \"Color/Picker Widgets\", to understand the various new options.\n- changed prototype of rarely used 'ColorButton(ImVec4 col, bool small_height = false, bool outline_border = true)' to 'ColorButton(const char* desc_id, ImVec4 col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0,0))'\n- 2017/07/20 (1.51) - removed IsPosHoveringAnyWindow(ImVec2), which was partly broken and misleading. ASSERT + redirect user to io.WantCaptureMouse\n- 2017/05/26 (1.50) - removed ImFontConfig::MergeGlyphCenterV in favor of a more multipurpose ImFontConfig::GlyphOffset.\n- 2017/05/01 (1.50) - renamed ImDrawList::PathFill() (rarely used directly) to ImDrawList::PathFillConvex() for clarity.\n- 2016/11/06 (1.50) - BeginChild(const char*) now applies the stack id to the provided label, consistently with other functions as it should always have been. It shouldn't affect you unless (extremely unlikely) you were appending multiple times to a same child from different locations of the stack id. If that's the case, generate an id with GetId() and use it instead of passing string to BeginChild().\n- 2016/10/15 (1.50) - avoid 'void* user_data' parameter to io.SetClipboardTextFn/io.GetClipboardTextFn pointers. We pass io.ClipboardUserData to it.\n- 2016/09/25 (1.50) - style.WindowTitleAlign is now a ImVec2 (ImGuiAlign enum was removed). set to (0.5f,0.5f) for horizontal+vertical centering, (0.0f,0.0f) for upper-left, etc.\n- 2016/07/30 (1.50) - SameLine(x) with x>0.0f is now relative to left of column/group if any, and not always to left of window. This was sort of always the intent and hopefully breakage should be minimal.\n- 2016/05/12 (1.49) - title bar (using ImGuiCol_TitleBg/ImGuiCol_TitleBgActive colors) isn't rendered over a window background (ImGuiCol_WindowBg color) anymore.\nIf your TitleBg/TitleBgActive alpha was 1.0f or you are using the default theme it will not affect you.\nHowever if your TitleBg/TitleBgActive alpha was <1.0f you need to tweak your custom theme to readjust for the fact that we don't draw a WindowBg background behind the title bar.\nThis helper function will convert an old TitleBg/TitleBgActive color into a new one with the same visual output, given the OLD color and the OLD WindowBg color.\nImVec4 ConvertTitleBgCol(const ImVec4& win_bg_col, const ImVec4& title_bg_col)\n{\nfloat new_a = 1.0f - ((1.0f - win_bg_col.w) * (1.0f - title_bg_col.w)), k = title_bg_col.w / new_a;\nreturn ImVec4((win_bg_col.x * win_bg_col.w + title_bg_col.x) * k, (win_bg_col.y * win_bg_col.w + title_bg_col.y) * k, (win_bg_col.z * win_bg_col.w + title_bg_col.z) * k, new_a);\n}\nIf this is confusing, pick the RGB value from title bar from an old screenshot and apply this as TitleBg/TitleBgActive. Or you may just create TitleBgActive from a tweaked TitleBg color.\n- 2016/05/07 (1.49) - removed confusing set of GetInternalState(), GetInternalStateSize(), SetInternalState() functions. Now using CreateContext(), DestroyContext(), GetCurrentContext(), SetCurrentContext().\n- 2016/05/02 (1.49) - renamed SetNextTreeNodeOpened() to SetNextTreeNodeOpen(), no redirection.\n- 2016/05/01 (1.49) - obsoleted old signature of CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false) as extra parameters were badly designed and rarely used. You can replace the \"default_open = true\" flag in new API with CollapsingHeader(label, ImGuiTreeNodeFlags_DefaultOpen).\n- 2016/04/26 (1.49) - changed ImDrawList::PushClipRect(ImVec4 rect) to ImDraw::PushClipRect(Imvec2 min,ImVec2 max,bool intersect_with_current_clip_rect=false). Note that higher-level ImGui::PushClipRect() is preferable because it will clip at logic/widget level, whereas ImDrawList::PushClipRect() only affect your renderer.\n- 2016/04/03 (1.48) - removed style.WindowFillAlphaDefault setting which was redundant. Bake default BG alpha inside style.Colors[ImGuiCol_WindowBg] and all other Bg color values. (ref github issue #337).\n- 2016/04/03 (1.48) - renamed ImGuiCol_TooltipBg to ImGuiCol_PopupBg, used by popups/menus and tooltips. popups/menus were previously using ImGuiCol_WindowBg. (ref github issue #337)\n- 2016/03/21 (1.48) - renamed GetWindowFont() to GetFont(), GetWindowFontSize() to GetFontSize(). Kept inline redirection function (will obsolete).\n- 2016/03/02 (1.48) - InputText() completion/history/always callbacks: if you modify the text buffer manually (without using DeleteChars()/InsertChars() helper) you need to maintain the BufTextLen field. added an assert.\n- 2016/01/23 (1.48) - fixed not honoring exact width passed to PushItemWidth(), previously it would add extra FramePadding.x*2 over that width. if you had manual pixel-perfect alignment in place it might affect you.\n- 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis.\n- 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.\n- 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.\nGetCursorPos()/SetCursorPos() functions now include the scrolled amount. It shouldn't affect the majority of users, but take note that SetCursorPosX(100.0f) puts you at +100 from the starting x position which may include scrolling, not at +100 from the window left side.\nGetContentRegionMax()/GetWindowContentRegionMin()/GetWindowContentRegionMax() functions allow include the scrolled amount. Typically those were used in cases where no scrolling would happen so it may not be a problem, but watch out!\n- 2015/08/29 (1.45) - renamed style.ScrollbarWidth to style.ScrollbarSize\n- 2015/08/05 (1.44) - split imgui.cpp into extra files: imgui_demo.cpp imgui_draw.cpp imgui_internal.h that you need to add to your project.\n- 2015/07/18 (1.44) - fixed angles in ImDrawList::PathArcTo(), PathArcToFast() (introduced in 1.43) being off by an extra PI for no justifiable reason\n- 2015/07/14 (1.43) - add new ImFontAtlas::AddFont() API. For the old AddFont***, moved the 'font_no' parameter of ImFontAtlas::AddFont** functions to the ImFontConfig structure.\nyou need to render your textured triangles with bilinear filtering to benefit from sub-pixel positioning of text.\n- 2015/07/08 (1.43) - switched rendering data to use indexed rendering. this is saving a fair amount of CPU/GPU and enables us to get anti-aliasing for a marginal cost.\nthis necessary change will break your rendering function! the fix should be very easy. sorry for that :(\n- if you are using a vanilla copy of one of the imgui_impl_XXXX.cpp provided in the example, you just need to update your copy and you can ignore the rest.\n- the signature of the io.RenderDrawListsFn handler has changed!\nImGui_XXXX_RenderDrawLists(ImDrawList** const cmd_lists, int cmd_lists_count)\nbecame:\nImGui_XXXX_RenderDrawLists(ImDrawData* draw_data).\nargument   'cmd_lists'        -> 'draw_data->CmdLists'\nargument   'cmd_lists_count'  -> 'draw_data->CmdListsCount'\nImDrawList 'commands'         -> 'CmdBuffer'\nImDrawList 'vtx_buffer'       -> 'VtxBuffer'\nImDrawList  n/a               -> 'IdxBuffer' (new)\nImDrawCmd  'vtx_count'        -> 'ElemCount'\nImDrawCmd  'clip_rect'        -> 'ClipRect'\nImDrawCmd  'user_callback'    -> 'UserCallback'\nImDrawCmd  'texture_id'       -> 'TextureId'\n- each ImDrawList now contains both a vertex buffer and an index buffer. For each command, render ElemCount/3 triangles using indices from the index buffer.\n- if you REALLY cannot render indexed primitives, you can call the draw_data->DeIndexAllBuffers() method to de-index the buffers. This is slow and a waste of CPU/GPU. Prefer using indexed rendering!\n- refer to code in the examples/ folder or ask on the GitHub if you are unsure of how to upgrade. please upgrade!\n- 2015/07/10 (1.43) - changed SameLine() parameters from int to float.\n- 2015/07/02 (1.42) - renamed SetScrollPosHere() to SetScrollFromCursorPos(). Kept inline redirection function (will obsolete).\n- 2015/07/02 (1.42) - renamed GetScrollPosY() to GetScrollY(). Necessary to reduce confusion along with other scrolling functions, because positions (e.g. cursor position) are not equivalent to scrolling amount.\n- 2015/06/14 (1.41) - changed ImageButton() default bg_col parameter from (0,0,0,1) (black) to (0,0,0,0) (transparent) - makes a difference when texture have transparence\n- 2015/06/14 (1.41) - changed Selectable() API from (label, selected, size) to (label, selected, flags, size). Size override should have been rarely be used. Sorry!\n- 2015/05/31 (1.40) - renamed GetWindowCollapsed() to IsWindowCollapsed() for consistency. Kept inline redirection function (will obsolete).\n- 2015/05/31 (1.40) - renamed IsRectClipped() to IsRectVisible() for consistency. Note that return value is opposite! Kept inline redirection function (will obsolete).\n- 2015/05/27 (1.40) - removed the third 'repeat_if_held' parameter from Button() - sorry! it was rarely used and inconsistent. Use PushButtonRepeat(true) / PopButtonRepeat() to enable repeat on desired buttons.\n- 2015/05/11 (1.40) - changed BeginPopup() API, takes a string identifier instead of a bool. ImGui needs to manage the open/closed state of popups. Call OpenPopup() to actually set the \"open\" state of a popup. BeginPopup() returns true if the popup is opened.\n- 2015/05/03 (1.40) - removed style.AutoFitPadding, using style.WindowPadding makes more sense (the default values were already the same).\n- 2015/04/13 (1.38) - renamed IsClipped() to IsRectClipped(). Kept inline redirection function until 1.50.\n- 2015/04/09 (1.38) - renamed ImDrawList::AddArc() to ImDrawList::AddArcFast() for compatibility with future API\n- 2015/04/03 (1.38) - removed ImGuiCol_CheckHovered, ImGuiCol_CheckActive, replaced with the more general ImGuiCol_FrameBgHovered, ImGuiCol_FrameBgActive.\n- 2014/04/03 (1.38) - removed support for passing -FLT_MAX..+FLT_MAX as the range for a SliderFloat(). Use DragFloat() or Inputfloat() instead.\n- 2015/03/17 (1.36) - renamed GetItemBoxMin()/GetItemBoxMax()/IsMouseHoveringBox() to GetItemRectMin()/GetItemRectMax()/IsMouseHoveringRect(). Kept inline redirection function until 1.50.\n- 2015/03/15 (1.36) - renamed style.TreeNodeSpacing to style.IndentSpacing, ImGuiStyleVar_TreeNodeSpacing to ImGuiStyleVar_IndentSpacing\n- 2015/03/13 (1.36) - renamed GetWindowIsFocused() to IsWindowFocused(). Kept inline redirection function until 1.50.\n- 2015/03/08 (1.35) - renamed style.ScrollBarWidth to style.ScrollbarWidth (casing)\n- 2015/02/27 (1.34) - renamed OpenNextNode(bool) to SetNextTreeNodeOpened(bool, ImGuiSetCond). Kept inline redirection function until 1.50.\n- 2015/02/27 (1.34) - renamed ImGuiSetCondition_*** to ImGuiSetCond_***, and _FirstUseThisSession becomes _Once.\n- 2015/02/11 (1.32) - changed text input callback ImGuiTextEditCallback return type from void-->int. reserved for future use, return 0 for now.\n- 2015/02/10 (1.32) - renamed GetItemWidth() to CalcItemWidth() to clarify its evolving behavior\n- 2015/02/08 (1.31) - renamed GetTextLineSpacing() to GetTextLineHeightWithSpacing()\n- 2015/02/01 (1.31) - removed IO.MemReallocFn (unused)\n- 2015/01/19 (1.30) - renamed ImGuiStorage::GetIntPtr()/GetFloatPtr() to GetIntRef()/GetIntRef() because Ptr was conflicting with actual pointer storage functions.\n- 2015/01/11 (1.30) - big font/image API change! now loads TTF file. allow for multiple fonts. no need for a PNG loader.\n(1.30) - removed GetDefaultFontData(). uses io.Fonts->GetTextureData*() API to retrieve uncompressed pixels.\nthis sequence:\nconst void* png_data;\nunsigned int png_size;\nImGui::GetDefaultFontData(NULL, NULL, &png_data, &png_size);\n// <Copy to GPU>\nbecame:\nunsigned char* pixels;\nint width, height;\nio.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);\n// <Copy to GPU>\nio.Fonts->TexID = (your_texture_identifier);\nyou now have much more flexibility to load multiple TTF fonts and manage the texture buffer for internal needs.\nit is now recommended that you sample the font texture with bilinear interpolation.\n(1.30) - added texture identifier in ImDrawCmd passed to your render function (we can now render images). make sure to set io.Fonts->TexID.\n(1.30) - removed IO.PixelCenterOffset (unnecessary, can be handled in user projection matrix)\n(1.30) - removed ImGui::IsItemFocused() in favor of ImGui::IsItemActive() which handles all widgets\n- 2014/12/10 (1.18) - removed SetNewWindowDefaultPos() in favor of new generic API SetNextWindowPos(pos, ImGuiSetCondition_FirstUseEver)\n- 2014/11/28 (1.17) - moved IO.Font*** options to inside the IO.Font-> structure (FontYOffset, FontTexUvForWhite, FontBaseScale, FontFallbackGlyph)\n- 2014/11/26 (1.17) - reworked syntax of IMGUI_ONCE_UPON_A_FRAME helper macro to increase compiler compatibility\n- 2014/11/07 (1.15) - renamed IsHovered() to IsItemHovered()\n- 2014/10/02 (1.14) - renamed IMGUI_INCLUDE_IMGUI_USER_CPP to IMGUI_INCLUDE_IMGUI_USER_INL and imgui_user.cpp to imgui_user.inl (more IDE friendly)\n- 2014/09/25 (1.13) - removed 'text_end' parameter from IO.SetClipboardTextFn (the string is now always zero-terminated for simplicity)\n- 2014/09/24 (1.12) - renamed SetFontScale() to SetWindowFontScale()\n- 2014/09/24 (1.12) - moved IM_MALLOC/IM_REALLOC/IM_FREE preprocessor defines to IO.MemAllocFn/IO.MemReallocFn/IO.MemFreeFn\n- 2014/08/30 (1.09) - removed IO.FontHeight (now computed automatically)\n- 2014/08/30 (1.09) - moved IMGUI_FONT_TEX_UV_FOR_WHITE preprocessor define to IO.FontTexUvForWhite\n- 2014/08/28 (1.09) - changed the behavior of IO.PixelCenterOffset following various rendering fixes\n\n\nISSUES & TODO-LIST\n==================\nSee TODO.txt\n\n\nFREQUENTLY ASKED QUESTIONS (FAQ), TIPS\n======================================\n\nQ: How can I help?\nA: - If you are experienced enough with Dear ImGui and with C/C++, look at the todo list and see how you want/can help!\n- Become a Patron/donate! Convince your company to become a Patron or provide serious funding for development time! See http://www.patreon.com/imgui\n\nQ: What is ImTextureID and how do I display an image?\nA: ImTextureID is a void* used to pass renderer-agnostic texture references around until it hits your render function.\nDear ImGui knows nothing about what those bits represent, it just passes them around. It is up to you to decide what you want the void* to carry!\nIt could be an identifier to your OpenGL texture (cast GLuint to void*), a pointer to your custom engine material (cast MyMaterial* to void*), etc.\nAt the end of the chain, your renderer takes this void* to cast it back into whatever it needs to select a current texture to render.\nRefer to examples applications, where each renderer (in a imgui_impl_xxxx.cpp file) is treating ImTextureID as a different thing.\n(c++ tip: OpenGL uses integers to identify textures. You can safely store an integer into a void*, just cast it to void*, don't take it's address!)\nTo display a custom image/texture within an ImGui window, you may use ImGui::Image(), ImGui::ImageButton(), ImDrawList::AddImage() functions.\nDear ImGui will generate the geometry and draw calls using the ImTextureID that you passed and which your renderer can use.\nIt is your responsibility to get textures uploaded to your GPU.\n\nQ: I integrated Dear ImGui in my engine and the text or lines are blurry..\nA: In your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f).\nAlso make sure your orthographic projection matrix and io.DisplaySize matches your actual framebuffer dimension.\n\nQ: I integrated Dear ImGui in my engine and some elements are clipping or disappearing when I move windows around..\nA: You are probably mishandling the clipping rectangles in your render function.\nRectangles provided by ImGui are defined as (x1=left,y1=top,x2=right,y2=bottom) and NOT as (x1,y1,width,height).\n\nQ: Can I have multiple widgets with the same label? Can I have widget without a label?\nA: Yes. A primer on the use of labels/IDs in Dear ImGui..\n\n- Elements that are not clickable, such as Text() items don't need an ID.\n\n- Interactive widgets require state to be carried over multiple frames (most typically Dear ImGui often needs to remember what is\nthe \"active\" widget). to do so they need a unique ID. unique ID are typically derived from a string label, an integer index or a pointer.\n\nButton(\"OK\");        // Label = \"OK\",     ID = hash of \"OK\"\nButton(\"Cancel\");    // Label = \"Cancel\", ID = hash of \"Cancel\"\n\n- ID are uniquely scoped within windows, tree nodes, etc. so no conflict can happen if you have two buttons called \"OK\"\nin two different windows or in two different locations of a tree.\n\n- If you have a same ID twice in the same location, you'll have a conflict:\n\nButton(\"OK\");\nButton(\"OK\");           // ID collision! Both buttons will be treated as the same.\n\nFear not! this is easy to solve and there are many ways to solve it!\n\n- When passing a label you can optionally specify extra unique ID information within string itself.\nThis helps solving the simpler collision cases. Use \"##\" to pass a complement to the ID that won't be visible to the end-user:\n\nButton(\"Play\");         // Label = \"Play\",   ID = hash of \"Play\"\nButton(\"Play##foo1\");   // Label = \"Play\",   ID = hash of \"Play##foo1\" (different from above)\nButton(\"Play##foo2\");   // Label = \"Play\",   ID = hash of \"Play##foo2\" (different from above)\n\n- If you want to completely hide the label, but still need an ID:\n\nCheckbox(\"##On\", &b);   // Label = \"\",       ID = hash of \"##On\" (no label!)\n\n- Occasionally/rarely you might want change a label while preserving a constant ID. This allows you to animate labels.\nFor example you may want to include varying information in a window title bar (and windows are uniquely identified by their ID.. obviously)\nUse \"###\" to pass a label that isn't part of ID:\n\nButton(\"Hello###ID\";   // Label = \"Hello\",  ID = hash of \"ID\"\nButton(\"World###ID\";   // Label = \"World\",  ID = hash of \"ID\" (same as above)\n\nsprintf(buf, \"My game (%f FPS)###MyGame\");\nBegin(buf);            // Variable label,   ID = hash of \"MyGame\"\n\n- Use PushID() / PopID() to create scopes and avoid ID conflicts within the same Window.\nThis is the most convenient way of distinguishing ID if you are iterating and creating many UI elements.\nYou can push a pointer, a string or an integer value. Remember that ID are formed from the concatenation of everything in the ID stack!\n\nfor (int i = 0; i < 100; i++)\n{\nPushID(i);\nButton(\"Click\");   // Label = \"Click\",  ID = hash of integer + \"label\" (unique)\nPopID();\n}\n\nfor (int i = 0; i < 100; i++)\n{\nMyObject* obj = Objects[i];\nPushID(obj);\nButton(\"Click\");   // Label = \"Click\",  ID = hash of pointer + \"label\" (unique)\nPopID();\n}\n\nfor (int i = 0; i < 100; i++)\n{\nMyObject* obj = Objects[i];\nPushID(obj->Name);\nButton(\"Click\");   // Label = \"Click\",  ID = hash of string + \"label\" (unique)\nPopID();\n}\n\n- More example showing that you can stack multiple prefixes into the ID stack:\n\nButton(\"Click\");     // Label = \"Click\",  ID = hash of \"Click\"\nPushID(\"node\");\nButton(\"Click\");     // Label = \"Click\",  ID = hash of \"node\" + \"Click\"\nPushID(my_ptr);\nButton(\"Click\"); // Label = \"Click\",  ID = hash of \"node\" + ptr + \"Click\"\nPopID();\nPopID();\n\n- Tree nodes implicitly creates a scope for you by calling PushID().\n\nButton(\"Click\");     // Label = \"Click\",  ID = hash of \"Click\"\nif (TreeNode(\"node\"))\n{\nButton(\"Click\");   // Label = \"Click\",  ID = hash of \"node\" + \"Click\"\nTreePop();\n}\n\n- When working with trees, ID are used to preserve the open/close state of each tree node.\nDepending on your use cases you may want to use strings, indices or pointers as ID.\ne.g. when displaying a single object that may change over time (dynamic 1-1 relationship), using a static string as ID will preserve your\nnode open/closed state when the targeted object change.\ne.g. when displaying a list of objects, using indices or pointers as ID will preserve the node open/closed state differently.\nexperiment and see what makes more sense!\n\nQ: How can I tell when Dear ImGui wants my mouse/keyboard inputs VS when I can pass them to my application?\nA: You can read the 'io.WantCaptureMouse'/'io.WantCaptureKeyboard'/'ioWantTextInput' flags from the ImGuiIO structure.\n- When 'io.WantCaptureMouse' or 'io.WantCaptureKeyboard' flags are set you may want to discard/hide the inputs from the rest of your application.\n- When 'io.WantTextInput' is set to may want to notify your OS to popup an on-screen keyboard, if available (e.g. on a mobile phone, or console OS).\nPreferably read the flags after calling ImGui::NewFrame() to avoid them lagging by one frame. But reading those flags before calling NewFrame() is\nalso generally ok, as the bool toggles fairly rarely and you don't generally expect to interact with either Dear ImGui or your application during\nthe same frame when that transition occurs. Dear ImGui is tracking dragging and widget activity that may occur outside the boundary of a window,\nso 'io.WantCaptureMouse' is more accurate and correct than checking if a window is hovered.\n(Advanced note: text input releases focus on Return 'KeyDown', so the following Return 'KeyUp' event that your application receive will typically\nhave 'io.WantCaptureKeyboard=false'. Depending on your application logic it may or not be inconvenient. You might want to track which key-downs\nwere for Dear ImGui, e.g. with an array of bool, and filter out the corresponding key-ups.)\n\nQ: How can I load a different font than the default? (default is an embedded version of ProggyClean.ttf, rendered at size 13)\nA: Use the font atlas to load the TTF/OTF file you want:\n\nImGuiIO& io = ImGui::GetIO();\nio.Fonts->AddFontFromFileTTF(\"myfontfile.ttf\", size_in_pixels);\nio.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()\n\nQ: How can I easily use icons in my application?\nA: The most convenient and practical way is to merge an icon font such as FontAwesome inside you main font. Then you can refer to icons within your\nstrings. Read 'How can I load multiple fonts?' and the file 'extra_fonts/README.txt' for instructions and useful header files.\n\nQ: How can I load multiple fonts?\nA: Use the font atlas to pack them into a single texture:\n(Read extra_fonts/README.txt and the code in ImFontAtlas for more details.)\n\nImGuiIO& io = ImGui::GetIO();\nImFont* font0 = io.Fonts->AddFontDefault();\nImFont* font1 = io.Fonts->AddFontFromFileTTF(\"myfontfile.ttf\", size_in_pixels);\nImFont* font2 = io.Fonts->AddFontFromFileTTF(\"myfontfile2.ttf\", size_in_pixels);\nio.Fonts->GetTexDataAsRGBA32() or GetTexDataAsAlpha8()\n// the first loaded font gets used by default\n// use ImGui::PushFont()/ImGui::PopFont() to change the font at runtime\n\n// Options\nImFontConfig config;\nconfig.OversampleH = 3;\nconfig.OversampleV = 1;\nconfig.GlyphOffset.y -= 2.0f;      // Move everything by 2 pixels up\nconfig.GlyphExtraSpacing.x = 1.0f; // Increase spacing between characters\nio.Fonts->LoadFromFileTTF(\"myfontfile.ttf\", size_pixels, &config);\n\n// Combine multiple fonts into one (e.g. for icon fonts)\nImWchar ranges[] = { 0xf000, 0xf3ff, 0 };\nImFontConfig config;\nconfig.MergeMode = true;\nio.Fonts->AddFontDefault();\nio.Fonts->LoadFromFileTTF(\"fontawesome-webfont.ttf\", 16.0f, &config, ranges); // Merge icon font\nio.Fonts->LoadFromFileTTF(\"myfontfile.ttf\", size_pixels, NULL, &config, io.Fonts->GetGlyphRangesJapanese()); // Merge japanese glyphs\n\nQ: How can I display and input non-Latin characters such as Chinese, Japanese, Korean, Cyrillic?\nA: When loading a font, pass custom Unicode ranges to specify the glyphs to load.\n\n// Add default Japanese ranges\nio.Fonts->AddFontFromFileTTF(\"myfontfile.ttf\", size_in_pixels, NULL, io.Fonts->GetGlyphRangesJapanese());\n\n// Or create your own custom ranges (e.g. for a game you can feed your entire game script and only build the characters the game need)\nImVector<ImWchar> ranges;\nImFontAtlas::GlyphRangesBuilder builder;\nbuilder.AddText(\"Hello world\");                        // Add a string (here \"Hello world\" contains 7 unique characters)\nbuilder.AddChar(0x7262);                               // Add a specific character\nbuilder.AddRanges(io.Fonts->GetGlyphRangesJapanese()); // Add one of the default ranges\nbuilder.BuildRanges(&ranges);                          // Build the final result (ordered ranges with all the unique characters submitted)\nio.Fonts->AddFontFromFileTTF(\"myfontfile.ttf\", size_in_pixels, NULL, ranges.Data);\n\nAll your strings needs to use UTF-8 encoding. In C++11 you can encode a string literal in UTF-8 by using the u8\"hello\" syntax.\nSpecifying literal in your source code using a local code page (such as CP-923 for Japanese or CP-1251 for Cyrillic) will NOT work!\nOtherwise you can convert yourself to UTF-8 or load text data from file already saved as UTF-8.\n\nText input: it is up to your application to pass the right character code to io.AddInputCharacter(). The applications in examples/ are doing that.\nFor languages using IME, on Windows you can copy the Hwnd of your application to io.ImeWindowHandle.\nThe default implementation of io.ImeSetInputScreenPosFn() on Windows will set your IME position correctly.\n\nQ: How can I preserve my Dear ImGui context across reloading a DLL? (loss of the global/static variables)\nA: Create your own context 'ctx = CreateContext()' + 'SetCurrentContext(ctx)' and your own font atlas 'ctx->GetIO().Fonts = new ImFontAtlas()'\nso you don't rely on the default globals.\n\nQ: How can I use the drawing facilities without an ImGui window? (using ImDrawList API)\nA: The easiest way is to create a dummy window. Call Begin() with NoTitleBar|NoResize|NoMove|NoScrollbar|NoSavedSettings|NoInputs flag,\nzero background alpha, then retrieve the ImDrawList* via GetWindowDrawList() and draw to it in any way you like.\nYou can also perfectly create a standalone ImDrawList instance _but_ you need ImGui to be initialized because ImDrawList pulls from ImGui\ndata to retrieve the coordinates of the white pixel.\n\n- tip: you can call Begin() multiple times with the same name during the same frame, it will keep appending to the same window.\nthis is also useful to set yourself in the context of another window (to get/set other settings)\n- tip: you can create widgets without a Begin()/End() block, they will go in an implicit window called \"Debug\".\n- tip: the ImGuiOnceUponAFrame helper will allow run the block of code only once a frame. You can use it to quickly add custom UI in the middle\nof a deep nested inner loop in your code.\n- tip: you can call Render() multiple times (e.g for VR renders).\n- tip: call and read the ShowDemoWindow() code in imgui_demo.cpp for more example of how to use ImGui!\n\n*/\n\n#include \"imgui.h\"\n#define IMGUI_DEFINE_MATH_OPERATORS\n#include \"imgui_internal.h\"\n\n#include <ctype.h>      // toupper, isprint\n#include <stdlib.h>     // NULL, malloc, free, qsort, atoi\n#include <stdio.h>      // vsnprintf, sscanf, printf\n#include <limits.h>     // INT_MIN, INT_MAX\n#if defined(_MSC_VER) && _MSC_VER <= 1500 // MSVC 2008 or earlier\n#include <stddef.h>     // intptr_t\n#else\n#include <stdint.h>     // intptr_t\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (disable: 4127) // condition expression is constant\n#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)\n#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#endif\n\n// Clang warnings with -Weverything\n#ifdef __clang__\n#pragma clang diagnostic ignored \"-Wunknown-pragmas\"        // warning : unknown warning group '-Wformat-pedantic *'        // not all warnings are known by all clang versions.. so ignoring warnings triggers new warnings on some configuration. great!\n#pragma clang diagnostic ignored \"-Wold-style-cast\"         // warning : use of old-style cast                              // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wfloat-equal\"            // warning : comparing floating point with == or != is unsafe   // storing and comparing against same constants (typically 0.0f) is ok.\n#pragma clang diagnostic ignored \"-Wformat-nonliteral\"      // warning : format string is not a string literal              // passing non-literal to vsnformat(). yes, user passing incorrect format strings can crash the code.\n#pragma clang diagnostic ignored \"-Wexit-time-destructors\"  // warning : declaration requires an exit-time destructor       // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.\n#pragma clang diagnostic ignored \"-Wglobal-constructors\"    // warning : declaration requires a global destructor           // similar to above, not sure what the exact difference it.\n#pragma clang diagnostic ignored \"-Wsign-conversion\"        // warning : implicit conversion changes signedness             //\n#pragma clang diagnostic ignored \"-Wformat-pedantic\"        // warning : format specifies type 'void *' but the argument has type 'xxxx *' // unreasonable, would lead to casting every %p arg to void*. probably enabled by -pedantic. \n#pragma clang diagnostic ignored \"-Wint-to-void-pointer-cast\" // warning : cast to 'void *' from smaller integer type 'int' //\n#elif defined(__GNUC__)\n#pragma GCC diagnostic ignored \"-Wunused-function\"          // warning: 'xxxx' defined but not used\n#pragma GCC diagnostic ignored \"-Wint-to-pointer-cast\"      // warning: cast to pointer from integer of different size\n#pragma GCC diagnostic ignored \"-Wformat\"                   // warning: format '%p' expects argument of type 'void*', but argument 6 has type 'ImGuiWindow*'\n#pragma GCC diagnostic ignored \"-Wdouble-promotion\"         // warning: implicit conversion from 'float' to 'double' when passing argument to function\n#pragma GCC diagnostic ignored \"-Wconversion\"               // warning: conversion to 'xxxx' from 'xxxx' may alter its value\n#pragma GCC diagnostic ignored \"-Wcast-qual\"                // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers\n#pragma GCC diagnostic ignored \"-Wformat-nonliteral\"        // warning: format not a string literal, format string not checked\n#endif\n\n//-------------------------------------------------------------------------\n// Forward Declarations\n//-------------------------------------------------------------------------\n\nstatic bool             IsKeyPressedMap(ImGuiKey key, bool repeat = true);\n\nstatic ImFont* GetDefaultFont();\nstatic void             SetCurrentFont(ImFont* font);\nstatic void             SetCurrentWindow(ImGuiWindow* window);\nstatic void             SetWindowScrollY(ImGuiWindow* window, float new_scroll_y);\nstatic void             SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond);\nstatic void             SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond);\nstatic void             SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond);\nstatic ImGuiWindow* FindHoveredWindow(ImVec2 pos);\nstatic ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags);\nstatic void             CheckStacksSize(ImGuiWindow* window, bool write);\nstatic ImVec2           CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window);\n\nstatic void             AddDrawListToDrawData(ImVector<ImDrawList*>* out_render_list, ImDrawList* draw_list);\nstatic void             AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWindow* window);\nstatic void             AddWindowToSortedBuffer(ImVector<ImGuiWindow*>* out_sorted_windows, ImGuiWindow* window);\n\nstatic ImGuiWindowSettings* AddWindowSettings(const char* name);\n\nstatic void             LoadIniSettingsFromDisk(const char* ini_filename);\nstatic void             LoadIniSettingsFromMemory(const char* buf);\nstatic void             SaveIniSettingsToDisk(const char* ini_filename);\nstatic void             SaveIniSettingsToMemory(ImVector<char>& out_buf);\nstatic void             MarkIniSettingsDirty(ImGuiWindow* window);\n\nstatic ImRect           GetVisibleRect();\n\nstatic void             CloseInactivePopups(ImGuiWindow* ref_window);\nstatic void             ClosePopupToLevel(int remaining);\nstatic ImGuiWindow* GetFrontMostModalRootWindow();\n\nstatic bool             InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data);\nstatic int              InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);\nstatic ImVec2           InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);\n\nstatic inline void      DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, const char* display_format, char* buf, int buf_size);\nstatic inline void      DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, int decimal_precision, char* buf, int buf_size);\nstatic void             DataTypeApplyOp(ImGuiDataType data_type, int op, void* value1, const void* value2);\nstatic bool             DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format);\n\nnamespace ImGui\n{\n\tstatic void             UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4]);\n\tstatic void             FocusFrontMostActiveWindow(ImGuiWindow* ignore_window);\n}\n\n//-----------------------------------------------------------------------------\n// Platform dependent default implementations\n//-----------------------------------------------------------------------------\n\nstatic const char* GetClipboardTextFn_DefaultImpl(void* user_data);\nstatic void             SetClipboardTextFn_DefaultImpl(void* user_data, const char* text);\nstatic void             ImeSetInputScreenPosFn_DefaultImpl(int x, int y);\n\n//-----------------------------------------------------------------------------\n// Context\n//-----------------------------------------------------------------------------\n\n// Default font atlas storage.\n// New contexts always point by default to this font atlas. It can be changed by reassigning the GetIO().Fonts variable.\nstatic ImFontAtlas      GImDefaultFontAtlas;\n\n// Default context storage + current context pointer.\n// Implicitely used by all ImGui functions. Always assumed to be != NULL. Change to a different context by calling ImGui::SetCurrentContext()\n// If you are hot-reloading this code in a DLL you will lose the static/global variables. Create your own context+font atlas instead of relying on those default (see FAQ entry \"How can I preserve my ImGui context across reloading a DLL?\").\n// ImGui is currently not thread-safe because of this variable. If you want thread-safety to allow N threads to access N different contexts, you might work around it by:\n// - Having multiple instances of the ImGui code compiled inside different namespace (easiest/safest, if you have a finite number of contexts)\n// - or: Changing this variable to be TLS. You may #define GImGui in imconfig.h for further custom hackery. Future development aim to make this context pointer explicit to all calls. Also read https://github.com/ocornut/imgui/issues/586\n#ifndef GImGui\nstatic ImGuiContext     GImDefaultContext;\nImGuiContext* GImGui = &GImDefaultContext;\n#endif\n\n//-----------------------------------------------------------------------------\n// User facing structures\n//-----------------------------------------------------------------------------\n\nImGuiStyle::ImGuiStyle()\n{\n\tAlpha = 1.0f;             // Global alpha applies to everything in ImGui\n\tWindowPadding = ImVec2(8, 8);      // Padding within a window\n\tWindowRounding = 7.0f;             // Radius of window corners rounding. Set to 0.0f to have rectangular windows\n\tWindowBorderSize = 0.0f;             // Thickness of border around windows. Generally set to 0.0f or 1.0f. Other values not well tested.\n\tWindowMinSize = ImVec2(32, 32);    // Minimum window size\n\tWindowTitleAlign = ImVec2(0.0f, 0.5f);// Alignment for title bar text\n\tChildRounding = 0.0f;             // Radius of child window corners rounding. Set to 0.0f to have rectangular child windows\n\tChildBorderSize = 1.0f;             // Thickness of border around child windows. Generally set to 0.0f or 1.0f. Other values not well tested.\n\tPopupRounding = 0.0f;             // Radius of popup window corners rounding. Set to 0.0f to have rectangular child windows\n\tPopupBorderSize = 1.0f;             // Thickness of border around popup or tooltip windows. Generally set to 0.0f or 1.0f. Other values not well tested.\n\tFramePadding = ImVec2(4, 3);      // Padding within a framed rectangle (used by most widgets)\n\tFrameRounding = 0.0f;             // Radius of frame corners rounding. Set to 0.0f to have rectangular frames (used by most widgets).\n\tFrameBorderSize = 0.0f;             // Thickness of border around frames. Generally set to 0.0f or 1.0f. Other values not well tested.\n\tItemSpacing = ImVec2(8, 4);      // Horizontal and vertical spacing between widgets/lines\n\tItemInnerSpacing = ImVec2(4, 4);      // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)\n\tTouchExtraPadding = ImVec2(0, 0);      // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!\n\tIndentSpacing = 21.0f;            // Horizontal spacing when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).\n\tColumnsMinSpacing = 6.0f;             // Minimum horizontal spacing between two columns\n\tScrollbarSize = 16.0f;            // Width of the vertical scrollbar, Height of the horizontal scrollbar\n\tScrollbarRounding = 9.0f;             // Radius of grab corners rounding for scrollbar\n\tGrabMinSize = 10.0f;            // Minimum width/height of a grab box for slider/scrollbar\n\tGrabRounding = 0.0f;             // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.\n\tButtonTextAlign = ImVec2(0.5f, 0.5f);// Alignment of button text when button is larger than text.\n\tDisplayWindowPadding = ImVec2(22, 22);    // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.\n\tDisplaySafeAreaPadding = ImVec2(4, 4);      // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.\n\tAntiAliasedLines = true;             // Enable anti-aliasing on lines/borders. Disable if you are really short on CPU/GPU.\n\tAntiAliasedFill = true;             // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)\n\tCurveTessellationTol = 1.25f;            // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.\n\n\tImGui::StyleColorsClassic(this);\n}\n\n// To scale your entire UI (e.g. if you want your app to use High DPI or generally be DPI aware) you may use this helper function. Scaling the fonts is done separately and is up to you.\n// Important: This operation is lossy because we round all sizes to integer. If you need to change your scale multiples, call this over a freshly initialized ImGuiStyle structure rather than scaling multiple times.\nvoid ImGuiStyle::ScaleAllSizes(float scale_factor)\n{\n\tWindowPadding = ImFloor(WindowPadding * scale_factor);\n\tWindowRounding = ImFloor(WindowRounding * scale_factor);\n\tWindowMinSize = ImFloor(WindowMinSize * scale_factor);\n\tChildRounding = ImFloor(ChildRounding * scale_factor);\n\tPopupRounding = ImFloor(PopupRounding * scale_factor);\n\tFramePadding = ImFloor(FramePadding * scale_factor);\n\tFrameRounding = ImFloor(FrameRounding * scale_factor);\n\tItemSpacing = ImFloor(ItemSpacing * scale_factor);\n\tItemInnerSpacing = ImFloor(ItemInnerSpacing * scale_factor);\n\tTouchExtraPadding = ImFloor(TouchExtraPadding * scale_factor);\n\tIndentSpacing = ImFloor(IndentSpacing * scale_factor);\n\tColumnsMinSpacing = ImFloor(ColumnsMinSpacing * scale_factor);\n\tScrollbarSize = ImFloor(ScrollbarSize * scale_factor);\n\tScrollbarRounding = ImFloor(ScrollbarRounding * scale_factor);\n\tGrabMinSize = ImFloor(GrabMinSize * scale_factor);\n\tGrabRounding = ImFloor(GrabRounding * scale_factor);\n\tDisplayWindowPadding = ImFloor(DisplayWindowPadding * scale_factor);\n\tDisplaySafeAreaPadding = ImFloor(DisplaySafeAreaPadding * scale_factor);\n}\n\nImGuiIO::ImGuiIO()\n{\n\t// Most fields are initialized with zero\n\tmemset(this, 0, sizeof(*this));\n\n\t// Settings\n\tDisplaySize = ImVec2(-1.0f, -1.0f);\n\tDeltaTime = 1.0f / 60.0f;\n\tIniSavingRate = 5.0f;\n\tIniFilename = \"imgui.ini\";\n\tLogFilename = \"imgui_log.txt\";\n\tMouseDoubleClickTime = 0.30f;\n\tMouseDoubleClickMaxDist = 6.0f;\n\tfor (int i = 0; i < ImGuiKey_COUNT; i++)\n\t\tKeyMap[i] = -1;\n\tKeyRepeatDelay = 0.250f;\n\tKeyRepeatRate = 0.050f;\n\tUserData = NULL;\n\n\tFonts = &GImDefaultFontAtlas;\n\tFontGlobalScale = 1.0f;\n\tFontDefault = NULL;\n\tFontAllowUserScaling = false;\n\tDisplayFramebufferScale = ImVec2(1.0f, 1.0f);\n\tDisplayVisibleMin = DisplayVisibleMax = ImVec2(0.0f, 0.0f);\n\n\t// Advanced/subtle behaviors\n#ifdef __APPLE__\n\tOptMacOSXBehaviors = true;  // Set Mac OS X style defaults based on __APPLE__ compile time flag\n#else\n\tOptMacOSXBehaviors = false;\n#endif\n\tOptCursorBlink = true;\n\n\t// Settings (User Functions)\n\tRenderDrawListsFn = NULL;\n\tMemAllocFn = malloc;\n\tMemFreeFn = free;\n\tGetClipboardTextFn = GetClipboardTextFn_DefaultImpl;   // Platform dependent default implementations\n\tSetClipboardTextFn = SetClipboardTextFn_DefaultImpl;\n\tClipboardUserData = NULL;\n\tImeSetInputScreenPosFn = ImeSetInputScreenPosFn_DefaultImpl;\n\tImeWindowHandle = NULL;\n\n\t// Input (NB: we already have memset zero the entire structure)\n\tMousePos = ImVec2(-FLT_MAX, -FLT_MAX);\n\tMousePosPrev = ImVec2(-FLT_MAX, -FLT_MAX);\n\tMouseDragThreshold = 6.0f;\n\tfor (int i = 0; i < IM_ARRAYSIZE(MouseDownDuration); i++) MouseDownDuration[i] = MouseDownDurationPrev[i] = -1.0f;\n\tfor (int i = 0; i < IM_ARRAYSIZE(KeysDownDuration); i++) KeysDownDuration[i] = KeysDownDurationPrev[i] = -1.0f;\n}\n\n// Pass in translated ASCII characters for text input.\n// - with glfw you can get those from the callback set in glfwSetCharCallback()\n// - on Windows you can get those using ToAscii+keyboard state, or via the WM_CHAR message\nvoid ImGuiIO::AddInputCharacter(ImWchar c)\n{\n\tconst int n = ImStrlenW(InputCharacters);\n\tif (n + 1 < IM_ARRAYSIZE(InputCharacters))\n\t{\n\t\tInputCharacters[n] = c;\n\t\tInputCharacters[n + 1] = '\\0';\n\t}\n}\n\nvoid ImGuiIO::AddInputCharactersUTF8(const char* utf8_chars)\n{\n\t// We can't pass more wchars than ImGuiIO::InputCharacters[] can hold so don't convert more\n\tconst int wchars_buf_len = sizeof(ImGuiIO::InputCharacters) / sizeof(ImWchar);\n\tImWchar wchars[wchars_buf_len];\n\tImTextStrFromUtf8(wchars, wchars_buf_len, utf8_chars, NULL);\n\tfor (int i = 0; i < wchars_buf_len && wchars[i] != 0; i++)\n\t\tAddInputCharacter(wchars[i]);\n}\n\n//-----------------------------------------------------------------------------\n// HELPERS\n//-----------------------------------------------------------------------------\n\n#define IM_F32_TO_INT8_UNBOUND(_VAL)    ((int)((_VAL) * 255.0f + ((_VAL)>=0 ? 0.5f : -0.5f)))   // Unsaturated, for display purpose \n#define IM_F32_TO_INT8_SAT(_VAL)        ((int)(ImSaturate(_VAL) * 255.0f + 0.5f))               // Saturated, always output 0..255\n\n// Play it nice with Windows users. Notepad in 2015 still doesn't display text data with Unix-style \\n.\n#ifdef _WIN32\n#define IM_NEWLINE \"\\r\\n\"\n#else\n#define IM_NEWLINE \"\\n\"\n#endif\n\nImVec2 ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p)\n{\n\tImVec2 ap = p - a;\n\tImVec2 ab_dir = b - a;\n\tfloat ab_len = sqrtf(ab_dir.x * ab_dir.x + ab_dir.y * ab_dir.y);\n\tab_dir *= 1.0f / ab_len;\n\tfloat dot = ap.x * ab_dir.x + ap.y * ab_dir.y;\n\tif (dot < 0.0f)\n\t\treturn a;\n\tif (dot > ab_len)\n\t\treturn b;\n\treturn a + ab_dir * dot;\n}\n\nbool ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p)\n{\n\tbool b1 = ((p.x - b.x) * (a.y - b.y) - (p.y - b.y) * (a.x - b.x)) < 0.0f;\n\tbool b2 = ((p.x - c.x) * (b.y - c.y) - (p.y - c.y) * (b.x - c.x)) < 0.0f;\n\tbool b3 = ((p.x - a.x) * (c.y - a.y) - (p.y - a.y) * (c.x - a.x)) < 0.0f;\n\treturn ((b1 == b2) && (b2 == b3));\n}\n\nvoid ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w)\n{\n\tImVec2 v0 = b - a;\n\tImVec2 v1 = c - a;\n\tImVec2 v2 = p - a;\n\tconst float denom = v0.x * v1.y - v1.x * v0.y;\n\tout_v = (v2.x * v1.y - v1.x * v2.y) / denom;\n\tout_w = (v0.x * v2.y - v2.x * v0.y) / denom;\n\tout_u = 1.0f - out_v - out_w;\n}\n\nImVec2 ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p)\n{\n\tImVec2 proj_ab = ImLineClosestPoint(a, b, p);\n\tImVec2 proj_bc = ImLineClosestPoint(b, c, p);\n\tImVec2 proj_ca = ImLineClosestPoint(c, a, p);\n\tfloat dist2_ab = ImLengthSqr(p - proj_ab);\n\tfloat dist2_bc = ImLengthSqr(p - proj_bc);\n\tfloat dist2_ca = ImLengthSqr(p - proj_ca);\n\tfloat m = ImMin(dist2_ab, ImMin(dist2_bc, dist2_ca));\n\tif (m == dist2_ab)\n\t\treturn proj_ab;\n\tif (m == dist2_bc)\n\t\treturn proj_bc;\n\treturn proj_ca;\n}\n\nint ImStricmp(const char* str1, const char* str2)\n{\n\tint d;\n\twhile ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; }\n\treturn d;\n}\n\nint ImStrnicmp(const char* str1, const char* str2, size_t count)\n{\n\tint d = 0;\n\twhile (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) { str1++; str2++; count--; }\n\treturn d;\n}\n\nvoid ImStrncpy(char* dst, const char* src, size_t count)\n{\n\tif (count < 1) return;\n\tstrncpy(dst, src, count);\n\tdst[count - 1] = 0;\n}\n\nchar* ImStrdup(const char* str)\n{\n\tsize_t len = strlen(str) + 1;\n\tvoid* buf = ImGui::MemAlloc(len);\n\treturn (char*)memcpy(buf, (const void*)str, len);\n}\n\nchar* ImStrchrRange(const char* str, const char* str_end, char c)\n{\n\tfor (; str < str_end; str++)\n\t\tif (*str == c)\n\t\t\treturn (char*)str;\n\treturn NULL;\n}\n\nint ImStrlenW(const ImWchar* str)\n{\n\tint n = 0;\n\twhile (*str++) n++;\n\treturn n;\n}\n\nconst ImWchar* ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin) // find beginning-of-line\n{\n\twhile (buf_mid_line > buf_begin&& buf_mid_line[-1] != '\\n')\n\t\tbuf_mid_line--;\n\treturn buf_mid_line;\n}\n\nconst char* ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end)\n{\n\tif (!needle_end)\n\t\tneedle_end = needle + strlen(needle);\n\n\tconst char un0 = (char)toupper(*needle);\n\twhile ((!haystack_end && *haystack) || (haystack_end && haystack < haystack_end))\n\t{\n\t\tif (toupper(*haystack) == un0)\n\t\t{\n\t\t\tconst char* b = needle + 1;\n\t\t\tfor (const char* a = haystack + 1; b < needle_end; a++, b++)\n\t\t\t\tif (toupper(*a) != toupper(*b))\n\t\t\t\t\tbreak;\n\t\t\tif (b == needle_end)\n\t\t\t\treturn haystack;\n\t\t}\n\t\thaystack++;\n\t}\n\treturn NULL;\n}\n\nstatic const char* ImAtoi(const char* src, int* output)\n{\n\tint negative = 0;\n\tif (*src == '-') { negative = 1; src++; }\n\tif (*src == '+') { src++; }\n\tint v = 0;\n\twhile (*src >= '0' && *src <= '9')\n\t\tv = (v * 10) + (*src++ - '0');\n\t*output = negative ? -v : v;\n\treturn src;\n}\n\n// A) MSVC version appears to return -1 on overflow, whereas glibc appears to return total count (which may be >= buf_size). \n// Ideally we would test for only one of those limits at runtime depending on the behavior the vsnprintf(), but trying to deduct it at compile time sounds like a pandora can of worm.\n// B) When buf==NULL vsnprintf() will return the output size.\n#ifndef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS\nint ImFormatString(char* buf, size_t buf_size, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tint w = vsnprintf(buf, buf_size, fmt, args);\n\tva_end(args);\n\tif (buf == NULL)\n\t\treturn w;\n\tif (w == -1 || w >= (int)buf_size)\n\t\tw = (int)buf_size - 1;\n\tbuf[w] = 0;\n\treturn w;\n}\n\nint ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args)\n{\n\tint w = vsnprintf(buf, buf_size, fmt, args);\n\tif (buf == NULL)\n\t\treturn w;\n\tif (w == -1 || w >= (int)buf_size)\n\t\tw = (int)buf_size - 1;\n\tbuf[w] = 0;\n\treturn w;\n}\n#endif // #ifdef IMGUI_DISABLE_FORMAT_STRING_FUNCTIONS\n\n// Pass data_size==0 for zero-terminated strings\n// FIXME-OPT: Replace with e.g. FNV1a hash? CRC32 pretty much randomly access 1KB. Need to do proper measurements.\nImU32 ImHash(const void* data, int data_size, ImU32 seed)\n{\n\tstatic ImU32 crc32_lut[256] = { 0 };\n\tif (!crc32_lut[1])\n\t{\n\t\tconst ImU32 polynomial = 0xEDB88320;\n\t\tfor (ImU32 i = 0; i < 256; i++)\n\t\t{\n\t\t\tImU32 crc = i;\n\t\t\tfor (ImU32 j = 0; j < 8; j++)\n\t\t\t\tcrc = (crc >> 1) ^ (ImU32(-int(crc & 1)) & polynomial);\n\t\t\tcrc32_lut[i] = crc;\n\t\t}\n\t}\n\n\tseed = ~seed;\n\tImU32 crc = seed;\n\tconst unsigned char* current = (const unsigned char*)data;\n\n\tif (data_size > 0)\n\t{\n\t\t// Known size\n\t\twhile (data_size--)\n\t\t\tcrc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ *current++];\n\t}\n\telse\n\t{\n\t\t// Zero-terminated string\n\t\twhile (unsigned char c = *current++)\n\t\t{\n\t\t\t// We support a syntax of \"label###id\" where only \"###id\" is included in the hash, and only \"label\" gets displayed.\n\t\t\t// Because this syntax is rarely used we are optimizing for the common case.\n\t\t\t// - If we reach ### in the string we discard the hash so far and reset to the seed.\n\t\t\t// - We don't do 'current += 2; continue;' after handling ### to keep the code smaller.\n\t\t\tif (c == '#' && current[0] == '#' && current[1] == '#')\n\t\t\t\tcrc = seed;\n\t\t\tcrc = (crc >> 8) ^ crc32_lut[(crc & 0xFF) ^ c];\n\t\t}\n\t}\n\treturn ~crc;\n}\n\n//-----------------------------------------------------------------------------\n// ImText* helpers\n//-----------------------------------------------------------------------------\n\n// Convert UTF-8 to 32-bits character, process single character input.\n// Based on stb_from_utf8() from github.com/nothings/stb/\n// We handle UTF-8 decoding error by skipping forward.\nint ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end)\n{\n\tunsigned int c = (unsigned int)-1;\n\tconst unsigned char* str = (const unsigned char*)in_text;\n\tif (!(*str & 0x80))\n\t{\n\t\tc = (unsigned int)(*str++);\n\t\t*out_char = c;\n\t\treturn 1;\n\t}\n\tif ((*str & 0xe0) == 0xc0)\n\t{\n\t\t*out_char = 0xFFFD; // will be invalid but not end of string\n\t\tif (in_text_end && in_text_end - (const char*)str < 2) return 1;\n\t\tif (*str < 0xc2) return 2;\n\t\tc = (unsigned int)((*str++ & 0x1f) << 6);\n\t\tif ((*str & 0xc0) != 0x80) return 2;\n\t\tc += (*str++ & 0x3f);\n\t\t*out_char = c;\n\t\treturn 2;\n\t}\n\tif ((*str & 0xf0) == 0xe0)\n\t{\n\t\t*out_char = 0xFFFD; // will be invalid but not end of string\n\t\tif (in_text_end && in_text_end - (const char*)str < 3) return 1;\n\t\tif (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return 3;\n\t\tif (*str == 0xed && str[1] > 0x9f) return 3; // str[1] < 0x80 is checked below\n\t\tc = (unsigned int)((*str++ & 0x0f) << 12);\n\t\tif ((*str & 0xc0) != 0x80) return 3;\n\t\tc += (unsigned int)((*str++ & 0x3f) << 6);\n\t\tif ((*str & 0xc0) != 0x80) return 3;\n\t\tc += (*str++ & 0x3f);\n\t\t*out_char = c;\n\t\treturn 3;\n\t}\n\tif ((*str & 0xf8) == 0xf0)\n\t{\n\t\t*out_char = 0xFFFD; // will be invalid but not end of string\n\t\tif (in_text_end && in_text_end - (const char*)str < 4) return 1;\n\t\tif (*str > 0xf4) return 4;\n\t\tif (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return 4;\n\t\tif (*str == 0xf4 && str[1] > 0x8f) return 4; // str[1] < 0x80 is checked below\n\t\tc = (unsigned int)((*str++ & 0x07) << 18);\n\t\tif ((*str & 0xc0) != 0x80) return 4;\n\t\tc += (unsigned int)((*str++ & 0x3f) << 12);\n\t\tif ((*str & 0xc0) != 0x80) return 4;\n\t\tc += (unsigned int)((*str++ & 0x3f) << 6);\n\t\tif ((*str & 0xc0) != 0x80) return 4;\n\t\tc += (*str++ & 0x3f);\n\t\t// utf-8 encodings of values used in surrogate pairs are invalid\n\t\tif ((c & 0xFFFFF800) == 0xD800) return 4;\n\t\t*out_char = c;\n\t\treturn 4;\n\t}\n\t*out_char = 0;\n\treturn 0;\n}\n\nint ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_text_remaining)\n{\n\tImWchar* buf_out = buf;\n\tImWchar* buf_end = buf + buf_size;\n\twhile (buf_out < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text)\n\t{\n\t\tunsigned int c;\n\t\tin_text += ImTextCharFromUtf8(&c, in_text, in_text_end);\n\t\tif (c == 0)\n\t\t\tbreak;\n\t\tif (c < 0x10000)    // FIXME: Losing characters that don't fit in 2 bytes\n\t\t\t*buf_out++ = (ImWchar)c;\n\t}\n\t*buf_out = 0;\n\tif (in_text_remaining)\n\t\t*in_text_remaining = in_text;\n\treturn (int)(buf_out - buf);\n}\n\nint ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end)\n{\n\tint char_count = 0;\n\twhile ((!in_text_end || in_text < in_text_end) && *in_text)\n\t{\n\t\tunsigned int c;\n\t\tin_text += ImTextCharFromUtf8(&c, in_text, in_text_end);\n\t\tif (c == 0)\n\t\t\tbreak;\n\t\tif (c < 0x10000)\n\t\t\tchar_count++;\n\t}\n\treturn char_count;\n}\n\n// Based on stb_to_utf8() from github.com/nothings/stb/\nstatic inline int ImTextCharToUtf8(char* buf, int buf_size, unsigned int c)\n{\n\tif (c < 0x80)\n\t{\n\t\tbuf[0] = (char)c;\n\t\treturn 1;\n\t}\n\tif (c < 0x800)\n\t{\n\t\tif (buf_size < 2) return 0;\n\t\tbuf[0] = (char)(0xc0 + (c >> 6));\n\t\tbuf[1] = (char)(0x80 + (c & 0x3f));\n\t\treturn 2;\n\t}\n\tif (c >= 0xdc00 && c < 0xe000)\n\t{\n\t\treturn 0;\n\t}\n\tif (c >= 0xd800 && c < 0xdc00)\n\t{\n\t\tif (buf_size < 4) return 0;\n\t\tbuf[0] = (char)(0xf0 + (c >> 18));\n\t\tbuf[1] = (char)(0x80 + ((c >> 12) & 0x3f));\n\t\tbuf[2] = (char)(0x80 + ((c >> 6) & 0x3f));\n\t\tbuf[3] = (char)(0x80 + ((c) & 0x3f));\n\t\treturn 4;\n\t}\n\t//else if (c < 0x10000)\n\t{\n\t\tif (buf_size < 3) return 0;\n\t\tbuf[0] = (char)(0xe0 + (c >> 12));\n\t\tbuf[1] = (char)(0x80 + ((c >> 6) & 0x3f));\n\t\tbuf[2] = (char)(0x80 + ((c) & 0x3f));\n\t\treturn 3;\n\t}\n}\n\nstatic inline int ImTextCountUtf8BytesFromChar(unsigned int c)\n{\n\tif (c < 0x80) return 1;\n\tif (c < 0x800) return 2;\n\tif (c >= 0xdc00 && c < 0xe000) return 0;\n\tif (c >= 0xd800 && c < 0xdc00) return 4;\n\treturn 3;\n}\n\nint ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end)\n{\n\tchar* buf_out = buf;\n\tconst char* buf_end = buf + buf_size;\n\twhile (buf_out < buf_end - 1 && (!in_text_end || in_text < in_text_end) && *in_text)\n\t{\n\t\tunsigned int c = (unsigned int)(*in_text++);\n\t\tif (c < 0x80)\n\t\t\t*buf_out++ = (char)c;\n\t\telse\n\t\t\tbuf_out += ImTextCharToUtf8(buf_out, (int)(buf_end - buf_out - 1), c);\n\t}\n\t*buf_out = 0;\n\treturn (int)(buf_out - buf);\n}\n\nint ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end)\n{\n\tint bytes_count = 0;\n\twhile ((!in_text_end || in_text < in_text_end) && *in_text)\n\t{\n\t\tunsigned int c = (unsigned int)(*in_text++);\n\t\tif (c < 0x80)\n\t\t\tbytes_count++;\n\t\telse\n\t\t\tbytes_count += ImTextCountUtf8BytesFromChar(c);\n\t}\n\treturn bytes_count;\n}\n\nImVec4 ImGui::ColorConvertU32ToFloat4(ImU32 in)\n{\n\tfloat s = 1.0f / 255.0f;\n\treturn ImVec4(\n\t\t((in >> IM_COL32_R_SHIFT) & 0xFF)* s,\n\t\t((in >> IM_COL32_G_SHIFT) & 0xFF)* s,\n\t\t((in >> IM_COL32_B_SHIFT) & 0xFF)* s,\n\t\t((in >> IM_COL32_A_SHIFT) & 0xFF)* s);\n}\n\nImU32 ImGui::ColorConvertFloat4ToU32(const ImVec4& in)\n{\n\tImU32 out;\n\tout = ((ImU32)IM_F32_TO_INT8_SAT(in.x)) << IM_COL32_R_SHIFT;\n\tout |= ((ImU32)IM_F32_TO_INT8_SAT(in.y)) << IM_COL32_G_SHIFT;\n\tout |= ((ImU32)IM_F32_TO_INT8_SAT(in.z)) << IM_COL32_B_SHIFT;\n\tout |= ((ImU32)IM_F32_TO_INT8_SAT(in.w)) << IM_COL32_A_SHIFT;\n\treturn out;\n}\n\nImU32 ImGui::GetColorU32(ImGuiCol idx, float alpha_mul)\n{\n\tImGuiStyle& style = GImGui->Style;\n\tImVec4 c = style.Colors[idx];\n\tc.w *= style.Alpha * alpha_mul;\n\treturn ColorConvertFloat4ToU32(c);\n}\n\nImU32 ImGui::GetColorU32(const ImVec4& col)\n{\n\tImGuiStyle& style = GImGui->Style;\n\tImVec4 c = col;\n\tc.w *= style.Alpha;\n\treturn ColorConvertFloat4ToU32(c);\n}\n\nconst ImVec4& ImGui::GetStyleColorVec4(ImGuiCol idx)\n{\n\tImGuiStyle& style = GImGui->Style;\n\treturn style.Colors[idx];\n}\n\nImU32 ImGui::GetColorU32(ImU32 col)\n{\n\tfloat style_alpha = GImGui->Style.Alpha;\n\tif (style_alpha >= 1.0f)\n\t\treturn col;\n\tint a = (col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT;\n\ta = (int)(a * style_alpha); // We don't need to clamp 0..255 because Style.Alpha is in 0..1 range.\n\treturn (col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);\n}\n\n// Convert rgb floats ([0-1],[0-1],[0-1]) to hsv floats ([0-1],[0-1],[0-1]), from Foley & van Dam p592\n// Optimized http://lolengine.net/blog/2013/01/13/fast-rgb-to-hsv\nvoid ImGui::ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v)\n{\n\tfloat K = 0.f;\n\tif (g < b)\n\t{\n\t\tImSwap(g, b);\n\t\tK = -1.f;\n\t}\n\tif (r < g)\n\t{\n\t\tImSwap(r, g);\n\t\tK = -2.f / 6.f - K;\n\t}\n\n\tconst float chroma = r - (g < b ? g : b);\n\tout_h = fabsf(K + (g - b) / (6.f * chroma + 1e-20f));\n\tout_s = chroma / (r + 1e-20f);\n\tout_v = r;\n}\n\n// Convert hsv floats ([0-1],[0-1],[0-1]) to rgb floats ([0-1],[0-1],[0-1]), from Foley & van Dam p593\n// also http://en.wikipedia.org/wiki/HSL_and_HSV\nvoid ImGui::ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b)\n{\n\tif (s == 0.0f)\n\t{\n\t\t// gray\n\t\tout_r = out_g = out_b = v;\n\t\treturn;\n\t}\n\n\th = fmodf(h, 1.0f) / (60.0f / 360.0f);\n\tint   i = (int)h;\n\tfloat f = h - (float)i;\n\tfloat p = v * (1.0f - s);\n\tfloat q = v * (1.0f - s * f);\n\tfloat t = v * (1.0f - s * (1.0f - f));\n\n\tswitch (i)\n\t{\n\tcase 0: out_r = v; out_g = t; out_b = p; break;\n\tcase 1: out_r = q; out_g = v; out_b = p; break;\n\tcase 2: out_r = p; out_g = v; out_b = t; break;\n\tcase 3: out_r = p; out_g = q; out_b = v; break;\n\tcase 4: out_r = t; out_g = p; out_b = v; break;\n\tcase 5: default: out_r = v; out_g = p; out_b = q; break;\n\t}\n}\n\nFILE* ImFileOpen(const char* filename, const char* mode)\n{\n#if defined(_WIN32) && !defined(__CYGWIN__)\n\t// We need a fopen() wrapper because MSVC/Windows fopen doesn't handle UTF-8 filenames. Converting both strings from UTF-8 to wchar format (using a single allocation, because we can)\n\tconst int filename_wsize = ImTextCountCharsFromUtf8(filename, NULL) + 1;\n\tconst int mode_wsize = ImTextCountCharsFromUtf8(mode, NULL) + 1;\n\tImVector<ImWchar> buf;\n\tbuf.resize(filename_wsize + mode_wsize);\n\tImTextStrFromUtf8(&buf[0], filename_wsize, filename, NULL);\n\tImTextStrFromUtf8(&buf[filename_wsize], mode_wsize, mode, NULL);\n\treturn _wfopen((wchar_t*)&buf[0], (wchar_t*)&buf[filename_wsize]);\n#else\n\treturn fopen(filename, mode);\n#endif\n}\n\n// Load file content into memory\n// Memory allocated with ImGui::MemAlloc(), must be freed by user using ImGui::MemFree()\nvoid* ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size, int padding_bytes)\n{\n\tIM_ASSERT(filename && file_open_mode);\n\tif (out_file_size)\n\t\t*out_file_size = 0;\n\n\tFILE* f;\n\tif ((f = ImFileOpen(filename, file_open_mode)) == NULL)\n\t\treturn NULL;\n\n\tlong file_size_signed;\n\tif (fseek(f, 0, SEEK_END) || (file_size_signed = ftell(f)) == -1 || fseek(f, 0, SEEK_SET))\n\t{\n\t\tfclose(f);\n\t\treturn NULL;\n\t}\n\n\tint file_size = (int)file_size_signed;\n\tvoid* file_data = ImGui::MemAlloc(file_size + padding_bytes);\n\tif (file_data == NULL)\n\t{\n\t\tfclose(f);\n\t\treturn NULL;\n\t}\n\tif (fread(file_data, 1, (size_t)file_size, f) != (size_t)file_size)\n\t{\n\t\tfclose(f);\n\t\tImGui::MemFree(file_data);\n\t\treturn NULL;\n\t}\n\tif (padding_bytes > 0)\n\t\tmemset((void*)(((char*)file_data) + file_size), 0, padding_bytes);\n\n\tfclose(f);\n\tif (out_file_size)\n\t\t*out_file_size = file_size;\n\n\treturn file_data;\n}\n\n//-----------------------------------------------------------------------------\n// ImGuiStorage\n// Helper: Key->value storage\n//-----------------------------------------------------------------------------\n\n// std::lower_bound but without the bullshit\nstatic ImVector<ImGuiStorage::Pair>::iterator LowerBound(ImVector<ImGuiStorage::Pair>& data, ImGuiID key)\n{\n\tImVector<ImGuiStorage::Pair>::iterator first = data.begin();\n\tImVector<ImGuiStorage::Pair>::iterator last = data.end();\n\tsize_t count = (size_t)(last - first);\n\twhile (count > 0)\n\t{\n\t\tsize_t count2 = count >> 1;\n\t\tImVector<ImGuiStorage::Pair>::iterator mid = first + count2;\n\t\tif (mid->key < key)\n\t\t{\n\t\t\tfirst = ++mid;\n\t\t\tcount -= count2 + 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcount = count2;\n\t\t}\n\t}\n\treturn first;\n}\n\n// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.\nvoid ImGuiStorage::BuildSortByKey()\n{\n\tstruct StaticFunc\n\t{\n\t\tstatic int PairCompareByID(const void* lhs, const void* rhs)\n\t\t{\n\t\t\t// We can't just do a subtraction because qsort uses signed integers and subtracting our ID doesn't play well with that.\n\t\t\tif (((const Pair*)lhs)->key > ((const Pair*)rhs)->key) return +1;\n\t\t\tif (((const Pair*)lhs)->key < ((const Pair*)rhs)->key) return -1;\n\t\t\treturn 0;\n\t\t}\n\t};\n\tif (Data.Size > 1)\n\t\tqsort(Data.Data, (size_t)Data.Size, sizeof(Pair), StaticFunc::PairCompareByID);\n}\n\nint ImGuiStorage::GetInt(ImGuiID key, int default_val) const\n{\n\tImVector<Pair>::iterator it = LowerBound(const_cast<ImVector<ImGuiStorage::Pair>&>(Data), key);\n\tif (it == Data.end() || it->key != key)\n\t\treturn default_val;\n\treturn it->val_i;\n}\n\nbool ImGuiStorage::GetBool(ImGuiID key, bool default_val) const\n{\n\treturn GetInt(key, default_val ? 1 : 0) != 0;\n}\n\nfloat ImGuiStorage::GetFloat(ImGuiID key, float default_val) const\n{\n\tImVector<Pair>::iterator it = LowerBound(const_cast<ImVector<ImGuiStorage::Pair>&>(Data), key);\n\tif (it == Data.end() || it->key != key)\n\t\treturn default_val;\n\treturn it->val_f;\n}\n\nvoid* ImGuiStorage::GetVoidPtr(ImGuiID key) const\n{\n\tImVector<Pair>::iterator it = LowerBound(const_cast<ImVector<ImGuiStorage::Pair>&>(Data), key);\n\tif (it == Data.end() || it->key != key)\n\t\treturn NULL;\n\treturn it->val_p;\n}\n\n// References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.\nint* ImGuiStorage::GetIntRef(ImGuiID key, int default_val)\n{\n\tImVector<Pair>::iterator it = LowerBound(Data, key);\n\tif (it == Data.end() || it->key != key)\n\t\tit = Data.insert(it, Pair(key, default_val));\n\treturn &it->val_i;\n}\n\nbool* ImGuiStorage::GetBoolRef(ImGuiID key, bool default_val)\n{\n\treturn (bool*)GetIntRef(key, default_val ? 1 : 0);\n}\n\nfloat* ImGuiStorage::GetFloatRef(ImGuiID key, float default_val)\n{\n\tImVector<Pair>::iterator it = LowerBound(Data, key);\n\tif (it == Data.end() || it->key != key)\n\t\tit = Data.insert(it, Pair(key, default_val));\n\treturn &it->val_f;\n}\n\nvoid** ImGuiStorage::GetVoidPtrRef(ImGuiID key, void* default_val)\n{\n\tImVector<Pair>::iterator it = LowerBound(Data, key);\n\tif (it == Data.end() || it->key != key)\n\t\tit = Data.insert(it, Pair(key, default_val));\n\treturn &it->val_p;\n}\n\n// FIXME-OPT: Need a way to reuse the result of lower_bound when doing GetInt()/SetInt() - not too bad because it only happens on explicit interaction (maximum one a frame)\nvoid ImGuiStorage::SetInt(ImGuiID key, int val)\n{\n\tImVector<Pair>::iterator it = LowerBound(Data, key);\n\tif (it == Data.end() || it->key != key)\n\t{\n\t\tData.insert(it, Pair(key, val));\n\t\treturn;\n\t}\n\tit->val_i = val;\n}\n\nvoid ImGuiStorage::SetBool(ImGuiID key, bool val)\n{\n\tSetInt(key, val ? 1 : 0);\n}\n\nvoid ImGuiStorage::SetFloat(ImGuiID key, float val)\n{\n\tImVector<Pair>::iterator it = LowerBound(Data, key);\n\tif (it == Data.end() || it->key != key)\n\t{\n\t\tData.insert(it, Pair(key, val));\n\t\treturn;\n\t}\n\tit->val_f = val;\n}\n\nvoid ImGuiStorage::SetVoidPtr(ImGuiID key, void* val)\n{\n\tImVector<Pair>::iterator it = LowerBound(Data, key);\n\tif (it == Data.end() || it->key != key)\n\t{\n\t\tData.insert(it, Pair(key, val));\n\t\treturn;\n\t}\n\tit->val_p = val;\n}\n\nvoid ImGuiStorage::SetAllInt(int v)\n{\n\tfor (int i = 0; i < Data.Size; i++)\n\t\tData[i].val_i = v;\n}\n\n//-----------------------------------------------------------------------------\n// ImGuiTextFilter\n//-----------------------------------------------------------------------------\n\n// Helper: Parse and apply text filters. In format \"aaaaa[,bbbb][,ccccc]\"\nImGuiTextFilter::ImGuiTextFilter(const char* default_filter)\n{\n\tif (default_filter)\n\t{\n\t\tImStrncpy(InputBuf, default_filter, IM_ARRAYSIZE(InputBuf));\n\t\tBuild();\n\t}\n\telse\n\t{\n\t\tInputBuf[0] = 0;\n\t\tCountGrep = 0;\n\t}\n}\n\nbool ImGuiTextFilter::Draw(const char* label, float width)\n{\n\tif (width != 0.0f)\n\t\tImGui::PushItemWidth(width);\n\tbool value_changed = ImGui::InputText(label, InputBuf, IM_ARRAYSIZE(InputBuf));\n\tif (width != 0.0f)\n\t\tImGui::PopItemWidth();\n\tif (value_changed)\n\t\tBuild();\n\treturn value_changed;\n}\n\nvoid ImGuiTextFilter::TextRange::split(char separator, ImVector<TextRange>& out)\n{\n\tout.resize(0);\n\tconst char* wb = b;\n\tconst char* we = wb;\n\twhile (we < e)\n\t{\n\t\tif (*we == separator)\n\t\t{\n\t\t\tout.push_back(TextRange(wb, we));\n\t\t\twb = we + 1;\n\t\t}\n\t\twe++;\n\t}\n\tif (wb != we)\n\t\tout.push_back(TextRange(wb, we));\n}\n\nvoid ImGuiTextFilter::Build()\n{\n\tFilters.resize(0);\n\tTextRange input_range(InputBuf, InputBuf + strlen(InputBuf));\n\tinput_range.split(',', Filters);\n\n\tCountGrep = 0;\n\tfor (int i = 0; i != Filters.Size; i++)\n\t{\n\t\tFilters[i].trim_blanks();\n\t\tif (Filters[i].empty())\n\t\t\tcontinue;\n\t\tif (Filters[i].front() != '-')\n\t\t\tCountGrep += 1;\n\t}\n}\n\nbool ImGuiTextFilter::PassFilter(const char* text, const char* text_end) const\n{\n\tif (Filters.empty())\n\t\treturn true;\n\n\tif (text == NULL)\n\t\ttext = \"\";\n\n\tfor (int i = 0; i != Filters.Size; i++)\n\t{\n\t\tconst TextRange& f = Filters[i];\n\t\tif (f.empty())\n\t\t\tcontinue;\n\t\tif (f.front() == '-')\n\t\t{\n\t\t\t// Subtract\n\t\t\tif (ImStristr(text, text_end, f.begin() + 1, f.end()) != NULL)\n\t\t\t\treturn false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Grep\n\t\t\tif (ImStristr(text, text_end, f.begin(), f.end()) != NULL)\n\t\t\t\treturn true;\n\t\t}\n\t}\n\n\t// Implicit * grep\n\tif (CountGrep == 0)\n\t\treturn true;\n\n\treturn false;\n}\n\n//-----------------------------------------------------------------------------\n// ImGuiTextBuffer\n//-----------------------------------------------------------------------------\n\n// On some platform vsnprintf() takes va_list by reference and modifies it.\n// va_copy is the 'correct' way to copy a va_list but Visual Studio prior to 2013 doesn't have it.\n#ifndef va_copy\n#define va_copy(dest, src) (dest = src)\n#endif\n\n// Helper: Text buffer for logging/accumulating text\nvoid ImGuiTextBuffer::appendfv(const char* fmt, va_list args)\n{\n\tva_list args_copy;\n\tva_copy(args_copy, args);\n\n\tint len = ImFormatStringV(NULL, 0, fmt, args);         // FIXME-OPT: could do a first pass write attempt, likely successful on first pass.\n\tif (len <= 0)\n\t\treturn;\n\n\tconst int write_off = Buf.Size;\n\tconst int needed_sz = write_off + len;\n\tif (write_off + len >= Buf.Capacity)\n\t{\n\t\tint double_capacity = Buf.Capacity * 2;\n\t\tBuf.reserve(needed_sz > double_capacity ? needed_sz : double_capacity);\n\t}\n\n\tBuf.resize(needed_sz);\n\tImFormatStringV(&Buf[write_off - 1], len + 1, fmt, args_copy);\n}\n\nvoid ImGuiTextBuffer::appendf(const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tappendfv(fmt, args);\n\tva_end(args);\n}\n\n//-----------------------------------------------------------------------------\n// ImGuiSimpleColumns (internal use only)\n//-----------------------------------------------------------------------------\n\nImGuiMenuColumns::ImGuiMenuColumns()\n{\n\tCount = 0;\n\tSpacing = Width = NextWidth = 0.0f;\n\tmemset(Pos, 0, sizeof(Pos));\n\tmemset(NextWidths, 0, sizeof(NextWidths));\n}\n\nvoid ImGuiMenuColumns::Update(int count, float spacing, bool clear)\n{\n\tIM_ASSERT(Count <= IM_ARRAYSIZE(Pos));\n\tCount = count;\n\tWidth = NextWidth = 0.0f;\n\tSpacing = spacing;\n\tif (clear) memset(NextWidths, 0, sizeof(NextWidths));\n\tfor (int i = 0; i < Count; i++)\n\t{\n\t\tif (i > 0 && NextWidths[i] > 0.0f)\n\t\t\tWidth += Spacing;\n\t\tPos[i] = (float)(int)Width;\n\t\tWidth += NextWidths[i];\n\t\tNextWidths[i] = 0.0f;\n\t}\n}\n\nfloat ImGuiMenuColumns::DeclColumns(float w0, float w1, float w2) // not using va_arg because they promote float to double\n{\n\tNextWidth = 0.0f;\n\tNextWidths[0] = ImMax(NextWidths[0], w0);\n\tNextWidths[1] = ImMax(NextWidths[1], w1);\n\tNextWidths[2] = ImMax(NextWidths[2], w2);\n\tfor (int i = 0; i < 3; i++)\n\t\tNextWidth += NextWidths[i] + ((i > 0 && NextWidths[i] > 0.0f) ? Spacing : 0.0f);\n\treturn ImMax(Width, NextWidth);\n}\n\nfloat ImGuiMenuColumns::CalcExtraSpace(float avail_w)\n{\n\treturn ImMax(0.0f, avail_w - Width);\n}\n\n//-----------------------------------------------------------------------------\n// ImGuiListClipper\n//-----------------------------------------------------------------------------\n\nstatic void SetCursorPosYAndSetupDummyPrevLine(float pos_y, float line_height)\n{\n\t// Set cursor position and a few other things so that SetScrollHere() and Columns() can work when seeking cursor. \n\t// FIXME: It is problematic that we have to do that here, because custom/equivalent end-user code would stumble on the same issue. Consider moving within SetCursorXXX functions?\n\tImGui::SetCursorPosY(pos_y);\n\tImGuiWindow* window = ImGui::GetCurrentWindow();\n\twindow->DC.CursorPosPrevLine.y = window->DC.CursorPos.y - line_height;      // Setting those fields so that SetScrollHere() can properly function after the end of our clipper usage.\n\twindow->DC.PrevLineHeight = (line_height - GImGui->Style.ItemSpacing.y);    // If we end up needing more accurate data (to e.g. use SameLine) we may as well make the clipper have a fourth step to let user process and display the last item in their list.\n\tif (window->DC.ColumnsSet)\n\t\twindow->DC.ColumnsSet->CellMinY = window->DC.CursorPos.y;           // Setting this so that cell Y position are set properly\n}\n\n// Use case A: Begin() called from constructor with items_height<0, then called again from Sync() in StepNo 1\n// Use case B: Begin() called from constructor with items_height>0\n// FIXME-LEGACY: Ideally we should remove the Begin/End functions but they are part of the legacy API we still support. This is why some of the code in Step() calling Begin() and reassign some fields, spaghetti style.\nvoid ImGuiListClipper::Begin(int count, float items_height)\n{\n\tStartPosY = ImGui::GetCursorPosY();\n\tItemsHeight = items_height;\n\tItemsCount = count;\n\tStepNo = 0;\n\tDisplayEnd = DisplayStart = -1;\n\tif (ItemsHeight > 0.0f)\n\t{\n\t\tImGui::CalcListClipping(ItemsCount, ItemsHeight, &DisplayStart, &DisplayEnd); // calculate how many to clip/display\n\t\tif (DisplayStart > 0)\n\t\t\tSetCursorPosYAndSetupDummyPrevLine(StartPosY + DisplayStart * ItemsHeight, ItemsHeight); // advance cursor\n\t\tStepNo = 2;\n\t}\n}\n\nvoid ImGuiListClipper::End()\n{\n\tif (ItemsCount < 0)\n\t\treturn;\n\t// In theory here we should assert that ImGui::GetCursorPosY() == StartPosY + DisplayEnd * ItemsHeight, but it feels saner to just seek at the end and not assert/crash the user.\n\tif (ItemsCount < INT_MAX)\n\t\tSetCursorPosYAndSetupDummyPrevLine(StartPosY + ItemsCount * ItemsHeight, ItemsHeight); // advance cursor\n\tItemsCount = -1;\n\tStepNo = 3;\n}\n\nbool ImGuiListClipper::Step()\n{\n\tif (ItemsCount == 0 || ImGui::GetCurrentWindowRead()->SkipItems)\n\t{\n\t\tItemsCount = -1;\n\t\treturn false;\n\t}\n\tif (StepNo == 0) // Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height.\n\t{\n\t\tDisplayStart = 0;\n\t\tDisplayEnd = 1;\n\t\tStartPosY = ImGui::GetCursorPosY();\n\t\tStepNo = 1;\n\t\treturn true;\n\t}\n\tif (StepNo == 1) // Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element.\n\t{\n\t\tif (ItemsCount == 1) { ItemsCount = -1; return false; }\n\t\tfloat items_height = ImGui::GetCursorPosY() - StartPosY;\n\t\tIM_ASSERT(items_height > 0.0f);   // If this triggers, it means Item 0 hasn't moved the cursor vertically\n\t\tBegin(ItemsCount - 1, items_height);\n\t\tDisplayStart++;\n\t\tDisplayEnd++;\n\t\tStepNo = 3;\n\t\treturn true;\n\t}\n\tif (StepNo == 2) // Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user still call Step(). Does nothing and switch to Step 3.\n\t{\n\t\tIM_ASSERT(DisplayStart >= 0 && DisplayEnd >= 0);\n\t\tStepNo = 3;\n\t\treturn true;\n\t}\n\tif (StepNo == 3) // Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.\n\t\tEnd();\n\treturn false;\n}\n\n//-----------------------------------------------------------------------------\n// ImGuiWindow\n//-----------------------------------------------------------------------------\n\nImGuiWindow::ImGuiWindow(ImGuiContext* context, const char* name)\n{\n\tName = ImStrdup(name);\n\tID = ImHash(name, 0);\n\tIDStack.push_back(ID);\n\tFlags = 0;\n\tPosFloat = Pos = ImVec2(0.0f, 0.0f);\n\tSize = SizeFull = ImVec2(0.0f, 0.0f);\n\tSizeContents = SizeContentsExplicit = ImVec2(0.0f, 0.0f);\n\tWindowPadding = ImVec2(0.0f, 0.0f);\n\tWindowRounding = 0.0f;\n\tWindowBorderSize = 0.0f;\n\tMoveId = GetID(\"#MOVE\");\n\tScroll = ImVec2(0.0f, 0.0f);\n\tScrollTarget = ImVec2(FLT_MAX, FLT_MAX);\n\tScrollTargetCenterRatio = ImVec2(0.5f, 0.5f);\n\tScrollbarX = ScrollbarY = false;\n\tScrollbarSizes = ImVec2(0.0f, 0.0f);\n\tActive = WasActive = false;\n\tWriteAccessed = false;\n\tCollapsed = false;\n\tSkipItems = false;\n\tAppearing = false;\n\tCloseButton = false;\n\tBeginOrderWithinParent = -1;\n\tBeginOrderWithinContext = -1;\n\tBeginCount = 0;\n\tPopupId = 0;\n\tAutoFitFramesX = AutoFitFramesY = -1;\n\tAutoFitOnlyGrows = false;\n\tAutoFitChildAxises = 0x00;\n\tAutoPosLastDirection = ImGuiDir_None;\n\tHiddenFrames = 0;\n\tSetWindowPosAllowFlags = SetWindowSizeAllowFlags = SetWindowCollapsedAllowFlags = ImGuiCond_Always | ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing;\n\tSetWindowPosVal = SetWindowPosPivot = ImVec2(FLT_MAX, FLT_MAX);\n\n\tLastFrameActive = -1;\n\tItemWidthDefault = 0.0f;\n\tFontWindowScale = 1.0f;\n\n\tDrawList = IM_NEW(ImDrawList)(&context->DrawListSharedData);\n\tDrawList->_OwnerName = Name;\n\tParentWindow = NULL;\n\tRootWindow = NULL;\n\tRootNonPopupWindow = NULL;\n\n\tFocusIdxAllCounter = FocusIdxTabCounter = -1;\n\tFocusIdxAllRequestCurrent = FocusIdxTabRequestCurrent = INT_MAX;\n\tFocusIdxAllRequestNext = FocusIdxTabRequestNext = INT_MAX;\n}\n\nImGuiWindow::~ImGuiWindow()\n{\n\tIM_DELETE(DrawList);\n\tIM_DELETE(Name);\n\tfor (int i = 0; i != ColumnsStorage.Size; i++)\n\t\tColumnsStorage[i].~ImGuiColumnsSet();\n}\n\nImGuiID ImGuiWindow::GetID(const char* str, const char* str_end)\n{\n\tImGuiID seed = IDStack.back();\n\tImGuiID id = ImHash(str, str_end ? (int)(str_end - str) : 0, seed);\n\tImGui::KeepAliveID(id);\n\treturn id;\n}\n\nImGuiID ImGuiWindow::GetID(const void* ptr)\n{\n\tImGuiID seed = IDStack.back();\n\tImGuiID id = ImHash(&ptr, sizeof(void*), seed);\n\tImGui::KeepAliveID(id);\n\treturn id;\n}\n\nImGuiID ImGuiWindow::GetIDNoKeepAlive(const char* str, const char* str_end)\n{\n\tImGuiID seed = IDStack.back();\n\treturn ImHash(str, str_end ? (int)(str_end - str) : 0, seed);\n}\n\n// This is only used in rare/specific situations to manufacture an ID out of nowhere.\nImGuiID ImGuiWindow::GetIDFromRectangle(const ImRect& r_abs)\n{\n\tImGuiID seed = IDStack.back();\n\tconst int r_rel[4] = { (int)(r_abs.Min.x - Pos.x), (int)(r_abs.Min.y - Pos.y), (int)(r_abs.Max.x - Pos.x), (int)(r_abs.Max.y - Pos.y) };\n\tImGuiID id = ImHash(&r_rel, sizeof(r_rel), seed);\n\tImGui::KeepAliveID(id);\n\treturn id;\n}\n\n//-----------------------------------------------------------------------------\n// Internal API exposed in imgui_internal.h\n//-----------------------------------------------------------------------------\n\nstatic void SetCurrentWindow(ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\tg.CurrentWindow = window;\n\tif (window)\n\t\tg.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize();\n}\n\nvoid ImGui::SetActiveID(ImGuiID id, ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\tg.ActiveIdIsJustActivated = (g.ActiveId != id);\n\tif (g.ActiveIdIsJustActivated)\n\t\tg.ActiveIdTimer = 0.0f;\n\tg.ActiveId = id;\n\tg.ActiveIdAllowOverlap = false;\n\tg.ActiveIdIsAlive |= (id != 0);\n\tg.ActiveIdWindow = window;\n}\n\nvoid ImGui::ClearActiveID()\n{\n\tSetActiveID(0, NULL);\n}\n\nvoid ImGui::SetHoveredID(ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tg.HoveredId = id;\n\tg.HoveredIdAllowOverlap = false;\n\tg.HoveredIdTimer = (id != 0 && g.HoveredIdPreviousFrame == id) ? (g.HoveredIdTimer + g.IO.DeltaTime) : 0.0f;\n}\n\nImGuiID ImGui::GetHoveredID()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.HoveredId ? g.HoveredId : g.HoveredIdPreviousFrame;\n}\n\nvoid ImGui::KeepAliveID(ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.ActiveId == id)\n\t\tg.ActiveIdIsAlive = true;\n}\n\nstatic inline bool IsWindowContentHoverable(ImGuiWindow* window, ImGuiHoveredFlags flags)\n{\n\t// An active popup disable hovering on other windows (apart from its own children)\n\t// FIXME-OPT: This could be cached/stored within the window.\n\tImGuiContext& g = *GImGui;\n\tif (g.NavWindow)\n\t\tif (ImGuiWindow* focused_root_window = g.NavWindow->RootWindow)\n\t\t\tif (focused_root_window->WasActive && focused_root_window != window->RootWindow)\n\t\t\t{\n\t\t\t\t// For the purpose of those flags we differentiate \"standard popup\" from \"modal popup\"\n\t\t\t\t// NB: The order of those two tests is important because Modal windows are also Popups.\n\t\t\t\tif (focused_root_window->Flags & ImGuiWindowFlags_Modal)\n\t\t\t\t\treturn false;\n\t\t\t\tif ((focused_root_window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n\t\t\t\t\treturn false;\n\t\t\t}\n\n\treturn true;\n}\n\n// Advance cursor given item size for layout.\nvoid ImGui::ItemSize(const ImVec2& size, float text_offset_y)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (window->SkipItems)\n\t\treturn;\n\n\t// Always align ourselves on pixel boundaries\n\tconst float line_height = ImMax(window->DC.CurrentLineHeight, size.y);\n\tconst float text_base_offset = ImMax(window->DC.CurrentLineTextBaseOffset, text_offset_y);\n\t//if (g.IO.KeyAlt) window->DrawList->AddRect(window->DC.CursorPos, window->DC.CursorPos + ImVec2(size.x, line_height), IM_COL32(255,0,0,200)); // [DEBUG]\n\twindow->DC.CursorPosPrevLine = ImVec2(window->DC.CursorPos.x + size.x, window->DC.CursorPos.y);\n\twindow->DC.CursorPos = ImVec2((float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX), (float)(int)(window->DC.CursorPos.y + line_height + g.Style.ItemSpacing.y));\n\twindow->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPosPrevLine.x);\n\twindow->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y - g.Style.ItemSpacing.y);\n\t//if (g.IO.KeyAlt) window->DrawList->AddCircle(window->DC.CursorMaxPos, 3.0f, IM_COL32(255,0,0,255), 4); // [DEBUG]\n\n\twindow->DC.PrevLineHeight = line_height;\n\twindow->DC.PrevLineTextBaseOffset = text_base_offset;\n\twindow->DC.CurrentLineHeight = window->DC.CurrentLineTextBaseOffset = 0.0f;\n\n\t// Horizontal layout mode\n\tif (window->DC.LayoutType == ImGuiLayoutType_Horizontal)\n\t\tSameLine();\n}\n\nvoid ImGui::ItemSize(const ImRect& bb, float text_offset_y)\n{\n\tItemSize(bb.GetSize(), text_offset_y);\n}\n\n// Declare item bounding box for clipping and interaction.\n// Note that the size can be different than the one provided to ItemSize(). Typically, widgets that spread over available surface\n// declares their minimum size requirement to ItemSize() and then use a larger region for drawing/interaction, which is passed to ItemAdd().\nbool ImGui::ItemAdd(const ImRect& bb, ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tconst bool is_clipped = IsClippedEx(bb, id, false);\n\twindow->DC.LastItemId = id;\n\twindow->DC.LastItemRect = bb;\n\twindow->DC.LastItemRectHoveredRect = false;\n\tif (is_clipped)\n\t\treturn false;\n\t//if (g.IO.KeyAlt) window->DrawList->AddRect(bb.Min, bb.Max, IM_COL32(255,255,0,120)); // [DEBUG]\n\n\t// We need to calculate this now to take account of the current clipping rectangle (as items like Selectable may change them)\n\twindow->DC.LastItemRectHoveredRect = IsMouseHoveringRect(bb.Min, bb.Max);\n\treturn true;\n}\n\n// This is roughly matching the behavior of internal-facing ItemHoverable()\n// - we allow hovering to be true when ActiveId==window->MoveID, so that clicking on non-interactive items such as a Text() item still returns true with IsItemHovered()\n// - this should work even for non-interactive items that have no ID, so we cannot use LastItemId\nbool ImGui::IsItemHovered(ImGuiHoveredFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\t// Test for bounding box overlap, as updated as ItemAdd()\n\tif (!window->DC.LastItemRectHoveredRect)\n\t\treturn false;\n\tIM_ASSERT((flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows)) == 0);   // Flags not supported by this function\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // Test if we are hovering the right window (our window could be behind another window)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // [2017/10/16] Reverted commit 344d48be3 and testing RootWindow instead. I believe it is correct to NOT test for RootWindow but this leaves us unable to use IsItemHovered() after EndChild() itself.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // Until a solution is found I believe reverting to the test from 2017/09/27 is safe since this was the test that has been running for a long while.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t //if (g.HoveredWindow != window)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t //    return false;\n\tif (g.HoveredRootWindow != window->RootWindow && !(flags & ImGuiHoveredFlags_AllowWhenOverlapped))\n\t\treturn false;\n\n\t// Test if another item is active (e.g. being dragged)\n\tif (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))\n\t\tif (g.ActiveId != 0 && g.ActiveId != window->DC.LastItemId && !g.ActiveIdAllowOverlap && g.ActiveId != window->MoveId)\n\t\t\treturn false;\n\n\t// Test if interactions on this window are blocked by an active popup or modal \n\tif (!IsWindowContentHoverable(window, flags))\n\t\treturn false;\n\n\t// Test if the item is disabled\n\tif (window->DC.ItemFlags & ImGuiItemFlags_Disabled)\n\t\treturn false;\n\n\t// Special handling for the 1st item after Begin() which represent the title bar. When the window is collapsed (SkipItems==true) that last item will never be overwritten so we need to detect tht case.\n\tif (window->DC.LastItemId == window->MoveId && window->WriteAccessed)\n\t\treturn false;\n\treturn true;\n}\n\n// Internal facing ItemHoverable() used when submitting widgets. Differs slightly from IsItemHovered().\nbool ImGui::ItemHoverable(const ImRect& bb, ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.HoveredId != 0 && g.HoveredId != id && !g.HoveredIdAllowOverlap)\n\t\treturn false;\n\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (g.HoveredWindow != window)\n\t\treturn false;\n\tif (g.ActiveId != 0 && g.ActiveId != id && !g.ActiveIdAllowOverlap)\n\t\treturn false;\n\tif (!IsMouseHoveringRect(bb.Min, bb.Max))\n\t\treturn false;\n\tif (!IsWindowContentHoverable(window, ImGuiHoveredFlags_Default))\n\t\treturn false;\n\tif (window->DC.ItemFlags & ImGuiItemFlags_Disabled)\n\t\treturn false;\n\n\tSetHoveredID(id);\n\treturn true;\n}\n\nbool ImGui::IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (!bb.Overlaps(window->ClipRect))\n\t\tif (id == 0 || id != g.ActiveId)\n\t\t\tif (clip_even_when_logged || !g.LogEnabled)\n\t\t\t\treturn true;\n\treturn false;\n}\n\nbool ImGui::FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop)\n{\n\tImGuiContext& g = *GImGui;\n\n\tconst bool allow_keyboard_focus = (window->DC.ItemFlags & (ImGuiItemFlags_AllowKeyboardFocus | ImGuiItemFlags_Disabled)) == ImGuiItemFlags_AllowKeyboardFocus;\n\twindow->FocusIdxAllCounter++;\n\tif (allow_keyboard_focus)\n\t\twindow->FocusIdxTabCounter++;\n\n\t// Process keyboard input at this point: TAB/Shift-TAB to tab out of the currently focused item.\n\t// Note that we can always TAB out of a widget that doesn't allow tabbing in.\n\tif (tab_stop && (g.ActiveId == id) && window->FocusIdxAllRequestNext == INT_MAX && window->FocusIdxTabRequestNext == INT_MAX && !g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_Tab))\n\t\twindow->FocusIdxTabRequestNext = window->FocusIdxTabCounter + (g.IO.KeyShift ? (allow_keyboard_focus ? -1 : 0) : +1); // Modulo on index will be applied at the end of frame once we've got the total counter of items.\n\n\tif (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent)\n\t\treturn true;\n\n\tif (allow_keyboard_focus)\n\t\tif (window->FocusIdxTabCounter == window->FocusIdxTabRequestCurrent)\n\t\t\treturn true;\n\n\treturn false;\n}\n\nvoid ImGui::FocusableItemUnregister(ImGuiWindow* window)\n{\n\twindow->FocusIdxAllCounter--;\n\twindow->FocusIdxTabCounter--;\n}\n\nImVec2 ImGui::CalcItemSize(ImVec2 size, float default_x, float default_y)\n{\n\tImGuiContext& g = *GImGui;\n\tImVec2 content_max;\n\tif (size.x < 0.0f || size.y < 0.0f)\n\t\tcontent_max = g.CurrentWindow->Pos + GetContentRegionMax();\n\tif (size.x <= 0.0f)\n\t\tsize.x = (size.x == 0.0f) ? default_x : ImMax(content_max.x - g.CurrentWindow->DC.CursorPos.x, 4.0f) + size.x;\n\tif (size.y <= 0.0f)\n\t\tsize.y = (size.y == 0.0f) ? default_y : ImMax(content_max.y - g.CurrentWindow->DC.CursorPos.y, 4.0f) + size.y;\n\treturn size;\n}\n\nfloat ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x)\n{\n\tif (wrap_pos_x < 0.0f)\n\t\treturn 0.0f;\n\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tif (wrap_pos_x == 0.0f)\n\t\twrap_pos_x = GetContentRegionMax().x + window->Pos.x;\n\telse if (wrap_pos_x > 0.0f)\n\t\twrap_pos_x += window->Pos.x - window->Scroll.x; // wrap_pos_x is provided is window local space\n\n\treturn ImMax(wrap_pos_x - pos.x, 1.0f);\n}\n\n//-----------------------------------------------------------------------------\n\nvoid* ImGui::MemAlloc(size_t sz)\n{\n\tGImGui->IO.MetricsAllocs++;\n\treturn GImGui->IO.MemAllocFn(sz);\n}\n\nvoid ImGui::MemFree(void* ptr)\n{\n\tif (ptr) GImGui->IO.MetricsAllocs--;\n\treturn GImGui->IO.MemFreeFn(ptr);\n}\n\nconst char* ImGui::GetClipboardText()\n{\n\treturn GImGui->IO.GetClipboardTextFn ? GImGui->IO.GetClipboardTextFn(GImGui->IO.ClipboardUserData) : \"\";\n}\n\nvoid ImGui::SetClipboardText(const char* text)\n{\n\tif (GImGui->IO.SetClipboardTextFn)\n\t\tGImGui->IO.SetClipboardTextFn(GImGui->IO.ClipboardUserData, text);\n}\n\nconst char* ImGui::GetVersion()\n{\n\treturn IMGUI_VERSION;\n}\n\n// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself\n// Note that we still point to some static data and members (such as GFontAtlas), so the state instance you end up using will point to the static data within its module\nImGuiContext* ImGui::GetCurrentContext()\n{\n\treturn GImGui;\n}\n\nvoid ImGui::SetCurrentContext(ImGuiContext* ctx)\n{\n#ifdef IMGUI_SET_CURRENT_CONTEXT_FUNC\n\tIMGUI_SET_CURRENT_CONTEXT_FUNC(ctx); // For custom thread-based hackery you may want to have control over this.\n#else\n\tGImGui = ctx;\n#endif\n}\n\nImGuiContext* ImGui::CreateContext(void* (*malloc_fn)(size_t), void(*free_fn)(void*))\n{\n\tif (!malloc_fn) malloc_fn = malloc;\n\tImGuiContext* ctx = (ImGuiContext*)malloc_fn(sizeof(ImGuiContext));\n\tIM_PLACEMENT_NEW(ctx) ImGuiContext();\n\tctx->IO.MemAllocFn = malloc_fn;\n\tctx->IO.MemFreeFn = free_fn ? free_fn : free;\n\treturn ctx;\n}\n\nvoid ImGui::DestroyContext(ImGuiContext* ctx)\n{\n\tvoid(*free_fn)(void*) = ctx->IO.MemFreeFn;\n\tctx->~ImGuiContext();\n\tfree_fn(ctx);\n\tif (GImGui == ctx)\n\t\tSetCurrentContext(NULL);\n}\n\nImGuiIO& ImGui::GetIO()\n{\n\treturn GImGui->IO;\n}\n\nImGuiStyle& ImGui::GetStyle()\n{\n\treturn GImGui->Style;\n}\n\n// Same value as passed to your RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame()\nImDrawData* ImGui::GetDrawData()\n{\n\treturn GImGui->DrawData.Valid ? &GImGui->DrawData : NULL;\n}\n\nfloat ImGui::GetTime()\n{\n\treturn GImGui->Time;\n}\n\nint ImGui::GetFrameCount()\n{\n\treturn GImGui->FrameCount;\n}\n\nImDrawList* ImGui::GetOverlayDrawList()\n{\n\treturn &GImGui->OverlayDrawList;\n}\n\nImDrawListSharedData* ImGui::GetDrawListSharedData()\n{\n\treturn &GImGui->DrawListSharedData;\n}\n\nvoid ImGui::NewFrame()\n{\n\tImGuiContext& g = *GImGui;\n\n\t// Check user data\n\t// (We pass an error message in the assert expression as a trick to get it visible to programmers who are not using a debugger, as most assert handlers display their argument)\n\tIM_ASSERT(g.IO.DeltaTime >= 0.0f && \"Need a positive DeltaTime (zero is tolerated but will cause some timing issues)\");\n\tIM_ASSERT(g.IO.DisplaySize.x >= 0.0f && g.IO.DisplaySize.y >= 0.0f && \"Invalid DisplaySize value\");\n\tIM_ASSERT(g.IO.Fonts->Fonts.Size > 0 && \"Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?\");\n\tIM_ASSERT(g.IO.Fonts->Fonts[0]->IsLoaded() && \"Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?\");\n\tIM_ASSERT(g.Style.CurveTessellationTol > 0.0f && \"Invalid style setting\");\n\tIM_ASSERT(g.Style.Alpha >= 0.0f && g.Style.Alpha <= 1.0f && \"Invalid style setting. Alpha cannot be negative (allows us to avoid a few clamps in color computations)\");\n\tIM_ASSERT((g.FrameCount == 0 || g.FrameCountEnded == g.FrameCount) && \"Forgot to call Render() or EndFrame() at the end of the previous frame?\");\n\tfor (int n = 0; n < ImGuiKey_COUNT; n++)\n\t\tIM_ASSERT(g.IO.KeyMap[n] >= -1 && g.IO.KeyMap[n] < IM_ARRAYSIZE(g.IO.KeysDown) && \"io.KeyMap[] contains an out of bound value (need to be 0..512, or -1 for unmapped key)\");\n\n\t// Initialize on first frame\n\tif (!g.Initialized)\n\t\tInitialize();\n\n\tg.Time += g.IO.DeltaTime;\n\tg.FrameCount += 1;\n\tg.TooltipOverrideCount = 0;\n\tg.WindowsActiveCount = 0;\n\n\tSetCurrentFont(GetDefaultFont());\n\tIM_ASSERT(g.Font->IsLoaded());\n\tg.DrawListSharedData.ClipRectFullscreen = ImVec4(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y);\n\tg.DrawListSharedData.CurveTessellationTol = g.Style.CurveTessellationTol;\n\n\tg.OverlayDrawList.Clear();\n\tg.OverlayDrawList.PushTextureID(g.IO.Fonts->TexID);\n\tg.OverlayDrawList.PushClipRectFullScreen();\n\tg.OverlayDrawList.Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);\n\n\t// Mark rendering data as invalid to prevent user who may have a handle on it to use it\n\tg.DrawData.Clear();\n\n\t// Clear reference to active widget if the widget isn't alive anymore\n\tif (!g.HoveredIdPreviousFrame)\n\t\tg.HoveredIdTimer = 0.0f;\n\tg.HoveredIdPreviousFrame = g.HoveredId;\n\tg.HoveredId = 0;\n\tg.HoveredIdAllowOverlap = false;\n\tif (!g.ActiveIdIsAlive && g.ActiveIdPreviousFrame == g.ActiveId && g.ActiveId != 0)\n\t\tClearActiveID();\n\tif (g.ActiveId)\n\t\tg.ActiveIdTimer += g.IO.DeltaTime;\n\tg.ActiveIdPreviousFrame = g.ActiveId;\n\tg.ActiveIdIsAlive = false;\n\tg.ActiveIdIsJustActivated = false;\n\tif (g.ScalarAsInputTextId && g.ActiveId != g.ScalarAsInputTextId)\n\t\tg.ScalarAsInputTextId = 0;\n\n\t// Elapse drag & drop payload\n\tif (g.DragDropActive && g.DragDropPayload.DataFrameCount + 1 < g.FrameCount)\n\t{\n\t\tClearDragDrop();\n\t\tg.DragDropPayloadBufHeap.clear();\n\t\tmemset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));\n\t}\n\tg.DragDropAcceptIdPrev = g.DragDropAcceptIdCurr;\n\tg.DragDropAcceptIdCurr = 0;\n\tg.DragDropAcceptIdCurrRectSurface = FLT_MAX;\n\n\t// Update keyboard input state\n\tmemcpy(g.IO.KeysDownDurationPrev, g.IO.KeysDownDuration, sizeof(g.IO.KeysDownDuration));\n\tfor (int i = 0; i < IM_ARRAYSIZE(g.IO.KeysDown); i++)\n\t\tg.IO.KeysDownDuration[i] = g.IO.KeysDown[i] ? (g.IO.KeysDownDuration[i] < 0.0f ? 0.0f : g.IO.KeysDownDuration[i] + g.IO.DeltaTime) : -1.0f;\n\n\t// Update mouse input state\n\t// If mouse just appeared or disappeared (usually denoted by -FLT_MAX component, but in reality we test for -256000.0f) we cancel out movement in MouseDelta\n\tif (IsMousePosValid(&g.IO.MousePos) && IsMousePosValid(&g.IO.MousePosPrev))\n\t\tg.IO.MouseDelta = g.IO.MousePos - g.IO.MousePosPrev;\n\telse\n\t\tg.IO.MouseDelta = ImVec2(0.0f, 0.0f);\n\tg.IO.MousePosPrev = g.IO.MousePos;\n\tfor (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)\n\t{\n\t\tg.IO.MouseClicked[i] = g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] < 0.0f;\n\t\tg.IO.MouseReleased[i] = !g.IO.MouseDown[i] && g.IO.MouseDownDuration[i] >= 0.0f;\n\t\tg.IO.MouseDownDurationPrev[i] = g.IO.MouseDownDuration[i];\n\t\tg.IO.MouseDownDuration[i] = g.IO.MouseDown[i] ? (g.IO.MouseDownDuration[i] < 0.0f ? 0.0f : g.IO.MouseDownDuration[i] + g.IO.DeltaTime) : -1.0f;\n\t\tg.IO.MouseDoubleClicked[i] = false;\n\t\tif (g.IO.MouseClicked[i])\n\t\t{\n\t\t\tif (g.Time - g.IO.MouseClickedTime[i] < g.IO.MouseDoubleClickTime)\n\t\t\t{\n\t\t\t\tif (ImLengthSqr(g.IO.MousePos - g.IO.MouseClickedPos[i]) < g.IO.MouseDoubleClickMaxDist * g.IO.MouseDoubleClickMaxDist)\n\t\t\t\t\tg.IO.MouseDoubleClicked[i] = true;\n\t\t\t\tg.IO.MouseClickedTime[i] = -FLT_MAX;    // so the third click isn't turned into a double-click\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tg.IO.MouseClickedTime[i] = g.Time;\n\t\t\t}\n\t\t\tg.IO.MouseClickedPos[i] = g.IO.MousePos;\n\t\t\tg.IO.MouseDragMaxDistanceAbs[i] = ImVec2(0.0f, 0.0f);\n\t\t\tg.IO.MouseDragMaxDistanceSqr[i] = 0.0f;\n\t\t}\n\t\telse if (g.IO.MouseDown[i])\n\t\t{\n\t\t\tImVec2 mouse_delta = g.IO.MousePos - g.IO.MouseClickedPos[i];\n\t\t\tg.IO.MouseDragMaxDistanceAbs[i].x = ImMax(g.IO.MouseDragMaxDistanceAbs[i].x, mouse_delta.x < 0.0f ? -mouse_delta.x : mouse_delta.x);\n\t\t\tg.IO.MouseDragMaxDistanceAbs[i].y = ImMax(g.IO.MouseDragMaxDistanceAbs[i].y, mouse_delta.y < 0.0f ? -mouse_delta.y : mouse_delta.y);\n\t\t\tg.IO.MouseDragMaxDistanceSqr[i] = ImMax(g.IO.MouseDragMaxDistanceSqr[i], ImLengthSqr(mouse_delta));\n\t\t}\n\t}\n\n\t// Calculate frame-rate for the user, as a purely luxurious feature\n\tg.FramerateSecPerFrameAccum += g.IO.DeltaTime - g.FramerateSecPerFrame[g.FramerateSecPerFrameIdx];\n\tg.FramerateSecPerFrame[g.FramerateSecPerFrameIdx] = g.IO.DeltaTime;\n\tg.FramerateSecPerFrameIdx = (g.FramerateSecPerFrameIdx + 1) % IM_ARRAYSIZE(g.FramerateSecPerFrame);\n\tg.IO.Framerate = 1.0f / (g.FramerateSecPerFrameAccum / (float)IM_ARRAYSIZE(g.FramerateSecPerFrame));\n\n\t// Handle user moving window with mouse (at the beginning of the frame to avoid input lag or sheering).\n\tif (g.MovingWindowMoveId && g.MovingWindowMoveId == g.ActiveId)\n\t{\n\t\tKeepAliveID(g.ActiveId);\n\t\tIM_ASSERT(g.MovingWindow && g.MovingWindow->RootWindow);\n\t\tIM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId);\n\t\tif (g.IO.MouseDown[0])\n\t\t{\n\t\t\t// MovingWindow = window we clicked on, could be a child window. We track it to preserve Focus and so that ActiveIdWindow == MovingWindow and ActiveId == MovingWindow->MoveId for consistency.\n\t\t\tImGuiWindow* actually_moving_window = g.MovingWindow->RootWindow;\n\t\t\tImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset;\n\t\t\tif (actually_moving_window->PosFloat.x != pos.x || actually_moving_window->PosFloat.y != pos.y)\n\t\t\t{\n\t\t\t\tMarkIniSettingsDirty(actually_moving_window);\n\t\t\t\tactually_moving_window->PosFloat = pos;\n\t\t\t}\n\t\t\tFocusWindow(g.MovingWindow);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tClearActiveID();\n\t\t\tg.MovingWindow = NULL;\n\t\t\tg.MovingWindowMoveId = 0;\n\t\t}\n\t}\n\telse\n\t{\n\t\t// When clicking/dragging from a window that has the _NoMove flag, we still set the ActiveId in order to prevent hovering others.\n\t\tif (g.ActiveIdWindow && g.ActiveIdWindow->MoveId == g.ActiveId)\n\t\t{\n\t\t\tKeepAliveID(g.ActiveId);\n\t\t\tif (!g.IO.MouseDown[0])\n\t\t\t\tClearActiveID();\n\t\t}\n\t\tg.MovingWindow = NULL;\n\t\tg.MovingWindowMoveId = 0;\n\t}\n\n\t// Delay saving settings so we don't spam disk too much\n\tif (g.SettingsDirtyTimer > 0.0f)\n\t{\n\t\tg.SettingsDirtyTimer -= g.IO.DeltaTime;\n\t\t/*if (g.SettingsDirtyTimer <= 0.0f)\n\t\tSaveIniSettingsToDisk(g.IO.IniFilename);*/\n\t}\n\n\t// Find the window we are hovering\n\t// - Child windows can extend beyond the limit of their parent so we need to derive HoveredRootWindow from HoveredWindow.\n\t// - When moving a window we can skip the search, which also conveniently bypasses the fact that window->WindowRectClipped is lagging as this point.\n\t// - We also support the moved window toggling the NoInputs flag after moving has started in order to be able to detect windows below it, which is useful for e.g. docking mechanisms.\n\tg.HoveredWindow = (g.MovingWindow && !(g.MovingWindow->Flags & ImGuiWindowFlags_NoInputs)) ? g.MovingWindow : FindHoveredWindow(g.IO.MousePos);\n\tg.HoveredRootWindow = g.HoveredWindow ? g.HoveredWindow->RootWindow : NULL;\n\n\tImGuiWindow* modal_window = GetFrontMostModalRootWindow();\n\tif (modal_window != NULL)\n\t{\n\t\tg.ModalWindowDarkeningRatio = ImMin(g.ModalWindowDarkeningRatio + g.IO.DeltaTime * 6.0f, 1.0f);\n\t\tif (g.HoveredRootWindow && !IsWindowChildOf(g.HoveredRootWindow, modal_window))\n\t\t\tg.HoveredRootWindow = g.HoveredWindow = NULL;\n\t}\n\telse\n\t{\n\t\tg.ModalWindowDarkeningRatio = 0.0f;\n\t}\n\n\t// Update the WantCaptureMouse/WantCAptureKeyboard flags, so user can capture/discard the inputs away from the rest of their application.\n\t// When clicking outside of a window we assume the click is owned by the application and won't request capture. We need to track click ownership.\n\tint mouse_earliest_button_down = -1;\n\tbool mouse_any_down = false;\n\tfor (int i = 0; i < IM_ARRAYSIZE(g.IO.MouseDown); i++)\n\t{\n\t\tif (g.IO.MouseClicked[i])\n\t\t\tg.IO.MouseDownOwned[i] = (g.HoveredWindow != NULL) || (!g.OpenPopupStack.empty());\n\t\tmouse_any_down |= g.IO.MouseDown[i];\n\t\tif (g.IO.MouseDown[i])\n\t\t\tif (mouse_earliest_button_down == -1 || g.IO.MouseClickedTime[i] < g.IO.MouseClickedTime[mouse_earliest_button_down])\n\t\t\t\tmouse_earliest_button_down = i;\n\t}\n\tbool mouse_avail_to_imgui = (mouse_earliest_button_down == -1) || g.IO.MouseDownOwned[mouse_earliest_button_down];\n\tif (g.WantCaptureMouseNextFrame != -1)\n\t\tg.IO.WantCaptureMouse = (g.WantCaptureMouseNextFrame != 0);\n\telse\n\t\tg.IO.WantCaptureMouse = (mouse_avail_to_imgui && (g.HoveredWindow != NULL || mouse_any_down)) || (!g.OpenPopupStack.empty());\n\tif (g.WantCaptureKeyboardNextFrame != -1)\n\t\tg.IO.WantCaptureKeyboard = (g.WantCaptureKeyboardNextFrame != 0);\n\telse\n\t\tg.IO.WantCaptureKeyboard = (g.ActiveId != 0) || (modal_window != NULL);\n\tg.IO.WantTextInput = (g.WantTextInputNextFrame != -1) ? (g.WantTextInputNextFrame != 0) : 0;\n\tg.MouseCursor = ImGuiMouseCursor_Arrow;\n\tg.WantCaptureMouseNextFrame = g.WantCaptureKeyboardNextFrame = g.WantTextInputNextFrame = -1;\n\tg.OsImePosRequest = ImVec2(1.0f, 1.0f); // OS Input Method Editor showing on top-left of our window by default\n\n\t\t\t\t\t\t\t\t\t\t\t// If mouse was first clicked outside of ImGui bounds we also cancel out hovering.\n\t\t\t\t\t\t\t\t\t\t\t// FIXME: For patterns of drag and drop across OS windows, we may need to rework/remove this test (first committed 311c0ca9 on 2015/02)\n\tbool mouse_dragging_extern_payload = g.DragDropActive && (g.DragDropSourceFlags & ImGuiDragDropFlags_SourceExtern) != 0;\n\tif (!mouse_avail_to_imgui && !mouse_dragging_extern_payload)\n\t\tg.HoveredWindow = g.HoveredRootWindow = NULL;\n\n\t// Scale & Scrolling\n\tif (g.HoveredWindow && g.IO.MouseWheel != 0.0f && !g.HoveredWindow->Collapsed)\n\t{\n\t\tImGuiWindow* window = g.HoveredWindow;\n\t\tif (g.IO.KeyCtrl && g.IO.FontAllowUserScaling)\n\t\t{\n\t\t\t// Zoom / Scale window\n\t\t\tconst float new_font_scale = ImClamp(window->FontWindowScale + g.IO.MouseWheel * 0.10f, 0.50f, 2.50f);\n\t\t\tconst float scale = new_font_scale / window->FontWindowScale;\n\t\t\twindow->FontWindowScale = new_font_scale;\n\n\t\t\tconst ImVec2 offset = window->Size * (1.0f - scale) * (g.IO.MousePos - window->Pos) / window->Size;\n\t\t\twindow->Pos += offset;\n\t\t\twindow->PosFloat += offset;\n\t\t\twindow->Size *= scale;\n\t\t\twindow->SizeFull *= scale;\n\t\t}\n\t\telse if (!g.IO.KeyCtrl)\n\t\t{\n\t\t\t// Mouse wheel Scrolling\n\t\t\t// If a child window has the ImGuiWindowFlags_NoScrollWithMouse flag, we give a chance to scroll its parent (unless either ImGuiWindowFlags_NoInputs or ImGuiWindowFlags_NoScrollbar are also set).\n\t\t\tImGuiWindow* scroll_window = window;\n\t\t\twhile ((scroll_window->Flags & ImGuiWindowFlags_ChildWindow) && (scroll_window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(scroll_window->Flags & ImGuiWindowFlags_NoScrollbar) && !(scroll_window->Flags & ImGuiWindowFlags_NoInputs) && scroll_window->ParentWindow)\n\t\t\t\tscroll_window = scroll_window->ParentWindow;\n\n\t\t\tif (!(scroll_window->Flags & ImGuiWindowFlags_NoScrollWithMouse) && !(scroll_window->Flags & ImGuiWindowFlags_NoInputs))\n\t\t\t{\n\t\t\t\tfloat scroll_amount = 5 * scroll_window->CalcFontSize();\n\t\t\t\tscroll_amount = (float)(int)ImMin(scroll_amount, (scroll_window->ContentsRegionRect.GetHeight() + scroll_window->WindowPadding.y * 2.0f) * 0.67f);\n\t\t\t\tSetWindowScrollY(scroll_window, scroll_window->Scroll.y - g.IO.MouseWheel * scroll_amount);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Pressing TAB activate widget focus\n\tif (g.ActiveId == 0 && g.NavWindow != NULL && g.NavWindow->Active && IsKeyPressedMap(ImGuiKey_Tab, false))\n\t\tg.NavWindow->FocusIdxTabRequestNext = 0;\n\n\t// Mark all windows as not visible\n\tfor (int i = 0; i != g.Windows.Size; i++)\n\t{\n\t\tImGuiWindow* window = g.Windows[i];\n\t\twindow->WasActive = window->Active;\n\t\twindow->Active = false;\n\t\twindow->WriteAccessed = false;\n\t}\n\n\t// Closing the focused window restore focus to the first active root window in descending z-order\n\tif (g.NavWindow && !g.NavWindow->WasActive)\n\t\tFocusFrontMostActiveWindow(NULL);\n\n\t// No window should be open at the beginning of the frame.\n\t// But in order to allow the user to call NewFrame() multiple times without calling Render(), we are doing an explicit clear.\n\tg.CurrentWindowStack.resize(0);\n\tg.CurrentPopupStack.resize(0);\n\tCloseInactivePopups(g.NavWindow);\n\n\t// Create implicit window - we will only render it if the user has added something to it.\n\t// We don't use \"Debug\" to avoid colliding with user trying to create a \"Debug\" window with custom flags.\n\tSetNextWindowSize(ImVec2(400, 400), ImGuiCond_FirstUseEver);\n\tBegin(\"Debug##Default\");\n}\n\nstatic void* SettingsHandlerWindow_ReadOpen(ImGuiContext*, ImGuiSettingsHandler*, const char* name)\n{\n\tImGuiWindowSettings* settings = ImGui::FindWindowSettings(ImHash(name, 0));\n\tif (!settings)\n\t\tsettings = AddWindowSettings(name);\n\treturn (void*)settings;\n}\n\nstatic void SettingsHandlerWindow_ReadLine(ImGuiContext*, ImGuiSettingsHandler*, void* entry, const char* line)\n{\n\tImGuiWindowSettings* settings = (ImGuiWindowSettings*)entry;\n\tfloat x, y;\n\tint i;\n\tif (sscanf(line, \"Pos=%f,%f\", &x, &y) == 2)         settings->Pos = ImVec2(x, y);\n\telse if (sscanf(line, \"Size=%f,%f\", &x, &y) == 2)   settings->Size = ImMax(ImVec2(x, y), GImGui->Style.WindowMinSize);\n\telse if (sscanf(line, \"Collapsed=%d\", &i) == 1)     settings->Collapsed = (i != 0);\n}\n\nstatic void SettingsHandlerWindow_WriteAll(ImGuiContext* imgui_ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* buf)\n{\n\t// Gather data from windows that were active during this session\n\tImGuiContext& g = *imgui_ctx;\n\tfor (int i = 0; i != g.Windows.Size; i++)\n\t{\n\t\tImGuiWindow* window = g.Windows[i];\n\t\tif (window->Flags & ImGuiWindowFlags_NoSavedSettings)\n\t\t\tcontinue;\n\t\tImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID);\n\t\tif (!settings)\n\t\t\tsettings = AddWindowSettings(window->Name);\n\t\tsettings->Pos = window->Pos;\n\t\tsettings->Size = window->SizeFull;\n\t\tsettings->Collapsed = window->Collapsed;\n\t}\n\n\t// Write a buffer\n\t// If a window wasn't opened in this session we preserve its settings\n\tbuf->reserve(buf->size() + g.SettingsWindows.Size * 96); // ballpark reserve\n\tfor (int i = 0; i != g.SettingsWindows.Size; i++)\n\t{\n\t\tconst ImGuiWindowSettings* settings = &g.SettingsWindows[i];\n\t\tif (settings->Pos.x == FLT_MAX)\n\t\t\tcontinue;\n\t\tconst char* name = settings->Name;\n\t\tif (const char* p = strstr(name, \"###\"))  // Skip to the \"###\" marker if any. We don't skip past to match the behavior of GetID()\n\t\t\tname = p;\n\t\tbuf->appendf(\"[%s][%s]\\n\", handler->TypeName, name);\n\t\tbuf->appendf(\"Pos=%d,%d\\n\", (int)settings->Pos.x, (int)settings->Pos.y);\n\t\tbuf->appendf(\"Size=%d,%d\\n\", (int)settings->Size.x, (int)settings->Size.y);\n\t\tbuf->appendf(\"Collapsed=%d\\n\", settings->Collapsed);\n\t\tbuf->appendf(\"\\n\");\n\t}\n}\n\nvoid ImGui::Initialize()\n{\n\tImGuiContext& g = *GImGui;\n\tg.LogClipboard = IM_NEW(ImGuiTextBuffer)();\n\n\t// Add .ini handle for ImGuiWindow type\n\tImGuiSettingsHandler ini_handler;\n\tini_handler.TypeName = \"Window\";\n\tini_handler.TypeHash = ImHash(\"Window\", 0, 0);\n\tini_handler.ReadOpenFn = SettingsHandlerWindow_ReadOpen;\n\tini_handler.ReadLineFn = SettingsHandlerWindow_ReadLine;\n\tini_handler.WriteAllFn = SettingsHandlerWindow_WriteAll;\n\tg.SettingsHandlers.push_front(ini_handler);\n\n\t// Load .ini file\n\tIM_ASSERT(g.SettingsWindows.empty());\n\tLoadIniSettingsFromDisk(g.IO.IniFilename);\n\tg.Initialized = true;\n}\n\n// This function is merely here to free heap allocations.\nvoid ImGui::Shutdown()\n{\n\tImGuiContext& g = *GImGui;\n\n\t// The fonts atlas can be used prior to calling NewFrame(), so we clear it even if g.Initialized is FALSE (which would happen if we never called NewFrame)\n\tif (g.IO.Fonts) // Testing for NULL to allow user to NULLify in case of running Shutdown() on multiple contexts. Bit hacky.\n\t\tg.IO.Fonts->Clear();\n\n\t// Cleanup of other data are conditional on actually having initialize ImGui.\n\tif (!g.Initialized)\n\t\treturn;\n\n\t//SaveIniSettingsToDisk(g.IO.IniFilename);\n\n\tfor (int i = 0; i < g.Windows.Size; i++)\n\t\tIM_DELETE(g.Windows[i]);\n\tg.Windows.clear();\n\tg.WindowsSortBuffer.clear();\n\tg.CurrentWindow = NULL;\n\tg.CurrentWindowStack.clear();\n\tg.WindowsById.Clear();\n\tg.NavWindow = NULL;\n\tg.HoveredWindow = NULL;\n\tg.HoveredRootWindow = NULL;\n\tg.ActiveIdWindow = NULL;\n\tg.MovingWindow = NULL;\n\tfor (int i = 0; i < g.SettingsWindows.Size; i++)\n\t\tIM_DELETE(g.SettingsWindows[i].Name);\n\tg.ColorModifiers.clear();\n\tg.StyleModifiers.clear();\n\tg.FontStack.clear();\n\tg.OpenPopupStack.clear();\n\tg.CurrentPopupStack.clear();\n\tg.DrawDataBuilder.ClearFreeMemory();\n\tg.OverlayDrawList.ClearFreeMemory();\n\tg.PrivateClipboard.clear();\n\tg.InputTextState.Text.clear();\n\tg.InputTextState.InitialText.clear();\n\tg.InputTextState.TempTextBuffer.clear();\n\n\tg.SettingsWindows.clear();\n\tg.SettingsHandlers.clear();\n\n\tif (g.LogFile && g.LogFile != stdout)\n\t{\n\t\tfclose(g.LogFile);\n\t\tg.LogFile = NULL;\n\t}\n\tif (g.LogClipboard)\n\t\tIM_DELETE(g.LogClipboard);\n\n\tg.Initialized = false;\n}\n\nImGuiWindowSettings* ImGui::FindWindowSettings(ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tfor (int i = 0; i != g.SettingsWindows.Size; i++)\n\t\tif (g.SettingsWindows[i].Id == id)\n\t\t\treturn &g.SettingsWindows[i];\n\treturn NULL;\n}\n\nstatic ImGuiWindowSettings* AddWindowSettings(const char* name)\n{\n\tImGuiContext& g = *GImGui;\n\tg.SettingsWindows.push_back(ImGuiWindowSettings());\n\tImGuiWindowSettings* settings = &g.SettingsWindows.back();\n\tsettings->Name = ImStrdup(name);\n\tsettings->Id = ImHash(name, 0);\n\treturn settings;\n}\n\nstatic void LoadIniSettingsFromDisk(const char* ini_filename)\n{\n\tif (!ini_filename)\n\t\treturn;\n\tchar* file_data = (char*)ImFileLoadToMemory(ini_filename, \"rb\", NULL, +1);\n\tif (!file_data)\n\t\treturn;\n\tLoadIniSettingsFromMemory(file_data);\n\tImGui::MemFree(file_data);\n}\n\nImGuiSettingsHandler* ImGui::FindSettingsHandler(const char* type_name)\n{\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiID type_hash = ImHash(type_name, 0, 0);\n\tfor (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n\t\tif (g.SettingsHandlers[handler_n].TypeHash == type_hash)\n\t\t\treturn &g.SettingsHandlers[handler_n];\n\treturn NULL;\n}\n\n// Zero-tolerance, no error reporting, cheap .ini parsing\nstatic void LoadIniSettingsFromMemory(const char* buf_readonly)\n{\n\t// For convenience and to make the code simpler, we'll write zero terminators inside the buffer. So let's create a writable copy.\n\tchar* buf = ImStrdup(buf_readonly);\n\tchar* buf_end = buf + strlen(buf);\n\n\tImGuiContext& g = *GImGui;\n\tvoid* entry_data = NULL;\n\tImGuiSettingsHandler* entry_handler = NULL;\n\n\tchar* line_end = NULL;\n\tfor (char* line = buf; line < buf_end; line = line_end + 1)\n\t{\n\t\t// Skip new lines markers, then find end of the line\n\t\twhile (*line == '\\n' || *line == '\\r')\n\t\t\tline++;\n\t\tline_end = line;\n\t\twhile (line_end < buf_end && *line_end != '\\n' && *line_end != '\\r')\n\t\t\tline_end++;\n\t\tline_end[0] = 0;\n\n\t\tif (line[0] == '[' && line_end > line&& line_end[-1] == ']')\n\t\t{\n\t\t\t// Parse \"[Type][Name]\". Note that 'Name' can itself contains [] characters, which is acceptable with the current format and parsing code.\n\t\t\tline_end[-1] = 0;\n\t\t\tconst char* name_end = line_end - 1;\n\t\t\tconst char* type_start = line + 1;\n\t\t\tchar* type_end = ImStrchrRange(type_start, name_end, ']');\n\t\t\tconst char* name_start = type_end ? ImStrchrRange(type_end + 1, name_end, '[') : NULL;\n\t\t\tif (!type_end || !name_start)\n\t\t\t{\n\t\t\t\tname_start = type_start; // Import legacy entries that have no type\n\t\t\t\ttype_start = \"Window\";\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t*type_end = 0; // Overwrite first ']' \n\t\t\t\tname_start++;  // Skip second '['\n\t\t\t}\n\t\t\tentry_handler = ImGui::FindSettingsHandler(type_start);\n\t\t\tentry_data = entry_handler ? entry_handler->ReadOpenFn(&g, entry_handler, name_start) : NULL;\n\t\t}\n\t\telse if (entry_handler != NULL && entry_data != NULL)\n\t\t{\n\t\t\t// Let type handler parse the line\n\t\t\tentry_handler->ReadLineFn(&g, entry_handler, entry_data, line);\n\t\t}\n\t}\n\tImGui::MemFree(buf);\n}\n\nstatic void SaveIniSettingsToDisk(const char* ini_filename)\n{\n\tImGuiContext& g = *GImGui;\n\tg.SettingsDirtyTimer = 0.0f;\n\tif (!ini_filename)\n\t\treturn;\n\n\tImVector<char> buf;\n\tSaveIniSettingsToMemory(buf);\n\n\tFILE* f = ImFileOpen(ini_filename, \"wt\");\n\tif (!f)\n\t\treturn;\n\tfwrite(buf.Data, sizeof(char), (size_t)buf.Size, f);\n\tfclose(f);\n}\n\nstatic void SaveIniSettingsToMemory(ImVector<char>& out_buf)\n{\n\tImGuiContext& g = *GImGui;\n\tg.SettingsDirtyTimer = 0.0f;\n\n\tImGuiTextBuffer buf;\n\tfor (int handler_n = 0; handler_n < g.SettingsHandlers.Size; handler_n++)\n\t{\n\t\tImGuiSettingsHandler* handler = &g.SettingsHandlers[handler_n];\n\t\thandler->WriteAllFn(&g, handler, &buf);\n\t}\n\n\tbuf.Buf.pop_back(); // Remove extra zero-terminator used by ImGuiTextBuffer\n\tout_buf.swap(buf.Buf);\n}\n\nvoid ImGui::MarkIniSettingsDirty()\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.SettingsDirtyTimer <= 0.0f)\n\t\tg.SettingsDirtyTimer = g.IO.IniSavingRate;\n}\n\nstatic void MarkIniSettingsDirty(ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\tif (!(window->Flags & ImGuiWindowFlags_NoSavedSettings))\n\t\tif (g.SettingsDirtyTimer <= 0.0f)\n\t\t\tg.SettingsDirtyTimer = g.IO.IniSavingRate;\n}\n\n// FIXME: Add a more explicit sort order in the window structure.\nstatic int ChildWindowComparer(const void* lhs, const void* rhs)\n{\n\tconst ImGuiWindow* a = *(const ImGuiWindow**)lhs;\n\tconst ImGuiWindow* b = *(const ImGuiWindow**)rhs;\n\tif (int d = (a->Flags & ImGuiWindowFlags_Popup) - (b->Flags & ImGuiWindowFlags_Popup))\n\t\treturn d;\n\tif (int d = (a->Flags & ImGuiWindowFlags_Tooltip) - (b->Flags & ImGuiWindowFlags_Tooltip))\n\t\treturn d;\n\treturn (a->BeginOrderWithinParent - b->BeginOrderWithinParent);\n}\n\nstatic void AddWindowToSortedBuffer(ImVector<ImGuiWindow*>& out_sorted_windows, ImGuiWindow* window)\n{\n\tout_sorted_windows.push_back(window);\n\tif (window->Active)\n\t{\n\t\tint count = window->DC.ChildWindows.Size;\n\t\tif (count > 1)\n\t\t\tqsort(window->DC.ChildWindows.begin(), (size_t)count, sizeof(ImGuiWindow*), ChildWindowComparer);\n\t\tfor (int i = 0; i < count; i++)\n\t\t{\n\t\t\tImGuiWindow* child = window->DC.ChildWindows[i];\n\t\t\tif (child->Active)\n\t\t\t\tAddWindowToSortedBuffer(out_sorted_windows, child);\n\t\t}\n\t}\n}\n\nstatic void AddDrawListToDrawData(ImVector<ImDrawList*>* out_render_list, ImDrawList* draw_list)\n{\n\tif (draw_list->CmdBuffer.empty())\n\t\treturn;\n\n\t// Remove trailing command if unused\n\tImDrawCmd& last_cmd = draw_list->CmdBuffer.back();\n\tif (last_cmd.ElemCount == 0 && last_cmd.UserCallback == NULL)\n\t{\n\t\tdraw_list->CmdBuffer.pop_back();\n\t\tif (draw_list->CmdBuffer.empty())\n\t\t\treturn;\n\t}\n\n\t// Draw list sanity check. Detect mismatch between PrimReserve() calls and incrementing _VtxCurrentIdx, _VtxWritePtr etc. May trigger for you if you are using PrimXXX functions incorrectly.\n\tIM_ASSERT(draw_list->VtxBuffer.Size == 0 || draw_list->_VtxWritePtr == draw_list->VtxBuffer.Data + draw_list->VtxBuffer.Size);\n\tIM_ASSERT(draw_list->IdxBuffer.Size == 0 || draw_list->_IdxWritePtr == draw_list->IdxBuffer.Data + draw_list->IdxBuffer.Size);\n\tIM_ASSERT((int)draw_list->_VtxCurrentIdx == draw_list->VtxBuffer.Size);\n\n\t// Check that draw_list doesn't use more vertices than indexable (default ImDrawIdx = unsigned short = 2 bytes = 64K vertices per ImDrawList = per window)\n\t// If this assert triggers because you are drawing lots of stuff manually:\n\t// A) Make sure you are coarse clipping, because ImDrawList let all your vertices pass. You can use the Metrics window to inspect draw list contents.\n\t// B) If you need/want meshes with more than 64K vertices, uncomment the '#define ImDrawIdx unsigned int' line in imconfig.h to set the index size to 4 bytes. \n\t//    You'll need to handle the 4-bytes indices to your renderer. For example, the OpenGL example code detect index size at compile-time by doing:\n\t//      glDrawElements(GL_TRIANGLES, (GLsizei)pcmd->ElemCount, sizeof(ImDrawIdx) == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT, idx_buffer_offset);\n\t//    Your own engine or render API may use different parameters or function calls to specify index sizes. 2 and 4 bytes indices are generally supported by most API.\n\t// C) If for some reason you cannot use 4 bytes indices or don't want to, a workaround is to call BeginChild()/EndChild() before reaching the 64K limit to split your draw commands in multiple draw lists.\n\tif (sizeof(ImDrawIdx) == 2)\n\t\tIM_ASSERT(draw_list->_VtxCurrentIdx < (1 << 16) && \"Too many vertices in ImDrawList using 16-bit indices. Read comment above\");\n\n\tout_render_list->push_back(draw_list);\n}\n\nstatic void AddWindowToDrawData(ImVector<ImDrawList*>* out_render_list, ImGuiWindow* window)\n{\n\tAddDrawListToDrawData(out_render_list, window->DrawList);\n\tfor (int i = 0; i < window->DC.ChildWindows.Size; i++)\n\t{\n\t\tImGuiWindow* child = window->DC.ChildWindows[i];\n\t\tif (child->Active && child->HiddenFrames <= 0) // clipped children may have been marked not active\n\t\t\tAddWindowToDrawData(out_render_list, child);\n\t}\n}\n\nstatic void AddWindowToDrawDataSelectLayer(ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\tg.IO.MetricsActiveWindows++;\n\tif (window->Flags & ImGuiWindowFlags_Tooltip)\n\t\tAddWindowToDrawData(&g.DrawDataBuilder.Layers[1], window);\n\telse\n\t\tAddWindowToDrawData(&g.DrawDataBuilder.Layers[0], window);\n}\n\nvoid ImDrawDataBuilder::FlattenIntoSingleLayer()\n{\n\tint n = Layers[0].Size;\n\tint size = n;\n\tfor (int i = 1; i < IM_ARRAYSIZE(Layers); i++)\n\t\tsize += Layers[i].Size;\n\tLayers[0].resize(size);\n\tfor (int layer_n = 1; layer_n < IM_ARRAYSIZE(Layers); layer_n++)\n\t{\n\t\tImVector<ImDrawList*>& layer = Layers[layer_n];\n\t\tif (layer.empty())\n\t\t\tcontinue;\n\t\tmemcpy(&Layers[0][n], &layer[0], layer.Size * sizeof(ImDrawList*));\n\t\tn += layer.Size;\n\t\tlayer.resize(0);\n\t}\n}\n\nstatic void SetupDrawData(ImVector<ImDrawList*>* draw_lists, ImDrawData* out_draw_data)\n{\n\tout_draw_data->Valid = true;\n\tout_draw_data->CmdLists = (draw_lists->Size > 0) ? draw_lists->Data : NULL;\n\tout_draw_data->CmdListsCount = draw_lists->Size;\n\tout_draw_data->TotalVtxCount = out_draw_data->TotalIdxCount = 0;\n\tfor (int n = 0; n < draw_lists->Size; n++)\n\t{\n\t\tout_draw_data->TotalVtxCount += draw_lists->Data[n]->VtxBuffer.Size;\n\t\tout_draw_data->TotalIdxCount += draw_lists->Data[n]->IdxBuffer.Size;\n\t}\n}\n\n// When using this function it is sane to ensure that float are perfectly rounded to integer values, to that e.g. (int)(max.x-min.x) in user's render produce correct result.\nvoid ImGui::PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DrawList->PushClipRect(clip_rect_min, clip_rect_max, intersect_with_current_clip_rect);\n\twindow->ClipRect = window->DrawList->_ClipRectStack.back();\n}\n\nvoid ImGui::PopClipRect()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DrawList->PopClipRect();\n\twindow->ClipRect = window->DrawList->_ClipRectStack.back();\n}\n\n// This is normally called by Render(). You may want to call it directly if you want to avoid calling Render() but the gain will be very minimal.\nvoid ImGui::EndFrame()\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(g.Initialized);                       // Forgot to call ImGui::NewFrame()\n\tif (g.FrameCountEnded == g.FrameCount)          // Don't process EndFrame() multiple times.\n\t\treturn;\n\n\t// Notify OS when our Input Method Editor cursor has moved (e.g. CJK inputs using Microsoft IME)\n\tif (g.IO.ImeSetInputScreenPosFn && ImLengthSqr(g.OsImePosRequest - g.OsImePosSet) > 0.0001f)\n\t{\n\t\tg.IO.ImeSetInputScreenPosFn((int)g.OsImePosRequest.x, (int)g.OsImePosRequest.y);\n\t\tg.OsImePosSet = g.OsImePosRequest;\n\t}\n\n\t// Hide implicit \"Debug\" window if it hasn't been used\n\tIM_ASSERT(g.CurrentWindowStack.Size == 1);    // Mismatched Begin()/End() calls\n\tif (g.CurrentWindow && !g.CurrentWindow->WriteAccessed)\n\t\tg.CurrentWindow->Active = false;\n\tEnd();\n\n\tif (g.ActiveId == 0 && g.HoveredId == 0)\n\t{\n\t\tif (!g.NavWindow || !g.NavWindow->Appearing) // Unless we just made a window/popup appear\n\t\t{\n\t\t\t// Click to focus window and start moving (after we're done with all our widgets)\n\t\t\tif (g.IO.MouseClicked[0])\n\t\t\t{\n\t\t\t\tif (g.HoveredRootWindow != NULL)\n\t\t\t\t{\n\t\t\t\t\t// Set ActiveId even if the _NoMove flag is set, without it dragging away from a window with _NoMove would activate hover on other windows.\n\t\t\t\t\tFocusWindow(g.HoveredWindow);\n\t\t\t\t\tSetActiveID(g.HoveredWindow->MoveId, g.HoveredWindow);\n\t\t\t\t\tg.ActiveIdClickOffset = g.IO.MousePos - g.HoveredRootWindow->Pos;\n\t\t\t\t\tif (!(g.HoveredWindow->Flags & ImGuiWindowFlags_NoMove) && !(g.HoveredRootWindow->Flags & ImGuiWindowFlags_NoMove))\n\t\t\t\t\t{\n\t\t\t\t\t\tg.MovingWindow = g.HoveredWindow;\n\t\t\t\t\t\tg.MovingWindowMoveId = g.MovingWindow->MoveId;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)\n\t\t\t\t{\n\t\t\t\t\t// Clicking on void disable focus\n\t\t\t\t\tFocusWindow(NULL);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// With right mouse button we close popups without changing focus\n\t\t\t// (The left mouse button path calls FocusWindow which will lead NewFrame->CloseInactivePopups to trigger)\n\t\t\tif (g.IO.MouseClicked[1])\n\t\t\t{\n\t\t\t\t// Find the top-most window between HoveredWindow and the front most Modal Window.\n\t\t\t\t// This is where we can trim the popup stack.\n\t\t\t\tImGuiWindow* modal = GetFrontMostModalRootWindow();\n\t\t\t\tbool hovered_window_above_modal = false;\n\t\t\t\tif (modal == NULL)\n\t\t\t\t\thovered_window_above_modal = true;\n\t\t\t\tfor (int i = g.Windows.Size - 1; i >= 0 && hovered_window_above_modal == false; i--)\n\t\t\t\t{\n\t\t\t\t\tImGuiWindow* window = g.Windows[i];\n\t\t\t\t\tif (window == modal)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (window == g.HoveredWindow)\n\t\t\t\t\t\thovered_window_above_modal = true;\n\t\t\t\t}\n\t\t\t\tCloseInactivePopups(hovered_window_above_modal ? g.HoveredWindow : modal);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Sort the window list so that all child windows are after their parent\n\t// We cannot do that on FocusWindow() because childs may not exist yet\n\tg.WindowsSortBuffer.resize(0);\n\tg.WindowsSortBuffer.reserve(g.Windows.Size);\n\tfor (int i = 0; i != g.Windows.Size; i++)\n\t{\n\t\tImGuiWindow* window = g.Windows[i];\n\t\tif (window->Active && (window->Flags & ImGuiWindowFlags_ChildWindow))       // if a child is active its parent will add it\n\t\t\tcontinue;\n\t\tAddWindowToSortedBuffer(g.WindowsSortBuffer, window);\n\t}\n\n\tIM_ASSERT(g.Windows.Size == g.WindowsSortBuffer.Size);  // we done something wrong\n\tg.Windows.swap(g.WindowsSortBuffer);\n\n\t// Clear Input data for next frame\n\tg.IO.MouseWheel = 0.0f;\n\tmemset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));\n\n\tg.FrameCountEnded = g.FrameCount;\n}\n\nvoid ImGui::Render()\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(g.Initialized);   // Forgot to call ImGui::NewFrame()\n\n\tif (g.FrameCountEnded != g.FrameCount)\n\t\tImGui::EndFrame();\n\tg.FrameCountRendered = g.FrameCount;\n\n\t// Skip render altogether if alpha is 0.0\n\t// Note that vertex buffers have been created and are wasted, so it is best practice that you don't create windows in the first place, or consistently respond to Begin() returning false.\n\tif (g.Style.Alpha > 0.0f)\n\t{\n\t\t// Gather windows to render\n\t\tg.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;\n\t\tg.DrawDataBuilder.Clear();\n\t\tfor (int n = 0; n != g.Windows.Size; n++)\n\t\t{\n\t\t\tImGuiWindow* window = g.Windows[n];\n\t\t\tif (window->Active && window->HiddenFrames <= 0 && (window->Flags & (ImGuiWindowFlags_ChildWindow)) == 0)\n\t\t\t\tAddWindowToDrawDataSelectLayer(window);\n\t\t}\n\t\tg.DrawDataBuilder.FlattenIntoSingleLayer();\n\n\t\t// Draw software mouse cursor if requested\n\t\tif (g.IO.MouseDrawCursor)\n\t\t{\n\t\t\tconst ImGuiMouseCursorData& cursor_data = g.MouseCursorData[g.MouseCursor];\n\t\t\tconst ImVec2 pos = g.IO.MousePos - cursor_data.HotOffset;\n\t\t\tconst ImVec2 size = cursor_data.Size;\n\t\t\tconst ImTextureID tex_id = g.IO.Fonts->TexID;\n\t\t\tg.OverlayDrawList.PushTextureID(tex_id);\n\t\t\tg.OverlayDrawList.AddImage(tex_id, pos + ImVec2(1, 0), pos + ImVec2(1, 0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0, 0, 0, 48));        // Shadow\n\t\t\tg.OverlayDrawList.AddImage(tex_id, pos + ImVec2(2, 0), pos + ImVec2(2, 0) + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0, 0, 0, 48));        // Shadow\n\t\t\tg.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[1], cursor_data.TexUvMax[1], IM_COL32(0, 0, 0, 255));       // Black border\n\t\t\tg.OverlayDrawList.AddImage(tex_id, pos, pos + size, cursor_data.TexUvMin[0], cursor_data.TexUvMax[0], IM_COL32(255, 255, 255, 255)); // White fill\n\t\t\tg.OverlayDrawList.PopTextureID();\n\t\t}\n\t\tif (!g.OverlayDrawList.VtxBuffer.empty())\n\t\t\tAddDrawListToDrawData(&g.DrawDataBuilder.Layers[0], &g.OverlayDrawList);\n\n\t\t// Setup ImDrawData structure for end-user\n\t\tSetupDrawData(&g.DrawDataBuilder.Layers[0], &g.DrawData);\n\t\tg.IO.MetricsRenderVertices = g.DrawData.TotalVtxCount;\n\t\tg.IO.MetricsRenderIndices = g.DrawData.TotalIdxCount;\n\n\t\t// Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData()\n\t\tif (g.DrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL)\n\t\t\tg.IO.RenderDrawListsFn(&g.DrawData);\n\t}\n}\n\nconst char* ImGui::FindRenderedTextEnd(const char* text, const char* text_end)\n{\n\tconst char* text_display_end = text;\n\tif (!text_end)\n\t\ttext_end = (const char*)-1;\n\n\twhile (text_display_end < text_end && *text_display_end != '\\0' && (text_display_end[0] != '#' || text_display_end[1] != '#'))\n\t\ttext_display_end++;\n\treturn text_display_end;\n}\n\n// Pass text data straight to log (without being displayed)\nvoid ImGui::LogText(const char* fmt, ...)\n{\n\tImGuiContext& g = *GImGui;\n\tif (!g.LogEnabled)\n\t\treturn;\n\n\tva_list args;\n\tva_start(args, fmt);\n\tif (g.LogFile)\n\t{\n\t\tvfprintf(g.LogFile, fmt, args);\n\t}\n\telse\n\t{\n\t\tg.LogClipboard->appendfv(fmt, args);\n\t}\n\tva_end(args);\n}\n\n// Internal version that takes a position to decide on newline placement and pad items according to their depth.\n// We split text into individual lines to add current tree level padding\nstatic void LogRenderedText(const ImVec2* ref_pos, const char* text, const char* text_end = NULL)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tif (!text_end)\n\t\ttext_end = ImGui::FindRenderedTextEnd(text, text_end);\n\n\tconst bool log_new_line = ref_pos && (ref_pos->y > window->DC.LogLinePosY + 1);\n\tif (ref_pos)\n\t\twindow->DC.LogLinePosY = ref_pos->y;\n\n\tconst char* text_remaining = text;\n\tif (g.LogStartDepth > window->DC.TreeDepth)  // Re-adjust padding if we have popped out of our starting depth\n\t\tg.LogStartDepth = window->DC.TreeDepth;\n\tconst int tree_depth = (window->DC.TreeDepth - g.LogStartDepth);\n\tfor (;;)\n\t{\n\t\t// Split the string. Each new line (after a '\\n') is followed by spacing corresponding to the current depth of our log entry.\n\t\tconst char* line_end = text_remaining;\n\t\twhile (line_end < text_end)\n\t\t\tif (*line_end == '\\n')\n\t\t\t\tbreak;\n\t\t\telse\n\t\t\t\tline_end++;\n\t\tif (line_end >= text_end)\n\t\t\tline_end = NULL;\n\n\t\tconst bool is_first_line = (text == text_remaining);\n\t\tbool is_last_line = false;\n\t\tif (line_end == NULL)\n\t\t{\n\t\t\tis_last_line = true;\n\t\t\tline_end = text_end;\n\t\t}\n\t\tif (line_end != NULL && !(is_last_line && (line_end - text_remaining) == 0))\n\t\t{\n\t\t\tconst int char_count = (int)(line_end - text_remaining);\n\t\t\tif (log_new_line || !is_first_line)\n\t\t\t\tImGui::LogText(IM_NEWLINE \"%*s%.*s\", tree_depth * 4, \"\", char_count, text_remaining);\n\t\t\telse\n\t\t\t\tImGui::LogText(\" %.*s\", char_count, text_remaining);\n\t\t}\n\n\t\tif (is_last_line)\n\t\t\tbreak;\n\t\ttext_remaining = line_end + 1;\n\t}\n}\n\n// Internal ImGui functions to render text\n// RenderText***() functions calls ImDrawList::AddText() calls ImBitmapFont::RenderText()\nvoid ImGui::RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\t// Hide anything after a '##' string\n\tconst char* text_display_end;\n\tif (hide_text_after_hash)\n\t{\n\t\ttext_display_end = FindRenderedTextEnd(text, text_end);\n\t}\n\telse\n\t{\n\t\tif (!text_end)\n\t\t\ttext_end = text + strlen(text); // FIXME-OPT\n\t\ttext_display_end = text_end;\n\t}\n\n\tconst int text_len = (int)(text_display_end - text);\n\tif (text_len > 0)\n\t{\n\t\twindow->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end);\n\t\tif (g.LogEnabled)\n\t\t\tLogRenderedText(&pos, text, text_display_end);\n\t}\n}\n\nvoid ImGui::RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tif (!text_end)\n\t\ttext_end = text + strlen(text); // FIXME-OPT\n\n\tconst int text_len = (int)(text_end - text);\n\tif (text_len > 0)\n\t{\n\t\twindow->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_end, wrap_width);\n\t\tif (g.LogEnabled)\n\t\t\tLogRenderedText(&pos, text, text_end);\n\t}\n}\n\n// Default clip_rect uses (pos_min,pos_max)\n// Handle clipping on CPU immediately (vs typically let the GPU clip the triangles that are overlapping the clipping rectangle edges)\nvoid ImGui::RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align, const ImRect* clip_rect)\n{\n\t// Hide anything after a '##' string\n\tconst char* text_display_end = FindRenderedTextEnd(text, text_end);\n\tconst int text_len = (int)(text_display_end - text);\n\tif (text_len == 0)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\t// Perform CPU side clipping for single clipped element to avoid using scissor state\n\tImVec2 pos = pos_min;\n\tconst ImVec2 text_size = text_size_if_known ? *text_size_if_known : CalcTextSize(text, text_display_end, false, 0.0f);\n\n\tconst ImVec2* clip_min = clip_rect ? &clip_rect->Min : &pos_min;\n\tconst ImVec2* clip_max = clip_rect ? &clip_rect->Max : &pos_max;\n\tbool need_clipping = (pos.x + text_size.x >= clip_max->x) || (pos.y + text_size.y >= clip_max->y);\n\tif (clip_rect) // If we had no explicit clipping rectangle then pos==clip_min\n\t\tneed_clipping |= (pos.x < clip_min->x) || (pos.y < clip_min->y);\n\n\t// Align whole block. We should defer that to the better rendering function when we'll have support for individual line alignment.\n\tif (align.x > 0.0f) pos.x = ImMax(pos.x, pos.x + (pos_max.x - pos.x - text_size.x) * align.x);\n\tif (align.y > 0.0f) pos.y = ImMax(pos.y, pos.y + (pos_max.y - pos.y - text_size.y) * align.y);\n\n\t// Render\n\tif (need_clipping)\n\t{\n\t\tImVec4 fine_clip_rect(clip_min->x, clip_min->y, clip_max->x, clip_max->y);\n\t\twindow->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, &fine_clip_rect);\n\t}\n\telse\n\t{\n\t\twindow->DrawList->AddText(g.Font, g.FontSize, pos, GetColorU32(ImGuiCol_Text), text, text_display_end, 0.0f, NULL);\n\t}\n\tif (g.LogEnabled)\n\t\tLogRenderedText(&pos, text, text_display_end);\n}\n\n// Render a rectangle shaped with optional rounding and borders\nvoid ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border, float rounding)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\twindow->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);\n\tconst float border_size = g.Style.FrameBorderSize;\n\tif (border && border_size > 0.0f)\n\t{\n\t\twindow->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size);\n\t\twindow->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size);\n\t}\n}\n\nvoid ImGui::RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tconst float border_size = g.Style.FrameBorderSize;\n\tif (border_size > 0.0f)\n\t{\n\t\twindow->DrawList->AddRect(p_min + ImVec2(1, 1), p_max + ImVec2(1, 1), GetColorU32(ImGuiCol_BorderShadow), rounding, ImDrawCornerFlags_All, border_size);\n\t\twindow->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding, ImDrawCornerFlags_All, border_size);\n\t}\n}\n\n// Render a triangle to denote expanded/collapsed state\nvoid ImGui::RenderTriangle(ImVec2 p_min, ImGuiDir dir, float scale)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tconst float h = g.FontSize * 1.00f;\n\tfloat r = h * 0.40f * scale;\n\tImVec2 center = p_min + ImVec2(h * 0.50f, h * 0.50f * scale);\n\n\tImVec2 a, b, c;\n\tswitch (dir)\n\t{\n\tcase ImGuiDir_Up:\n\tcase ImGuiDir_Down:\n\t\tif (dir == ImGuiDir_Up) r = -r;\n\t\tcenter.y -= r * 0.25f;\n\t\ta = ImVec2(0, 1) * r;\n\t\tb = ImVec2(-0.866f, -0.5f) * r;\n\t\tc = ImVec2(+0.866f, -0.5f) * r;\n\t\tbreak;\n\tcase ImGuiDir_Left:\n\tcase ImGuiDir_Right:\n\t\tif (dir == ImGuiDir_Left) r = -r;\n\t\tcenter.x -= r * 0.25f;\n\t\ta = ImVec2(1, 0) * r;\n\t\tb = ImVec2(-0.500f, +0.866f) * r;\n\t\tc = ImVec2(-0.500f, -0.866f) * r;\n\t\tbreak;\n\tcase ImGuiDir_None:\n\tcase ImGuiDir_Count_:\n\t\tIM_ASSERT(0);\n\t\tbreak;\n\t}\n\n\twindow->DrawList->AddTriangleFilled(center + a, center + b, center + c, GetColorU32(ImGuiCol_Text));\n}\n\nvoid ImGui::RenderBullet(ImVec2 pos)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\twindow->DrawList->AddCircleFilled(pos, GImGui->FontSize * 0.20f, GetColorU32(ImGuiCol_Text), 8);\n}\n\nvoid ImGui::RenderCheckMark(ImVec2 pos, ImU32 col, float sz)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tfloat thickness = ImMax(sz / 5.0f, 1.0f);\n\tsz -= thickness * 0.5f;\n\tpos += ImVec2(thickness * 0.25f, thickness * 0.25f);\n\n\tfloat third = sz / 3.0f;\n\tfloat bx = pos.x + third;\n\tfloat by = pos.y + sz - third * 0.5f;\n\twindow->DrawList->PathLineTo(ImVec2(bx - third, by - third));\n\twindow->DrawList->PathLineTo(ImVec2(bx, by));\n\twindow->DrawList->PathLineTo(ImVec2(bx + third * 2, by - third * 2));\n\twindow->DrawList->PathStroke(col, false, thickness);\n}\n\n// Calculate text size. Text can be multi-line. Optionally ignore text after a ## marker.\n// CalcTextSize(\"\") should return ImVec2(0.0f, GImGui->FontSize)\nImVec2 ImGui::CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash, float wrap_width)\n{\n\tImGuiContext& g = *GImGui;\n\n\tconst char* text_display_end;\n\tif (hide_text_after_double_hash)\n\t\ttext_display_end = FindRenderedTextEnd(text, text_end);      // Hide anything after a '##' string\n\telse\n\t\ttext_display_end = text_end;\n\n\tImFont* font = g.Font;\n\tconst float font_size = g.FontSize;\n\tif (text == text_display_end)\n\t\treturn ImVec2(0.0f, font_size);\n\tImVec2 text_size = font->CalcTextSizeA(font_size, FLT_MAX, wrap_width, text, text_display_end, NULL);\n\n\t// Cancel out character spacing for the last character of a line (it is baked into glyph->AdvanceX field)\n\tconst float font_scale = font_size / font->FontSize;\n\tconst float character_spacing_x = 1.0f * font_scale;\n\tif (text_size.x > 0.0f)\n\t\ttext_size.x -= character_spacing_x;\n\ttext_size.x = (float)(int)(text_size.x + 0.95f);\n\n\treturn text_size;\n}\n\n// Helper to calculate coarse clipping of large list of evenly sized items.\n// NB: Prefer using the ImGuiListClipper higher-level helper if you can! Read comments and instructions there on how those use this sort of pattern.\n// NB: 'items_count' is only used to clamp the result, if you don't know your count you can use INT_MAX\nvoid ImGui::CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (g.LogEnabled)\n\t{\n\t\t// If logging is active, do not perform any clipping\n\t\t*out_items_display_start = 0;\n\t\t*out_items_display_end = items_count;\n\t\treturn;\n\t}\n\tif (window->SkipItems)\n\t{\n\t\t*out_items_display_start = *out_items_display_end = 0;\n\t\treturn;\n\t}\n\n\tconst ImVec2 pos = window->DC.CursorPos;\n\tint start = (int)((window->ClipRect.Min.y - pos.y) / items_height);\n\tint end = (int)((window->ClipRect.Max.y - pos.y) / items_height);\n\tstart = ImClamp(start, 0, items_count);\n\tend = ImClamp(end + 1, start, items_count);\n\t*out_items_display_start = start;\n\t*out_items_display_end = end;\n}\n\n// Find window given position, search front-to-back\n// FIXME: Note that we have a lag here because WindowRectClipped is updated in Begin() so windows moved by user via SetWindowPos() and not SetNextWindowPos() will have that rectangle lagging by a frame at the time FindHoveredWindow() is called, aka before the next Begin(). Moving window thankfully isn't affected.\nstatic ImGuiWindow* FindHoveredWindow(ImVec2 pos)\n{\n\tImGuiContext& g = *GImGui;\n\tfor (int i = g.Windows.Size - 1; i >= 0; i--)\n\t{\n\t\tImGuiWindow* window = g.Windows[i];\n\t\tif (!window->Active)\n\t\t\tcontinue;\n\t\tif (window->Flags & ImGuiWindowFlags_NoInputs)\n\t\t\tcontinue;\n\n\t\t// Using the clipped AABB, a child window will typically be clipped by its parent (not always)\n\t\tImRect bb(window->WindowRectClipped.Min - g.Style.TouchExtraPadding, window->WindowRectClipped.Max + g.Style.TouchExtraPadding);\n\t\tif (bb.Contains(pos))\n\t\t\treturn window;\n\t}\n\treturn NULL;\n}\n\n// Test if mouse cursor is hovering given rectangle\n// NB- Rectangle is clipped by our current clip setting\n// NB- Expand the rectangle to be generous on imprecise inputs systems (g.Style.TouchExtraPadding)\nbool ImGui::IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\t// Clip\n\tImRect rect_clipped(r_min, r_max);\n\tif (clip)\n\t\trect_clipped.ClipWith(window->ClipRect);\n\n\t// Expand for touch input\n\tconst ImRect rect_for_touch(rect_clipped.Min - g.Style.TouchExtraPadding, rect_clipped.Max + g.Style.TouchExtraPadding);\n\treturn rect_for_touch.Contains(g.IO.MousePos);\n}\n\nstatic bool IsKeyPressedMap(ImGuiKey key, bool repeat)\n{\n\tconst int key_index = GImGui->IO.KeyMap[key];\n\treturn (key_index >= 0) ? ImGui::IsKeyPressed(key_index, repeat) : false;\n}\n\nint ImGui::GetKeyIndex(ImGuiKey imgui_key)\n{\n\tIM_ASSERT(imgui_key >= 0 && imgui_key < ImGuiKey_COUNT);\n\treturn GImGui->IO.KeyMap[imgui_key];\n}\n\n// Note that imgui doesn't know the semantic of each entry of io.KeyDown[]. Use your own indices/enums according to how your backend/engine stored them into KeyDown[]!\nbool ImGui::IsKeyDown(int user_key_index)\n{\n\tif (user_key_index < 0) return false;\n\tIM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(GImGui->IO.KeysDown));\n\treturn GImGui->IO.KeysDown[user_key_index];\n}\n\nint ImGui::CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate)\n{\n\tif (t == 0.0f)\n\t\treturn 1;\n\tif (t <= repeat_delay || repeat_rate <= 0.0f)\n\t\treturn 0;\n\tconst int count = (int)((t - repeat_delay) / repeat_rate) - (int)((t_prev - repeat_delay) / repeat_rate);\n\treturn (count > 0) ? count : 0;\n}\n\nint ImGui::GetKeyPressedAmount(int key_index, float repeat_delay, float repeat_rate)\n{\n\tImGuiContext& g = *GImGui;\n\tif (key_index < 0) return false;\n\tIM_ASSERT(key_index >= 0 && key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n\tconst float t = g.IO.KeysDownDuration[key_index];\n\treturn CalcTypematicPressedRepeatAmount(t, t - g.IO.DeltaTime, repeat_delay, repeat_rate);\n}\n\nbool ImGui::IsKeyPressed(int user_key_index, bool repeat)\n{\n\tImGuiContext& g = *GImGui;\n\tif (user_key_index < 0) return false;\n\tIM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n\tconst float t = g.IO.KeysDownDuration[user_key_index];\n\tif (t == 0.0f)\n\t\treturn true;\n\tif (repeat && t > g.IO.KeyRepeatDelay)\n\t\treturn GetKeyPressedAmount(user_key_index, g.IO.KeyRepeatDelay, g.IO.KeyRepeatRate) > 0;\n\treturn false;\n}\n\nbool ImGui::IsKeyReleased(int user_key_index)\n{\n\tImGuiContext& g = *GImGui;\n\tif (user_key_index < 0) return false;\n\tIM_ASSERT(user_key_index >= 0 && user_key_index < IM_ARRAYSIZE(g.IO.KeysDown));\n\tif (g.IO.KeysDownDurationPrev[user_key_index] >= 0.0f && !g.IO.KeysDown[user_key_index])\n\t\treturn true;\n\treturn false;\n}\n\nbool ImGui::IsMouseDown(int button)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\treturn g.IO.MouseDown[button];\n}\n\nbool ImGui::IsMouseClicked(int button, bool repeat)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\tconst float t = g.IO.MouseDownDuration[button];\n\tif (t == 0.0f)\n\t\treturn true;\n\n\tif (repeat && t > g.IO.KeyRepeatDelay)\n\t{\n\t\tfloat delay = g.IO.KeyRepeatDelay, rate = g.IO.KeyRepeatRate;\n\t\tif ((fmodf(t - delay, rate) > rate * 0.5f) != (fmodf(t - delay - g.IO.DeltaTime, rate) > rate * 0.5f))\n\t\t\treturn true;\n\t}\n\n\treturn false;\n}\n\nbool ImGui::IsMouseReleased(int button)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\treturn g.IO.MouseReleased[button];\n}\n\nbool ImGui::IsMouseDoubleClicked(int button)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\treturn g.IO.MouseDoubleClicked[button];\n}\n\nbool ImGui::IsMouseDragging(int button, float lock_threshold)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\tif (!g.IO.MouseDown[button])\n\t\treturn false;\n\tif (lock_threshold < 0.0f)\n\t\tlock_threshold = g.IO.MouseDragThreshold;\n\treturn g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold;\n}\n\nImVec2 ImGui::GetMousePos()\n{\n\treturn GImGui->IO.MousePos;\n}\n\n// NB: prefer to call right after BeginPopup(). At the time Selectable/MenuItem is activated, the popup is already closed!\nImVec2 ImGui::GetMousePosOnOpeningCurrentPopup()\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.CurrentPopupStack.Size > 0)\n\t\treturn g.OpenPopupStack[g.CurrentPopupStack.Size - 1].OpenMousePos;\n\treturn g.IO.MousePos;\n}\n\n// We typically use ImVec2(-FLT_MAX,-FLT_MAX) to denote an invalid mouse position\nbool ImGui::IsMousePosValid(const ImVec2* mouse_pos)\n{\n\tif (mouse_pos == NULL)\n\t\tmouse_pos = &GImGui->IO.MousePos;\n\tconst float MOUSE_INVALID = -256000.0f;\n\treturn mouse_pos->x >= MOUSE_INVALID && mouse_pos->y >= MOUSE_INVALID;\n}\n\n// NB: This is only valid if IsMousePosValid(). Backends in theory should always keep mouse position valid when dragging even outside the client window.\nImVec2 ImGui::GetMouseDragDelta(int button, float lock_threshold)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\tif (lock_threshold < 0.0f)\n\t\tlock_threshold = g.IO.MouseDragThreshold;\n\tif (g.IO.MouseDown[button])\n\t\tif (g.IO.MouseDragMaxDistanceSqr[button] >= lock_threshold * lock_threshold)\n\t\t\treturn g.IO.MousePos - g.IO.MouseClickedPos[button];     // Assume we can only get active with left-mouse button (at the moment).\n\treturn ImVec2(0.0f, 0.0f);\n}\n\nvoid ImGui::ResetMouseDragDelta(int button)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(button >= 0 && button < IM_ARRAYSIZE(g.IO.MouseDown));\n\t// NB: We don't need to reset g.IO.MouseDragMaxDistanceSqr\n\tg.IO.MouseClickedPos[button] = g.IO.MousePos;\n}\n\nImGuiMouseCursor ImGui::GetMouseCursor()\n{\n\treturn GImGui->MouseCursor;\n}\n\nvoid ImGui::SetMouseCursor(ImGuiMouseCursor cursor_type)\n{\n\tGImGui->MouseCursor = cursor_type;\n}\n\nvoid ImGui::CaptureKeyboardFromApp(bool capture)\n{\n\tGImGui->WantCaptureKeyboardNextFrame = capture ? 1 : 0;\n}\n\nvoid ImGui::CaptureMouseFromApp(bool capture)\n{\n\tGImGui->WantCaptureMouseNextFrame = capture ? 1 : 0;\n}\n\nbool ImGui::IsItemActive()\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.ActiveId)\n\t{\n\t\tImGuiWindow* window = g.CurrentWindow;\n\t\treturn g.ActiveId == window->DC.LastItemId;\n\t}\n\treturn false;\n}\n\nbool ImGui::IsItemClicked(int mouse_button)\n{\n\treturn IsMouseClicked(mouse_button) && IsItemHovered(ImGuiHoveredFlags_Default);\n}\n\nbool ImGui::IsAnyItemHovered()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.HoveredId != 0 || g.HoveredIdPreviousFrame != 0;\n}\n\nbool ImGui::IsAnyItemActive()\n{\n\treturn GImGui->ActiveId != 0;\n}\n\nbool ImGui::IsItemVisible()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->ClipRect.Overlaps(window->DC.LastItemRect);\n}\n\n// Allow last item to be overlapped by a subsequent item. Both may be activated during the same frame before the later one takes priority.\nvoid ImGui::SetItemAllowOverlap()\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.HoveredId == g.CurrentWindow->DC.LastItemId)\n\t\tg.HoveredIdAllowOverlap = true;\n\tif (g.ActiveId == g.CurrentWindow->DC.LastItemId)\n\t\tg.ActiveIdAllowOverlap = true;\n}\n\nImVec2 ImGui::GetItemRectMin()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.LastItemRect.Min;\n}\n\nImVec2 ImGui::GetItemRectMax()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.LastItemRect.Max;\n}\n\nImVec2 ImGui::GetItemRectSize()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.LastItemRect.GetSize();\n}\n\nstatic ImRect GetVisibleRect()\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.IO.DisplayVisibleMin.x != g.IO.DisplayVisibleMax.x && g.IO.DisplayVisibleMin.y != g.IO.DisplayVisibleMax.y)\n\t\treturn ImRect(g.IO.DisplayVisibleMin, g.IO.DisplayVisibleMax);\n\treturn ImRect(0.0f, 0.0f, g.IO.DisplaySize.x, g.IO.DisplaySize.y);\n}\n\n// Not exposed publicly as BeginTooltip() because bool parameters are evil. Let's see if other needs arise first.\nvoid ImGui::BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip)\n{\n\tImGuiContext& g = *GImGui;\n\tchar window_name[16];\n\tImFormatString(window_name, IM_ARRAYSIZE(window_name), \"##Tooltip_%02d\", g.TooltipOverrideCount);\n\tif (override_previous_tooltip)\n\t\tif (ImGuiWindow* window = FindWindowByName(window_name))\n\t\t\tif (window->Active)\n\t\t\t{\n\t\t\t\t// Hide previous tooltips. We can't easily \"reset\" the content of a window so we create a new one.\n\t\t\t\twindow->HiddenFrames = 1;\n\t\t\t\tImFormatString(window_name, IM_ARRAYSIZE(window_name), \"##Tooltip_%02d\", ++g.TooltipOverrideCount);\n\t\t\t}\n\tImGuiWindowFlags flags = ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_AlwaysAutoResize;\n\tBegin(window_name, NULL, flags | extra_flags);\n}\n\nvoid ImGui::SetTooltipV(const char* fmt, va_list args)\n{\n\tBeginTooltipEx(0, true);\n\tTextV(fmt, args);\n\tEndTooltip();\n}\n\nvoid ImGui::SetTooltip(const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tSetTooltipV(fmt, args);\n\tva_end(args);\n}\n\nvoid ImGui::BeginTooltip()\n{\n\tBeginTooltipEx(0, false);\n}\n\nvoid ImGui::EndTooltip()\n{\n\tIM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip);   // Mismatched BeginTooltip()/EndTooltip() calls\n\tEnd();\n}\n\n// Mark popup as open (toggle toward open state).\n// Popups are closed when user click outside, or activate a pressable item, or CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block.\n// Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).\n// One open popup per level of the popup hierarchy (NB: when assigning we reset the Window member of ImGuiPopupRef to NULL)\nvoid ImGui::OpenPopupEx(ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* parent_window = g.CurrentWindow;\n\tint current_stack_size = g.CurrentPopupStack.Size;\n\tImGuiPopupRef popup_ref; // Tagged as new ref as Window will be set back to NULL if we write this into OpenPopupStack.\n\tpopup_ref.PopupId = id;\n\tpopup_ref.Window = NULL;\n\tpopup_ref.ParentWindow = parent_window;\n\tpopup_ref.OpenFrameCount = g.FrameCount;\n\tpopup_ref.OpenParentId = parent_window->IDStack.back();\n\tpopup_ref.OpenMousePos = g.IO.MousePos;\n\tpopup_ref.OpenPopupPos = g.IO.MousePos; // NB: In the Navigation branch OpenPopupPos doesn't use the mouse position, hence the separation here.\n\n\tif (g.OpenPopupStack.Size < current_stack_size + 1)\n\t{\n\t\tg.OpenPopupStack.push_back(popup_ref);\n\t}\n\telse\n\t{\n\t\t// Close child popups if any\n\t\tg.OpenPopupStack.resize(current_stack_size + 1);\n\n\t\t// Gently handle the user mistakenly calling OpenPopup() every frame. It is a programming mistake! However, if we were to run the regular code path, the ui\n\t\t// would become completely unusable because the popup will always be in hidden-while-calculating-size state _while_ claiming focus. Which would be a very confusing\n\t\t// situation for the programmer. Instead, we silently allow the popup to proceed, it will keep reappearing and the programming error will be more obvious to understand. \n\t\tif (g.OpenPopupStack[current_stack_size].PopupId == id && g.OpenPopupStack[current_stack_size].OpenFrameCount == g.FrameCount - 1)\n\t\t\tg.OpenPopupStack[current_stack_size].OpenFrameCount = popup_ref.OpenFrameCount;\n\t\telse\n\t\t\tg.OpenPopupStack[current_stack_size] = popup_ref;\n\n\t\t// When reopening a popup we first refocus its parent, otherwise if its parent is itself a popup it would get closed by CloseInactivePopups().\n\t\t// This is equivalent to what ClosePopupToLevel() does.\n\t\t//if (g.OpenPopupStack[current_stack_size].PopupId == id)\n\t\t//    FocusWindow(parent_window);\n\t}\n}\n\nvoid ImGui::OpenPopup(const char* str_id)\n{\n\tImGuiContext& g = *GImGui;\n\tOpenPopupEx(g.CurrentWindow->GetID(str_id));\n}\n\nstatic void CloseInactivePopups(ImGuiWindow* ref_window)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.OpenPopupStack.empty())\n\t\treturn;\n\n\t// When popups are stacked, clicking on a lower level popups puts focus back to it and close popups above it.\n\t// Don't close our own child popup windows.\n\tint n = 0;\n\tif (ref_window)\n\t{\n\t\tfor (n = 0; n < g.OpenPopupStack.Size; n++)\n\t\t{\n\t\t\tImGuiPopupRef& popup = g.OpenPopupStack[n];\n\t\t\tif (!popup.Window)\n\t\t\t\tcontinue;\n\t\t\tIM_ASSERT((popup.Window->Flags & ImGuiWindowFlags_Popup) != 0);\n\t\t\tif (popup.Window->Flags & ImGuiWindowFlags_ChildWindow)\n\t\t\t\tcontinue;\n\n\t\t\t// Trim the stack if popups are not direct descendant of the reference window (which is often the NavWindow)\n\t\t\tbool has_focus = false;\n\t\t\tfor (int m = n; m < g.OpenPopupStack.Size && !has_focus; m++)\n\t\t\t\thas_focus = (g.OpenPopupStack[m].Window && g.OpenPopupStack[m].Window->RootWindow == ref_window->RootWindow);\n\t\t\tif (!has_focus)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tif (n < g.OpenPopupStack.Size) // This test is not required but it allows to set a convenient breakpoint on the block below\n\t\tClosePopupToLevel(n);\n}\n\nstatic ImGuiWindow* GetFrontMostModalRootWindow()\n{\n\tImGuiContext& g = *GImGui;\n\tfor (int n = g.OpenPopupStack.Size - 1; n >= 0; n--)\n\t\tif (ImGuiWindow* popup = g.OpenPopupStack.Data[n].Window)\n\t\t\tif (popup->Flags & ImGuiWindowFlags_Modal)\n\t\t\t\treturn popup;\n\treturn NULL;\n}\n\nstatic void ClosePopupToLevel(int remaining)\n{\n\tImGuiContext& g = *GImGui;\n\tif (remaining > 0)\n\t\tImGui::FocusWindow(g.OpenPopupStack[remaining - 1].Window);\n\telse\n\t\tImGui::FocusWindow(g.OpenPopupStack[0].ParentWindow);\n\tg.OpenPopupStack.resize(remaining);\n}\n\nvoid ImGui::ClosePopup(ImGuiID id)\n{\n\tif (!IsPopupOpen(id))\n\t\treturn;\n\tImGuiContext& g = *GImGui;\n\tClosePopupToLevel(g.OpenPopupStack.Size - 1);\n}\n\n// Close the popup we have begin-ed into.\nvoid ImGui::CloseCurrentPopup()\n{\n\tImGuiContext& g = *GImGui;\n\tint popup_idx = g.CurrentPopupStack.Size - 1;\n\tif (popup_idx < 0 || popup_idx >= g.OpenPopupStack.Size || g.CurrentPopupStack[popup_idx].PopupId != g.OpenPopupStack[popup_idx].PopupId)\n\t\treturn;\n\twhile (popup_idx > 0 && g.OpenPopupStack[popup_idx].Window && (g.OpenPopupStack[popup_idx].Window->Flags & ImGuiWindowFlags_ChildMenu))\n\t\tpopup_idx--;\n\tClosePopupToLevel(popup_idx);\n}\n\nbool ImGui::BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags)\n{\n\tImGuiContext& g = *GImGui;\n\tif (!IsPopupOpen(id))\n\t{\n\t\tg.NextWindowData.Clear(); // We behave like Begin() and need to consume those values\n\t\treturn false;\n\t}\n\n\tchar name[20];\n\tif (extra_flags & ImGuiWindowFlags_ChildMenu)\n\t\tImFormatString(name, IM_ARRAYSIZE(name), \"##Menu_%02d\", g.CurrentPopupStack.Size);    // Recycle windows based on depth\n\telse\n\t\tImFormatString(name, IM_ARRAYSIZE(name), \"##Popup_%08x\", id); // Not recycling, so we can close/open during the same frame\n\n\tbool is_open = Begin(name, NULL, extra_flags | ImGuiWindowFlags_Popup);\n\tif (!is_open) // NB: Begin can return false when the popup is completely clipped (e.g. zero size display)\n\t\tEndPopup();\n\n\treturn is_open;\n}\n\nbool ImGui::BeginPopup(const char* str_id, ImGuiWindowFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.OpenPopupStack.Size <= g.CurrentPopupStack.Size) // Early out for performance\n\t{\n\t\tg.NextWindowData.Clear(); // We behave like Begin() and need to consume those values\n\t\treturn false;\n\t}\n\treturn BeginPopupEx(g.CurrentWindow->GetID(str_id), flags | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\nbool ImGui::IsPopupOpen(ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.OpenPopupStack.Size > g.CurrentPopupStack.Size&& g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == id;\n}\n\nbool ImGui::IsPopupOpen(const char* str_id)\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.OpenPopupStack.Size > g.CurrentPopupStack.Size&& g.OpenPopupStack[g.CurrentPopupStack.Size].PopupId == g.CurrentWindow->GetID(str_id);\n}\n\nbool ImGui::BeginPopupModal(const char* name, bool* p_open, ImGuiWindowFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tconst ImGuiID id = window->GetID(name);\n\tif (!IsPopupOpen(id))\n\t{\n\t\tg.NextWindowData.Clear(); // We behave like Begin() and need to consume those values\n\t\treturn false;\n\t}\n\n\t// Center modal windows by default\n\tif (g.NextWindowData.PosCond == 0)\n\t\tSetNextWindowPos(g.IO.DisplaySize * 0.5f, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));\n\n\tbool is_open = Begin(name, p_open, flags | ImGuiWindowFlags_Popup | ImGuiWindowFlags_Modal | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings);\n\tif (!is_open || (p_open && !*p_open)) // NB: is_open can be 'false' when the popup is completely clipped (e.g. zero size display)\n\t{\n\t\tEndPopup();\n\t\tif (is_open)\n\t\t\tClosePopup(id);\n\t\treturn false;\n\t}\n\n\treturn is_open;\n}\n\nvoid ImGui::EndPopup()\n{\n\tImGuiContext& g = *GImGui; (void)g;\n\tIM_ASSERT(g.CurrentWindow->Flags & ImGuiWindowFlags_Popup);  // Mismatched BeginPopup()/EndPopup() calls\n\tIM_ASSERT(g.CurrentPopupStack.Size > 0);\n\tEnd();\n}\n\nbool ImGui::OpenPopupOnItemClick(const char* str_id, int mouse_button)\n{\n\tImGuiWindow* window = GImGui->CurrentWindow;\n\tif (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n\t{\n\t\tImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!\n\t\tIM_ASSERT(id != 0);                                                  // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)\n\t\tOpenPopupEx(id);\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// This is a helper to handle the simplest case of associating one named popup to one given widget.\n// You may want to handle this on user side if you have specific needs (e.g. tweaking IsItemHovered() parameters).\n// You can pass a NULL str_id to use the identifier of the last item.\nbool ImGui::BeginPopupContextItem(const char* str_id, int mouse_button)\n{\n\tImGuiWindow* window = GImGui->CurrentWindow;\n\tImGuiID id = str_id ? window->GetID(str_id) : window->DC.LastItemId; // If user hasn't passed an ID, we can use the LastItemID. Using LastItemID as a Popup ID won't conflict!\n\tIM_ASSERT(id != 0);                                                  // However, you cannot pass a NULL str_id if the last item has no identifier (e.g. a Text() item)\n\tif (IsMouseReleased(mouse_button) && IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n\t\tOpenPopupEx(id);\n\treturn BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\nbool ImGui::BeginPopupContextWindow(const char* str_id, int mouse_button, bool also_over_items)\n{\n\tif (!str_id)\n\t\tstr_id = \"window_context\";\n\tImGuiID id = GImGui->CurrentWindow->GetID(str_id);\n\tif (IsMouseReleased(mouse_button) && IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup))\n\t\tif (also_over_items || !IsAnyItemHovered())\n\t\t\tOpenPopupEx(id);\n\treturn BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\nbool ImGui::BeginPopupContextVoid(const char* str_id, int mouse_button)\n{\n\tif (!str_id)\n\t\tstr_id = \"void_context\";\n\tImGuiID id = GImGui->CurrentWindow->GetID(str_id);\n\tif (IsMouseReleased(mouse_button) && !IsWindowHovered(ImGuiHoveredFlags_AnyWindow))\n\t\tOpenPopupEx(id);\n\treturn BeginPopupEx(id, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings);\n}\n\nstatic bool BeginChildEx(const char* name, ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* parent_window = ImGui::GetCurrentWindow();\n\tImGuiWindowFlags flags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_ChildWindow;\n\tflags |= (parent_window->Flags & ImGuiWindowFlags_NoMove);  // Inherit the NoMove flag\n\n\tconst ImVec2 content_avail = ImGui::GetContentRegionAvail();\n\tImVec2 size = ImFloor(size_arg);\n\tconst int auto_fit_axises = ((size.x == 0.0f) ? (1 << ImGuiAxis_X) : 0x00) | ((size.y == 0.0f) ? (1 << ImGuiAxis_Y) : 0x00);\n\tif (size.x <= 0.0f)\n\t\tsize.x = ImMax(content_avail.x + size.x, 4.0f); // Arbitrary minimum child size (0.0f causing too much issues)\n\tif (size.y <= 0.0f)\n\t\tsize.y = ImMax(content_avail.y + size.y, 4.0f);\n\n\tconst float backup_border_size = g.Style.ChildBorderSize;\n\tif (!border)\n\t\tg.Style.ChildBorderSize = 0.0f;\n\tflags |= extra_flags;\n\n\tchar title[256];\n\tif (name)\n\t\tImFormatString(title, IM_ARRAYSIZE(title), \"%s/%s_%08X\", parent_window->Name, name, id);\n\telse\n\t\tImFormatString(title, IM_ARRAYSIZE(title), \"%s/%08X\", parent_window->Name, id);\n\n\tImGui::SetNextWindowSize(size);\n\tbool ret = ImGui::Begin(title, NULL, flags);\n\tImGuiWindow* child_window = ImGui::GetCurrentWindow();\n\tchild_window->AutoFitChildAxises = auto_fit_axises;\n\tg.Style.ChildBorderSize = backup_border_size;\n\n\treturn ret;\n}\n\nbool ImGui::BeginChild(const char* str_id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\treturn BeginChildEx(str_id, window->GetID(str_id), size_arg, border, extra_flags);\n}\n\nbool ImGui::BeginChild(ImGuiID id, const ImVec2& size_arg, bool border, ImGuiWindowFlags extra_flags)\n{\n\treturn BeginChildEx(NULL, id, size_arg, border, extra_flags);\n}\n\nvoid ImGui::EndChild()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\n\tIM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow);   // Mismatched BeginChild()/EndChild() callss\n\tif (window->BeginCount > 1)\n\t{\n\t\tEnd();\n\t}\n\telse\n\t{\n\t\t// When using auto-filling child window, we don't provide full width/height to ItemSize so that it doesn't feed back into automatic size-fitting.\n\t\tImVec2 sz = GetWindowSize();\n\t\tif (window->AutoFitChildAxises & (1 << ImGuiAxis_X)) // Arbitrary minimum zero-ish child size of 4.0f causes less trouble than a 0.0f\n\t\t\tsz.x = ImMax(4.0f, sz.x);\n\t\tif (window->AutoFitChildAxises & (1 << ImGuiAxis_Y))\n\t\t\tsz.y = ImMax(4.0f, sz.y);\n\t\tEnd();\n\n\t\tImGuiWindow* parent_window = GetCurrentWindow();\n\t\tImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz);\n\t\tItemSize(sz);\n\t\tItemAdd(bb, 0);\n\t}\n}\n\n// Helper to create a child window / scrolling region that looks like a normal widget frame.\nbool ImGui::BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags extra_flags)\n{\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tPushStyleColor(ImGuiCol_ChildBg, style.Colors[ImGuiCol_FrameBg]);\n\tPushStyleVar(ImGuiStyleVar_ChildRounding, style.FrameRounding);\n\tPushStyleVar(ImGuiStyleVar_ChildBorderSize, style.FrameBorderSize);\n\tPushStyleVar(ImGuiStyleVar_WindowPadding, style.FramePadding);\n\treturn BeginChild(id, size, true, ImGuiWindowFlags_NoMove | ImGuiWindowFlags_AlwaysUseWindowPadding | extra_flags);\n}\n\nvoid ImGui::EndChildFrame()\n{\n\tEndChild();\n\tPopStyleVar(3);\n\tPopStyleColor();\n}\n\n// Save and compare stack sizes on Begin()/End() to detect usage errors\nstatic void CheckStacksSize(ImGuiWindow* window, bool write)\n{\n\t// NOT checking: DC.ItemWidth, DC.AllowKeyboardFocus, DC.ButtonRepeat, DC.TextWrapPos (per window) to allow user to conveniently push once and not pop (they are cleared on Begin)\n\tImGuiContext& g = *GImGui;\n\tint* p_backup = &window->DC.StackSizesBackup[0];\n\t{ int current = window->IDStack.Size;       if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && \"PushID/PopID or TreeNode/TreePop Mismatch!\");   p_backup++; }    // Too few or too many PopID()/TreePop()\n\t{ int current = window->DC.GroupStack.Size; if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && \"BeginGroup/EndGroup Mismatch!\");                p_backup++; }    // Too few or too many EndGroup()\n\t{ int current = g.CurrentPopupStack.Size;   if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && \"BeginMenu/EndMenu or BeginPopup/EndPopup Mismatch\"); p_backup++; }// Too few or too many EndMenu()/EndPopup()\n\t{ int current = g.ColorModifiers.Size;      if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && \"PushStyleColor/PopStyleColor Mismatch!\");       p_backup++; }    // Too few or too many PopStyleColor()\n\t{ int current = g.StyleModifiers.Size;      if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && \"PushStyleVar/PopStyleVar Mismatch!\");           p_backup++; }    // Too few or too many PopStyleVar()\n\t{ int current = g.FontStack.Size;           if (write) *p_backup = current; else IM_ASSERT(*p_backup == current && \"PushFont/PopFont Mismatch!\");                   p_backup++; }    // Too few or too many PopFont()\n\tIM_ASSERT(p_backup == window->DC.StackSizesBackup + IM_ARRAYSIZE(window->DC.StackSizesBackup));\n}\n\nenum ImGuiPopupPositionPolicy\n{\n\tImGuiPopupPositionPolicy_Default,\n\tImGuiPopupPositionPolicy_ComboBox\n};\n\nstatic ImVec2 FindBestWindowPosForPopup(const ImVec2& ref_pos, const ImVec2& size, ImGuiDir* last_dir, const ImRect& r_avoid, ImGuiPopupPositionPolicy policy = ImGuiPopupPositionPolicy_Default)\n{\n\tconst ImGuiStyle& style = GImGui->Style;\n\n\t// r_avoid = the rectangle to avoid (e.g. for tooltip it is a rectangle around the mouse cursor which we want to avoid. for popups it's a small point around the cursor.)\n\t// r_outer = the visible area rectangle, minus safe area padding. If our popup size won't fit because of safe area padding we ignore it.\n\tImVec2 safe_padding = style.DisplaySafeAreaPadding;\n\tImRect r_outer(GetVisibleRect());\n\tr_outer.Expand(ImVec2((size.x - r_outer.GetWidth() > safe_padding.x * 2) ? -safe_padding.x : 0.0f, (size.y - r_outer.GetHeight() > safe_padding.y * 2) ? -safe_padding.y : 0.0f));\n\tImVec2 base_pos_clamped = ImClamp(ref_pos, r_outer.Min, r_outer.Max - size);\n\t//GImGui->OverlayDrawList.AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255));\n\t//GImGui->OverlayDrawList.AddRect(r_outer.Min, r_outer.Max, IM_COL32(0,255,0,255));\n\n\t// Combo Box policy (we want a connecting edge)\n\tif (policy == ImGuiPopupPositionPolicy_ComboBox)\n\t{\n\t\tconst ImGuiDir dir_prefered_order[ImGuiDir_Count_] = { ImGuiDir_Down, ImGuiDir_Right, ImGuiDir_Left, ImGuiDir_Up };\n\t\tfor (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_Count_; n++)\n\t\t{\n\t\t\tconst ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n];\n\t\t\tif (n != -1 && dir == *last_dir) // Already tried this direction?\n\t\t\t\tcontinue;\n\t\t\tImVec2 pos;\n\t\t\tif (dir == ImGuiDir_Down)  pos = ImVec2(r_avoid.Min.x, r_avoid.Max.y);          // Below, Toward Right (default)\n\t\t\tif (dir == ImGuiDir_Right) pos = ImVec2(r_avoid.Min.x, r_avoid.Min.y - size.y); // Above, Toward Right\n\t\t\tif (dir == ImGuiDir_Left)  pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Max.y); // Below, Toward Left\n\t\t\tif (dir == ImGuiDir_Up)    pos = ImVec2(r_avoid.Max.x - size.x, r_avoid.Min.y - size.y); // Above, Toward Left\n\t\t\tif (!r_outer.Contains(ImRect(pos, pos + size)))\n\t\t\t\tcontinue;\n\t\t\t*last_dir = dir;\n\t\t\treturn pos;\n\t\t}\n\t}\n\n\t// Default popup policy\n\tconst ImGuiDir dir_prefered_order[ImGuiDir_Count_] = { ImGuiDir_Right, ImGuiDir_Down, ImGuiDir_Up, ImGuiDir_Left };\n\tfor (int n = (*last_dir != ImGuiDir_None) ? -1 : 0; n < ImGuiDir_Count_; n++)\n\t{\n\t\tconst ImGuiDir dir = (n == -1) ? *last_dir : dir_prefered_order[n];\n\t\tif (n != -1 && dir == *last_dir) // Already tried this direction?\n\t\t\tcontinue;\n\t\tfloat avail_w = (dir == ImGuiDir_Left ? r_avoid.Min.x : r_outer.Max.x) - (dir == ImGuiDir_Right ? r_avoid.Max.x : r_outer.Min.x);\n\t\tfloat avail_h = (dir == ImGuiDir_Up ? r_avoid.Min.y : r_outer.Max.y) - (dir == ImGuiDir_Down ? r_avoid.Max.y : r_outer.Min.y);\n\t\tif (avail_w < size.x || avail_h < size.y)\n\t\t\tcontinue;\n\t\tImVec2 pos;\n\t\tpos.x = (dir == ImGuiDir_Left) ? r_avoid.Min.x - size.x : (dir == ImGuiDir_Right) ? r_avoid.Max.x : base_pos_clamped.x;\n\t\tpos.y = (dir == ImGuiDir_Up) ? r_avoid.Min.y - size.y : (dir == ImGuiDir_Down) ? r_avoid.Max.y : base_pos_clamped.y;\n\t\t*last_dir = dir;\n\t\treturn pos;\n\t}\n\n\t// Fallback, try to keep within display\n\t*last_dir = ImGuiDir_None;\n\tImVec2 pos = ref_pos;\n\tpos.x = ImMax(ImMin(pos.x + size.x, r_outer.Max.x) - size.x, r_outer.Min.x);\n\tpos.y = ImMax(ImMin(pos.y + size.y, r_outer.Max.y) - size.y, r_outer.Min.y);\n\treturn pos;\n}\n\nstatic void SetWindowConditionAllowFlags(ImGuiWindow* window, ImGuiCond flags, bool enabled)\n{\n\twindow->SetWindowPosAllowFlags = enabled ? (window->SetWindowPosAllowFlags | flags) : (window->SetWindowPosAllowFlags & ~flags);\n\twindow->SetWindowSizeAllowFlags = enabled ? (window->SetWindowSizeAllowFlags | flags) : (window->SetWindowSizeAllowFlags & ~flags);\n\twindow->SetWindowCollapsedAllowFlags = enabled ? (window->SetWindowCollapsedAllowFlags | flags) : (window->SetWindowCollapsedAllowFlags & ~flags);\n}\n\nImGuiWindow* ImGui::FindWindowByName(const char* name)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiID id = ImHash(name, 0);\n\treturn (ImGuiWindow*)g.WindowsById.GetVoidPtr(id);\n}\n\nstatic ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\n\t// Create window the first time\n\tImGuiWindow* window = IM_NEW(ImGuiWindow)(&g, name);\n\twindow->Flags = flags;\n\tg.WindowsById.SetVoidPtr(window->ID, window);\n\n\t// User can disable loading and saving of settings. Tooltip and child windows also don't store settings.\n\tif (!(flags & ImGuiWindowFlags_NoSavedSettings))\n\t{\n\t\t// Retrieve settings from .ini file\n\t\t// Use SetWindowPos() or SetNextWindowPos() with the appropriate condition flag to change the initial position of a window.\n\t\twindow->Pos = window->PosFloat = ImVec2(60, 60);\n\n\t\tif (ImGuiWindowSettings* settings = ImGui::FindWindowSettings(window->ID))\n\t\t{\n\t\t\tSetWindowConditionAllowFlags(window, ImGuiCond_FirstUseEver, false);\n\t\t\twindow->PosFloat = settings->Pos;\n\t\t\twindow->Pos = ImFloor(window->PosFloat);\n\t\t\twindow->Collapsed = settings->Collapsed;\n\t\t\tif (ImLengthSqr(settings->Size) > 0.00001f)\n\t\t\t\tsize = settings->Size;\n\t\t}\n\t}\n\twindow->Size = window->SizeFull = window->SizeFullAtLastBegin = size;\n\n\tif ((flags & ImGuiWindowFlags_AlwaysAutoResize) != 0)\n\t{\n\t\twindow->AutoFitFramesX = window->AutoFitFramesY = 2;\n\t\twindow->AutoFitOnlyGrows = false;\n\t}\n\telse\n\t{\n\t\tif (window->Size.x <= 0.0f)\n\t\t\twindow->AutoFitFramesX = 2;\n\t\tif (window->Size.y <= 0.0f)\n\t\t\twindow->AutoFitFramesY = 2;\n\t\twindow->AutoFitOnlyGrows = (window->AutoFitFramesX > 0) || (window->AutoFitFramesY > 0);\n\t}\n\n\tif (flags & ImGuiWindowFlags_NoBringToFrontOnFocus)\n\t\tg.Windows.insert(g.Windows.begin(), window); // Quite slow but rare and only once\n\telse\n\t\tg.Windows.push_back(window);\n\treturn window;\n}\n\nstatic ImVec2 CalcSizeAfterConstraint(ImGuiWindow* window, ImVec2 new_size)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.NextWindowData.SizeConstraintCond != 0)\n\t{\n\t\t// Using -1,-1 on either X/Y axis to preserve the current size.\n\t\tImRect cr = g.NextWindowData.SizeConstraintRect;\n\t\tnew_size.x = (cr.Min.x >= 0 && cr.Max.x >= 0) ? ImClamp(new_size.x, cr.Min.x, cr.Max.x) : window->SizeFull.x;\n\t\tnew_size.y = (cr.Min.y >= 0 && cr.Max.y >= 0) ? ImClamp(new_size.y, cr.Min.y, cr.Max.y) : window->SizeFull.y;\n\t\tif (g.NextWindowData.SizeCallback)\n\t\t{\n\t\t\tImGuiSizeCallbackData data;\n\t\t\tdata.UserData = g.NextWindowData.SizeCallbackUserData;\n\t\t\tdata.Pos = window->Pos;\n\t\t\tdata.CurrentSize = window->SizeFull;\n\t\t\tdata.DesiredSize = new_size;\n\t\t\tg.NextWindowData.SizeCallback(&data);\n\t\t\tnew_size = data.DesiredSize;\n\t\t}\n\t}\n\n\t// Minimum size\n\tif (!(window->Flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_AlwaysAutoResize)))\n\t{\n\t\tnew_size = ImMax(new_size, g.Style.WindowMinSize);\n\t\tnew_size.y = ImMax(new_size.y, window->TitleBarHeight() + window->MenuBarHeight() + ImMax(0.0f, g.Style.WindowRounding - 1.0f)); // Reduce artifacts with very small windows\n\t}\n\treturn new_size;\n}\n\nstatic ImVec2 CalcSizeContents(ImGuiWindow* window)\n{\n\tImVec2 sz;\n\tsz.x = (float)(int)((window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : (window->DC.CursorMaxPos.x - window->Pos.x + window->Scroll.x));\n\tsz.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : (window->DC.CursorMaxPos.y - window->Pos.y + window->Scroll.y));\n\treturn sz + window->WindowPadding;\n}\n\nstatic ImVec2 CalcSizeAutoFit(ImGuiWindow* window, const ImVec2& size_contents)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiStyle& style = g.Style;\n\tImGuiWindowFlags flags = window->Flags;\n\tImVec2 size_auto_fit;\n\tif ((flags & ImGuiWindowFlags_Tooltip) != 0)\n\t{\n\t\t// Tooltip always resize. We keep the spacing symmetric on both axises for aesthetic purpose.\n\t\tsize_auto_fit = size_contents;\n\t}\n\telse\n\t{\n\t\t// When the window cannot fit all contents (either because of constraints, either because screen is too small): we are growing the size on the other axis to compensate for expected scrollbar. FIXME: Might turn bigger than DisplaySize-WindowPadding.\n\t\tsize_auto_fit = ImClamp(size_contents, style.WindowMinSize, ImMax(style.WindowMinSize, g.IO.DisplaySize - g.Style.DisplaySafeAreaPadding));\n\t\tImVec2 size_auto_fit_after_constraint = CalcSizeAfterConstraint(window, size_auto_fit);\n\t\tif (size_auto_fit_after_constraint.x < size_contents.x && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar))\n\t\t\tsize_auto_fit.y += style.ScrollbarSize;\n\t\tif (size_auto_fit_after_constraint.y < size_contents.y && !(flags & ImGuiWindowFlags_NoScrollbar))\n\t\t\tsize_auto_fit.x += style.ScrollbarSize;\n\t}\n\treturn size_auto_fit;\n}\n\nstatic float GetScrollMaxX(ImGuiWindow* window)\n{\n\treturn ImMax(0.0f, window->SizeContents.x - (window->SizeFull.x - window->ScrollbarSizes.x));\n}\n\nstatic float GetScrollMaxY(ImGuiWindow* window)\n{\n\treturn ImMax(0.0f, window->SizeContents.y - (window->SizeFull.y - window->ScrollbarSizes.y));\n}\n\nstatic ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window)\n{\n\tImVec2 scroll = window->Scroll;\n\tfloat cr_x = window->ScrollTargetCenterRatio.x;\n\tfloat cr_y = window->ScrollTargetCenterRatio.y;\n\tif (window->ScrollTarget.x < FLT_MAX)\n\t\tscroll.x = window->ScrollTarget.x - cr_x * (window->SizeFull.x - window->ScrollbarSizes.x);\n\tif (window->ScrollTarget.y < FLT_MAX)\n\t\tscroll.y = window->ScrollTarget.y - (1.0f - cr_y) * (window->TitleBarHeight() + window->MenuBarHeight()) - cr_y * (window->SizeFull.y - window->ScrollbarSizes.y);\n\tscroll = ImMax(scroll, ImVec2(0.0f, 0.0f));\n\tif (!window->Collapsed && !window->SkipItems)\n\t{\n\t\tscroll.x = ImMin(scroll.x, GetScrollMaxX(window));\n\t\tscroll.y = ImMin(scroll.y, GetScrollMaxY(window));\n\t}\n\treturn scroll;\n}\n\nstatic ImGuiCol GetWindowBgColorIdxFromFlags(ImGuiWindowFlags flags)\n{\n\tif (flags & (ImGuiWindowFlags_Tooltip | ImGuiWindowFlags_Popup))\n\t\treturn ImGuiCol_PopupBg;\n\tif (flags & ImGuiWindowFlags_ChildWindow)\n\t\treturn ImGuiCol_ChildBg;\n\treturn ImGuiCol_WindowBg;\n}\n\nstatic void CalcResizePosSizeFromAnyCorner(ImGuiWindow* window, const ImVec2& corner_target, const ImVec2& corner_norm, ImVec2* out_pos, ImVec2* out_size)\n{\n\tImVec2 pos_min = ImLerp(corner_target, window->Pos, corner_norm);                // Expected window upper-left\n\tImVec2 pos_max = ImLerp(window->Pos + window->Size, corner_target, corner_norm); // Expected window lower-right\n\tImVec2 size_expected = pos_max - pos_min;\n\tImVec2 size_constrained = CalcSizeAfterConstraint(window, size_expected);\n\t*out_pos = pos_min;\n\tif (corner_norm.x == 0.0f)\n\t\tout_pos->x -= (size_constrained.x - size_expected.x);\n\tif (corner_norm.y == 0.0f)\n\t\tout_pos->y -= (size_constrained.y - size_expected.y);\n\t*out_size = size_constrained;\n}\n\nstruct ImGuiResizeGripDef\n{\n\tImVec2           CornerPos;\n\tImVec2           InnerDir;\n\tint              AngleMin12, AngleMax12;\n};\n\nconst ImGuiResizeGripDef resize_grip_def[4] =\n{\n\t{ ImVec2(1,1), ImVec2(-1,-1), 0, 3 }, // Lower right\n\t{ ImVec2(0,1), ImVec2(+1,-1), 3, 6 }, // Lower left\n\t{ ImVec2(0,0), ImVec2(+1,+1), 6, 9 }, // Upper left\n\t{ ImVec2(1,0), ImVec2(-1,+1), 9,12 }, // Upper right\n};\n\nstatic ImRect GetBorderRect(ImGuiWindow* window, int border_n, float perp_padding, float thickness)\n{\n\tImRect rect = window->Rect();\n\tif (thickness == 0.0f) rect.Max -= ImVec2(1, 1);\n\tif (border_n == 0) return ImRect(rect.Min.x + perp_padding, rect.Min.y, rect.Max.x - perp_padding, rect.Min.y + thickness);\n\tif (border_n == 1) return ImRect(rect.Max.x - thickness, rect.Min.y + perp_padding, rect.Max.x, rect.Max.y - perp_padding);\n\tif (border_n == 2) return ImRect(rect.Min.x + perp_padding, rect.Max.y - thickness, rect.Max.x - perp_padding, rect.Max.y);\n\tif (border_n == 3) return ImRect(rect.Min.x, rect.Min.y + perp_padding, rect.Min.x + thickness, rect.Max.y - perp_padding);\n\tIM_ASSERT(0);\n\treturn ImRect();\n}\n\n// Handle resize for: Resize Grips, Borders, Gamepad\nstatic void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4])\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindowFlags flags = window->Flags;\n\tif ((flags & ImGuiWindowFlags_NoResize) || (flags & ImGuiWindowFlags_AlwaysAutoResize) || window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)\n\t\treturn;\n\n\tconst int resize_border_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 4 : 0;\n\tconst float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);\n\tconst float grip_hover_size = (float)(int)(grip_draw_size * 0.75f);\n\n\tImVec2 pos_target(FLT_MAX, FLT_MAX);\n\tImVec2 size_target(FLT_MAX, FLT_MAX);\n\n\t// Manual resize grips\n\tPushID(\"#RESIZE\");\n\tfor (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)\n\t{\n\t\tconst ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];\n\t\tconst ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPos);\n\n\t\t// Using the FlattenChilds button flag we make the resize button accessible even if we are hovering over a child window\n\t\tImRect resize_rect(corner, corner + grip.InnerDir * grip_hover_size);\n\t\tresize_rect.FixInverted();\n\t\tbool hovered, held;\n\t\tButtonBehavior(resize_rect, window->GetID((void*)(intptr_t)resize_grip_n), &hovered, &held, ImGuiButtonFlags_FlattenChildren);\n\t\tif (hovered || held)\n\t\t\tg.MouseCursor = (resize_grip_n & 1) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE;\n\n\t\tif (g.HoveredWindow == window && held && g.IO.MouseDoubleClicked[0] && resize_grip_n == 0)\n\t\t{\n\t\t\t// Manual auto-fit when double-clicking\n\t\t\tsize_target = CalcSizeAfterConstraint(window, size_auto_fit);\n\t\t\tClearActiveID();\n\t\t}\n\t\telse if (held)\n\t\t{\n\t\t\t// Resize from any of the four corners\n\t\t\t// We don't use an incremental MouseDelta but rather compute an absolute target size based on mouse position\n\t\t\tImVec2 corner_target = g.IO.MousePos - g.ActiveIdClickOffset + resize_rect.GetSize() * grip.CornerPos; // Corner of the window corresponding to our corner grip\n\t\t\tCalcResizePosSizeFromAnyCorner(window, corner_target, grip.CornerPos, &pos_target, &size_target);\n\t\t}\n\t\tif (resize_grip_n == 0 || held || hovered)\n\t\t\tresize_grip_col[resize_grip_n] = GetColorU32(held ? ImGuiCol_ResizeGripActive : hovered ? ImGuiCol_ResizeGripHovered : ImGuiCol_ResizeGrip);\n\t}\n\tfor (int border_n = 0; border_n < resize_border_count; border_n++)\n\t{\n\t\tconst float BORDER_SIZE = 5.0f;          // FIXME: Only works _inside_ window because of HoveredWindow check.\n\t\tconst float BORDER_APPEAR_TIMER = 0.05f; // Reduce visual noise\n\t\tbool hovered, held;\n\t\tImRect border_rect = GetBorderRect(window, border_n, grip_hover_size, BORDER_SIZE);\n\t\tButtonBehavior(border_rect, window->GetID((void*)(intptr_t)(border_n + 4)), &hovered, &held, ImGuiButtonFlags_FlattenChildren);\n\t\tif ((hovered && g.HoveredIdTimer > BORDER_APPEAR_TIMER) || held)\n\t\t{\n\t\t\tg.MouseCursor = (border_n & 1) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS;\n\t\t\tif (held) *border_held = border_n;\n\t\t}\n\t\tif (held)\n\t\t{\n\t\t\tImVec2 border_target = window->Pos;\n\t\t\tImVec2 border_posn;\n\t\t\tif (border_n == 0) { border_posn = ImVec2(0, 0); border_target.y = (g.IO.MousePos.y - g.ActiveIdClickOffset.y); }\n\t\t\tif (border_n == 1) { border_posn = ImVec2(1, 0); border_target.x = (g.IO.MousePos.x - g.ActiveIdClickOffset.x + BORDER_SIZE); }\n\t\t\tif (border_n == 2) { border_posn = ImVec2(0, 1); border_target.y = (g.IO.MousePos.y - g.ActiveIdClickOffset.y + BORDER_SIZE); }\n\t\t\tif (border_n == 3) { border_posn = ImVec2(0, 0); border_target.x = (g.IO.MousePos.x - g.ActiveIdClickOffset.x); }\n\t\t\tCalcResizePosSizeFromAnyCorner(window, border_target, border_posn, &pos_target, &size_target);\n\t\t}\n\t}\n\tPopID();\n\n\t// Apply back modified position/size to window\n\tif (size_target.x != FLT_MAX)\n\t{\n\t\twindow->SizeFull = size_target;\n\t\tMarkIniSettingsDirty(window);\n\t}\n\tif (pos_target.x != FLT_MAX)\n\t{\n\t\twindow->Pos = window->PosFloat = ImFloor(pos_target);\n\t\tMarkIniSettingsDirty(window);\n\t}\n\n\twindow->Size = window->SizeFull;\n}\n\n// Push a new ImGui window to add widgets to.\n// - A default window called \"Debug\" is automatically stacked at the beginning of every frame so you can use widgets without explicitly calling a Begin/End pair.\n// - Begin/End can be called multiple times during the frame with the same window name to append content.\n// - The window name is used as a unique identifier to preserve window information across frames (and save rudimentary information to the .ini file).\n//   You can use the \"##\" or \"###\" markers to use the same label with different id, or same id with different label. See documentation at the top of this file.\n// - Return false when window is collapsed, so you can early out in your code. You always need to call ImGui::End() even if false is returned.\n// - Passing 'bool* p_open' displays a Close button on the upper-right corner of the window, the pointed value will be set to false when the button is pressed.\nbool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tIM_ASSERT(name != NULL);                        // Window name required\n\tIM_ASSERT(g.Initialized);                       // Forgot to call ImGui::NewFrame()\n\tIM_ASSERT(g.FrameCountEnded != g.FrameCount);   // Called ImGui::Render() or ImGui::EndFrame() and haven't called ImGui::NewFrame() again yet\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Find or create\n\tImGuiWindow* window = FindWindowByName(name);\n\tif (!window)\n\t{\n\t\tImVec2 size_on_first_use = (g.NextWindowData.SizeCond != 0) ? g.NextWindowData.SizeVal : ImVec2(0.0f, 0.0f); // Any condition flag will do since we are creating a new window here.\n\t\twindow = CreateNewWindow(name, size_on_first_use, flags);\n\t}\n\n\t// Automatically disable manual moving/resizing when NoInputs is set\n\tif (flags & ImGuiWindowFlags_NoInputs)\n\t\tflags |= ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize;\n\t//if (flags & ImGuiWindowFlags_NavFlattened)\n\t//    IM_ASSERT(flags & ImGuiWindowFlags_ChildWindow);\n\n\tconst int current_frame = g.FrameCount;\n\tconst bool first_begin_of_the_frame = (window->LastFrameActive != current_frame);\n\tif (first_begin_of_the_frame)\n\t\twindow->Flags = (ImGuiWindowFlags)flags;\n\telse\n\t\tflags = window->Flags;\n\n\t// Update the Appearing flag\n\tbool window_just_activated_by_user = (window->LastFrameActive < current_frame - 1);   // Not using !WasActive because the implicit \"Debug\" window would always toggle off->on\n\tconst bool window_just_appearing_after_hidden_for_resize = (window->HiddenFrames == 1);\n\tif (flags & ImGuiWindowFlags_Popup)\n\t{\n\t\tImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size];\n\t\twindow_just_activated_by_user |= (window->PopupId != popup_ref.PopupId); // We recycle popups so treat window as activated if popup id changed\n\t\twindow_just_activated_by_user |= (window != popup_ref.Window);\n\t}\n\twindow->Appearing = (window_just_activated_by_user || window_just_appearing_after_hidden_for_resize);\n\twindow->CloseButton = (p_open != NULL);\n\tif (window->Appearing)\n\t\tSetWindowConditionAllowFlags(window, ImGuiCond_Appearing, true);\n\n\t// Parent window is latched only on the first call to Begin() of the frame, so further append-calls can be done from a different window stack\n\tImGuiWindow* parent_window_in_stack = g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back();\n\tImGuiWindow* parent_window = first_begin_of_the_frame ? ((flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)) ? parent_window_in_stack : NULL) : window->ParentWindow;\n\tIM_ASSERT(parent_window != NULL || !(flags & ImGuiWindowFlags_ChildWindow));\n\n\t// Add to stack\n\tg.CurrentWindowStack.push_back(window);\n\tSetCurrentWindow(window);\n\tCheckStacksSize(window, true);\n\tif (flags & ImGuiWindowFlags_Popup)\n\t{\n\t\tImGuiPopupRef& popup_ref = g.OpenPopupStack[g.CurrentPopupStack.Size];\n\t\tpopup_ref.Window = window;\n\t\tg.CurrentPopupStack.push_back(popup_ref);\n\t\twindow->PopupId = popup_ref.PopupId;\n\t}\n\n\t// Process SetNextWindow***() calls\n\tbool window_pos_set_by_api = false;\n\tbool window_size_x_set_by_api = false, window_size_y_set_by_api = false;\n\tif (g.NextWindowData.PosCond)\n\t{\n\t\twindow_pos_set_by_api = (window->SetWindowPosAllowFlags & g.NextWindowData.PosCond) != 0;\n\t\tif (window_pos_set_by_api && ImLengthSqr(g.NextWindowData.PosPivotVal) > 0.00001f)\n\t\t{\n\t\t\t// May be processed on the next frame if this is our first frame and we are measuring size\n\t\t\t// FIXME: Look into removing the branch so everything can go through this same code path for consistency.\n\t\t\twindow->SetWindowPosVal = g.NextWindowData.PosVal;\n\t\t\twindow->SetWindowPosPivot = g.NextWindowData.PosPivotVal;\n\t\t\twindow->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSetWindowPos(window, g.NextWindowData.PosVal, g.NextWindowData.PosCond);\n\t\t}\n\t\tg.NextWindowData.PosCond = 0;\n\t}\n\tif (g.NextWindowData.SizeCond)\n\t{\n\t\twindow_size_x_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.x > 0.0f);\n\t\twindow_size_y_set_by_api = (window->SetWindowSizeAllowFlags & g.NextWindowData.SizeCond) != 0 && (g.NextWindowData.SizeVal.y > 0.0f);\n\t\tSetWindowSize(window, g.NextWindowData.SizeVal, g.NextWindowData.SizeCond);\n\t\tg.NextWindowData.SizeCond = 0;\n\t}\n\tif (g.NextWindowData.ContentSizeCond)\n\t{\n\t\t// Adjust passed \"client size\" to become a \"window size\"\n\t\twindow->SizeContentsExplicit = g.NextWindowData.ContentSizeVal;\n\t\twindow->SizeContentsExplicit.y += window->TitleBarHeight() + window->MenuBarHeight();\n\t\tg.NextWindowData.ContentSizeCond = 0;\n\t}\n\telse if (first_begin_of_the_frame)\n\t{\n\t\twindow->SizeContentsExplicit = ImVec2(0.0f, 0.0f);\n\t}\n\tif (g.NextWindowData.CollapsedCond)\n\t{\n\t\tSetWindowCollapsed(window, g.NextWindowData.CollapsedVal, g.NextWindowData.CollapsedCond);\n\t\tg.NextWindowData.CollapsedCond = 0;\n\t}\n\tif (g.NextWindowData.FocusCond)\n\t{\n\t\tSetWindowFocus();\n\t\tg.NextWindowData.FocusCond = 0;\n\t}\n\tif (window->Appearing)\n\t\tSetWindowConditionAllowFlags(window, ImGuiCond_Appearing, false);\n\n\t// When reusing window again multiple times a frame, just append content (don't need to setup again)\n\tif (first_begin_of_the_frame)\n\t{\n\t\tconst bool is_pinned_child_tooltip = (flags & ImGuiWindowFlags_ChildWindow) && (flags & ImGuiWindowFlags_Tooltip); // FIXME-WIP: Undocumented behavior of Child+Tooltip for pinned tooltip (#1345)\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   // Initialize\n\t\twindow->ParentWindow = parent_window;\n\t\twindow->RootWindow = window->RootNonPopupWindow = window;\n\t\tif (parent_window && (flags & ImGuiWindowFlags_ChildWindow) && !is_pinned_child_tooltip)\n\t\t\twindow->RootWindow = parent_window->RootWindow;\n\t\tif (parent_window && !(flags & ImGuiWindowFlags_Modal) && (flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Popup)))\n\t\t\twindow->RootNonPopupWindow = parent_window->RootNonPopupWindow;\n\t\t//window->RootNavWindow = window;\n\t\t//while (window->RootNavWindow->Flags & ImGuiWindowFlags_NavFlattened)\n\t\t//    window->RootNavWindow = window->RootNavWindow->ParentWindow;\n\n\t\twindow->Active = true;\n\t\twindow->BeginOrderWithinParent = 0;\n\t\twindow->BeginOrderWithinContext = g.WindowsActiveCount++;\n\t\twindow->BeginCount = 0;\n\t\twindow->ClipRect = ImVec4(-FLT_MAX, -FLT_MAX, +FLT_MAX, +FLT_MAX);\n\t\twindow->LastFrameActive = current_frame;\n\t\twindow->IDStack.resize(1);\n\n\t\t// Lock window rounding, border size and rounding so that altering the border sizes for children doesn't have side-effects.\n\t\twindow->WindowRounding = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildRounding : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupRounding : style.WindowRounding;\n\t\twindow->WindowBorderSize = (flags & ImGuiWindowFlags_ChildWindow) ? style.ChildBorderSize : ((flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiWindowFlags_Modal)) ? style.PopupBorderSize : style.WindowBorderSize;\n\t\twindow->WindowPadding = style.WindowPadding;\n\t\tif ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_AlwaysUseWindowPadding | ImGuiWindowFlags_Popup)) && window->WindowBorderSize == 0.0f)\n\t\t\twindow->WindowPadding = ImVec2(0.0f, (flags & ImGuiWindowFlags_MenuBar) ? style.WindowPadding.y : 0.0f);\n\n\t\t// Collapse window by double-clicking on title bar\n\t\t// At this point we don't have a clipping rectangle setup yet, so we can use the title bar area for hit detection and drawing\n\t\tif (!(flags & ImGuiWindowFlags_NoTitleBar) && !(flags & ImGuiWindowFlags_NoCollapse))\n\t\t{\n\t\t\tImRect title_bar_rect = window->TitleBarRect();\n\t\t\tif (g.HoveredWindow == window && IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max) && g.IO.MouseDoubleClicked[0])\n\t\t\t{\n\t\t\t\twindow->Collapsed = !window->Collapsed;\n\t\t\t\tMarkIniSettingsDirty(window);\n\t\t\t\tFocusWindow(window);\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\twindow->Collapsed = false;\n\t\t}\n\n\t\t// SIZE\n\n\t\t// Update contents size from last frame for auto-fitting (unless explicitly specified)\n\t\twindow->SizeContents = CalcSizeContents(window);\n\n\t\t// Hide popup/tooltip window when re-opening while we measure size (because we recycle the windows)\n\t\tif (window->HiddenFrames > 0)\n\t\t\twindow->HiddenFrames--;\n\t\tif ((flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_Tooltip)) != 0 && window_just_activated_by_user)\n\t\t{\n\t\t\twindow->HiddenFrames = 1;\n\t\t\tif (flags & ImGuiWindowFlags_AlwaysAutoResize)\n\t\t\t{\n\t\t\t\tif (!window_size_x_set_by_api)\n\t\t\t\t\twindow->Size.x = window->SizeFull.x = 0.f;\n\t\t\t\tif (!window_size_y_set_by_api)\n\t\t\t\t\twindow->Size.y = window->SizeFull.y = 0.f;\n\t\t\t\twindow->SizeContents = ImVec2(0.f, 0.f);\n\t\t\t}\n\t\t}\n\n\t\t// Calculate auto-fit size, handle automatic resize\n\t\tconst ImVec2 size_auto_fit = CalcSizeAutoFit(window, window->SizeContents);\n\t\tImVec2 size_full_modified(FLT_MAX, FLT_MAX);\n\t\tif (flags & ImGuiWindowFlags_AlwaysAutoResize && !window->Collapsed)\n\t\t{\n\t\t\t// Using SetNextWindowSize() overrides ImGuiWindowFlags_AlwaysAutoResize, so it can be used on tooltips/popups, etc.\n\t\t\tif (!window_size_x_set_by_api)\n\t\t\t\twindow->SizeFull.x = size_full_modified.x = size_auto_fit.x;\n\t\t\tif (!window_size_y_set_by_api)\n\t\t\t\twindow->SizeFull.y = size_full_modified.y = size_auto_fit.y;\n\t\t}\n\t\telse if (window->AutoFitFramesX > 0 || window->AutoFitFramesY > 0)\n\t\t{\n\t\t\t// Auto-fit only grows during the first few frames\n\t\t\t// We still process initial auto-fit on collapsed windows to get a window width, but otherwise don't honor ImGuiWindowFlags_AlwaysAutoResize when collapsed.\n\t\t\tif (!window_size_x_set_by_api && window->AutoFitFramesX > 0)\n\t\t\t\twindow->SizeFull.x = size_full_modified.x = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.x, size_auto_fit.x) : size_auto_fit.x;\n\t\t\tif (!window_size_y_set_by_api && window->AutoFitFramesY > 0)\n\t\t\t\twindow->SizeFull.y = size_full_modified.y = window->AutoFitOnlyGrows ? ImMax(window->SizeFull.y, size_auto_fit.y) : size_auto_fit.y;\n\t\t\tif (!window->Collapsed)\n\t\t\t\tMarkIniSettingsDirty(window);\n\t\t}\n\n\t\t// Apply minimum/maximum window size constraints and final size\n\t\twindow->SizeFull = CalcSizeAfterConstraint(window, window->SizeFull);\n\t\twindow->Size = window->Collapsed && !(flags & ImGuiWindowFlags_ChildWindow) ? window->TitleBarRect().GetSize() : window->SizeFull;\n\n\t\t// SCROLLBAR STATUS\n\n\t\t// Update scrollbar status (based on the Size that was effective during last frame or the auto-resized Size). \n\t\tif (!window->Collapsed)\n\t\t{\n\t\t\t// When reading the current size we need to read it after size constraints have been applied\n\t\t\tfloat size_x_for_scrollbars = size_full_modified.x != FLT_MAX ? window->SizeFull.x : window->SizeFullAtLastBegin.x;\n\t\t\tfloat size_y_for_scrollbars = size_full_modified.y != FLT_MAX ? window->SizeFull.y : window->SizeFullAtLastBegin.y;\n\t\t\twindow->ScrollbarY = (flags & ImGuiWindowFlags_AlwaysVerticalScrollbar) || ((window->SizeContents.y > size_y_for_scrollbars) && !(flags & ImGuiWindowFlags_NoScrollbar));\n\t\t\twindow->ScrollbarX = (flags & ImGuiWindowFlags_AlwaysHorizontalScrollbar) || ((window->SizeContents.x > size_x_for_scrollbars - (window->ScrollbarY ? style.ScrollbarSize : 0.0f) - window->WindowPadding.x) && !(flags & ImGuiWindowFlags_NoScrollbar) && (flags & ImGuiWindowFlags_HorizontalScrollbar));\n\t\t\tif (window->ScrollbarX && !window->ScrollbarY)\n\t\t\t\twindow->ScrollbarY = (window->SizeContents.y > size_y_for_scrollbars + style.ScrollbarSize) && !(flags & ImGuiWindowFlags_NoScrollbar);\n\t\t\twindow->ScrollbarSizes = ImVec2(window->ScrollbarY ? style.ScrollbarSize : 0.0f, window->ScrollbarX ? style.ScrollbarSize : 0.0f);\n\t\t}\n\n\t\t// POSITION\n\n\t\t// Popup latch its initial position, will position itself when it appears next frame\n\t\tif (window_just_activated_by_user)\n\t\t{\n\t\t\twindow->AutoPosLastDirection = ImGuiDir_None;\n\t\t\tif ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api)\n\t\t\t\twindow->Pos = window->PosFloat = g.CurrentPopupStack.back().OpenPopupPos;\n\t\t}\n\n\t\t// Position child window\n\t\tif (flags & ImGuiWindowFlags_ChildWindow)\n\t\t{\n\t\t\twindow->BeginOrderWithinParent = parent_window->DC.ChildWindows.Size;\n\t\t\tparent_window->DC.ChildWindows.push_back(window);\n\t\t\tif (!(flags & ImGuiWindowFlags_Popup) && !window_pos_set_by_api && !is_pinned_child_tooltip)\n\t\t\t\twindow->Pos = window->PosFloat = parent_window->DC.CursorPos;\n\t\t}\n\n\t\tconst bool window_pos_with_pivot = (window->SetWindowPosVal.x != FLT_MAX && window->HiddenFrames == 0);\n\t\tif (window_pos_with_pivot)\n\t\t{\n\t\t\t// Position given a pivot (e.g. for centering)\n\t\t\tSetWindowPos(window, ImMax(style.DisplaySafeAreaPadding, window->SetWindowPosVal - window->SizeFull * window->SetWindowPosPivot), 0);\n\t\t}\n\t\telse if (flags & ImGuiWindowFlags_ChildMenu)\n\t\t{\n\t\t\t// Child menus typically request _any_ position within the parent menu item, and then our FindBestPopupWindowPos() function will move the new menu outside the parent bounds.\n\t\t\t// This is how we end up with child menus appearing (most-commonly) on the right of the parent menu.\n\t\t\tIM_ASSERT(window_pos_set_by_api);\n\t\t\tfloat horizontal_overlap = style.ItemSpacing.x; // We want some overlap to convey the relative depth of each popup (currently the amount of overlap it is hard-coded to style.ItemSpacing.x, may need to introduce another style value).\n\t\t\tImGuiWindow* parent_menu = parent_window_in_stack;\n\t\t\tImRect rect_to_avoid;\n\t\t\tif (parent_menu->DC.MenuBarAppending)\n\t\t\t\trect_to_avoid = ImRect(-FLT_MAX, parent_menu->Pos.y + parent_menu->TitleBarHeight(), FLT_MAX, parent_menu->Pos.y + parent_menu->TitleBarHeight() + parent_menu->MenuBarHeight());\n\t\t\telse\n\t\t\t\trect_to_avoid = ImRect(parent_menu->Pos.x + horizontal_overlap, -FLT_MAX, parent_menu->Pos.x + parent_menu->Size.x - horizontal_overlap - parent_menu->ScrollbarSizes.x, FLT_MAX);\n\t\t\twindow->PosFloat = FindBestWindowPosForPopup(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);\n\t\t}\n\t\telse if ((flags & ImGuiWindowFlags_Popup) != 0 && !window_pos_set_by_api && window_just_appearing_after_hidden_for_resize)\n\t\t{\n\t\t\tImRect rect_to_avoid(window->PosFloat.x - 1, window->PosFloat.y - 1, window->PosFloat.x + 1, window->PosFloat.y + 1);\n\t\t\twindow->PosFloat = FindBestWindowPosForPopup(window->PosFloat, window->Size, &window->AutoPosLastDirection, rect_to_avoid);\n\t\t}\n\n\t\t// Position tooltip (always follows mouse)\n\t\tif ((flags & ImGuiWindowFlags_Tooltip) != 0 && !window_pos_set_by_api && !is_pinned_child_tooltip)\n\t\t{\n\t\t\tImVec2 ref_pos = g.IO.MousePos;\n\t\t\tImRect rect_to_avoid(ref_pos.x - 16, ref_pos.y - 8, ref_pos.x + 24, ref_pos.y + 24); // FIXME: Completely hard-coded. Store boxes in mouse cursor data? Scale? Center on cursor hit-point?\n\t\t\twindow->PosFloat = FindBestWindowPosForPopup(ref_pos, window->Size, &window->AutoPosLastDirection, rect_to_avoid);\n\t\t\tif (window->AutoPosLastDirection == ImGuiDir_None)\n\t\t\t\twindow->PosFloat = ref_pos + ImVec2(2, 2); // If there's not enough room, for tooltip we prefer avoiding the cursor at all cost even if it means that part of the tooltip won't be visible.\n\t\t}\n\n\t\t// Clamp position so it stays visible\n\t\tif (!(flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Tooltip))\n\t\t{\n\t\t\tif (!window_pos_set_by_api && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0 && g.IO.DisplaySize.x > 0.0f && g.IO.DisplaySize.y > 0.0f) // Ignore zero-sized display explicitly to avoid losing positions if a window manager reports zero-sized window when initializing or minimizing.\n\t\t\t{\n\t\t\t\tImVec2 padding = ImMax(style.DisplayWindowPadding, style.DisplaySafeAreaPadding);\n\t\t\t\twindow->PosFloat = ImMax(window->PosFloat + window->Size, padding) - window->Size;\n\t\t\t\twindow->PosFloat = ImMin(window->PosFloat, g.IO.DisplaySize - padding);\n\t\t\t}\n\t\t}\n\t\twindow->Pos = ImFloor(window->PosFloat);\n\n\t\t// Default item width. Make it proportional to window size if window manually resizes\n\t\tif (window->Size.x > 0.0f && !(flags & ImGuiWindowFlags_Tooltip) && !(flags & ImGuiWindowFlags_AlwaysAutoResize))\n\t\t\twindow->ItemWidthDefault = (float)(int)(window->Size.x * 0.65f);\n\t\telse\n\t\t\twindow->ItemWidthDefault = (float)(int)(g.FontSize * 16.0f);\n\n\t\t// Prepare for focus requests\n\t\twindow->FocusIdxAllRequestCurrent = (window->FocusIdxAllRequestNext == INT_MAX || window->FocusIdxAllCounter == -1) ? INT_MAX : (window->FocusIdxAllRequestNext + (window->FocusIdxAllCounter + 1)) % (window->FocusIdxAllCounter + 1);\n\t\twindow->FocusIdxTabRequestCurrent = (window->FocusIdxTabRequestNext == INT_MAX || window->FocusIdxTabCounter == -1) ? INT_MAX : (window->FocusIdxTabRequestNext + (window->FocusIdxTabCounter + 1)) % (window->FocusIdxTabCounter + 1);\n\t\twindow->FocusIdxAllCounter = window->FocusIdxTabCounter = -1;\n\t\twindow->FocusIdxAllRequestNext = window->FocusIdxTabRequestNext = INT_MAX;\n\n\t\t// Apply scrolling\n\t\twindow->Scroll = CalcNextScrollFromScrollTargetAndClamp(window);\n\t\twindow->ScrollTarget = ImVec2(FLT_MAX, FLT_MAX);\n\n\t\t// Apply focus, new windows appears in front\n\t\tbool want_focus = false;\n\t\tif (window_just_activated_by_user && !(flags & ImGuiWindowFlags_NoFocusOnAppearing))\n\t\t\tif (!(flags & (ImGuiWindowFlags_ChildWindow | ImGuiWindowFlags_Tooltip)) || (flags & ImGuiWindowFlags_Popup))\n\t\t\t\twant_focus = true;\n\n\t\t// Handle manual resize: Resize Grips, Borders, Gamepad\n\t\tint border_held = -1;\n\t\tImU32 resize_grip_col[4] = { 0 };\n\t\tconst int resize_grip_count = (flags & ImGuiWindowFlags_ResizeFromAnySide) ? 2 : 1; // 4\n\t\tconst float grip_draw_size = (float)(int)ImMax(g.FontSize * 1.35f, window->WindowRounding + 1.0f + g.FontSize * 0.2f);\n\t\tif (!window->Collapsed)\n\t\t\tUpdateManualResize(window, size_auto_fit, &border_held, resize_grip_count, &resize_grip_col[0]);\n\n\t\t// DRAWING\n\n\t\t// Setup draw list and outer clipping rectangle\n\t\twindow->DrawList->Clear();\n\t\twindow->DrawList->Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);\n\t\twindow->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);\n\t\tImRect fullscreen_rect(GetVisibleRect());\n\t\tif ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & ImGuiWindowFlags_Popup) && !is_pinned_child_tooltip)\n\t\t\tPushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true);\n\t\telse\n\t\t\tPushClipRect(fullscreen_rect.Min, fullscreen_rect.Max, true);\n\n\t\t// Draw modal window background (darkens what is behind them)\n\t\tif ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())\n\t\t\twindow->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));\n\n\t\t// Draw window + handle manual resize\n\t\tconst float window_rounding = window->WindowRounding;\n\t\tconst float window_border_size = window->WindowBorderSize;\n\t\tImRect title_bar_rect = window->TitleBarRect();\n\t\tconst bool window_is_focused = want_focus || (g.NavWindow && window->RootNonPopupWindow == g.NavWindow->RootNonPopupWindow);\n\t\tif (window->Collapsed)\n\t\t{\n\t\t\t// Title bar only\n\t\t\tfloat backup_border_size = style.FrameBorderSize;\n\t\t\tg.Style.FrameBorderSize = window->WindowBorderSize;\n\t\t\tRenderFrame(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(ImGuiCol_TitleBgCollapsed), true, window_rounding);\n\t\t\tg.Style.FrameBorderSize = backup_border_size;\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// Window background, Default Alpha\n\t\t\tImU32 bg_col = GetColorU32(GetWindowBgColorIdxFromFlags(flags));\n\t\t\twindow->DrawList->AddRectFilled(window->Pos + ImVec2(0, window->TitleBarHeight()), window->Pos + window->Size, bg_col, window_rounding, (flags & ImGuiWindowFlags_NoTitleBar) ? ImDrawCornerFlags_All : ImDrawCornerFlags_Bot);\n\n\t\t\t// Title bar\n\t\t\tif (!(flags & ImGuiWindowFlags_NoTitleBar))\n\t\t\t\twindow->DrawList->AddRectFilled(title_bar_rect.Min, title_bar_rect.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg), window_rounding, ImDrawCornerFlags_Top);\n\n\t\t\t// Menu bar\n\t\t\tif (flags & ImGuiWindowFlags_MenuBar)\n\t\t\t{\n\t\t\t\tImRect menu_bar_rect = window->MenuBarRect();\n\t\t\t\tmenu_bar_rect.ClipWith(window->Rect());  // Soft clipping, in particular child window don't have minimum size covering the menu bar so this is useful for them.\n\t\t\t\twindow->DrawList->AddRectFilled(menu_bar_rect.Min, menu_bar_rect.Max, GetColorU32(ImGuiCol_MenuBarBg), (flags & ImGuiWindowFlags_NoTitleBar) ? window_rounding : 0.0f, ImDrawCornerFlags_Top);\n\t\t\t\tif (style.FrameBorderSize > 0.0f && menu_bar_rect.Max.y < window->Pos.y + window->Size.y)\n\t\t\t\t\twindow->DrawList->AddLine(menu_bar_rect.GetBL(), menu_bar_rect.GetBR(), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);\n\t\t\t}\n\n\t\t\t// Scrollbars\n\t\t\tif (window->ScrollbarX)\n\t\t\t\tScrollbar(ImGuiLayoutType_Horizontal);\n\t\t\tif (window->ScrollbarY)\n\t\t\t\tScrollbar(ImGuiLayoutType_Vertical);\n\n\t\t\t// Render resize grips (after their input handling so we don't have a frame of latency)\n\t\t\tif (!(flags & ImGuiWindowFlags_NoResize))\n\t\t\t{\n\t\t\t\tfor (int resize_grip_n = 0; resize_grip_n < resize_grip_count; resize_grip_n++)\n\t\t\t\t{\n\t\t\t\t\tconst ImGuiResizeGripDef& grip = resize_grip_def[resize_grip_n];\n\t\t\t\t\tconst ImVec2 corner = ImLerp(window->Pos, window->Pos + window->Size, grip.CornerPos);\n\t\t\t\t\twindow->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(window_border_size, grip_draw_size) : ImVec2(grip_draw_size, window_border_size)));\n\t\t\t\t\twindow->DrawList->PathLineTo(corner + grip.InnerDir * ((resize_grip_n & 1) ? ImVec2(grip_draw_size, window_border_size) : ImVec2(window_border_size, grip_draw_size)));\n\t\t\t\t\twindow->DrawList->PathArcToFast(ImVec2(corner.x + grip.InnerDir.x * (window_rounding + window_border_size), corner.y + grip.InnerDir.y * (window_rounding + window_border_size)), window_rounding, grip.AngleMin12, grip.AngleMax12);\n\t\t\t\t\twindow->DrawList->PathFillConvex(resize_grip_col[resize_grip_n]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Borders\n\t\t\tif (window_border_size > 0.0f)\n\t\t\t\twindow->DrawList->AddRect(window->Pos, window->Pos + window->Size, GetColorU32(ImGuiCol_Border), window_rounding, ImDrawCornerFlags_All, window_border_size);\n\t\t\tif (border_held != -1)\n\t\t\t{\n\t\t\t\tImRect border = GetBorderRect(window, border_held, grip_draw_size, 0.0f);\n\t\t\t\twindow->DrawList->AddLine(border.Min, border.Max, GetColorU32(ImGuiCol_SeparatorActive), ImMax(1.0f, window_border_size));\n\t\t\t}\n\t\t\tif (style.FrameBorderSize > 0 && !(flags & ImGuiWindowFlags_NoTitleBar))\n\t\t\t\twindow->DrawList->AddLine(title_bar_rect.GetBL() + ImVec2(style.WindowBorderSize, -1), title_bar_rect.GetBR() + ImVec2(-style.WindowBorderSize, -1), GetColorU32(ImGuiCol_Border), style.FrameBorderSize);\n\t\t}\n\n\t\t// Store a backup of SizeFull which we will use next frame to decide if we need scrollbars. \n\t\twindow->SizeFullAtLastBegin = window->SizeFull;\n\n\t\t// Update ContentsRegionMax. All the variable it depends on are set above in this function.\n\t\twindow->ContentsRegionRect.Min.x = -window->Scroll.x + window->WindowPadding.x;\n\t\twindow->ContentsRegionRect.Min.y = -window->Scroll.y + window->WindowPadding.y + window->TitleBarHeight() + window->MenuBarHeight();\n\t\twindow->ContentsRegionRect.Max.x = -window->Scroll.x - window->WindowPadding.x + (window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : (window->Size.x - window->ScrollbarSizes.x));\n\t\twindow->ContentsRegionRect.Max.y = -window->Scroll.y - window->WindowPadding.y + (window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : (window->Size.y - window->ScrollbarSizes.y));\n\n\t\t// Setup drawing context\n\t\t// (NB: That term \"drawing context / DC\" lost its meaning a long time ago. Initially was meant to hold transient data only. Nowadays difference between window-> and window->DC-> is dubious.)\n\t\twindow->DC.IndentX = 0.0f + window->WindowPadding.x - window->Scroll.x;\n\t\twindow->DC.GroupOffsetX = 0.0f;\n\t\twindow->DC.ColumnsOffsetX = 0.0f;\n\t\twindow->DC.CursorStartPos = window->Pos + ImVec2(window->DC.IndentX + window->DC.ColumnsOffsetX, window->TitleBarHeight() + window->MenuBarHeight() + window->WindowPadding.y - window->Scroll.y);\n\t\twindow->DC.CursorPos = window->DC.CursorStartPos;\n\t\twindow->DC.CursorPosPrevLine = window->DC.CursorPos;\n\t\twindow->DC.CursorMaxPos = window->DC.CursorStartPos;\n\t\twindow->DC.CurrentLineHeight = window->DC.PrevLineHeight = 0.0f;\n\t\twindow->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset = 0.0f;\n\t\twindow->DC.MenuBarAppending = false;\n\t\twindow->DC.MenuBarOffsetX = ImMax(window->WindowPadding.x, style.ItemSpacing.x);\n\t\twindow->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;\n\t\twindow->DC.ChildWindows.resize(0);\n\t\twindow->DC.LayoutType = ImGuiLayoutType_Vertical;\n\t\twindow->DC.ItemFlags = ImGuiItemFlags_Default_;\n\t\twindow->DC.ItemWidth = window->ItemWidthDefault;\n\t\twindow->DC.TextWrapPos = -1.0f; // disabled\n\t\twindow->DC.ItemFlagsStack.resize(0);\n\t\twindow->DC.ItemWidthStack.resize(0);\n\t\twindow->DC.TextWrapPosStack.resize(0);\n\t\twindow->DC.ColumnsSet = NULL;\n\t\twindow->DC.TreeDepth = 0;\n\t\twindow->DC.StateStorage = &window->StateStorage;\n\t\twindow->DC.GroupStack.resize(0);\n\t\twindow->MenuColumns.Update(3, style.ItemSpacing.x, window_just_activated_by_user);\n\n\t\tif ((flags & ImGuiWindowFlags_ChildWindow) && (window->DC.ItemFlags != parent_window->DC.ItemFlags))\n\t\t{\n\t\t\twindow->DC.ItemFlags = parent_window->DC.ItemFlags;\n\t\t\twindow->DC.ItemFlagsStack.push_back(window->DC.ItemFlags);\n\t\t}\n\n\t\tif (window->AutoFitFramesX > 0)\n\t\t\twindow->AutoFitFramesX--;\n\t\tif (window->AutoFitFramesY > 0)\n\t\t\twindow->AutoFitFramesY--;\n\n\t\t// Apply focus (we need to call FocusWindow() AFTER setting DC.CursorStartPos so our initial navigation reference rectangle can start around there)\n\t\tif (want_focus)\n\t\t\tFocusWindow(window);\n\n\t\t// Title bar\n\t\tif (!(flags & ImGuiWindowFlags_NoTitleBar))\n\t\t{\n\t\t\t// Collapse button\n\t\t\tif (!(flags & ImGuiWindowFlags_NoCollapse))\n\t\t\t{\n\t\t\t\tRenderTriangle(window->Pos + style.FramePadding, window->Collapsed ? ImGuiDir_Right : ImGuiDir_Down, 1.0f);\n\t\t\t}\n\n\t\t\t// Close button\n\t\t\tif (p_open != NULL)\n\t\t\t{\n\t\t\t\tconst float PAD = 2.0f;\n\t\t\t\tconst float rad = (window->TitleBarHeight() - PAD * 2.0f) * 0.5f;\n\t\t\t\tif (CloseButton(window->GetID(\"#CLOSE\"), window->Rect().GetTR() + ImVec2(-PAD - rad, PAD + rad), rad))\n\t\t\t\t\t*p_open = false;\n\t\t\t}\n\n\t\t\t// Title text (FIXME: refactor text alignment facilities along with RenderText helpers)\n\t\t\tImVec2 text_size = CalcTextSize(name, NULL, true);\n\t\t\tImRect text_r = title_bar_rect;\n\t\t\tfloat pad_left = (flags & ImGuiWindowFlags_NoCollapse) == 0 ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x;\n\t\t\tfloat pad_right = (p_open != NULL) ? (style.FramePadding.x + g.FontSize + style.ItemInnerSpacing.x) : style.FramePadding.x;\n\t\t\tif (style.WindowTitleAlign.x > 0.0f) pad_right = ImLerp(pad_right, pad_left, style.WindowTitleAlign.x);\n\t\t\ttext_r.Min.x += pad_left;\n\t\t\ttext_r.Max.x -= pad_right;\n\t\t\tImRect clip_rect = text_r;\n\t\t\tclip_rect.Max.x = window->Pos.x + window->Size.x - (p_open ? title_bar_rect.GetHeight() - 3 : style.FramePadding.x); // Match the size of CloseButton()\n\t\t\tRenderTextClipped(text_r.Min, text_r.Max, name, NULL, &text_size, style.WindowTitleAlign, &clip_rect);\n\t\t}\n\n\t\t// Save clipped aabb so we can access it in constant-time in FindHoveredWindow()\n\t\twindow->WindowRectClipped = window->Rect();\n\t\twindow->WindowRectClipped.ClipWith(window->ClipRect);\n\n\t\t// Pressing CTRL+C while holding on a window copy its content to the clipboard\n\t\t// This works but 1. doesn't handle multiple Begin/End pairs, 2. recursing into another Begin/End pair - so we need to work that out and add better logging scope.\n\t\t// Maybe we can support CTRL+C on every element?\n\t\t/*\n\t\tif (g.ActiveId == move_id)\n\t\tif (g.IO.KeyCtrl && IsKeyPressedMap(ImGuiKey_C))\n\t\tImGui::LogToClipboard();\n\t\t*/\n\n\t\t// Inner rectangle\n\t\t// We set this up after processing the resize grip so that our clip rectangle doesn't lag by a frame\n\t\t// Note that if our window is collapsed we will end up with a null clipping rectangle which is the correct behavior.\n\t\twindow->InnerRect.Min.x = title_bar_rect.Min.x + window->WindowBorderSize;\n\t\twindow->InnerRect.Min.y = title_bar_rect.Max.y + window->MenuBarHeight() + (((flags & ImGuiWindowFlags_MenuBar) || !(flags & ImGuiWindowFlags_NoTitleBar)) ? style.FrameBorderSize : window->WindowBorderSize);\n\t\twindow->InnerRect.Max.x = window->Pos.x + window->Size.x - window->ScrollbarSizes.x - window->WindowBorderSize;\n\t\twindow->InnerRect.Max.y = window->Pos.y + window->Size.y - window->ScrollbarSizes.y - window->WindowBorderSize;\n\t\t//window->DrawList->AddRect(window->InnerRect.Min, window->InnerRect.Max, IM_COL32_WHITE);\n\n\t\t// After Begin() we fill the last item / hovered data using the title bar data. Make that a standard behavior (to allow usage of context menus on title bar only, etc.).\n\t\twindow->DC.LastItemId = window->MoveId;\n\t\twindow->DC.LastItemRect = title_bar_rect;\n\t\twindow->DC.LastItemRectHoveredRect = IsMouseHoveringRect(title_bar_rect.Min, title_bar_rect.Max, false);\n\t}\n\n\t// Inner clipping rectangle\n\t// Force round operator last to ensure that e.g. (int)(max.x-min.x) in user's render code produce correct result.\n\tconst float border_size = window->WindowBorderSize;\n\tImRect clip_rect;\n\tclip_rect.Min.x = ImFloor(0.5f + window->InnerRect.Min.x + ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - border_size)));\n\tclip_rect.Min.y = ImFloor(0.5f + window->InnerRect.Min.y);\n\tclip_rect.Max.x = ImFloor(0.5f + window->InnerRect.Max.x - ImMax(0.0f, ImFloor(window->WindowPadding.x * 0.5f - border_size)));\n\tclip_rect.Max.y = ImFloor(0.5f + window->InnerRect.Max.y);\n\tPushClipRect(clip_rect.Min, clip_rect.Max, true);\n\n\t// Clear 'accessed' flag last thing (After PushClipRect which will set the flag. We want the flag to stay false when the default \"Debug\" window is unused)\n\tif (first_begin_of_the_frame)\n\t\twindow->WriteAccessed = false;\n\n\twindow->BeginCount++;\n\tg.NextWindowData.SizeConstraintCond = 0;\n\n\t// Child window can be out of sight and have \"negative\" clip windows.\n\t// Mark them as collapsed so commands are skipped earlier (we can't manually collapse because they have no title bar).\n\tif (flags & ImGuiWindowFlags_ChildWindow)\n\t{\n\t\tIM_ASSERT((flags & ImGuiWindowFlags_NoTitleBar) != 0);\n\t\twindow->Collapsed = parent_window && parent_window->Collapsed;\n\n\t\tif (!(flags & ImGuiWindowFlags_AlwaysAutoResize) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0)\n\t\t\twindow->Collapsed |= (window->WindowRectClipped.Min.x >= window->WindowRectClipped.Max.x || window->WindowRectClipped.Min.y >= window->WindowRectClipped.Max.y);\n\n\t\t// We also hide the window from rendering because we've already added its border to the command list.\n\t\t// (we could perform the check earlier in the function but it is simpler at this point)\n\t\tif (window->Collapsed)\n\t\t\twindow->Active = false;\n\t}\n\tif (style.Alpha <= 0.0f)\n\t\twindow->Active = false;\n\n\t// Return false if we don't intend to display anything to allow user to perform an early out optimization\n\twindow->SkipItems = (window->Collapsed || !window->Active) && window->AutoFitFramesX <= 0 && window->AutoFitFramesY <= 0;\n\treturn !window->SkipItems;\n}\n\n// Old Begin() API with 5 parameters, avoid calling this version directly! Use SetNextWindowSize()+Begin() instead.\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\nbool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override, ImGuiWindowFlags flags)\n{\n\t// Old API feature: we could pass the initial window size as a parameter, however this was very misleading because in most cases it would only affect the window when it didn't have storage in the .ini file.\n\tif (size_on_first_use.x != 0.0f || size_on_first_use.y != 0.0f)\n\t\tSetNextWindowSize(size_on_first_use, ImGuiCond_FirstUseEver);\n\n\t// Old API feature: we could override the window background alpha with a parameter. This is actually tricky to reproduce manually because: \n\t// (1) there are multiple variants of WindowBg (popup, tooltip, etc.) and (2) you can't call PushStyleColor before Begin and PopStyleColor just after Begin() because of how CheckStackSizes() behave.\n\t// The user-side solution is to do backup = GetStyleColorVec4(ImGuiCol_xxxBG), PushStyleColor(ImGuiCol_xxxBg), Begin, PushStyleColor(ImGuiCol_xxxBg, backup), [...], PopStyleColor(), End(); PopStyleColor() - which is super awkward.\n\t// The alpha override was rarely used but for now we'll leave the Begin() variant around for a bit. We may either lift the constraint on CheckStackSizes() either add a SetNextWindowBgAlpha() helper that does it magically.\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiCol bg_color_idx = GetWindowBgColorIdxFromFlags(flags);\n\tconst ImVec4 bg_color_backup = g.Style.Colors[bg_color_idx];\n\tif (bg_alpha_override >= 0.0f)\n\t\tg.Style.Colors[bg_color_idx].w = bg_alpha_override;\n\n\tbool ret = Begin(name, p_open, flags);\n\n\tif (bg_alpha_override >= 0.0f)\n\t\tg.Style.Colors[bg_color_idx] = bg_color_backup;\n\treturn ret;\n}\n#endif // IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\nvoid ImGui::End()\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tif (window->DC.ColumnsSet != NULL)\n\t\tEndColumns();\n\tPopClipRect();   // inner window clip rectangle\n\n\t\t\t\t\t // Stop logging\n\tif (!(window->Flags & ImGuiWindowFlags_ChildWindow))    // FIXME: add more options for scope of logging\n\t\tLogFinish();\n\n\t// Pop\n\t// NB: we don't clear 'window->RootWindow'. The pointer is allowed to live until the next call to Begin().\n\tg.CurrentWindowStack.pop_back();\n\tif (window->Flags & ImGuiWindowFlags_Popup)\n\t\tg.CurrentPopupStack.pop_back();\n\tCheckStacksSize(window, false);\n\tSetCurrentWindow(g.CurrentWindowStack.empty() ? NULL : g.CurrentWindowStack.back());\n}\n\n// Vertical scrollbar\n// The entire piece of code below is rather confusing because:\n// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab)\n// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar\n// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal.\nvoid ImGui::Scrollbar(ImGuiLayoutType direction)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tconst bool horizontal = (direction == ImGuiLayoutType_Horizontal);\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(horizontal ? \"#SCROLLX\" : \"#SCROLLY\");\n\n\t// Render background\n\tbool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);\n\tfloat other_scrollbar_size_w = other_scrollbar ? style.ScrollbarSize : 0.0f;\n\tconst ImRect window_rect = window->Rect();\n\tconst float border_size = window->WindowBorderSize;\n\tImRect bb = horizontal\n\t\t? ImRect(window->Pos.x + border_size, window_rect.Max.y - style.ScrollbarSize, window_rect.Max.x - other_scrollbar_size_w - border_size, window_rect.Max.y - border_size)\n\t\t: ImRect(window_rect.Max.x - style.ScrollbarSize, window->Pos.y + border_size, window_rect.Max.x - border_size, window_rect.Max.y - other_scrollbar_size_w - border_size);\n\tif (!horizontal)\n\t\tbb.Min.y += window->TitleBarHeight() + ((window->Flags & ImGuiWindowFlags_MenuBar) ? window->MenuBarHeight() : 0.0f);\n\tif (bb.GetWidth() <= 0.0f || bb.GetHeight() <= 0.0f)\n\t\treturn;\n\n\tint window_rounding_corners;\n\tif (horizontal)\n\t\twindow_rounding_corners = ImDrawCornerFlags_BotLeft | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight);\n\telse\n\t\twindow_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImDrawCornerFlags_TopRight : 0) | (other_scrollbar ? 0 : ImDrawCornerFlags_BotRight);\n\twindow->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window->WindowRounding, window_rounding_corners);\n\tbb.Expand(ImVec2(-ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f)));\n\n\t// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)\n\tfloat scrollbar_size_v = horizontal ? bb.GetWidth() : bb.GetHeight();\n\tfloat scroll_v = horizontal ? window->Scroll.x : window->Scroll.y;\n\tfloat win_size_avail_v = (horizontal ? window->SizeFull.x : window->SizeFull.y) - other_scrollbar_size_w;\n\tfloat win_size_contents_v = horizontal ? window->SizeContents.x : window->SizeContents.y;\n\n\t// Calculate the height of our grabbable box. It generally represent the amount visible (vs the total scrollable amount)\n\t// But we maintain a minimum size in pixel to allow for the user to still aim inside.\n\tIM_ASSERT(ImMax(win_size_contents_v, win_size_avail_v) > 0.0f); // Adding this assert to check if the ImMax(XXX,1.0f) is still needed. PLEASE CONTACT ME if this triggers.\n\tconst float win_size_v = ImMax(ImMax(win_size_contents_v, win_size_avail_v), 1.0f);\n\tconst float grab_h_pixels = ImClamp(scrollbar_size_v * (win_size_avail_v / win_size_v), style.GrabMinSize, scrollbar_size_v);\n\tconst float grab_h_norm = grab_h_pixels / scrollbar_size_v;\n\n\t// Handle input right away. None of the code of Begin() is relying on scrolling position before calling Scrollbar().\n\tbool held = false;\n\tbool hovered = false;\n\tconst bool previously_held = (g.ActiveId == id);\n\tButtonBehavior(bb, id, &hovered, &held);\n\n\tfloat scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v);\n\tfloat scroll_ratio = ImSaturate(scroll_v / scroll_max);\n\tfloat grab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;\n\tif (held && grab_h_norm < 1.0f)\n\t{\n\t\tfloat scrollbar_pos_v = horizontal ? bb.Min.x : bb.Min.y;\n\t\tfloat mouse_pos_v = horizontal ? g.IO.MousePos.x : g.IO.MousePos.y;\n\t\tfloat* click_delta_to_grab_center_v = horizontal ? &g.ScrollbarClickDeltaToGrabCenter.x : &g.ScrollbarClickDeltaToGrabCenter.y;\n\n\t\t// Click position in scrollbar normalized space (0.0f->1.0f)\n\t\tconst float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);\n\t\tSetHoveredID(id);\n\n\t\tbool seek_absolute = false;\n\t\tif (!previously_held)\n\t\t{\n\t\t\t// On initial click calculate the distance between mouse and the center of the grab\n\t\t\tif (clicked_v_norm >= grab_v_norm && clicked_v_norm <= grab_v_norm + grab_h_norm)\n\t\t\t{\n\t\t\t\t*click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tseek_absolute = true;\n\t\t\t\t*click_delta_to_grab_center_v = 0.0f;\n\t\t\t}\n\t\t}\n\n\t\t// Apply scroll\n\t\t// It is ok to modify Scroll here because we are being called in Begin() after the calculation of SizeContents and before setting up our starting position\n\t\tconst float scroll_v_norm = ImSaturate((clicked_v_norm - *click_delta_to_grab_center_v - grab_h_norm * 0.5f) / (1.0f - grab_h_norm));\n\t\tscroll_v = (float)(int)(0.5f + scroll_v_norm * scroll_max);//(win_size_contents_v - win_size_v));\n\t\tif (horizontal)\n\t\t\twindow->Scroll.x = scroll_v;\n\t\telse\n\t\t\twindow->Scroll.y = scroll_v;\n\n\t\t// Update values for rendering\n\t\tscroll_ratio = ImSaturate(scroll_v / scroll_max);\n\t\tgrab_v_norm = scroll_ratio * (scrollbar_size_v - grab_h_pixels) / scrollbar_size_v;\n\n\t\t// Update distance to grab now that we have seeked and saturated\n\t\tif (seek_absolute)\n\t\t\t*click_delta_to_grab_center_v = clicked_v_norm - grab_v_norm - grab_h_norm * 0.5f;\n\t}\n\n\t// Render\n\tconst ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);\n\tImRect grab_rect;\n\tif (horizontal)\n\t\tgrab_rect = ImRect(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y, ImMin(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, window_rect.Max.x), bb.Max.y);\n\telse\n\t\tgrab_rect = ImRect(bb.Min.x, ImLerp(bb.Min.y, bb.Max.y, grab_v_norm), bb.Max.x, ImMin(ImLerp(bb.Min.y, bb.Max.y, grab_v_norm) + grab_h_pixels, window_rect.Max.y));\n\twindow->DrawList->AddRectFilled(grab_rect.Min, grab_rect.Max, grab_col, style.ScrollbarRounding);\n}\n\nvoid ImGui::BringWindowToFront(ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.Windows.back() == window)\n\t\treturn;\n\tfor (int i = g.Windows.Size - 2; i >= 0; i--) // We can ignore the front most window\n\t\tif (g.Windows[i] == window)\n\t\t{\n\t\t\tg.Windows.erase(g.Windows.Data + i);\n\t\t\tg.Windows.push_back(window);\n\t\t\tbreak;\n\t\t}\n}\n\nvoid ImGui::BringWindowToBack(ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.Windows[0] == window)\n\t\treturn;\n\tfor (int i = 0; i < g.Windows.Size; i++)\n\t\tif (g.Windows[i] == window)\n\t\t{\n\t\t\tmemmove(&g.Windows[1], &g.Windows[0], (size_t)i * sizeof(ImGuiWindow*));\n\t\t\tg.Windows[0] = window;\n\t\t\tbreak;\n\t\t}\n}\n\n// Moving window to front of display and set focus (which happens to be back of our sorted list)\nvoid ImGui::FocusWindow(ImGuiWindow* window)\n{\n\tImGuiContext& g = *GImGui;\n\n\t// Always mark the window we passed as focused. This is used for keyboard interactions such as tabbing.\n\tg.NavWindow = window;\n\n\t// Passing NULL allow to disable keyboard focus\n\tif (!window)\n\t\treturn;\n\n\t// Move the root window to the top of the pile\n\tif (window->RootWindow)\n\t\twindow = window->RootWindow;\n\n\t// Steal focus on active widgets\n\tif (window->Flags & ImGuiWindowFlags_Popup) // FIXME: This statement should be unnecessary. Need further testing before removing it..\n\t\tif (g.ActiveId != 0 && g.ActiveIdWindow && g.ActiveIdWindow->RootWindow != window)\n\t\t\tClearActiveID();\n\n\t// Bring to front\n\tif (!(window->Flags & ImGuiWindowFlags_NoBringToFrontOnFocus))\n\t\tBringWindowToFront(window);\n}\n\nvoid ImGui::FocusFrontMostActiveWindow(ImGuiWindow* ignore_window)\n{\n\tImGuiContext& g = *GImGui;\n\tfor (int i = g.Windows.Size - 1; i >= 0; i--)\n\t\tif (g.Windows[i] != ignore_window && g.Windows[i]->WasActive && !(g.Windows[i]->Flags & ImGuiWindowFlags_ChildWindow))\n\t\t{\n\t\t\tFocusWindow(g.Windows[i]);\n\t\t\treturn;\n\t\t}\n}\n\nvoid ImGui::PushItemWidth(float item_width)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.ItemWidth = (item_width == 0.0f ? window->ItemWidthDefault : item_width);\n\twindow->DC.ItemWidthStack.push_back(window->DC.ItemWidth);\n}\n\nvoid ImGui::PushMultiItemsWidths(int components, float w_full)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tconst ImGuiStyle& style = GImGui->Style;\n\tif (w_full <= 0.0f)\n\t\tw_full = CalcItemWidth();\n\tconst float w_item_one = ImMax(1.0f, (float)(int)((w_full - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));\n\tconst float w_item_last = ImMax(1.0f, (float)(int)(w_full - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));\n\twindow->DC.ItemWidthStack.push_back(w_item_last);\n\tfor (int i = 0; i < components - 1; i++)\n\t\twindow->DC.ItemWidthStack.push_back(w_item_one);\n\twindow->DC.ItemWidth = window->DC.ItemWidthStack.back();\n}\n\nvoid ImGui::PopItemWidth()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.ItemWidthStack.pop_back();\n\twindow->DC.ItemWidth = window->DC.ItemWidthStack.empty() ? window->ItemWidthDefault : window->DC.ItemWidthStack.back();\n}\n\nfloat ImGui::CalcItemWidth()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tfloat w = window->DC.ItemWidth;\n\tif (w < 0.0f)\n\t{\n\t\t// Align to a right-side limit. We include 1 frame padding in the calculation because this is how the width is always used (we add 2 frame padding to it), but we could move that responsibility to the widget as well.\n\t\tfloat width_to_right_edge = GetContentRegionAvail().x;\n\t\tw = ImMax(1.0f, width_to_right_edge + w);\n\t}\n\tw = (float)(int)w;\n\treturn w;\n}\n\nstatic ImFont* GetDefaultFont()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.IO.FontDefault ? g.IO.FontDefault : g.IO.Fonts->Fonts[0];\n}\n\nstatic void SetCurrentFont(ImFont* font)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(font && font->IsLoaded());    // Font Atlas not created. Did you call io.Fonts->GetTexDataAsRGBA32 / GetTexDataAsAlpha8 ?\n\tIM_ASSERT(font->Scale > 0.0f);\n\tg.Font = font;\n\tg.FontBaseSize = g.IO.FontGlobalScale * g.Font->FontSize * g.Font->Scale;\n\tg.FontSize = g.CurrentWindow ? g.CurrentWindow->CalcFontSize() : 0.0f;\n\n\tImFontAtlas* atlas = g.Font->ContainerAtlas;\n\tg.DrawListSharedData.TexUvWhitePixel = atlas->TexUvWhitePixel;\n\tg.DrawListSharedData.Font = g.Font;\n\tg.DrawListSharedData.FontSize = g.FontSize;\n}\n\nvoid ImGui::PushFont(ImFont* font)\n{\n\tImGuiContext& g = *GImGui;\n\tif (!font)\n\t\tfont = GetDefaultFont();\n\tSetCurrentFont(font);\n\tg.FontStack.push_back(font);\n\tg.CurrentWindow->DrawList->PushTextureID(font->ContainerAtlas->TexID);\n}\n\nvoid  ImGui::PopFont()\n{\n\tImGuiContext& g = *GImGui;\n\tg.CurrentWindow->DrawList->PopTextureID();\n\tg.FontStack.pop_back();\n\tSetCurrentFont(g.FontStack.empty() ? GetDefaultFont() : g.FontStack.back());\n}\n\nvoid ImGui::PushItemFlag(ImGuiItemFlags option, bool enabled)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (enabled)\n\t\twindow->DC.ItemFlags |= option;\n\telse\n\t\twindow->DC.ItemFlags &= ~option;\n\twindow->DC.ItemFlagsStack.push_back(window->DC.ItemFlags);\n}\n\nvoid ImGui::PopItemFlag()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.ItemFlagsStack.pop_back();\n\twindow->DC.ItemFlags = window->DC.ItemFlagsStack.empty() ? ImGuiItemFlags_Default_ : window->DC.ItemFlagsStack.back();\n}\n\nvoid ImGui::PushAllowKeyboardFocus(bool allow_keyboard_focus)\n{\n\tPushItemFlag(ImGuiItemFlags_AllowKeyboardFocus, allow_keyboard_focus);\n}\n\nvoid ImGui::PopAllowKeyboardFocus()\n{\n\tPopItemFlag();\n}\n\nvoid ImGui::PushButtonRepeat(bool repeat)\n{\n\tPushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat);\n}\n\nvoid ImGui::PopButtonRepeat()\n{\n\tPopItemFlag();\n}\n\nvoid ImGui::PushTextWrapPos(float wrap_pos_x)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.TextWrapPos = wrap_pos_x;\n\twindow->DC.TextWrapPosStack.push_back(wrap_pos_x);\n}\n\nvoid ImGui::PopTextWrapPos()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.TextWrapPosStack.pop_back();\n\twindow->DC.TextWrapPos = window->DC.TextWrapPosStack.empty() ? -1.0f : window->DC.TextWrapPosStack.back();\n}\n\n// FIXME: This may incur a round-trip (if the end user got their data from a float4) but eventually we aim to store the in-flight colors as ImU32\nvoid ImGui::PushStyleColor(ImGuiCol idx, ImU32 col)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiColMod backup;\n\tbackup.Col = idx;\n\tbackup.BackupValue = g.Style.Colors[idx];\n\tg.ColorModifiers.push_back(backup);\n\tg.Style.Colors[idx] = ColorConvertU32ToFloat4(col);\n}\n\nvoid ImGui::PushStyleColor(ImGuiCol idx, const ImVec4& col)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiColMod backup;\n\tbackup.Col = idx;\n\tbackup.BackupValue = g.Style.Colors[idx];\n\tg.ColorModifiers.push_back(backup);\n\tg.Style.Colors[idx] = col;\n}\n\nvoid ImGui::PopStyleColor(int count)\n{\n\tImGuiContext& g = *GImGui;\n\twhile (count > 0)\n\t{\n\t\tImGuiColMod& backup = g.ColorModifiers.back();\n\t\tg.Style.Colors[backup.Col] = backup.BackupValue;\n\t\tg.ColorModifiers.pop_back();\n\t\tcount--;\n\t}\n}\n\nstruct ImGuiStyleVarInfo\n{\n\tImGuiDataType   Type;\n\tImU32           Offset;\n\tvoid* GetVarPtr(ImGuiStyle* style) const { return (void*)((unsigned char*)style + Offset); }\n};\n\nstatic const ImGuiStyleVarInfo GStyleVarInfo[ImGuiStyleVar_Count_] =\n{\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, Alpha) },                // ImGuiStyleVar_Alpha\n\t{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowPadding) },        // ImGuiStyleVar_WindowPadding\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, WindowRounding) },       // ImGuiStyleVar_WindowRounding\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, WindowBorderSize) },     // ImGuiStyleVar_WindowBorderSize\n\t{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, WindowMinSize) },        // ImGuiStyleVar_WindowMinSize\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, ChildRounding) },        // ImGuiStyleVar_ChildRounding\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, ChildBorderSize) },      // ImGuiStyleVar_ChildBorderSize\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, PopupRounding) },        // ImGuiStyleVar_PopupRounding\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, PopupBorderSize) },      // ImGuiStyleVar_PopupBorderSize\n\t{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, FramePadding) },         // ImGuiStyleVar_FramePadding\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, FrameRounding) },        // ImGuiStyleVar_FrameRounding\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, FrameBorderSize) },      // ImGuiStyleVar_FrameBorderSize\n\t{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemSpacing) },          // ImGuiStyleVar_ItemSpacing\n\t{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ItemInnerSpacing) },     // ImGuiStyleVar_ItemInnerSpacing\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, IndentSpacing) },        // ImGuiStyleVar_IndentSpacing\n\t{ ImGuiDataType_Float,  (ImU32)IM_OFFSETOF(ImGuiStyle, GrabMinSize) },          // ImGuiStyleVar_GrabMinSize\n\t{ ImGuiDataType_Float2, (ImU32)IM_OFFSETOF(ImGuiStyle, ButtonTextAlign) },      // ImGuiStyleVar_ButtonTextAlign\n};\n\nstatic const ImGuiStyleVarInfo* GetStyleVarInfo(ImGuiStyleVar idx)\n{\n\tIM_ASSERT(idx >= 0 && idx < ImGuiStyleVar_Count_);\n\treturn &GStyleVarInfo[idx];\n}\n\nvoid ImGui::PushStyleVar(ImGuiStyleVar idx, float val)\n{\n\tconst ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);\n\tif (var_info->Type == ImGuiDataType_Float)\n\t{\n\t\tImGuiContext& g = *GImGui;\n\t\tfloat* pvar = (float*)var_info->GetVarPtr(&g.Style);\n\t\tg.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));\n\t\t*pvar = val;\n\t\treturn;\n\t}\n\tIM_ASSERT(0); // Called function with wrong-type? Variable is not a float.\n}\n\nvoid ImGui::PushStyleVar(ImGuiStyleVar idx, const ImVec2& val)\n{\n\tconst ImGuiStyleVarInfo* var_info = GetStyleVarInfo(idx);\n\tif (var_info->Type == ImGuiDataType_Float2)\n\t{\n\t\tImGuiContext& g = *GImGui;\n\t\tImVec2* pvar = (ImVec2*)var_info->GetVarPtr(&g.Style);\n\t\tg.StyleModifiers.push_back(ImGuiStyleMod(idx, *pvar));\n\t\t*pvar = val;\n\t\treturn;\n\t}\n\tIM_ASSERT(0); // Called function with wrong-type? Variable is not a ImVec2.\n}\n\nvoid ImGui::PopStyleVar(int count)\n{\n\tImGuiContext& g = *GImGui;\n\twhile (count > 0)\n\t{\n\t\tImGuiStyleMod& backup = g.StyleModifiers.back();\n\t\tconst ImGuiStyleVarInfo* info = GetStyleVarInfo(backup.VarIdx);\n\t\tif (info->Type == ImGuiDataType_Float)          (*(float*)info->GetVarPtr(&g.Style)) = backup.BackupFloat[0];\n\t\telse if (info->Type == ImGuiDataType_Float2)    (*(ImVec2*)info->GetVarPtr(&g.Style)) = ImVec2(backup.BackupFloat[0], backup.BackupFloat[1]);\n\t\telse if (info->Type == ImGuiDataType_Int)       (*(int*)info->GetVarPtr(&g.Style)) = backup.BackupInt[0];\n\t\tg.StyleModifiers.pop_back();\n\t\tcount--;\n\t}\n}\n\nconst char* ImGui::GetStyleColorName(ImGuiCol idx)\n{\n\t// Create switch-case from enum with regexp: ImGuiCol_{.*}, --> case ImGuiCol_\\1: return \"\\1\";\n\tswitch (idx)\n\t{\n\tcase ImGuiCol_Text: return \"Text\";\n\tcase ImGuiCol_TextDisabled: return \"TextDisabled\";\n\tcase ImGuiCol_WindowBg: return \"WindowBg\";\n\tcase ImGuiCol_ChildBg: return \"ChildBg\";\n\tcase ImGuiCol_PopupBg: return \"PopupBg\";\n\tcase ImGuiCol_Border: return \"Border\";\n\tcase ImGuiCol_BorderShadow: return \"BorderShadow\";\n\tcase ImGuiCol_FrameBg: return \"FrameBg\";\n\tcase ImGuiCol_FrameBgHovered: return \"FrameBgHovered\";\n\tcase ImGuiCol_FrameBgActive: return \"FrameBgActive\";\n\tcase ImGuiCol_TitleBg: return \"TitleBg\";\n\tcase ImGuiCol_TitleBgActive: return \"TitleBgActive\";\n\tcase ImGuiCol_TitleBgCollapsed: return \"TitleBgCollapsed\";\n\tcase ImGuiCol_MenuBarBg: return \"MenuBarBg\";\n\tcase ImGuiCol_ScrollbarBg: return \"ScrollbarBg\";\n\tcase ImGuiCol_ScrollbarGrab: return \"ScrollbarGrab\";\n\tcase ImGuiCol_ScrollbarGrabHovered: return \"ScrollbarGrabHovered\";\n\tcase ImGuiCol_ScrollbarGrabActive: return \"ScrollbarGrabActive\";\n\tcase ImGuiCol_CheckMark: return \"CheckMark\";\n\tcase ImGuiCol_SliderGrab: return \"SliderGrab\";\n\tcase ImGuiCol_SliderGrabActive: return \"SliderGrabActive\";\n\tcase ImGuiCol_Button: return \"Button\";\n\tcase ImGuiCol_ButtonHovered: return \"ButtonHovered\";\n\tcase ImGuiCol_ButtonActive: return \"ButtonActive\";\n\tcase ImGuiCol_Header: return \"Header\";\n\tcase ImGuiCol_HeaderHovered: return \"HeaderHovered\";\n\tcase ImGuiCol_HeaderActive: return \"HeaderActive\";\n\tcase ImGuiCol_Separator: return \"Separator\";\n\tcase ImGuiCol_SeparatorHovered: return \"SeparatorHovered\";\n\tcase ImGuiCol_SeparatorActive: return \"SeparatorActive\";\n\tcase ImGuiCol_ResizeGrip: return \"ResizeGrip\";\n\tcase ImGuiCol_ResizeGripHovered: return \"ResizeGripHovered\";\n\tcase ImGuiCol_ResizeGripActive: return \"ResizeGripActive\";\n\tcase ImGuiCol_CloseButton: return \"CloseButton\";\n\tcase ImGuiCol_CloseButtonHovered: return \"CloseButtonHovered\";\n\tcase ImGuiCol_CloseButtonActive: return \"CloseButtonActive\";\n\tcase ImGuiCol_PlotLines: return \"PlotLines\";\n\tcase ImGuiCol_PlotLinesHovered: return \"PlotLinesHovered\";\n\tcase ImGuiCol_PlotHistogram: return \"PlotHistogram\";\n\tcase ImGuiCol_PlotHistogramHovered: return \"PlotHistogramHovered\";\n\tcase ImGuiCol_TextSelectedBg: return \"TextSelectedBg\";\n\tcase ImGuiCol_ModalWindowDarkening: return \"ModalWindowDarkening\";\n\tcase ImGuiCol_DragDropTarget: return \"DragDropTarget\";\n\t}\n\tIM_ASSERT(0);\n\treturn \"Unknown\";\n}\n\nbool ImGui::IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent)\n{\n\tif (window->RootWindow == potential_parent)\n\t\treturn true;\n\twhile (window != NULL)\n\t{\n\t\tif (window == potential_parent)\n\t\t\treturn true;\n\t\twindow = window->ParentWindow;\n\t}\n\treturn false;\n}\n\nbool ImGui::IsWindowHovered(ImGuiHoveredFlags flags)\n{\n\tIM_ASSERT((flags & ImGuiHoveredFlags_AllowWhenOverlapped) == 0);   // Flags not supported by this function\n\tImGuiContext& g = *GImGui;\n\n\tif (flags & ImGuiHoveredFlags_AnyWindow)\n\t{\n\t\tif (g.HoveredWindow == NULL)\n\t\t\treturn false;\n\t}\n\telse\n\t{\n\t\tswitch (flags & (ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows))\n\t\t{\n\t\tcase ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows:\n\t\t\tif (g.HoveredRootWindow != g.CurrentWindow->RootWindow)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\tcase ImGuiHoveredFlags_RootWindow:\n\t\t\tif (g.HoveredWindow != g.CurrentWindow->RootWindow)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\tcase ImGuiHoveredFlags_ChildWindows:\n\t\t\tif (g.HoveredWindow == NULL || !IsWindowChildOf(g.HoveredWindow, g.CurrentWindow))\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif (g.HoveredWindow != g.CurrentWindow)\n\t\t\t\treturn false;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (!IsWindowContentHoverable(g.HoveredRootWindow, flags))\n\t\treturn false;\n\tif (!(flags & ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))\n\t\tif (g.ActiveId != 0 && !g.ActiveIdAllowOverlap && g.ActiveId != g.HoveredWindow->MoveId)\n\t\t\treturn false;\n\treturn true;\n}\n\nbool ImGui::IsWindowFocused(ImGuiFocusedFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(g.CurrentWindow);     // Not inside a Begin()/End()\n\n\tif (flags & ImGuiFocusedFlags_AnyWindow)\n\t\treturn g.NavWindow != NULL;\n\n\tswitch (flags & (ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows))\n\t{\n\tcase ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows:\n\t\treturn g.NavWindow && g.NavWindow->RootWindow == g.CurrentWindow->RootWindow;\n\tcase ImGuiFocusedFlags_RootWindow:\n\t\treturn g.NavWindow == g.CurrentWindow->RootWindow;\n\tcase ImGuiFocusedFlags_ChildWindows:\n\t\treturn g.NavWindow && IsWindowChildOf(g.NavWindow, g.CurrentWindow);\n\tdefault:\n\t\treturn g.NavWindow == g.CurrentWindow;\n\t}\n}\n\nfloat ImGui::GetWindowWidth()\n{\n\tImGuiWindow* window = GImGui->CurrentWindow;\n\treturn window->Size.x;\n}\n\nfloat ImGui::GetWindowHeight()\n{\n\tImGuiWindow* window = GImGui->CurrentWindow;\n\treturn window->Size.y;\n}\n\nImVec2 ImGui::GetWindowPos()\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\treturn window->Pos;\n}\n\nstatic void SetWindowScrollY(ImGuiWindow* window, float new_scroll_y)\n{\n\twindow->DC.CursorMaxPos.y += window->Scroll.y; // SizeContents is generally computed based on CursorMaxPos which is affected by scroll position, so we need to apply our change to it.\n\twindow->Scroll.y = new_scroll_y;\n\twindow->DC.CursorMaxPos.y -= window->Scroll.y;\n}\n\nstatic void SetWindowPos(ImGuiWindow* window, const ImVec2& pos, ImGuiCond cond)\n{\n\t// Test condition (NB: bit 0 is always true) and clear flags for next time\n\tif (cond && (window->SetWindowPosAllowFlags & cond) == 0)\n\t\treturn;\n\twindow->SetWindowPosAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n\twindow->SetWindowPosVal = ImVec2(FLT_MAX, FLT_MAX);\n\n\t// Set\n\tconst ImVec2 old_pos = window->Pos;\n\twindow->PosFloat = pos;\n\twindow->Pos = ImFloor(pos);\n\twindow->DC.CursorPos += (window->Pos - old_pos);    // As we happen to move the window while it is being appended to (which is a bad idea - will smear) let's at least offset the cursor\n\twindow->DC.CursorMaxPos += (window->Pos - old_pos); // And more importantly we need to adjust this so size calculation doesn't get affected.\n}\n\nvoid ImGui::SetWindowPos(const ImVec2& pos, ImGuiCond cond)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tSetWindowPos(window, pos, cond);\n}\n\nvoid ImGui::SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond)\n{\n\tif (ImGuiWindow* window = FindWindowByName(name))\n\t\tSetWindowPos(window, pos, cond);\n}\n\nImVec2 ImGui::GetWindowSize()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->Size;\n}\n\nstatic void SetWindowSize(ImGuiWindow* window, const ImVec2& size, ImGuiCond cond)\n{\n\t// Test condition (NB: bit 0 is always true) and clear flags for next time\n\tif (cond && (window->SetWindowSizeAllowFlags & cond) == 0)\n\t\treturn;\n\twindow->SetWindowSizeAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n\n\t// Set\n\tif (size.x > 0.0f)\n\t{\n\t\twindow->AutoFitFramesX = 0;\n\t\twindow->SizeFull.x = size.x;\n\t}\n\telse\n\t{\n\t\twindow->AutoFitFramesX = 2;\n\t\twindow->AutoFitOnlyGrows = false;\n\t}\n\tif (size.y > 0.0f)\n\t{\n\t\twindow->AutoFitFramesY = 0;\n\t\twindow->SizeFull.y = size.y;\n\t}\n\telse\n\t{\n\t\twindow->AutoFitFramesY = 2;\n\t\twindow->AutoFitOnlyGrows = false;\n\t}\n}\n\nvoid ImGui::SetWindowSize(const ImVec2& size, ImGuiCond cond)\n{\n\tSetWindowSize(GImGui->CurrentWindow, size, cond);\n}\n\nvoid ImGui::SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond)\n{\n\tif (ImGuiWindow* window = FindWindowByName(name))\n\t\tSetWindowSize(window, size, cond);\n}\n\nstatic void SetWindowCollapsed(ImGuiWindow* window, bool collapsed, ImGuiCond cond)\n{\n\t// Test condition (NB: bit 0 is always true) and clear flags for next time\n\tif (cond && (window->SetWindowCollapsedAllowFlags & cond) == 0)\n\t\treturn;\n\twindow->SetWindowCollapsedAllowFlags &= ~(ImGuiCond_Once | ImGuiCond_FirstUseEver | ImGuiCond_Appearing);\n\n\t// Set\n\twindow->Collapsed = collapsed;\n}\n\nvoid ImGui::SetWindowCollapsed(bool collapsed, ImGuiCond cond)\n{\n\tSetWindowCollapsed(GImGui->CurrentWindow, collapsed, cond);\n}\n\nbool ImGui::IsWindowCollapsed()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->Collapsed;\n}\n\nbool ImGui::IsWindowAppearing()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->Appearing;\n}\n\nvoid ImGui::SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond)\n{\n\tif (ImGuiWindow* window = FindWindowByName(name))\n\t\tSetWindowCollapsed(window, collapsed, cond);\n}\n\nvoid ImGui::SetWindowFocus()\n{\n\tFocusWindow(GImGui->CurrentWindow);\n}\n\nvoid ImGui::SetWindowFocus(const char* name)\n{\n\tif (name)\n\t{\n\t\tif (ImGuiWindow* window = FindWindowByName(name))\n\t\t\tFocusWindow(window);\n\t}\n\telse\n\t{\n\t\tFocusWindow(NULL);\n\t}\n}\n\nvoid ImGui::SetNextWindowPos(const ImVec2& pos, ImGuiCond cond, const ImVec2& pivot)\n{\n\tImGuiContext& g = *GImGui;\n\tg.NextWindowData.PosVal = pos;\n\tg.NextWindowData.PosPivotVal = pivot;\n\tg.NextWindowData.PosCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowSize(const ImVec2& size, ImGuiCond cond)\n{\n\tImGuiContext& g = *GImGui;\n\tg.NextWindowData.SizeVal = size;\n\tg.NextWindowData.SizeCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback, void* custom_callback_user_data)\n{\n\tImGuiContext& g = *GImGui;\n\tg.NextWindowData.SizeConstraintCond = ImGuiCond_Always;\n\tg.NextWindowData.SizeConstraintRect = ImRect(size_min, size_max);\n\tg.NextWindowData.SizeCallback = custom_callback;\n\tg.NextWindowData.SizeCallbackUserData = custom_callback_user_data;\n}\n\nvoid ImGui::SetNextWindowContentSize(const ImVec2& size)\n{\n\tImGuiContext& g = *GImGui;\n\tg.NextWindowData.ContentSizeVal = size;  // In Begin() we will add the size of window decorations (title bar, menu etc.) to that to form a SizeContents value.\n\tg.NextWindowData.ContentSizeCond = ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowCollapsed(bool collapsed, ImGuiCond cond)\n{\n\tImGuiContext& g = *GImGui;\n\tg.NextWindowData.CollapsedVal = collapsed;\n\tg.NextWindowData.CollapsedCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::SetNextWindowFocus()\n{\n\tImGuiContext& g = *GImGui;\n\tg.NextWindowData.FocusCond = ImGuiCond_Always;\n}\n\n// In window space (not screen space!)\nImVec2 ImGui::GetContentRegionMax()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tImVec2 mx = window->ContentsRegionRect.Max;\n\tif (window->DC.ColumnsSet)\n\t\tmx.x = GetColumnOffset(window->DC.ColumnsSet->Current + 1) - window->WindowPadding.x;\n\treturn mx;\n}\n\nImVec2 ImGui::GetContentRegionAvail()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn GetContentRegionMax() - (window->DC.CursorPos - window->Pos);\n}\n\nfloat ImGui::GetContentRegionAvailWidth()\n{\n\treturn GetContentRegionAvail().x;\n}\n\n// In window space (not screen space!)\nImVec2 ImGui::GetWindowContentRegionMin()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->ContentsRegionRect.Min;\n}\n\nImVec2 ImGui::GetWindowContentRegionMax()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->ContentsRegionRect.Max;\n}\n\nfloat ImGui::GetWindowContentRegionWidth()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->ContentsRegionRect.Max.x - window->ContentsRegionRect.Min.x;\n}\n\nfloat ImGui::GetTextLineHeight()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.FontSize;\n}\n\nfloat ImGui::GetTextLineHeightWithSpacing()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.FontSize + g.Style.ItemSpacing.y;\n}\n\nfloat ImGui::GetFrameHeight()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.FontSize + g.Style.FramePadding.y * 2.0f;\n}\n\nfloat ImGui::GetFrameHeightWithSpacing()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.FontSize + g.Style.FramePadding.y * 2.0f + g.Style.ItemSpacing.y;\n}\n\nImDrawList* ImGui::GetWindowDrawList()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\treturn window->DrawList;\n}\n\nImFont* ImGui::GetFont()\n{\n\treturn GImGui->Font;\n}\n\nfloat ImGui::GetFontSize()\n{\n\treturn GImGui->FontSize;\n}\n\nImVec2 ImGui::GetFontTexUvWhitePixel()\n{\n\treturn GImGui->DrawListSharedData.TexUvWhitePixel;\n}\n\nvoid ImGui::SetWindowFontScale(float scale)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->FontWindowScale = scale;\n\tg.FontSize = g.DrawListSharedData.FontSize = window->CalcFontSize();\n}\n\n// User generally sees positions in window coordinates. Internally we store CursorPos in absolute screen coordinates because it is more convenient.\n// Conversion happens as we pass the value to user, but it makes our naming convention confusing because GetCursorPos() == (DC.CursorPos - window.Pos). May want to rename 'DC.CursorPos'.\nImVec2 ImGui::GetCursorPos()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.CursorPos - window->Pos + window->Scroll;\n}\n\nfloat ImGui::GetCursorPosX()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.CursorPos.x - window->Pos.x + window->Scroll.x;\n}\n\nfloat ImGui::GetCursorPosY()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.CursorPos.y - window->Pos.y + window->Scroll.y;\n}\n\nvoid ImGui::SetCursorPos(const ImVec2& local_pos)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.CursorPos = window->Pos - window->Scroll + local_pos;\n\twindow->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);\n}\n\nvoid ImGui::SetCursorPosX(float x)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.CursorPos.x = window->Pos.x - window->Scroll.x + x;\n\twindow->DC.CursorMaxPos.x = ImMax(window->DC.CursorMaxPos.x, window->DC.CursorPos.x);\n}\n\nvoid ImGui::SetCursorPosY(float y)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.CursorPos.y = window->Pos.y - window->Scroll.y + y;\n\twindow->DC.CursorMaxPos.y = ImMax(window->DC.CursorMaxPos.y, window->DC.CursorPos.y);\n}\n\nint ImGui::FindKeybind(int s1)\n{\n\tif (s1 == 0)\n\t\ts1 = 0x2D;\n\telse if (s1 == 1)\n\t\ts1 = 0x14;\n\telse if (s1 == 2)\n\t\ts1 = 0x09;\n\telse if (s1 == 3)\n\t\ts1 = 0x12;\n\telse if (s1 == 4)\n\t\ts1 = 0xA0;\n\telse if (s1 == 5)\n\t\ts1 = 0xA1;\n\telse if (s1 == 6)\n\t\ts1 = 0xA2;\n\telse if (s1 == 7)\n\t\ts1 = 0xA3;\n\telse if (s1 == 8)\n\t\ts1 = 0xBD;\n\telse if (s1 == 9)\n\t\ts1 = 0xBB;\n\telse if (s1 == 10)\n\t\ts1 = 0x70;\n\telse if (s1 == 11)\n\t\ts1 = 0x71;\n\telse if (s1 == 12)\n\t\ts1 = 0x72;\n\telse if (s1 == 13)\n\t\ts1 = 0x73;\n\telse if (s1 == 14)\n\t\ts1 = 0x74;\n\telse if (s1 == 15)\n\t\ts1 = 0x75;\n\telse if (s1 == 16)\n\t\ts1 = 0x76;\n\telse if (s1 == 17)\n\t\ts1 = 0x77;\n\telse if (s1 == 18)\n\t\ts1 = 0x78;\n\telse if (s1 == 19)\n\t\ts1 = 0x79;\n\telse if (s1 == 20)\n\t\ts1 = 0x7A;\n\telse if (s1 == 21)\n\t\ts1 = 0x7B;\n\telse if (s1 == 22)\n\t\ts1 = 0x01;\n\telse if (s1 == 23)\n\t\ts1 = 0x02;\n\telse if (s1 == 24)\n\t\ts1 = 0x04;\n\n\treturn s1;\n}\n\nImVec2 ImGui::GetCursorStartPos()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.CursorStartPos - window->Pos;\n}\n\nImVec2 ImGui::GetCursorScreenPos()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.CursorPos;\n}\n\nvoid ImGui::SetCursorScreenPos(const ImVec2& screen_pos)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.CursorPos = screen_pos;\n\twindow->DC.CursorMaxPos = ImMax(window->DC.CursorMaxPos, window->DC.CursorPos);\n}\n\nfloat ImGui::GetScrollX()\n{\n\treturn GImGui->CurrentWindow->Scroll.x;\n}\n\nfloat ImGui::GetScrollY()\n{\n\treturn GImGui->CurrentWindow->Scroll.y;\n}\n\nfloat ImGui::GetScrollMaxX()\n{\n\treturn GetScrollMaxX(GImGui->CurrentWindow);\n}\n\nfloat ImGui::GetScrollMaxY()\n{\n\treturn GetScrollMaxY(GImGui->CurrentWindow);\n}\n\nvoid ImGui::SetScrollX(float scroll_x)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->ScrollTarget.x = scroll_x;\n\twindow->ScrollTargetCenterRatio.x = 0.0f;\n}\n\nvoid ImGui::SetScrollY(float scroll_y)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->ScrollTarget.y = scroll_y + window->TitleBarHeight() + window->MenuBarHeight(); // title bar height canceled out when using ScrollTargetRelY\n\twindow->ScrollTargetCenterRatio.y = 0.0f;\n}\n\nvoid ImGui::SetScrollFromPosY(float pos_y, float center_y_ratio)\n{\n\t// We store a target position so centering can occur on the next frame when we are guaranteed to have a known window size\n\tImGuiWindow* window = GetCurrentWindow();\n\tIM_ASSERT(center_y_ratio >= 0.0f && center_y_ratio <= 1.0f);\n\twindow->ScrollTarget.y = (float)(int)(pos_y + window->Scroll.y);\n\twindow->ScrollTargetCenterRatio.y = center_y_ratio;\n\n\t// Minor hack to to make scrolling to top/bottom of window take account of WindowPadding, it looks more right to the user this way\n\tif (center_y_ratio <= 0.0f && window->ScrollTarget.y <= window->WindowPadding.y)\n\t\twindow->ScrollTarget.y = 0.0f;\n\telse if (center_y_ratio >= 1.0f && window->ScrollTarget.y >= window->SizeContents.y - window->WindowPadding.y + GImGui->Style.ItemSpacing.y)\n\t\twindow->ScrollTarget.y = window->SizeContents.y;\n}\n\n// center_y_ratio: 0.0f top of last item, 0.5f vertical center of last item, 1.0f bottom of last item.\nvoid ImGui::SetScrollHere(float center_y_ratio)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tfloat target_y = window->DC.CursorPosPrevLine.y - window->Pos.y; // Top of last item, in window space\n\ttarget_y += (window->DC.PrevLineHeight * center_y_ratio) + (GImGui->Style.ItemSpacing.y * (center_y_ratio - 0.5f) * 2.0f); // Precisely aim above, in the middle or below the last line.\n\tSetScrollFromPosY(target_y, center_y_ratio);\n}\n\n// FIXME-NAV: This function is a placeholder for the upcoming Navigation branch + Focusing features.\n// In the current branch this function will only set the scrolling, in the navigation branch it will also set your navigation cursor.\n// Prefer using \"SetItemDefaultFocus()\" over \"if (IsWindowAppearing()) SetScrollHere()\" when applicable.\nvoid ImGui::SetItemDefaultFocus()\n{\n\tif (IsWindowAppearing())\n\t\tSetScrollHere();\n}\n\nvoid ImGui::SetKeyboardFocusHere(int offset)\n{\n\tIM_ASSERT(offset >= -1);    // -1 is allowed but not below\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->FocusIdxAllRequestNext = window->FocusIdxAllCounter + 1 + offset;\n\twindow->FocusIdxTabRequestNext = INT_MAX;\n}\n\nvoid ImGui::SetStateStorage(ImGuiStorage* tree)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.StateStorage = tree ? tree : &window->StateStorage;\n}\n\nImGuiStorage* ImGui::GetStateStorage()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.StateStorage;\n}\n\nvoid ImGui::TextV(const char* fmt, va_list args)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst char* text_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n\tTextUnformatted(g.TempBuffer, text_end);\n}\n\nvoid ImGui::Text(const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tTextV(fmt, args);\n\tva_end(args);\n}\n\nvoid ImGui::TextColoredV(const ImVec4& col, const char* fmt, va_list args)\n{\n\tPushStyleColor(ImGuiCol_Text, col);\n\tTextV(fmt, args);\n\tPopStyleColor();\n}\n\nvoid ImGui::TextColored(const ImVec4& col, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tTextColoredV(col, fmt, args);\n\tva_end(args);\n}\n\nvoid ImGui::TextDisabledV(const char* fmt, va_list args)\n{\n\tPushStyleColor(ImGuiCol_Text, GImGui->Style.Colors[ImGuiCol_TextDisabled]);\n\tTextV(fmt, args);\n\tPopStyleColor();\n}\n\nvoid ImGui::TextDisabled(const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tTextDisabledV(fmt, args);\n\tva_end(args);\n}\n\nvoid ImGui::TextWrappedV(const char* fmt, va_list args)\n{\n\tbool need_wrap = (GImGui->CurrentWindow->DC.TextWrapPos < 0.0f);    // Keep existing wrap position is one ia already set\n\tif (need_wrap) PushTextWrapPos(0.0f);\n\tTextV(fmt, args);\n\tif (need_wrap) PopTextWrapPos();\n}\n\nvoid ImGui::TextWrapped(const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tTextWrappedV(fmt, args);\n\tva_end(args);\n}\n\nvoid ImGui::TextUnformatted(const char* text, const char* text_end)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(text != NULL);\n\tconst char* text_begin = text;\n\tif (text_end == NULL)\n\t\ttext_end = text + strlen(text); // FIXME-OPT\n\n\tconst ImVec2 text_pos(window->DC.CursorPos.x, window->DC.CursorPos.y + window->DC.CurrentLineTextBaseOffset);\n\tconst float wrap_pos_x = window->DC.TextWrapPos;\n\tconst bool wrap_enabled = wrap_pos_x >= 0.0f;\n\tif (text_end - text > 2000 && !wrap_enabled)\n\t{\n\t\t// Long text!\n\t\t// Perform manual coarse clipping to optimize for long multi-line text\n\t\t// From this point we will only compute the width of lines that are visible. Optimization only available when word-wrapping is disabled.\n\t\t// We also don't vertically center the text within the line full height, which is unlikely to matter because we are likely the biggest and only item on the line.\n\t\tconst char* line = text;\n\t\tconst float line_height = GetTextLineHeight();\n\t\tconst ImRect clip_rect = window->ClipRect;\n\t\tImVec2 text_size(0, 0);\n\n\t\tif (text_pos.y <= clip_rect.Max.y)\n\t\t{\n\t\t\tImVec2 pos = text_pos;\n\n\t\t\t// Lines to skip (can't skip when logging text)\n\t\t\tif (!g.LogEnabled)\n\t\t\t{\n\t\t\t\tint lines_skippable = (int)((clip_rect.Min.y - text_pos.y) / line_height);\n\t\t\t\tif (lines_skippable > 0)\n\t\t\t\t{\n\t\t\t\t\tint lines_skipped = 0;\n\t\t\t\t\twhile (line < text_end && lines_skipped < lines_skippable)\n\t\t\t\t\t{\n\t\t\t\t\t\tconst char* line_end = strchr(line, '\\n');\n\t\t\t\t\t\tif (!line_end)\n\t\t\t\t\t\t\tline_end = text_end;\n\t\t\t\t\t\tline = line_end + 1;\n\t\t\t\t\t\tlines_skipped++;\n\t\t\t\t\t}\n\t\t\t\t\tpos.y += lines_skipped * line_height;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Lines to render\n\t\t\tif (line < text_end)\n\t\t\t{\n\t\t\t\tImRect line_rect(pos, pos + ImVec2(FLT_MAX, line_height));\n\t\t\t\twhile (line < text_end)\n\t\t\t\t{\n\t\t\t\t\tconst char* line_end = strchr(line, '\\n');\n\t\t\t\t\tif (IsClippedEx(line_rect, 0, false))\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tconst ImVec2 line_size = CalcTextSize(line, line_end, false);\n\t\t\t\t\ttext_size.x = ImMax(text_size.x, line_size.x);\n\t\t\t\t\tRenderText(pos, line, line_end, false);\n\t\t\t\t\tif (!line_end)\n\t\t\t\t\t\tline_end = text_end;\n\t\t\t\t\tline = line_end + 1;\n\t\t\t\t\tline_rect.Min.y += line_height;\n\t\t\t\t\tline_rect.Max.y += line_height;\n\t\t\t\t\tpos.y += line_height;\n\t\t\t\t}\n\n\t\t\t\t// Count remaining lines\n\t\t\t\tint lines_skipped = 0;\n\t\t\t\twhile (line < text_end)\n\t\t\t\t{\n\t\t\t\t\tconst char* line_end = strchr(line, '\\n');\n\t\t\t\t\tif (!line_end)\n\t\t\t\t\t\tline_end = text_end;\n\t\t\t\t\tline = line_end + 1;\n\t\t\t\t\tlines_skipped++;\n\t\t\t\t}\n\t\t\t\tpos.y += lines_skipped * line_height;\n\t\t\t}\n\n\t\t\ttext_size.y += (pos - text_pos).y;\n\t\t}\n\n\t\tImRect bb(text_pos, text_pos + text_size);\n\t\tItemSize(bb);\n\t\tItemAdd(bb, 0);\n\t}\n\telse\n\t{\n\t\tconst float wrap_width = wrap_enabled ? CalcWrapWidthForPos(window->DC.CursorPos, wrap_pos_x) : 0.0f;\n\t\tconst ImVec2 text_size = CalcTextSize(text_begin, text_end, false, wrap_width);\n\n\t\t// Account of baseline offset\n\t\tImRect bb(text_pos, text_pos + text_size);\n\t\tItemSize(text_size);\n\t\tif (!ItemAdd(bb, 0))\n\t\t\treturn;\n\n\t\t// Render (we don't hide text after ## in this end-user function)\n\t\tRenderTextWrapped(bb.Min, text_begin, text_end, wrap_width);\n\t}\n}\n\nvoid ImGui::AlignTextToFramePadding()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\twindow->DC.CurrentLineHeight = ImMax(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y * 2);\n\twindow->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y);\n}\n\n// Add a label+text combo aligned to other label+value widgets\nvoid ImGui::LabelTextV(const char* label, const char* fmt, va_list args)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst float w = CalcItemWidth();\n\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tconst ImRect value_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2));\n\tconst ImRect total_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w + (label_size.x > 0.0f ? style.ItemInnerSpacing.x : 0.0f), style.FramePadding.y * 2) + label_size);\n\tItemSize(total_bb, style.FramePadding.y);\n\tif (!ItemAdd(total_bb, 0))\n\t\treturn;\n\n\t// Render\n\tconst char* value_text_begin = &g.TempBuffer[0];\n\tconst char* value_text_end = value_text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n\tRenderTextClipped(value_bb.Min, value_bb.Max, value_text_begin, value_text_end, NULL, ImVec2(0.0f, 0.5f));\n\tif (label_size.x > 0.0f)\n\t\tRenderText(ImVec2(value_bb.Max.x + style.ItemInnerSpacing.x, value_bb.Min.y + style.FramePadding.y), label);\n}\n\nvoid ImGui::LabelText(const char* label, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tLabelTextV(label, fmt, args);\n\tva_end(args);\n}\n\nbool ImGui::ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\n\tif (flags & ImGuiButtonFlags_Disabled)\n\t{\n\t\tif (out_hovered) *out_hovered = false;\n\t\tif (out_held) *out_held = false;\n\t\tif (g.ActiveId == id) ClearActiveID();\n\t\treturn false;\n\t}\n\n\t// Default behavior requires click+release on same spot\n\tif ((flags & (ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_PressedOnRelease | ImGuiButtonFlags_PressedOnDoubleClick)) == 0)\n\t\tflags |= ImGuiButtonFlags_PressedOnClickRelease;\n\n\tImGuiWindow* backup_hovered_window = g.HoveredWindow;\n\tif ((flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window)\n\t\tg.HoveredWindow = window;\n\n\tbool pressed = false;\n\tbool hovered = ItemHoverable(bb, id);\n\n\t// Special mode for Drag and Drop where holding button pressed for a long time while dragging another item triggers the button\n\tif ((flags & ImGuiButtonFlags_PressedOnDragDropHold) && g.DragDropActive && !(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoHoldToOpenOthers))\n\t\tif (IsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))\n\t\t{\n\t\t\thovered = true;\n\t\t\tSetHoveredID(id);\n\t\t\tif (CalcTypematicPressedRepeatAmount(g.HoveredIdTimer + 0.0001f, g.HoveredIdTimer + 0.0001f - g.IO.DeltaTime, 0.01f, 0.70f)) // FIXME: Our formula for CalcTypematicPressedRepeatAmount() is fishy\n\t\t\t{\n\t\t\t\tpressed = true;\n\t\t\t\tFocusWindow(window);\n\t\t\t}\n\t\t}\n\n\tif ((flags & ImGuiButtonFlags_FlattenChildren) && g.HoveredRootWindow == window)\n\t\tg.HoveredWindow = backup_hovered_window;\n\n\t// AllowOverlap mode (rarely used) requires previous frame HoveredId to be null or to match. This allows using patterns where a later submitted widget overlaps a previous one.\n\tif (hovered && (flags & ImGuiButtonFlags_AllowItemOverlap) && (g.HoveredIdPreviousFrame != id && g.HoveredIdPreviousFrame != 0))\n\t\thovered = false;\n\n\tif (hovered)\n\t{\n\t\tif (!(flags & ImGuiButtonFlags_NoKeyModifiers) || (!g.IO.KeyCtrl && !g.IO.KeyShift && !g.IO.KeyAlt))\n\t\t{\n\t\t\t//                        | CLICKING        | HOLDING with ImGuiButtonFlags_Repeat\n\t\t\t// PressedOnClickRelease  |  <on release>*  |  <on repeat> <on repeat> .. (NOT on release)  <-- MOST COMMON! (*) only if both click/release were over bounds\n\t\t\t// PressedOnClick         |  <on click>     |  <on click> <on repeat> <on repeat> ..\n\t\t\t// PressedOnRelease       |  <on release>   |  <on repeat> <on repeat> .. (NOT on release)\n\t\t\t// PressedOnDoubleClick   |  <on dclick>    |  <on dclick> <on repeat> <on repeat> ..\n\t\t\tif ((flags & ImGuiButtonFlags_PressedOnClickRelease) && g.IO.MouseClicked[0])\n\t\t\t{\n\t\t\t\tSetActiveID(id, window); // Hold on ID\n\t\t\t\tFocusWindow(window);\n\t\t\t}\n\t\t\tif (((flags & ImGuiButtonFlags_PressedOnClick) && g.IO.MouseClicked[0]) || ((flags & ImGuiButtonFlags_PressedOnDoubleClick) && g.IO.MouseDoubleClicked[0]))\n\t\t\t{\n\t\t\t\tpressed = true;\n\t\t\t\tif (flags & ImGuiButtonFlags_NoHoldingActiveID)\n\t\t\t\t\tClearActiveID();\n\t\t\t\telse\n\t\t\t\t\tSetActiveID(id, window); // Hold on ID\n\t\t\t\tFocusWindow(window);\n\t\t\t}\n\t\t\tif ((flags & ImGuiButtonFlags_PressedOnRelease) && g.IO.MouseReleased[0])\n\t\t\t{\n\t\t\t\tif (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay))  // Repeat mode trumps <on release>\n\t\t\t\t\tpressed = true;\n\t\t\t\tClearActiveID();\n\t\t\t}\n\n\t\t\t// 'Repeat' mode acts when held regardless of _PressedOn flags (see table above). \n\t\t\t// Relies on repeat logic of IsMouseClicked() but we may as well do it ourselves if we end up exposing finer RepeatDelay/RepeatRate settings.\n\t\t\tif ((flags & ImGuiButtonFlags_Repeat) && g.ActiveId == id && g.IO.MouseDownDuration[0] > 0.0f && IsMouseClicked(0, true))\n\t\t\t\tpressed = true;\n\t\t}\n\t}\n\n\tbool held = false;\n\tif (g.ActiveId == id)\n\t{\n\t\tif (g.ActiveIdIsJustActivated)\n\t\t\tg.ActiveIdClickOffset = g.IO.MousePos - bb.Min;\n\t\tif (g.IO.MouseDown[0])\n\t\t{\n\t\t\theld = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tif (hovered && (flags & ImGuiButtonFlags_PressedOnClickRelease))\n\t\t\t\tif (!((flags & ImGuiButtonFlags_Repeat) && g.IO.MouseDownDurationPrev[0] >= g.IO.KeyRepeatDelay))  // Repeat mode trumps <on release>\n\t\t\t\t\tif (!g.DragDropActive)\n\t\t\t\t\t\tpressed = true;\n\t\t\tClearActiveID();\n\t\t}\n\t}\n\n\tif (out_hovered) *out_hovered = hovered;\n\tif (out_held) *out_held = held;\n\n\treturn pressed;\n}\n\nbool ImGui::ButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFlags flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\tImVec2 pos = window->DC.CursorPos;\n\tif ((flags & ImGuiButtonFlags_AlignTextBaseLine) && style.FramePadding.y < window->DC.CurrentLineTextBaseOffset) // Try to vertically align buttons that are smaller/have no padding so that text baseline matches (bit hacky, since it shouldn't be a flag)\n\t\tpos.y += window->DC.CurrentLineTextBaseOffset - style.FramePadding.y;\n\tImVec2 size = CalcItemSize(size_arg, label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);\n\n\tconst ImRect bb(pos, pos + size);\n\tItemSize(bb, style.FramePadding.y);\n\tif (!ItemAdd(bb, id))\n\t\treturn false;\n\n\tif (window->DC.ItemFlags & ImGuiItemFlags_ButtonRepeat)\n\t\tflags |= ImGuiButtonFlags_Repeat;\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);\n\n\t// Render\n\tconst ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n\tRenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);\n\tRenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.ButtonTextAlign, &bb);\n\n\t// Automatically close popups\n\t//if (pressed && !(flags & ImGuiButtonFlags_DontClosePopups) && (window->Flags & ImGuiWindowFlags_Popup))\n\t//    CloseCurrentPopup();\n\n\treturn pressed;\n}\n\nbool ImGui::Button(const char* label, const ImVec2& size_arg)\n{\n\treturn ButtonEx(label, size_arg, 0);\n}\n\n// Small buttons fits within text without additional vertical spacing.\nbool ImGui::SmallButton(const char* label)\n{\n\tImGuiContext& g = *GImGui;\n\tfloat backup_padding_y = g.Style.FramePadding.y;\n\tg.Style.FramePadding.y = 0.0f;\n\tbool pressed = ButtonEx(label, ImVec2(0, 0), ImGuiButtonFlags_AlignTextBaseLine);\n\tg.Style.FramePadding.y = backup_padding_y;\n\treturn pressed;\n}\n\n// Tip: use ImGui::PushID()/PopID() to push indices or pointers in the ID stack.\n// Then you can keep 'str_id' empty or the same for all your buttons (instead of creating a string based on a non-string id)\nbool ImGui::InvisibleButton(const char* str_id, const ImVec2& size_arg)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tconst ImGuiID id = window->GetID(str_id);\n\tImVec2 size = CalcItemSize(size_arg, 0.0f, 0.0f);\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n\tItemSize(bb);\n\tif (!ItemAdd(bb, id))\n\t\treturn false;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb, id, &hovered, &held);\n\n\treturn pressed;\n}\n\n// Upper-right button to close a window.\nbool ImGui::CloseButton(ImGuiID id, const ImVec2& pos, float radius)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\n\tconst ImRect bb(pos - ImVec2(radius, radius), pos + ImVec2(radius, radius));\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb, id, &hovered, &held);\n\n\t// Render\n\tconst ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_CloseButtonActive : hovered ? ImGuiCol_CloseButtonHovered : ImGuiCol_CloseButton);\n\tconst ImVec2 center = bb.GetCenter();\n\twindow->DrawList->AddCircleFilled(center, ImMax(2.0f, radius), col, 12);\n\n\tconst float cross_extent = (radius * 0.7071f) - 1.0f;\n\tif (hovered)\n\t{\n\t\twindow->DrawList->AddLine(center + ImVec2(+cross_extent, +cross_extent), center + ImVec2(-cross_extent, -cross_extent), GetColorU32(ImGuiCol_Text));\n\t\twindow->DrawList->AddLine(center + ImVec2(+cross_extent, -cross_extent), center + ImVec2(-cross_extent, +cross_extent), GetColorU32(ImGuiCol_Text));\n\t}\n\n\treturn pressed;\n}\n\n// [Internal]\nbool ImGui::ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tconst ImGuiStyle& style = g.Style;\n\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + padding.x * 2.0f, g.FontSize + padding.y * 2.0f));\n\tItemSize(bb, style.FramePadding.y);\n\tif (!ItemAdd(bb, id))\n\t\treturn false;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);\n\n\tconst ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n#ifdef IMGUI_HAS_NAV\n\tRenderNavHighlight(bb, id);\n#endif\n\tRenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);\n\tRenderTriangle(bb.Min + padding, dir, 1.0f);\n\n\treturn pressed;\n}\n\nvoid ImGui::Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, const ImVec4& tint_col, const ImVec4& border_col)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n\tif (border_col.w > 0.0f)\n\t\tbb.Max += ImVec2(2, 2);\n\tItemSize(bb);\n\tif (!ItemAdd(bb, 0))\n\t\treturn;\n\n\tif (border_col.w > 0.0f)\n\t{\n\t\twindow->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(border_col), 0.0f);\n\t\twindow->DrawList->AddImage(user_texture_id, bb.Min + ImVec2(1, 1), bb.Max - ImVec2(1, 1), uv0, uv1, GetColorU32(tint_col));\n\t}\n\telse\n\t{\n\t\twindow->DrawList->AddImage(user_texture_id, bb.Min, bb.Max, uv0, uv1, GetColorU32(tint_col));\n\t}\n}\n\n// frame_padding < 0: uses FramePadding from style (default)\n// frame_padding = 0: no framing\n// frame_padding > 0: set framing size\n// The color used are the button colors.\nbool ImGui::ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0, const ImVec2& uv1, int frame_padding, const ImVec4& bg_col, const ImVec4& tint_col)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\n\t// Default to using texture ID as ID. User can still push string/integer prefixes.\n\t// We could hash the size/uv to create a unique ID but that would prevent the user from animating UV.\n\tPushID((void*)user_texture_id);\n\tconst ImGuiID id = window->GetID(\"#image\");\n\tPopID();\n\n\tconst ImVec2 padding = (frame_padding >= 0) ? ImVec2((float)frame_padding, (float)frame_padding) : style.FramePadding;\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size + padding * 2);\n\tconst ImRect image_bb(window->DC.CursorPos + padding, window->DC.CursorPos + padding + size);\n\tItemSize(bb);\n\tif (!ItemAdd(bb, id))\n\t\treturn false;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb, id, &hovered, &held);\n\n\t// Render\n\tconst ImU32 col = GetColorU32((hovered && held) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);\n\tRenderFrame(bb.Min, bb.Max, col, true, ImClamp((float)ImMin(padding.x, padding.y), 0.0f, style.FrameRounding));\n\tif (bg_col.w > 0.0f)\n\t\twindow->DrawList->AddRectFilled(image_bb.Min, image_bb.Max, GetColorU32(bg_col));\n\twindow->DrawList->AddImage(user_texture_id, image_bb.Min, image_bb.Max, uv0, uv1, GetColorU32(tint_col));\n\n\treturn pressed;\n}\n\n// Start logging ImGui output to TTY\nvoid ImGui::LogToTTY(int max_depth)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.LogEnabled)\n\t\treturn;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tg.LogEnabled = true;\n\tg.LogFile = stdout;\n\tg.LogStartDepth = window->DC.TreeDepth;\n\tif (max_depth >= 0)\n\t\tg.LogAutoExpandMaxDepth = max_depth;\n}\n\n// Start logging ImGui output to given file\nvoid ImGui::LogToFile(int max_depth, const char* filename)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.LogEnabled)\n\t\treturn;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tif (!filename)\n\t{\n\t\tfilename = g.IO.LogFilename;\n\t\tif (!filename)\n\t\t\treturn;\n\t}\n\n\tg.LogFile = ImFileOpen(filename, \"ab\");\n\tif (!g.LogFile)\n\t{\n\t\tIM_ASSERT(g.LogFile != NULL); // Consider this an error\n\t\treturn;\n\t}\n\tg.LogEnabled = true;\n\tg.LogStartDepth = window->DC.TreeDepth;\n\tif (max_depth >= 0)\n\t\tg.LogAutoExpandMaxDepth = max_depth;\n}\n\n// Start logging ImGui output to clipboard\nvoid ImGui::LogToClipboard(int max_depth)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.LogEnabled)\n\t\treturn;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tg.LogEnabled = true;\n\tg.LogFile = NULL;\n\tg.LogStartDepth = window->DC.TreeDepth;\n\tif (max_depth >= 0)\n\t\tg.LogAutoExpandMaxDepth = max_depth;\n}\n\nvoid ImGui::LogFinish()\n{\n\tImGuiContext& g = *GImGui;\n\tif (!g.LogEnabled)\n\t\treturn;\n\n\tLogText(IM_NEWLINE);\n\tg.LogEnabled = false;\n\tif (g.LogFile != NULL)\n\t{\n\t\tif (g.LogFile == stdout)\n\t\t\tfflush(g.LogFile);\n\t\telse\n\t\t\tfclose(g.LogFile);\n\t\tg.LogFile = NULL;\n\t}\n\tif (g.LogClipboard->size() > 1)\n\t{\n\t\tSetClipboardText(g.LogClipboard->begin());\n\t\tg.LogClipboard->clear();\n\t}\n}\n\n// Helper to display logging buttons\nvoid ImGui::LogButtons()\n{\n\tImGuiContext& g = *GImGui;\n\n\tPushID(\"LogButtons\");\n\tconst bool log_to_tty = Button(\"Log To TTY\"); SameLine();\n\tconst bool log_to_file = Button(\"Log To File\"); SameLine();\n\tconst bool log_to_clipboard = Button(\"Log To Clipboard\"); SameLine();\n\tPushItemWidth(80.0f);\n\tPushAllowKeyboardFocus(false);\n\tSliderInt(\"Depth\", &g.LogAutoExpandMaxDepth, 0, 9, NULL);\n\tPopAllowKeyboardFocus();\n\tPopItemWidth();\n\tPopID();\n\n\t// Start logging at the end of the function so that the buttons don't appear in the log\n\tif (log_to_tty)\n\t\tLogToTTY(g.LogAutoExpandMaxDepth);\n\tif (log_to_file)\n\t\tLogToFile(g.LogAutoExpandMaxDepth, g.IO.LogFilename);\n\tif (log_to_clipboard)\n\t\tLogToClipboard(g.LogAutoExpandMaxDepth);\n}\n\nbool ImGui::TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags)\n{\n\tif (flags & ImGuiTreeNodeFlags_Leaf)\n\t\treturn true;\n\n\t// We only write to the tree storage if the user clicks (or explicitely use SetNextTreeNode*** functions)\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tImGuiStorage* storage = window->DC.StateStorage;\n\n\tbool is_open;\n\tif (g.NextTreeNodeOpenCond != 0)\n\t{\n\t\tif (g.NextTreeNodeOpenCond & ImGuiCond_Always)\n\t\t{\n\t\t\tis_open = g.NextTreeNodeOpenVal;\n\t\t\tstorage->SetInt(id, is_open);\n\t\t}\n\t\telse\n\t\t{\n\t\t\t// We treat ImGuiCond_Once and ImGuiCond_FirstUseEver the same because tree node state are not saved persistently.\n\t\t\tconst int stored_value = storage->GetInt(id, -1);\n\t\t\tif (stored_value == -1)\n\t\t\t{\n\t\t\t\tis_open = g.NextTreeNodeOpenVal;\n\t\t\t\tstorage->SetInt(id, is_open);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tis_open = stored_value != 0;\n\t\t\t}\n\t\t}\n\t\tg.NextTreeNodeOpenCond = 0;\n\t}\n\telse\n\t{\n\t\tis_open = storage->GetInt(id, (flags & ImGuiTreeNodeFlags_DefaultOpen) ? 1 : 0) != 0;\n\t}\n\n\t// When logging is enabled, we automatically expand tree nodes (but *NOT* collapsing headers.. seems like sensible behavior).\n\t// NB- If we are above max depth we still allow manually opened nodes to be logged.\n\tif (g.LogEnabled && !(flags & ImGuiTreeNodeFlags_NoAutoOpenOnLog) && window->DC.TreeDepth < g.LogAutoExpandMaxDepth)\n\t\tis_open = true;\n\n\treturn is_open;\n}\n\nbool ImGui::TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst bool display_frame = (flags & ImGuiTreeNodeFlags_Framed) != 0;\n\tconst ImVec2 padding = (display_frame || (flags & ImGuiTreeNodeFlags_FramePadding)) ? style.FramePadding : ImVec2(style.FramePadding.x, 0.0f);\n\n\tif (!label_end)\n\t\tlabel_end = FindRenderedTextEnd(label);\n\tconst ImVec2 label_size = CalcTextSize(label, label_end, false);\n\n\t// We vertically grow up to current line height up the typical widget height.\n\tconst float text_base_offset_y = ImMax(padding.y, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it\n\tconst float frame_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + style.FramePadding.y * 2), label_size.y + padding.y * 2);\n\tImRect bb = ImRect(window->DC.CursorPos, ImVec2(window->Pos.x + GetContentRegionMax().x, window->DC.CursorPos.y + frame_height));\n\tif (display_frame)\n\t{\n\t\t// Framed header expand a little outside the default padding\n\t\tbb.Min.x -= (float)(int)(window->WindowPadding.x * 0.5f) - 1;\n\t\tbb.Max.x += (float)(int)(window->WindowPadding.x * 0.5f) - 1;\n\t}\n\n\tconst float text_offset_x = (g.FontSize + (display_frame ? padding.x * 3 : padding.x * 2));   // Collapser arrow width + Spacing\n\tconst float text_width = g.FontSize + (label_size.x > 0.0f ? label_size.x + padding.x * 2 : 0.0f);   // Include collapser\n\tItemSize(ImVec2(text_width, frame_height), text_base_offset_y);\n\n\t// For regular tree nodes, we arbitrary allow to click past 2 worth of ItemSpacing\n\t// (Ideally we'd want to add a flag for the user to specify if we want the hit test to be done up to the right side of the content or not)\n\tconst ImRect interact_bb = display_frame ? bb : ImRect(bb.Min.x, bb.Min.y, bb.Min.x + text_width + style.ItemSpacing.x * 2, bb.Max.y);\n\tbool is_open = TreeNodeBehaviorIsOpen(id, flags);\n\tif (!ItemAdd(interact_bb, id))\n\t{\n\t\tif (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))\n\t\t\tTreePushRawID(id);\n\t\treturn is_open;\n\t}\n\n\t// Flags that affects opening behavior:\n\t// - 0(default) ..................... single-click anywhere to open\n\t// - OpenOnDoubleClick .............. double-click anywhere to open\n\t// - OpenOnArrow .................... single-click on arrow to open\n\t// - OpenOnDoubleClick|OpenOnArrow .. single-click on arrow or double-click anywhere to open\n\tImGuiButtonFlags button_flags = ImGuiButtonFlags_NoKeyModifiers | ((flags & ImGuiTreeNodeFlags_AllowItemOverlap) ? ImGuiButtonFlags_AllowItemOverlap : 0);\n\tif (!(flags & ImGuiTreeNodeFlags_Leaf))\n\t\tbutton_flags |= ImGuiButtonFlags_PressedOnDragDropHold;\n\tif (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)\n\t\tbutton_flags |= ImGuiButtonFlags_PressedOnDoubleClick | ((flags & ImGuiTreeNodeFlags_OpenOnArrow) ? ImGuiButtonFlags_PressedOnClickRelease : 0);\n\n\tbool hovered, held, pressed = ButtonBehavior(interact_bb, id, &hovered, &held, button_flags);\n\tif (pressed && !(flags & ImGuiTreeNodeFlags_Leaf))\n\t{\n\t\tbool toggled = !(flags & (ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick));\n\t\tif (flags & ImGuiTreeNodeFlags_OpenOnArrow)\n\t\t\ttoggled |= IsMouseHoveringRect(interact_bb.Min, ImVec2(interact_bb.Min.x + text_offset_x, interact_bb.Max.y));\n\t\tif (flags & ImGuiTreeNodeFlags_OpenOnDoubleClick)\n\t\t\ttoggled |= g.IO.MouseDoubleClicked[0];\n\t\tif (g.DragDropActive && is_open) // When using Drag and Drop \"hold to open\" we keep the node highlighted after opening, but never close it again.\n\t\t\ttoggled = false;\n\t\tif (toggled)\n\t\t{\n\t\t\tis_open = !is_open;\n\t\t\twindow->DC.StateStorage->SetInt(id, is_open);\n\t\t}\n\t}\n\tif (flags & ImGuiTreeNodeFlags_AllowItemOverlap)\n\t\tSetItemAllowOverlap();\n\n\t// Render\n\tconst ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);\n\tconst ImVec2 text_pos = bb.Min + ImVec2(text_offset_x, text_base_offset_y);\n\tif (display_frame)\n\t{\n\t\t// Framed type\n\t\tRenderFrame(bb.Min, bb.Max, col, true, style.FrameRounding);\n\t\tRenderTriangle(bb.Min + ImVec2(padding.x, text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 1.0f);\n\t\tif (g.LogEnabled)\n\t\t{\n\t\t\t// NB: '##' is normally used to hide text (as a library-wide feature), so we need to specify the text range to make sure the ## aren't stripped out here.\n\t\t\tconst char log_prefix[] = \"\\n##\";\n\t\t\tconst char log_suffix[] = \"##\";\n\t\t\tLogRenderedText(&text_pos, log_prefix, log_prefix + 3);\n\t\t\tRenderTextClipped(text_pos, bb.Max, label, label_end, &label_size);\n\t\t\tLogRenderedText(&text_pos, log_suffix + 1, log_suffix + 3);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tRenderTextClipped(text_pos, bb.Max, label, label_end, &label_size);\n\t\t}\n\t}\n\telse\n\t{\n\t\t// Unframed typed for tree nodes\n\t\tif (hovered || (flags & ImGuiTreeNodeFlags_Selected))\n\t\t\tRenderFrame(bb.Min, bb.Max, col, false);\n\n\t\tif (flags & ImGuiTreeNodeFlags_Bullet)\n\t\t\tRenderBullet(bb.Min + ImVec2(text_offset_x * 0.5f, g.FontSize * 0.50f + text_base_offset_y));\n\t\telse if (!(flags & ImGuiTreeNodeFlags_Leaf))\n\t\t\tRenderTriangle(bb.Min + ImVec2(padding.x, g.FontSize * 0.15f + text_base_offset_y), is_open ? ImGuiDir_Down : ImGuiDir_Right, 0.70f);\n\t\tif (g.LogEnabled)\n\t\t\tLogRenderedText(&text_pos, \">\");\n\t\tRenderText(text_pos, label, label_end, false);\n\t}\n\n\tif (is_open && !(flags & ImGuiTreeNodeFlags_NoTreePushOnOpen))\n\t\tTreePushRawID(id);\n\treturn is_open;\n}\n\n// CollapsingHeader returns true when opened but do not indent nor push into the ID stack (because of the ImGuiTreeNodeFlags_NoTreePushOnOpen flag).\n// This is basically the same as calling TreeNodeEx(label, ImGuiTreeNodeFlags_CollapsingHeader | ImGuiTreeNodeFlags_NoTreePushOnOpen). You can remove the _NoTreePushOnOpen flag if you want behavior closer to normal TreeNode().\nbool ImGui::CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\treturn TreeNodeBehavior(window->GetID(label), flags | ImGuiTreeNodeFlags_CollapsingHeader | ImGuiTreeNodeFlags_NoTreePushOnOpen, label);\n}\n\nbool ImGui::CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tif (p_open && !*p_open)\n\t\treturn false;\n\n\tImGuiID id = window->GetID(label);\n\tbool is_open = TreeNodeBehavior(id, flags | ImGuiTreeNodeFlags_CollapsingHeader | ImGuiTreeNodeFlags_NoTreePushOnOpen | (p_open ? ImGuiTreeNodeFlags_AllowItemOverlap : 0), label);\n\tif (p_open)\n\t{\n\t\t// Create a small overlapping close button // FIXME: We can evolve this into user accessible helpers to add extra buttons on title bars, headers, etc.\n\t\tImGuiContext& g = *GImGui;\n\t\tfloat button_sz = g.FontSize * 0.5f;\n\t\tImGuiItemHoveredDataBackup last_item_backup;\n\t\tif (CloseButton(window->GetID((void*)(intptr_t)(id + 1)), ImVec2(ImMin(window->DC.LastItemRect.Max.x, window->ClipRect.Max.x) - g.Style.FramePadding.x - button_sz, window->DC.LastItemRect.Min.y + g.Style.FramePadding.y + button_sz), button_sz))\n\t\t\t*p_open = false;\n\t\tlast_item_backup.Restore();\n\t}\n\n\treturn is_open;\n}\n\nbool ImGui::TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\treturn TreeNodeBehavior(window->GetID(label), flags, label, NULL);\n}\n\nbool ImGui::TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n\treturn TreeNodeBehavior(window->GetID(str_id), flags, g.TempBuffer, label_end);\n}\n\nbool ImGui::TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst char* label_end = g.TempBuffer + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n\treturn TreeNodeBehavior(window->GetID(ptr_id), flags, g.TempBuffer, label_end);\n}\n\nbool ImGui::TreeNodeV(const char* str_id, const char* fmt, va_list args)\n{\n\treturn TreeNodeExV(str_id, 0, fmt, args);\n}\n\nbool ImGui::TreeNodeV(const void* ptr_id, const char* fmt, va_list args)\n{\n\treturn TreeNodeExV(ptr_id, 0, fmt, args);\n}\n\nbool ImGui::TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tbool is_open = TreeNodeExV(str_id, flags, fmt, args);\n\tva_end(args);\n\treturn is_open;\n}\n\nbool ImGui::TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tbool is_open = TreeNodeExV(ptr_id, flags, fmt, args);\n\tva_end(args);\n\treturn is_open;\n}\n\nbool ImGui::TreeNode(const char* str_id, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tbool is_open = TreeNodeExV(str_id, 0, fmt, args);\n\tva_end(args);\n\treturn is_open;\n}\n\nbool ImGui::TreeNode(const void* ptr_id, const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tbool is_open = TreeNodeExV(ptr_id, 0, fmt, args);\n\tva_end(args);\n\treturn is_open;\n}\n\nbool ImGui::TreeNode(const char* label)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\treturn TreeNodeBehavior(window->GetID(label), 0, label, NULL);\n}\n\nvoid ImGui::TreeAdvanceToLabelPos()\n{\n\tImGuiContext& g = *GImGui;\n\tg.CurrentWindow->DC.CursorPos.x += GetTreeNodeToLabelSpacing();\n}\n\n// Horizontal distance preceding label when using TreeNode() or Bullet()\nfloat ImGui::GetTreeNodeToLabelSpacing()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.FontSize + (g.Style.FramePadding.x * 2.0f);\n}\n\nvoid ImGui::SetNextTreeNodeOpen(bool is_open, ImGuiCond cond)\n{\n\tImGuiContext& g = *GImGui;\n\tif (g.CurrentWindow->SkipItems)\n\t\treturn;\n\tg.NextTreeNodeOpenVal = is_open;\n\tg.NextTreeNodeOpenCond = cond ? cond : ImGuiCond_Always;\n}\n\nvoid ImGui::PushID(const char* str_id)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\twindow->IDStack.push_back(window->GetID(str_id));\n}\n\nvoid ImGui::PushID(const char* str_id_begin, const char* str_id_end)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\twindow->IDStack.push_back(window->GetID(str_id_begin, str_id_end));\n}\n\nvoid ImGui::PushID(const void* ptr_id)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\twindow->IDStack.push_back(window->GetID(ptr_id));\n}\n\nvoid ImGui::PushID(int int_id)\n{\n\tconst void* ptr_id = (void*)(intptr_t)int_id;\n\tImGuiWindow* window = GetCurrentWindowRead();\n\twindow->IDStack.push_back(window->GetID(ptr_id));\n}\n\nvoid ImGui::PopID()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\twindow->IDStack.pop_back();\n}\n\nImGuiID ImGui::GetID(const char* str_id)\n{\n\treturn GImGui->CurrentWindow->GetID(str_id);\n}\n\nImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end)\n{\n\treturn GImGui->CurrentWindow->GetID(str_id_begin, str_id_end);\n}\n\nImGuiID ImGui::GetID(const void* ptr_id)\n{\n\treturn GImGui->CurrentWindow->GetID(ptr_id);\n}\n\nvoid ImGui::Bullet()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y * 2), g.FontSize);\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize, line_height));\n\tItemSize(bb);\n\tif (!ItemAdd(bb, 0))\n\t{\n\t\tSameLine(0, style.FramePadding.x * 2);\n\t\treturn;\n\t}\n\n\t// Render and stay on same line\n\tRenderBullet(bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, line_height * 0.5f));\n\tSameLine(0, style.FramePadding.x * 2);\n}\n\n// Text with a little bullet aligned to the typical tree node.\nvoid ImGui::BulletTextV(const char* fmt, va_list args)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\n\tconst char* text_begin = g.TempBuffer;\n\tconst char* text_end = text_begin + ImFormatStringV(g.TempBuffer, IM_ARRAYSIZE(g.TempBuffer), fmt, args);\n\tconst ImVec2 label_size = CalcTextSize(text_begin, text_end, false);\n\tconst float text_base_offset_y = ImMax(0.0f, window->DC.CurrentLineTextBaseOffset); // Latch before ItemSize changes it\n\tconst float line_height = ImMax(ImMin(window->DC.CurrentLineHeight, g.FontSize + g.Style.FramePadding.y * 2), g.FontSize);\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(g.FontSize + (label_size.x > 0.0f ? (label_size.x + style.FramePadding.x * 2) : 0.0f), ImMax(line_height, label_size.y)));  // Empty text doesn't add padding\n\tItemSize(bb);\n\tif (!ItemAdd(bb, 0))\n\t\treturn;\n\n\t// Render\n\tRenderBullet(bb.Min + ImVec2(style.FramePadding.x + g.FontSize * 0.5f, line_height * 0.5f));\n\tRenderText(bb.Min + ImVec2(g.FontSize + style.FramePadding.x * 2, text_base_offset_y), text_begin, text_end, false);\n}\n\nvoid ImGui::BulletText(const char* fmt, ...)\n{\n\tva_list args;\n\tva_start(args, fmt);\n\tBulletTextV(fmt, args);\n\tva_end(args);\n}\n\nstatic inline void DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, const char* display_format, char* buf, int buf_size)\n{\n\tif (data_type == ImGuiDataType_Int)\n\t\tImFormatString(buf, buf_size, display_format, *(int*)data_ptr);\n\telse if (data_type == ImGuiDataType_Float)\n\t\tImFormatString(buf, buf_size, display_format, *(float*)data_ptr);\n}\n\nstatic inline void DataTypeFormatString(ImGuiDataType data_type, void* data_ptr, int decimal_precision, char* buf, int buf_size)\n{\n\tif (data_type == ImGuiDataType_Int)\n\t{\n\t\tif (decimal_precision < 0)\n\t\t\tImFormatString(buf, buf_size, \"%d\", *(int*)data_ptr);\n\t\telse\n\t\t\tImFormatString(buf, buf_size, \"%.*d\", decimal_precision, *(int*)data_ptr);\n\t}\n\telse if (data_type == ImGuiDataType_Float)\n\t{\n\t\tif (decimal_precision < 0)\n\t\t\tImFormatString(buf, buf_size, \"%f\", *(float*)data_ptr);     // Ideally we'd have a minimum decimal precision of 1 to visually denote that it is a float, while hiding non-significant digits?\n\t\telse\n\t\t\tImFormatString(buf, buf_size, \"%.*f\", decimal_precision, *(float*)data_ptr);\n\t}\n}\n\nstatic void DataTypeApplyOp(ImGuiDataType data_type, int op, void* value1, const void* value2)// Store into value1\n{\n\tif (data_type == ImGuiDataType_Int)\n\t{\n\t\tif (op == '+')\n\t\t\t*(int*)value1 = *(int*)value1 + *(const int*)value2;\n\t\telse if (op == '-')\n\t\t\t*(int*)value1 = *(int*)value1 - *(const int*)value2;\n\t}\n\telse if (data_type == ImGuiDataType_Float)\n\t{\n\t\tif (op == '+')\n\t\t\t*(float*)value1 = *(float*)value1 + *(const float*)value2;\n\t\telse if (op == '-')\n\t\t\t*(float*)value1 = *(float*)value1 - *(const float*)value2;\n\t}\n}\n\n// User can input math operators (e.g. +100) to edit a numerical values.\nstatic bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format)\n{\n\twhile (ImCharIsSpace(*buf))\n\t\tbuf++;\n\n\t// We don't support '-' op because it would conflict with inputing negative value.\n\t// Instead you can use +-100 to subtract from an existing value\n\tchar op = buf[0];\n\tif (op == '+' || op == '*' || op == '/')\n\t{\n\t\tbuf++;\n\t\twhile (ImCharIsSpace(*buf))\n\t\t\tbuf++;\n\t}\n\telse\n\t{\n\t\top = 0;\n\t}\n\tif (!buf[0])\n\t\treturn false;\n\n\tif (data_type == ImGuiDataType_Int)\n\t{\n\t\tif (!scalar_format)\n\t\t\tscalar_format = \"%d\";\n\t\tint* v = (int*)data_ptr;\n\t\tconst int old_v = *v;\n\t\tint arg0i = *v;\n\t\tif (op && sscanf(initial_value_buf, scalar_format, &arg0i) < 1)\n\t\t\treturn false;\n\n\t\t// Store operand in a float so we can use fractional value for multipliers (*1.1), but constant always parsed as integer so we can fit big integers (e.g. 2000000003) past float precision\n\t\tfloat arg1f = 0.0f;\n\t\tif (op == '+') { if (sscanf(buf, \"%f\", &arg1f) == 1) *v = (int)(arg0i + arg1f); }                 // Add (use \"+-\" to subtract)\n\t\telse if (op == '*') { if (sscanf(buf, \"%f\", &arg1f) == 1) *v = (int)(arg0i * arg1f); }                 // Multiply\n\t\telse if (op == '/') { if (sscanf(buf, \"%f\", &arg1f) == 1 && arg1f != 0.0f) *v = (int)(arg0i / arg1f); }// Divide\n\t\telse { if (sscanf(buf, scalar_format, &arg0i) == 1) *v = arg0i; }                       // Assign constant (read as integer so big values are not lossy)\n\t\treturn (old_v != *v);\n\t}\n\telse if (data_type == ImGuiDataType_Float)\n\t{\n\t\t// For floats we have to ignore format with precision (e.g. \"%.2f\") because sscanf doesn't take them in\n\t\tscalar_format = \"%f\";\n\t\tfloat* v = (float*)data_ptr;\n\t\tconst float old_v = *v;\n\t\tfloat arg0f = *v;\n\t\tif (op && sscanf(initial_value_buf, scalar_format, &arg0f) < 1)\n\t\t\treturn false;\n\n\t\tfloat arg1f = 0.0f;\n\t\tif (sscanf(buf, scalar_format, &arg1f) < 1)\n\t\t\treturn false;\n\t\tif (op == '+') { *v = arg0f + arg1f; }                    // Add (use \"+-\" to subtract)\n\t\telse if (op == '*') { *v = arg0f * arg1f; }                    // Multiply\n\t\telse if (op == '/') { if (arg1f != 0.0f) *v = arg0f / arg1f; } // Divide\n\t\telse { *v = arg1f; }                            // Assign constant\n\t\treturn (old_v != *v);\n\t}\n\n\treturn false;\n}\n\n// Create text input in place of a slider (when CTRL+Clicking on slider)\n// FIXME: Logic is messy and confusing.\nbool ImGui::InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\n\t// Our replacement widget will override the focus ID (registered previously to allow for a TAB focus to happen)\n\t// On the first frame, g.ScalarAsInputTextId == 0, then on subsequent frames it becomes == id\n\tSetActiveID(g.ScalarAsInputTextId, window);\n\tSetHoveredID(0);\n\tFocusableItemUnregister(window);\n\n\tchar buf[32];\n\tDataTypeFormatString(data_type, data_ptr, decimal_precision, buf, IM_ARRAYSIZE(buf));\n\tbool text_value_changed = InputTextEx(label, buf, IM_ARRAYSIZE(buf), aabb.GetSize(), ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_AutoSelectAll);\n\tif (g.ScalarAsInputTextId == 0)     // First frame we started displaying the InputText widget\n\t{\n\t\tIM_ASSERT(g.ActiveId == id);    // InputText ID expected to match the Slider ID (else we'd need to store them both, which is also possible)\n\t\tg.ScalarAsInputTextId = g.ActiveId;\n\t\tSetHoveredID(id);\n\t}\n\tif (text_value_changed)\n\t\treturn DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, NULL);\n\treturn false;\n}\n\n// Parse display precision back from the display format string\nint ImGui::ParseFormatPrecision(const char* fmt, int default_precision)\n{\n\tint precision = default_precision;\n\twhile ((fmt = strchr(fmt, '%')) != NULL)\n\t{\n\t\tfmt++;\n\t\tif (fmt[0] == '%') { fmt++; continue; } // Ignore \"%%\"\n\t\twhile (*fmt >= '0' && *fmt <= '9')\n\t\t\tfmt++;\n\t\tif (*fmt == '.')\n\t\t{\n\t\t\tfmt = ImAtoi(fmt + 1, &precision);\n\t\t\tif (precision < 0 || precision > 10)\n\t\t\t\tprecision = default_precision;\n\t\t}\n\t\tif (*fmt == 'e' || *fmt == 'E') // Maximum precision with scientific notation\n\t\t\tprecision = -1;\n\t\tbreak;\n\t}\n\treturn precision;\n}\n\nstatic float GetMinimumStepAtDecimalPrecision(int decimal_precision)\n{\n\tstatic const float min_steps[10] = { 1.0f, 0.1f, 0.01f, 0.001f, 0.0001f, 0.00001f, 0.000001f, 0.0000001f, 0.00000001f, 0.000000001f };\n\treturn (decimal_precision >= 0 && decimal_precision < 10) ? min_steps[decimal_precision] : powf(10.0f, (float)-decimal_precision);\n}\n\nfloat ImGui::RoundScalar(float value, int decimal_precision)\n{\n\t// Round past decimal precision\n\t// So when our value is 1.99999 with a precision of 0.001 we'll end up rounding to 2.0\n\t// FIXME: Investigate better rounding methods\n\tif (decimal_precision < 0)\n\t\treturn value;\n\tconst float min_step = GetMinimumStepAtDecimalPrecision(decimal_precision);\n\tbool negative = value < 0.0f;\n\tvalue = fabsf(value);\n\tfloat remainder = fmodf(value, min_step);\n\tif (remainder <= min_step * 0.5f)\n\t\tvalue -= remainder;\n\telse\n\t\tvalue += (min_step - remainder);\n\treturn negative ? -value : value;\n}\n\nstatic inline float SliderBehaviorCalcRatioFromValue(float v, float v_min, float v_max, float power, float linear_zero_pos)\n{\n\tif (v_min == v_max)\n\t\treturn 0.0f;\n\n\tconst bool is_non_linear = (power < 1.0f - 0.00001f) || (power > 1.0f + 0.00001f);\n\tconst float v_clamped = (v_min < v_max) ? ImClamp(v, v_min, v_max) : ImClamp(v, v_max, v_min);\n\tif (is_non_linear)\n\t{\n\t\tif (v_clamped < 0.0f)\n\t\t{\n\t\t\tconst float f = 1.0f - (v_clamped - v_min) / (ImMin(0.0f, v_max) - v_min);\n\t\t\treturn (1.0f - powf(f, 1.0f / power)) * linear_zero_pos;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tconst float f = (v_clamped - ImMax(0.0f, v_min)) / (v_max - ImMax(0.0f, v_min));\n\t\t\treturn linear_zero_pos + powf(f, 1.0f / power) * (1.0f - linear_zero_pos);\n\t\t}\n\t}\n\n\t// Linear slider\n\treturn (v_clamped - v_min) / (v_max - v_min);\n}\n\nbool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\tconst ImGuiStyle& style = g.Style;\n\n\t// Draw frame\n\tRenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n\n\tconst bool is_non_linear = (power < 1.0f - 0.00001f) || (power > 1.0f + 0.00001f);\n\tconst bool is_horizontal = (flags & ImGuiSliderFlags_Vertical) == 0;\n\n\tconst float grab_padding = 2.0f;\n\tconst float slider_sz = is_horizontal ? (frame_bb.GetWidth() - grab_padding * 2.0f) : (frame_bb.GetHeight() - grab_padding * 2.0f);\n\tfloat grab_sz;\n\tif (decimal_precision != 0)\n\t\tgrab_sz = ImMin(style.GrabMinSize, slider_sz);\n\telse\n\t\tgrab_sz = ImMin(ImMax(1.0f * (slider_sz / ((v_min < v_max ? v_max - v_min : v_min - v_max) + 1.0f)), style.GrabMinSize), slider_sz);  // Integer sliders, if possible have the grab size represent 1 unit\n\tconst float slider_usable_sz = slider_sz - grab_sz;\n\tconst float slider_usable_pos_min = (is_horizontal ? frame_bb.Min.x : frame_bb.Min.y) + grab_padding + grab_sz * 0.5f;\n\tconst float slider_usable_pos_max = (is_horizontal ? frame_bb.Max.x : frame_bb.Max.y) - grab_padding - grab_sz * 0.5f;\n\n\t// For logarithmic sliders that cross over sign boundary we want the exponential increase to be symmetric around 0.0f\n\tfloat linear_zero_pos = 0.0f;   // 0.0->1.0f\n\tif (v_min * v_max < 0.0f)\n\t{\n\t\t// Different sign\n\t\tconst float linear_dist_min_to_0 = powf(fabsf(0.0f - v_min), 1.0f / power);\n\t\tconst float linear_dist_max_to_0 = powf(fabsf(v_max - 0.0f), 1.0f / power);\n\t\tlinear_zero_pos = linear_dist_min_to_0 / (linear_dist_min_to_0 + linear_dist_max_to_0);\n\t}\n\telse\n\t{\n\t\t// Same sign\n\t\tlinear_zero_pos = v_min < 0.0f ? 1.0f : 0.0f;\n\t}\n\n\t// Process clicking on the slider\n\tbool value_changed = false;\n\tif (g.ActiveId == id)\n\t{\n\t\tbool set_new_value = false;\n\t\tfloat clicked_t = 0.0f;\n\t\tif (g.IO.MouseDown[0])\n\t\t{\n\t\t\tconst float mouse_abs_pos = is_horizontal ? g.IO.MousePos.x : g.IO.MousePos.y;\n\t\t\tclicked_t = (slider_usable_sz > 0.0f) ? ImClamp((mouse_abs_pos - slider_usable_pos_min) / slider_usable_sz, 0.0f, 1.0f) : 0.0f;\n\t\t\tif (!is_horizontal)\n\t\t\t\tclicked_t = 1.0f - clicked_t;\n\t\t\tset_new_value = true;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tClearActiveID();\n\t\t}\n\n\t\tif (set_new_value)\n\t\t{\n\t\t\tfloat new_value;\n\t\t\tif (is_non_linear)\n\t\t\t{\n\t\t\t\t// Account for logarithmic scale on both sides of the zero\n\t\t\t\tif (clicked_t < linear_zero_pos)\n\t\t\t\t{\n\t\t\t\t\t// Negative: rescale to the negative range before powering\n\t\t\t\t\tfloat a = 1.0f - (clicked_t / linear_zero_pos);\n\t\t\t\t\ta = powf(a, power);\n\t\t\t\t\tnew_value = ImLerp(ImMin(v_max, 0.0f), v_min, a);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t// Positive: rescale to the positive range before powering\n\t\t\t\t\tfloat a;\n\t\t\t\t\tif (fabsf(linear_zero_pos - 1.0f) > 1.e-6f)\n\t\t\t\t\t\ta = (clicked_t - linear_zero_pos) / (1.0f - linear_zero_pos);\n\t\t\t\t\telse\n\t\t\t\t\t\ta = clicked_t;\n\t\t\t\t\ta = powf(a, power);\n\t\t\t\t\tnew_value = ImLerp(ImMax(v_min, 0.0f), v_max, a);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t// Linear slider\n\t\t\t\tnew_value = ImLerp(v_min, v_max, clicked_t);\n\t\t\t}\n\n\t\t\t// Round past decimal precision\n\t\t\tnew_value = RoundScalar(new_value, decimal_precision);\n\t\t\tif (*v != new_value)\n\t\t\t{\n\t\t\t\t*v = new_value;\n\t\t\t\tvalue_changed = true;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Draw\n\tfloat grab_t = SliderBehaviorCalcRatioFromValue(*v, v_min, v_max, power, linear_zero_pos);\n\tif (!is_horizontal)\n\t\tgrab_t = 1.0f - grab_t;\n\tconst float grab_pos = ImLerp(slider_usable_pos_min, slider_usable_pos_max, grab_t);\n\tImRect grab_bb;\n\tif (is_horizontal)\n\t\tgrab_bb = ImRect(ImVec2(grab_pos - grab_sz * 0.5f, frame_bb.Min.y + grab_padding), ImVec2(grab_pos + grab_sz * 0.5f, frame_bb.Max.y - grab_padding));\n\telse\n\t\tgrab_bb = ImRect(ImVec2(frame_bb.Min.x + grab_padding, grab_pos - grab_sz * 0.5f), ImVec2(frame_bb.Max.x - grab_padding, grab_pos + grab_sz * 0.5f));\n\twindow->DrawList->AddRectFilled(grab_bb.Min, grab_bb.Max, GetColorU32(g.ActiveId == id ? ImGuiCol_SliderGrabActive : ImGuiCol_SliderGrab), style.GrabRounding);\n\n\treturn value_changed;\n}\n\n// Use power!=1.0 for logarithmic sliders.\n// Adjust display_format to decorate the value with a prefix or a suffix.\n//   \"%.3f\"         1.234\n//   \"%5.2f secs\"   01.23 secs\n//   \"Gold: %.0f\"   Gold: 1\nbool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\tconst float w = CalcItemWidth();\n\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tconst ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));\n\tconst ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\n\t// NB- we don't call ItemSize() yet because we may turn into a text edit box below\n\tif (!ItemAdd(total_bb, id))\n\t{\n\t\tItemSize(total_bb, style.FramePadding.y);\n\t\treturn false;\n\t}\n\tconst bool hovered = ItemHoverable(frame_bb, id);\n\n\tif (!display_format)\n\t\tdisplay_format = \"%.3f\";\n\tint decimal_precision = ParseFormatPrecision(display_format, 3);\n\n\t// Tabbing or CTRL-clicking on Slider turns it into an input box\n\tbool start_text_input = false;\n\tconst bool tab_focus_requested = FocusableItemRegister(window, id);\n\tif (tab_focus_requested || (hovered && g.IO.MouseClicked[0]))\n\t{\n\t\tSetActiveID(id, window);\n\t\tFocusWindow(window);\n\t\tif (tab_focus_requested || g.IO.KeyCtrl)\n\t\t{\n\t\t\tstart_text_input = true;\n\t\t\tg.ScalarAsInputTextId = 0;\n\t\t}\n\t}\n\tif (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))\n\t\treturn InputScalarAsWidgetReplacement(frame_bb, label, ImGuiDataType_Float, v, id, decimal_precision);\n\n\t// Actual slider behavior + render grab\n\tItemSize(total_bb, style.FramePadding.y);\n\tconst bool value_changed = SliderBehavior(frame_bb, id, v, v_min, v_max, power, decimal_precision);\n\n\t// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.\n\tchar value_buf[64];\n\tconst char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);\n\tRenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));\n\n\tif (label_size.x > 0.0f)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n\treturn value_changed;\n}\n\nbool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tconst ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);\n\tconst ImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\n\tItemSize(bb, style.FramePadding.y);\n\tif (!ItemAdd(frame_bb, id))\n\t\treturn false;\n\tconst bool hovered = ItemHoverable(frame_bb, id);\n\n\tif (!display_format)\n\t\tdisplay_format = \"%.3f\";\n\tint decimal_precision = ParseFormatPrecision(display_format, 3);\n\n\tif (hovered && g.IO.MouseClicked[0])\n\t{\n\t\tSetActiveID(id, window);\n\t\tFocusWindow(window);\n\t}\n\n\t// Actual slider behavior + render grab\n\tbool value_changed = SliderBehavior(frame_bb, id, v, v_min, v_max, power, decimal_precision, ImGuiSliderFlags_Vertical);\n\n\t// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.\n\t// For the vertical slider we allow centered text to overlap the frame padding\n\tchar value_buf[64];\n\tchar* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);\n\tRenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.0f));\n\tif (label_size.x > 0.0f)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n\treturn value_changed;\n}\n\nbool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, float v_degrees_max)\n{\n\tfloat v_deg = (*v_rad) * 360.0f / (2 * IM_PI);\n\tbool value_changed = SliderFloat(label, &v_deg, v_degrees_min, v_degrees_max, \"%.0f deg\", 1.0f);\n\t*v_rad = v_deg * (2 * IM_PI) / 360.0f;\n\treturn value_changed;\n}\n\nbool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format)\n{\n\tif (!display_format)\n\t\tdisplay_format = \"%.0f\";\n\tfloat v_f = (float)*v;\n\tbool value_changed = SliderFloat(label, &v_f, (float)v_min, (float)v_max, display_format, 1.0f);\n\t*v = (int)v_f;\n\treturn value_changed;\n}\n\nbool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format)\n{\n\tif (!display_format)\n\t\tdisplay_format = \"%.0f\";\n\tfloat v_f = (float)*v;\n\tbool value_changed = VSliderFloat(label, size, &v_f, (float)v_min, (float)v_max, display_format, 1.0f);\n\t*v = (int)v_f;\n\treturn value_changed;\n}\n\n// Add multiple sliders on 1 line for compact edition of multiple components\nbool ImGui::SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tbool value_changed = false;\n\tBeginGroup();\n\tPushID(label);\n\tPushMultiItemsWidths(components);\n\tfor (int i = 0; i < components; i++)\n\t{\n\t\tPushID(i);\n\t\tvalue_changed |= SliderFloat(\"##v\", &v[i], v_min, v_max, display_format, power);\n\t\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\t\tPopID();\n\t\tPopItemWidth();\n\t}\n\tPopID();\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format, float power)\n{\n\treturn SliderFloatN(label, v, 2, v_min, v_max, display_format, power);\n}\n\nbool ImGui::SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format, float power)\n{\n\treturn SliderFloatN(label, v, 3, v_min, v_max, display_format, power);\n}\n\nbool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format, float power)\n{\n\treturn SliderFloatN(label, v, 4, v_min, v_max, display_format, power);\n}\n\nbool ImGui::SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tbool value_changed = false;\n\tBeginGroup();\n\tPushID(label);\n\tPushMultiItemsWidths(components);\n\tfor (int i = 0; i < components; i++)\n\t{\n\t\tPushID(i);\n\t\tvalue_changed |= SliderInt(\"##v\", &v[i], v_min, v_max, display_format);\n\t\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\t\tPopID();\n\t\tPopItemWidth();\n\t}\n\tPopID();\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format)\n{\n\treturn SliderIntN(label, v, 2, v_min, v_max, display_format);\n}\n\nbool ImGui::SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format)\n{\n\treturn SliderIntN(label, v, 3, v_min, v_max, display_format);\n}\n\nbool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format)\n{\n\treturn SliderIntN(label, v, 4, v_min, v_max, display_format);\n}\n\nbool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power)\n{\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\n\t// Draw frame\n\tconst ImU32 frame_col = GetColorU32(g.ActiveId == id ? ImGuiCol_FrameBgActive : g.HoveredId == id ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg);\n\tRenderFrame(frame_bb.Min, frame_bb.Max, frame_col, true, style.FrameRounding);\n\n\tbool value_changed = false;\n\n\t// Process clicking on the drag\n\tif (g.ActiveId == id)\n\t{\n\t\tif (g.IO.MouseDown[0])\n\t\t{\n\t\t\tif (g.ActiveIdIsJustActivated)\n\t\t\t{\n\t\t\t\t// Lock current value on click\n\t\t\t\tg.DragCurrentValue = *v;\n\t\t\t\tg.DragLastMouseDelta = ImVec2(0.f, 0.f);\n\t\t\t}\n\n\t\t\tif (v_speed == 0.0f && (v_max - v_min) != 0.0f && (v_max - v_min) < FLT_MAX)\n\t\t\t\tv_speed = (v_max - v_min) * g.DragSpeedDefaultRatio;\n\n\t\t\tfloat v_cur = g.DragCurrentValue;\n\t\t\tconst ImVec2 mouse_drag_delta = GetMouseDragDelta(0, 1.0f);\n\t\t\tfloat adjust_delta = 0.0f;\n\t\t\tif (IsMousePosValid())\n\t\t\t{\n\t\t\t\t//if (g.ActiveIdSource == ImGuiInputSource_Mouse)\n\t\t\t\t{\n\t\t\t\t\tadjust_delta = mouse_drag_delta.x - g.DragLastMouseDelta.x;\n\t\t\t\t\tif (g.IO.KeyShift && g.DragSpeedScaleFast >= 0.0f)\n\t\t\t\t\t\tadjust_delta *= g.DragSpeedScaleFast;\n\t\t\t\t\tif (g.IO.KeyAlt && g.DragSpeedScaleSlow >= 0.0f)\n\t\t\t\t\t\tadjust_delta *= g.DragSpeedScaleSlow;\n\t\t\t\t}\n\t\t\t\tg.DragLastMouseDelta.x = mouse_drag_delta.x;\n\t\t\t}\n\t\t\tadjust_delta *= v_speed;\n\n\t\t\tif (fabsf(adjust_delta) > 0.0f)\n\t\t\t{\n\t\t\t\tif (fabsf(power - 1.0f) > 0.001f)\n\t\t\t\t{\n\t\t\t\t\t// Logarithmic curve on both side of 0.0\n\t\t\t\t\tfloat v0_abs = v_cur >= 0.0f ? v_cur : -v_cur;\n\t\t\t\t\tfloat v0_sign = v_cur >= 0.0f ? 1.0f : -1.0f;\n\t\t\t\t\tfloat v1 = powf(v0_abs, 1.0f / power) + (adjust_delta * v0_sign);\n\t\t\t\t\tfloat v1_abs = v1 >= 0.0f ? v1 : -v1;\n\t\t\t\t\tfloat v1_sign = v1 >= 0.0f ? 1.0f : -1.0f;          // Crossed sign line\n\t\t\t\t\tv_cur = powf(v1_abs, power) * v0_sign * v1_sign;    // Reapply sign\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tv_cur += adjust_delta;\n\t\t\t\t}\n\n\t\t\t\t// Clamp\n\t\t\t\tif (v_min < v_max)\n\t\t\t\t\tv_cur = ImClamp(v_cur, v_min, v_max);\n\t\t\t\tg.DragCurrentValue = v_cur;\n\t\t\t}\n\n\t\t\t// Round to user desired precision, then apply\n\t\t\tv_cur = RoundScalar(v_cur, decimal_precision);\n\t\t\tif (*v != v_cur)\n\t\t\t{\n\t\t\t\t*v = v_cur;\n\t\t\t\tvalue_changed = true;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tClearActiveID();\n\t\t}\n\t}\n\n\treturn value_changed;\n}\n\nbool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* display_format, float power)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\tconst float w = CalcItemWidth();\n\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tconst ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));\n\tconst ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);\n\tconst ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\n\t// NB- we don't call ItemSize() yet because we may turn into a text edit box below\n\tif (!ItemAdd(total_bb, id))\n\t{\n\t\tItemSize(total_bb, style.FramePadding.y);\n\t\treturn false;\n\t}\n\tconst bool hovered = ItemHoverable(frame_bb, id);\n\n\tif (!display_format)\n\t\tdisplay_format = \"%.3f\";\n\tint decimal_precision = ParseFormatPrecision(display_format, 3);\n\n\t// Tabbing or CTRL-clicking on Drag turns it into an input box\n\tbool start_text_input = false;\n\tconst bool tab_focus_requested = FocusableItemRegister(window, id);\n\tif (tab_focus_requested || (hovered && (g.IO.MouseClicked[0] || g.IO.MouseDoubleClicked[0])))\n\t{\n\t\tSetActiveID(id, window);\n\t\tFocusWindow(window);\n\t\tif (tab_focus_requested || g.IO.KeyCtrl || g.IO.MouseDoubleClicked[0])\n\t\t{\n\t\t\tstart_text_input = true;\n\t\t\tg.ScalarAsInputTextId = 0;\n\t\t}\n\t}\n\tif (start_text_input || (g.ActiveId == id && g.ScalarAsInputTextId == id))\n\t\treturn InputScalarAsWidgetReplacement(frame_bb, label, ImGuiDataType_Float, v, id, decimal_precision);\n\n\t// Actual drag behavior\n\tItemSize(total_bb, style.FramePadding.y);\n\tconst bool value_changed = DragBehavior(frame_bb, id, v, v_speed, v_min, v_max, decimal_precision, power);\n\n\t// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.\n\tchar value_buf[64];\n\tconst char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);\n\tRenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));\n\n\tif (label_size.x > 0.0f)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);\n\n\treturn value_changed;\n}\n\nbool ImGui::DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tbool value_changed = false;\n\tBeginGroup();\n\tPushID(label);\n\tPushMultiItemsWidths(components);\n\tfor (int i = 0; i < components; i++)\n\t{\n\t\tPushID(i);\n\t\tvalue_changed |= DragFloat(\"##v\", &v[i], v_speed, v_min, v_max, display_format, power);\n\t\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\t\tPopID();\n\t\tPopItemWidth();\n\t}\n\tPopID();\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* display_format, float power)\n{\n\treturn DragFloatN(label, v, 2, v_speed, v_min, v_max, display_format, power);\n}\n\nbool ImGui::DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* display_format, float power)\n{\n\treturn DragFloatN(label, v, 3, v_speed, v_min, v_max, display_format, power);\n}\n\nbool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* display_format, float power)\n{\n\treturn DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power);\n}\n\nbool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* display_format, const char* display_format_max, float power)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tPushID(label);\n\tBeginGroup();\n\tPushMultiItemsWidths(2);\n\n\tbool value_changed = DragFloat(\"##min\", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format, power);\n\tPopItemWidth();\n\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\tvalue_changed |= DragFloat(\"##max\", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, display_format_max ? display_format_max : display_format, power);\n\tPopItemWidth();\n\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\tPopID();\n\n\treturn value_changed;\n}\n\n// NB: v_speed is float to allow adjusting the drag speed with more precision\nbool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* display_format)\n{\n\tif (!display_format)\n\t\tdisplay_format = \"%.0f\";\n\tfloat v_f = (float)*v;\n\tbool value_changed = DragFloat(label, &v_f, v_speed, (float)v_min, (float)v_max, display_format);\n\t*v = (int)v_f;\n\treturn value_changed;\n}\n\nbool ImGui::DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tbool value_changed = false;\n\tBeginGroup();\n\tPushID(label);\n\tPushMultiItemsWidths(components);\n\tfor (int i = 0; i < components; i++)\n\t{\n\t\tPushID(i);\n\t\tvalue_changed |= DragInt(\"##v\", &v[i], v_speed, v_min, v_max, display_format);\n\t\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\t\tPopID();\n\t\tPopItemWidth();\n\t}\n\tPopID();\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::DragInt2(const char* label, int v[2], float v_speed, int v_min, int v_max, const char* display_format)\n{\n\treturn DragIntN(label, v, 2, v_speed, v_min, v_max, display_format);\n}\n\nbool ImGui::DragInt3(const char* label, int v[3], float v_speed, int v_min, int v_max, const char* display_format)\n{\n\treturn DragIntN(label, v, 3, v_speed, v_min, v_max, display_format);\n}\n\nbool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int v_max, const char* display_format)\n{\n\treturn DragIntN(label, v, 4, v_speed, v_min, v_max, display_format);\n}\n\nbool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* display_format, const char* display_format_max)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tPushID(label);\n\tBeginGroup();\n\tPushMultiItemsWidths(2);\n\n\tbool value_changed = DragInt(\"##min\", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format);\n\tPopItemWidth();\n\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\tvalue_changed |= DragInt(\"##max\", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, display_format_max ? display_format_max : display_format);\n\tPopItemWidth();\n\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\tPopID();\n\n\treturn value_changed;\n}\n\nvoid ImGui::PlotEx(ImGuiPlotType plot_type, const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tif (graph_size.x == 0.0f)\n\t\tgraph_size.x = CalcItemWidth();\n\tif (graph_size.y == 0.0f)\n\t\tgraph_size.y = label_size.y + (style.FramePadding.y * 2);\n\n\tconst ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(graph_size.x, graph_size.y));\n\tconst ImRect inner_bb(frame_bb.Min + style.FramePadding, frame_bb.Max - style.FramePadding);\n\tconst ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0));\n\tItemSize(total_bb, style.FramePadding.y);\n\tif (!ItemAdd(total_bb, 0))\n\t\treturn;\n\tconst bool hovered = ItemHoverable(inner_bb, 0);\n\n\t// Determine scale from values if not specified\n\tif (scale_min == FLT_MAX || scale_max == FLT_MAX)\n\t{\n\t\tfloat v_min = FLT_MAX;\n\t\tfloat v_max = -FLT_MAX;\n\t\tfor (int i = 0; i < values_count; i++)\n\t\t{\n\t\t\tconst float v = values_getter(data, i);\n\t\t\tv_min = ImMin(v_min, v);\n\t\t\tv_max = ImMax(v_max, v);\n\t\t}\n\t\tif (scale_min == FLT_MAX)\n\t\t\tscale_min = v_min;\n\t\tif (scale_max == FLT_MAX)\n\t\t\tscale_max = v_max;\n\t}\n\n\tRenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n\n\tif (values_count > 0)\n\t{\n\t\tint res_w = ImMin((int)graph_size.x, values_count) + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);\n\t\tint item_count = values_count + ((plot_type == ImGuiPlotType_Lines) ? -1 : 0);\n\n\t\t// Tooltip on hover\n\t\tint v_hovered = -1;\n\t\tif (hovered)\n\t\t{\n\t\t\tconst float t = ImClamp((g.IO.MousePos.x - inner_bb.Min.x) / (inner_bb.Max.x - inner_bb.Min.x), 0.0f, 0.9999f);\n\t\t\tconst int v_idx = (int)(t * item_count);\n\t\t\tIM_ASSERT(v_idx >= 0 && v_idx < values_count);\n\n\t\t\tconst float v0 = values_getter(data, (v_idx + values_offset) % values_count);\n\t\t\tconst float v1 = values_getter(data, (v_idx + 1 + values_offset) % values_count);\n\t\t\tif (plot_type == ImGuiPlotType_Lines)\n\t\t\t\tSetTooltip(\"%d: %8.4g\\n%d: %8.4g\", v_idx, v0, v_idx + 1, v1);\n\t\t\telse if (plot_type == ImGuiPlotType_Histogram)\n\t\t\t\tSetTooltip(\"%d: %8.4g\", v_idx, v0);\n\t\t\tv_hovered = v_idx;\n\t\t}\n\n\t\tconst float t_step = 1.0f / (float)res_w;\n\n\t\tfloat v0 = values_getter(data, (0 + values_offset) % values_count);\n\t\tfloat t0 = 0.0f;\n\t\tImVec2 tp0 = ImVec2(t0, 1.0f - ImSaturate((v0 - scale_min) / (scale_max - scale_min)));                       // Point in the normalized space of our target rectangle\n\t\tfloat histogram_zero_line_t = (scale_min * scale_max < 0.0f) ? (-scale_min / (scale_max - scale_min)) : (scale_min < 0.0f ? 0.0f : 1.0f);   // Where does the zero line stands\n\n\t\tconst ImU32 col_base = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLines : ImGuiCol_PlotHistogram);\n\t\tconst ImU32 col_hovered = GetColorU32((plot_type == ImGuiPlotType_Lines) ? ImGuiCol_PlotLinesHovered : ImGuiCol_PlotHistogramHovered);\n\n\t\tfor (int n = 0; n < res_w; n++)\n\t\t{\n\t\t\tconst float t1 = t0 + t_step;\n\t\t\tconst int v1_idx = (int)(t0 * item_count + 0.5f);\n\t\t\tIM_ASSERT(v1_idx >= 0 && v1_idx < values_count);\n\t\t\tconst float v1 = values_getter(data, (v1_idx + values_offset + 1) % values_count);\n\t\t\tconst ImVec2 tp1 = ImVec2(t1, 1.0f - ImSaturate((v1 - scale_min) / (scale_max - scale_min)));\n\n\t\t\t// NB: Draw calls are merged together by the DrawList system. Still, we should render our batch are lower level to save a bit of CPU.\n\t\t\tImVec2 pos0 = ImLerp(inner_bb.Min, inner_bb.Max, tp0);\n\t\t\tImVec2 pos1 = ImLerp(inner_bb.Min, inner_bb.Max, (plot_type == ImGuiPlotType_Lines) ? tp1 : ImVec2(tp1.x, histogram_zero_line_t));\n\t\t\tif (plot_type == ImGuiPlotType_Lines)\n\t\t\t{\n\t\t\t\twindow->DrawList->AddLine(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);\n\t\t\t}\n\t\t\telse if (plot_type == ImGuiPlotType_Histogram)\n\t\t\t{\n\t\t\t\tif (pos1.x >= pos0.x + 2.0f)\n\t\t\t\t\tpos1.x -= 1.0f;\n\t\t\t\twindow->DrawList->AddRectFilled(pos0, pos1, v_hovered == v1_idx ? col_hovered : col_base);\n\t\t\t}\n\n\t\t\tt0 = t1;\n\t\t\ttp0 = tp1;\n\t\t}\n\t}\n\n\t// Text overlay\n\tif (overlay_text)\n\t\tRenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, overlay_text, NULL, NULL, ImVec2(0.5f, 0.0f));\n\n\tif (label_size.x > 0.0f)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, inner_bb.Min.y), label);\n}\n\nstruct ImGuiPlotArrayGetterData\n{\n\tconst float* Values;\n\tint Stride;\n\n\tImGuiPlotArrayGetterData(const float* values, int stride) { Values = values; Stride = stride; }\n};\n\nstatic float Plot_ArrayGetter(void* data, int idx)\n{\n\tImGuiPlotArrayGetterData* plot_data = (ImGuiPlotArrayGetterData*)data;\n\tconst float v = *(float*)(void*)((unsigned char*)plot_data->Values + (size_t)idx * plot_data->Stride);\n\treturn v;\n}\n\nvoid ImGui::PlotLines(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride)\n{\n\tImGuiPlotArrayGetterData data(values, stride);\n\tPlotEx(ImGuiPlotType_Lines, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\nvoid ImGui::PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)\n{\n\tPlotEx(ImGuiPlotType_Lines, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\nvoid ImGui::PlotHistogram(const char* label, const float* values, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size, int stride)\n{\n\tImGuiPlotArrayGetterData data(values, stride);\n\tPlotEx(ImGuiPlotType_Histogram, label, &Plot_ArrayGetter, (void*)&data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\nvoid ImGui::PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size)\n{\n\tPlotEx(ImGuiPlotType_Histogram, label, values_getter, data, values_count, values_offset, overlay_text, scale_min, scale_max, graph_size);\n}\n\n// size_arg (for each axis) < 0.0f: align to end, 0.0f: auto, > 0.0f: specified size\nvoid ImGui::ProgressBar(float fraction, const ImVec2& size_arg, const char* overlay)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\n\tImVec2 pos = window->DC.CursorPos;\n\tImRect bb(pos, pos + CalcItemSize(size_arg, CalcItemWidth(), g.FontSize + style.FramePadding.y * 2.0f));\n\tItemSize(bb, style.FramePadding.y);\n\tif (!ItemAdd(bb, 0))\n\t\treturn;\n\n\t// Render\n\tfraction = ImSaturate(fraction);\n\tRenderFrame(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n\tbb.Expand(ImVec2(-style.FrameBorderSize, -style.FrameBorderSize));\n\tconst ImVec2 fill_br = ImVec2(ImLerp(bb.Min.x, bb.Max.x, fraction), bb.Max.y);\n\tRenderRectFilledRangeH(window->DrawList, bb, GetColorU32(ImGuiCol_PlotHistogram), 0.0f, fraction, style.FrameRounding);\n\n\t// Default displaying the fraction as percentage string, but user can override it\n\tchar overlay_buf[32];\n\tif (!overlay)\n\t{\n\t\tImFormatString(overlay_buf, IM_ARRAYSIZE(overlay_buf), \"%.0f%%\", fraction * 100 + 0.01f);\n\t\toverlay = overlay_buf;\n\t}\n\n\tImVec2 overlay_size = CalcTextSize(overlay, NULL);\n\tif (overlay_size.x > 0.0f)\n\t\tRenderTextClipped(ImVec2(ImClamp(fill_br.x + style.ItemSpacing.x, bb.Min.x, bb.Max.x - overlay_size.x - style.ItemInnerSpacing.x), bb.Min.y), bb.Max, overlay, NULL, &overlay_size, ImVec2(0.0f, 0.5f), &bb);\n}\n\nbool ImGui::Checkbox(const char* label, bool* v)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\tconst ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y * 2, label_size.y + style.FramePadding.y * 2)); // We want a square shape to we use Y twice\n\tItemSize(check_bb, style.FramePadding.y);\n\n\tImRect total_bb = check_bb;\n\tif (label_size.x > 0)\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\tconst ImRect text_bb(window->DC.CursorPos + ImVec2(0, style.FramePadding.y), window->DC.CursorPos + ImVec2(0, style.FramePadding.y) + label_size);\n\tif (label_size.x > 0)\n\t{\n\t\tItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y);\n\t\ttotal_bb = ImRect(ImMin(check_bb.Min, text_bb.Min), ImMax(check_bb.Max, text_bb.Max));\n\t}\n\n\tif (!ItemAdd(total_bb, id))\n\t\treturn false;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(total_bb, id, &hovered, &held);\n\tif (pressed)\n\t\t*v = !(*v);\n\n\tRenderFrame(check_bb.Min, check_bb.Max, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding);\n\tif (*v)\n\t{\n\t\tconst float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());\n\t\tconst float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f));\n\t\tRenderCheckMark(check_bb.Min + ImVec2(pad, pad), GetColorU32(ImGuiCol_CheckMark), check_bb.GetWidth() - pad * 2.0f);\n\t}\n\n\tif (g.LogEnabled)\n\t\tLogRenderedText(&text_bb.Min, *v ? \"[x]\" : \"[ ]\");\n\tif (label_size.x > 0.0f)\n\t\tRenderText(text_bb.Min, label);\n\n\treturn pressed;\n}\n\nbool ImGui::Switch(const char* label, bool* v)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = ImGuiStyle::ImGuiStyle();\n\tconst ImGuiID id = window->GetID(label);\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tconst ImVec2 pading = ImVec2(2, 2);\n\tconst ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.x * 6, label_size.y + style.FramePadding.y / 2));\n\tItemSize(check_bb, style.FramePadding.y);\n\tImRect total_bb = check_bb;\n\tif (label_size.x > 0)\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\tconst ImRect text_bb(window->DC.CursorPos + ImVec2(0, style.FramePadding.y), window->DC.CursorPos + ImVec2(0, style.FramePadding.y) + label_size);\n\tif (label_size.x > 0)\n\t{\n\t\tItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y);\n\t\ttotal_bb = ImRect(ImMin(check_bb.Min, text_bb.Min), ImMax(check_bb.Max, text_bb.Max));\n\t}\n\tif (!ItemAdd(total_bb, id))\n\t\treturn false;\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(total_bb, id, &hovered, &held);\n\tif (pressed)\n\t\t*v = !(*v);\n\tconst float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());\n\tconst float check_sz2 = check_sz / 2;\n\tconst float pad = ImMax(1.0f, (float)(int)(check_sz / 4.f));\n\t//window->DrawList->AddRectFilled(check_bb.Min+ImVec2(pad,pad), check_bb.Max-ImVec2(pad,pad), GetColorU32(ImGuiCol_CheckMark), style.FrameRounding);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 6, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 5, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 4, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 3, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 2, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 1, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 1, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 2, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 3, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 4, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 5, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.8627450980392157f, 0.2980392156862745f, 0.2980392156862745f, 1.0f)), 13);\n\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 6, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(1.0f, 1.0f, 1.0f, 1.0f)), 13);\n\tif (*v)//?? ?????? ???????\n\t{\n\t\t//window->DrawList->AddRectFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Min.y), check_bb.Max, GetColorU32(ImVec4(0.34f, 1.0f, 0.54f, 1.0f)), 0);\n\t\t//window->DrawList->AddRectFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Min.y), check_bb.Max, GetColorU32(ImVec4(0.34f, 1.0f, 0.54f, 1.0f)), 0);\n\n\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 6, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 5, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 4, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 3, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 2, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 1, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 1, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 2, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 3, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 4, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 5, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 6, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(0.61f, 0.35f, 0.71f, 1.f)), 13);\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 + 6, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(1.0f, 1.0f, 1.0f, 1.0f)), 13);\n\t}\n\telse\n\t{\n\t\twindow->DrawList->AddCircleFilled(ImVec2(check_bb.Min.x + (check_bb.Max.x - check_bb.Min.x) / 2 - 6, check_bb.Min.y + 9), 7, GetColorU32(ImVec4(1.0f, 1.0f, 1.0f, 1.0f)), 12);\n\t}\n\tif (label_size.x > 0.0f)\n\t\tRenderText(text_bb.GetTL() - ImVec2(2, 2), label);\n\treturn pressed;\n}\n\nbool ImGui::CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value)\n{\n\tbool v = ((*flags & flags_value) == flags_value);\n\tbool pressed = Checkbox(label, &v);\n\tif (pressed)\n\t{\n\t\tif (v)\n\t\t\t*flags |= flags_value;\n\t\telse\n\t\t\t*flags &= ~flags_value;\n\t}\n\n\treturn pressed;\n}\n\nbool ImGui::RadioButton(const char* label, bool active)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\tconst ImRect check_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(label_size.y + style.FramePadding.y * 2 - 1, label_size.y + style.FramePadding.y * 2 - 1));\n\tItemSize(check_bb, style.FramePadding.y);\n\n\tImRect total_bb = check_bb;\n\tif (label_size.x > 0)\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\tconst ImRect text_bb(window->DC.CursorPos + ImVec2(0, style.FramePadding.y), window->DC.CursorPos + ImVec2(0, style.FramePadding.y) + label_size);\n\tif (label_size.x > 0)\n\t{\n\t\tItemSize(ImVec2(text_bb.GetWidth(), check_bb.GetHeight()), style.FramePadding.y);\n\t\ttotal_bb.Add(text_bb);\n\t}\n\n\tif (!ItemAdd(total_bb, id))\n\t\treturn false;\n\n\tImVec2 center = check_bb.GetCenter();\n\tcenter.x = (float)(int)center.x + 0.5f;\n\tcenter.y = (float)(int)center.y + 0.5f;\n\tconst float radius = check_bb.GetHeight() * 0.5f;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(total_bb, id, &hovered, &held);\n\n\twindow->DrawList->AddCircleFilled(center, radius, GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), 16);\n\tif (active)\n\t{\n\t\tconst float check_sz = ImMin(check_bb.GetWidth(), check_bb.GetHeight());\n\t\tconst float pad = ImMax(1.0f, (float)(int)(check_sz / 6.0f));\n\t\twindow->DrawList->AddCircleFilled(center, radius - pad, GetColorU32(ImGuiCol_CheckMark), 16);\n\t}\n\n\tif (style.FrameBorderSize > 0.0f)\n\t{\n\t\twindow->DrawList->AddCircle(center + ImVec2(1, 1), radius, GetColorU32(ImGuiCol_BorderShadow), 16, style.FrameBorderSize);\n\t\twindow->DrawList->AddCircle(center, radius, GetColorU32(ImGuiCol_Border), 16, style.FrameBorderSize);\n\t}\n\n\tif (g.LogEnabled)\n\t\tLogRenderedText(&text_bb.Min, active ? \"(x)\" : \"( )\");\n\tif (label_size.x > 0.0f)\n\t\tRenderText(text_bb.Min, label);\n\n\treturn pressed;\n}\n\nbool ImGui::RadioButton(const char* label, int* v, int v_button)\n{\n\tconst bool pressed = RadioButton(label, *v == v_button);\n\tif (pressed)\n\t{\n\t\t*v = v_button;\n\t}\n\treturn pressed;\n}\n\nstatic int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end)\n{\n\tint line_count = 0;\n\tconst char* s = text_begin;\n\twhile (char c = *s++) // We are only matching for \\n so we can ignore UTF-8 decoding\n\t\tif (c == '\\n')\n\t\t\tline_count++;\n\ts--;\n\tif (s[0] != '\\n' && s[0] != '\\r')\n\t\tline_count++;\n\t*out_text_end = s;\n\treturn line_count;\n}\n\nstatic ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining, ImVec2* out_offset, bool stop_on_new_line)\n{\n\tImFont* font = GImGui->Font;\n\tconst float line_height = GImGui->FontSize;\n\tconst float scale = line_height / font->FontSize;\n\n\tImVec2 text_size = ImVec2(0, 0);\n\tfloat line_width = 0.0f;\n\n\tconst ImWchar* s = text_begin;\n\twhile (s < text_end)\n\t{\n\t\tunsigned int c = (unsigned int)(*s++);\n\t\tif (c == '\\n')\n\t\t{\n\t\t\ttext_size.x = ImMax(text_size.x, line_width);\n\t\t\ttext_size.y += line_height;\n\t\t\tline_width = 0.0f;\n\t\t\tif (stop_on_new_line)\n\t\t\t\tbreak;\n\t\t\tcontinue;\n\t\t}\n\t\tif (c == '\\r')\n\t\t\tcontinue;\n\n\t\tconst float char_width = font->GetCharAdvance((unsigned short)c) * scale;\n\t\tline_width += char_width;\n\t}\n\n\tif (text_size.x < line_width)\n\t\ttext_size.x = line_width;\n\n\tif (out_offset)\n\t\t*out_offset = ImVec2(line_width, text_size.y + line_height);  // offset allow for the possibility of sitting after a trailing \\n\n\n\tif (line_width > 0 || text_size.y == 0.0f)                        // whereas size.y will ignore the trailing \\n\n\t\ttext_size.y += line_height;\n\n\tif (remaining)\n\t\t*remaining = s;\n\n\treturn text_size;\n}\n\n// Wrapper for stb_textedit.h to edit text (our wrapper is for: statically sized buffer, single-line, wchar characters. InputText converts between UTF-8 and wchar)\nnamespace ImGuiStb\n{\n\n\tstatic int     STB_TEXTEDIT_STRINGLEN(const STB_TEXTEDIT_STRING* obj) { return obj->CurLenW; }\n\tstatic ImWchar STB_TEXTEDIT_GETCHAR(const STB_TEXTEDIT_STRING* obj, int idx) { return obj->Text[idx]; }\n\tstatic float   STB_TEXTEDIT_GETWIDTH(STB_TEXTEDIT_STRING* obj, int line_start_idx, int char_idx) { ImWchar c = obj->Text[line_start_idx + char_idx]; if (c == '\\n') return STB_TEXTEDIT_GETWIDTH_NEWLINE; return GImGui->Font->GetCharAdvance(c) * (GImGui->FontSize / GImGui->Font->FontSize); }\n\tstatic int     STB_TEXTEDIT_KEYTOTEXT(int key) { return key >= 0x10000 ? 0 : key; }\n\tstatic ImWchar STB_TEXTEDIT_NEWLINE = '\\n';\n\tstatic void    STB_TEXTEDIT_LAYOUTROW(StbTexteditRow* r, STB_TEXTEDIT_STRING* obj, int line_start_idx)\n\t{\n\t\tconst ImWchar* text = obj->Text.Data;\n\t\tconst ImWchar* text_remaining = NULL;\n\t\tconst ImVec2 size = InputTextCalcTextSizeW(text + line_start_idx, text + obj->CurLenW, &text_remaining, NULL, true);\n\t\tr->x0 = 0.0f;\n\t\tr->x1 = size.x;\n\t\tr->baseline_y_delta = size.y;\n\t\tr->ymin = 0.0f;\n\t\tr->ymax = size.y;\n\t\tr->num_chars = (int)(text_remaining - (text + line_start_idx));\n\t}\n\n\tstatic bool is_separator(unsigned int c) { return ImCharIsSpace(c) || c == ',' || c == ';' || c == '(' || c == ')' || c == '{' || c == '}' || c == '[' || c == ']' || c == '|'; }\n\tstatic int  is_word_boundary_from_right(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (is_separator(obj->Text[idx - 1]) && !is_separator(obj->Text[idx])) : 1; }\n\tstatic int  STB_TEXTEDIT_MOVEWORDLEFT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx--; while (idx >= 0 && !is_word_boundary_from_right(obj, idx)) idx--; return idx < 0 ? 0 : idx; }\n#ifdef __APPLE__    // FIXME: Move setting to IO structure\n\tstatic int  is_word_boundary_from_left(STB_TEXTEDIT_STRING* obj, int idx) { return idx > 0 ? (!is_separator(obj->Text[idx - 1]) && is_separator(obj->Text[idx])) : 1; }\n\tstatic int  STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_left(obj, idx)) idx++; return idx > len ? len : idx; }\n#else\n\tstatic int  STB_TEXTEDIT_MOVEWORDRIGHT_IMPL(STB_TEXTEDIT_STRING* obj, int idx) { idx++; int len = obj->CurLenW; while (idx < len && !is_word_boundary_from_right(obj, idx)) idx++; return idx > len ? len : idx; }\n#endif\n#define STB_TEXTEDIT_MOVEWORDLEFT   STB_TEXTEDIT_MOVEWORDLEFT_IMPL    // They need to be #define for stb_textedit.h\n#define STB_TEXTEDIT_MOVEWORDRIGHT  STB_TEXTEDIT_MOVEWORDRIGHT_IMPL\n\n\tstatic void STB_TEXTEDIT_DELETECHARS(STB_TEXTEDIT_STRING* obj, int pos, int n)\n\t{\n\t\tImWchar* dst = obj->Text.Data + pos;\n\n\t\t// We maintain our buffer length in both UTF-8 and wchar formats\n\t\tobj->CurLenA -= ImTextCountUtf8BytesFromStr(dst, dst + n);\n\t\tobj->CurLenW -= n;\n\n\t\t// Offset remaining text\n\t\tconst ImWchar* src = obj->Text.Data + pos + n;\n\t\twhile (ImWchar c = *src++)\n\t\t\t*dst++ = c;\n\t\t*dst = '\\0';\n\t}\n\n\tstatic bool STB_TEXTEDIT_INSERTCHARS(STB_TEXTEDIT_STRING* obj, int pos, const ImWchar* new_text, int new_text_len)\n\t{\n\t\tconst int text_len = obj->CurLenW;\n\t\tIM_ASSERT(pos <= text_len);\n\t\tif (new_text_len + text_len + 1 > obj->Text.Size)\n\t\t\treturn false;\n\n\t\tconst int new_text_len_utf8 = ImTextCountUtf8BytesFromStr(new_text, new_text + new_text_len);\n\t\tif (new_text_len_utf8 + obj->CurLenA + 1 > obj->BufSizeA)\n\t\t\treturn false;\n\n\t\tImWchar* text = obj->Text.Data;\n\t\tif (pos != text_len)\n\t\t\tmemmove(text + pos + new_text_len, text + pos, (size_t)(text_len - pos) * sizeof(ImWchar));\n\t\tmemcpy(text + pos, new_text, (size_t)new_text_len * sizeof(ImWchar));\n\n\t\tobj->CurLenW += new_text_len;\n\t\tobj->CurLenA += new_text_len_utf8;\n\t\tobj->Text[obj->CurLenW] = '\\0';\n\n\t\treturn true;\n\t}\n\n\t// We don't use an enum so we can build even with conflicting symbols (if another user of stb_textedit.h leak their STB_TEXTEDIT_K_* symbols)\n#define STB_TEXTEDIT_K_LEFT         0x10000 // keyboard input to move cursor left\n#define STB_TEXTEDIT_K_RIGHT        0x10001 // keyboard input to move cursor right\n#define STB_TEXTEDIT_K_UP           0x10002 // keyboard input to move cursor up\n#define STB_TEXTEDIT_K_DOWN         0x10003 // keyboard input to move cursor down\n#define STB_TEXTEDIT_K_LINESTART    0x10004 // keyboard input to move cursor to start of line\n#define STB_TEXTEDIT_K_LINEEND      0x10005 // keyboard input to move cursor to end of line\n#define STB_TEXTEDIT_K_TEXTSTART    0x10006 // keyboard input to move cursor to start of text\n#define STB_TEXTEDIT_K_TEXTEND      0x10007 // keyboard input to move cursor to end of text\n#define STB_TEXTEDIT_K_DELETE       0x10008 // keyboard input to delete selection or character under cursor\n#define STB_TEXTEDIT_K_BACKSPACE    0x10009 // keyboard input to delete selection or character left of cursor\n#define STB_TEXTEDIT_K_UNDO         0x1000A // keyboard input to perform undo\n#define STB_TEXTEDIT_K_REDO         0x1000B // keyboard input to perform redo\n#define STB_TEXTEDIT_K_WORDLEFT     0x1000C // keyboard input to move cursor left one word\n#define STB_TEXTEDIT_K_WORDRIGHT    0x1000D // keyboard input to move cursor right one word\n#define STB_TEXTEDIT_K_SHIFT        0x20000\n\n#define STB_TEXTEDIT_IMPLEMENTATION\n#include \"stb_textedit.h\"\n\n}\n\nvoid ImGuiTextEditState::OnKeyPressed(int key)\n{\n\tstb_textedit_key(this, &StbState, key);\n\tCursorFollow = true;\n\tCursorAnimReset();\n}\n\n// Public API to manipulate UTF-8 text\n// We expose UTF-8 to the user (unlike the STB_TEXTEDIT_* functions which are manipulating wchar)\n// FIXME: The existence of this rarely exercised code path is a bit of a nuisance.\nvoid ImGuiTextEditCallbackData::DeleteChars(int pos, int bytes_count)\n{\n\tIM_ASSERT(pos + bytes_count <= BufTextLen);\n\tchar* dst = Buf + pos;\n\tconst char* src = Buf + pos + bytes_count;\n\twhile (char c = *src++)\n\t\t*dst++ = c;\n\t*dst = '\\0';\n\n\tif (CursorPos + bytes_count >= pos)\n\t\tCursorPos -= bytes_count;\n\telse if (CursorPos >= pos)\n\t\tCursorPos = pos;\n\tSelectionStart = SelectionEnd = CursorPos;\n\tBufDirty = true;\n\tBufTextLen -= bytes_count;\n}\n\nvoid ImGuiTextEditCallbackData::InsertChars(int pos, const char* new_text, const char* new_text_end)\n{\n\tconst int new_text_len = new_text_end ? (int)(new_text_end - new_text) : (int)strlen(new_text);\n\tif (new_text_len + BufTextLen + 1 >= BufSize)\n\t\treturn;\n\n\tif (BufTextLen != pos)\n\t\tmemmove(Buf + pos + new_text_len, Buf + pos, (size_t)(BufTextLen - pos));\n\tmemcpy(Buf + pos, new_text, (size_t)new_text_len * sizeof(char));\n\tBuf[BufTextLen + new_text_len] = '\\0';\n\n\tif (CursorPos >= pos)\n\t\tCursorPos += new_text_len;\n\tSelectionStart = SelectionEnd = CursorPos;\n\tBufDirty = true;\n\tBufTextLen += new_text_len;\n}\n\n// Return false to discard a character.\nstatic bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)\n{\n\tunsigned int c = *p_char;\n\n\tif (c < 128 && c != ' ' && !isprint((int)(c & 0xFF)))\n\t{\n\t\tbool pass = false;\n\t\tpass |= (c == '\\n' && (flags & ImGuiInputTextFlags_Multiline));\n\t\tpass |= (c == '\\t' && (flags & ImGuiInputTextFlags_AllowTabInput));\n\t\tif (!pass)\n\t\t\treturn false;\n\t}\n\n\tif (c >= 0xE000 && c <= 0xF8FF) // Filter private Unicode range. I don't imagine anybody would want to input them. GLFW on OSX seems to send private characters for special keys like arrow keys.\n\t\treturn false;\n\n\tif (flags & (ImGuiInputTextFlags_CharsDecimal | ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_CharsNoBlank))\n\t{\n\t\tif (flags & ImGuiInputTextFlags_CharsDecimal)\n\t\t\tif (!(c >= '0' && c <= '9') && (c != '.') && (c != '-') && (c != '+') && (c != '*') && (c != '/'))\n\t\t\t\treturn false;\n\n\t\tif (flags & ImGuiInputTextFlags_CharsHexadecimal)\n\t\t\tif (!(c >= '0' && c <= '9') && !(c >= 'a' && c <= 'f') && !(c >= 'A' && c <= 'F'))\n\t\t\t\treturn false;\n\n\t\tif (flags & ImGuiInputTextFlags_CharsUppercase)\n\t\t\tif (c >= 'a' && c <= 'z')\n\t\t\t\t*p_char = (c += (unsigned int)('A' - 'a'));\n\n\t\tif (flags & ImGuiInputTextFlags_CharsNoBlank)\n\t\t\tif (ImCharIsSpace(c))\n\t\t\t\treturn false;\n\t}\n\n\tif (flags & ImGuiInputTextFlags_CallbackCharFilter)\n\t{\n\t\tImGuiTextEditCallbackData callback_data;\n\t\tmemset(&callback_data, 0, sizeof(ImGuiTextEditCallbackData));\n\t\tcallback_data.EventFlag = ImGuiInputTextFlags_CallbackCharFilter;\n\t\tcallback_data.EventChar = (ImWchar)c;\n\t\tcallback_data.Flags = flags;\n\t\tcallback_data.UserData = user_data;\n\t\tif (callback(&callback_data) != 0)\n\t\t\treturn false;\n\t\t*p_char = callback_data.EventChar;\n\t\tif (!callback_data.EventChar)\n\t\t\treturn false;\n\t}\n\n\treturn true;\n}\n\n// Edit a string of text\n// NB: when active, hold on a privately held copy of the text (and apply back to 'buf'). So changing 'buf' while active has no effect.\n// FIXME: Rather messy function partly because we are doing UTF8 > u16 > UTF8 conversions on the go to more easily handle stb_textedit calls. Ideally we should stay in UTF-8 all the time. See https://github.com/nothings/stb/issues/188\nbool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tIM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys)\n\tIM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiIO& io = g.IO;\n\tconst ImGuiStyle& style = g.Style;\n\n\tconst bool is_multiline = (flags & ImGuiInputTextFlags_Multiline) != 0;\n\tconst bool is_editable = (flags & ImGuiInputTextFlags_ReadOnly) == 0;\n\tconst bool is_password = (flags & ImGuiInputTextFlags_Password) != 0;\n\tconst bool is_undoable = (flags & ImGuiInputTextFlags_NoUndoRedo) == 0;\n\n\tif (is_multiline) // Open group before calling GetID() because groups tracks id created during their spawn\n\t\tBeginGroup();\n\tconst ImGuiID id = window->GetID(label);\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), (is_multiline ? GetTextLineHeight() * 8.0f : label_size.y) + style.FramePadding.y * 2.0f); // Arbitrary default of 8 lines high for multi-line\n\tconst ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + size);\n\tconst ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? (style.ItemInnerSpacing.x + label_size.x) : 0.0f, 0.0f));\n\n\tImGuiWindow* draw_window = window;\n\tif (is_multiline)\n\t{\n\t\tif (!BeginChildFrame(id, frame_bb.GetSize()))\n\t\t{\n\t\t\tEndChildFrame();\n\t\t\tEndGroup();\n\t\t\treturn false;\n\t\t}\n\t\tdraw_window = GetCurrentWindow();\n\t\tsize.x -= draw_window->ScrollbarSizes.x;\n\t}\n\telse\n\t{\n\t\tItemSize(total_bb, style.FramePadding.y);\n\t\tif (!ItemAdd(total_bb, id))\n\t\t\treturn false;\n\t}\n\tconst bool hovered = ItemHoverable(frame_bb, id);\n\tif (hovered)\n\t\tg.MouseCursor = ImGuiMouseCursor_TextInput;\n\n\t// Password pushes a temporary font with only a fallback glyph\n\tif (is_password)\n\t{\n\t\tconst ImFontGlyph* glyph = g.Font->FindGlyph('*');\n\t\tImFont* password_font = &g.InputTextPasswordFont;\n\t\tpassword_font->FontSize = g.Font->FontSize;\n\t\tpassword_font->Scale = g.Font->Scale;\n\t\tpassword_font->DisplayOffset = g.Font->DisplayOffset;\n\t\tpassword_font->Ascent = g.Font->Ascent;\n\t\tpassword_font->Descent = g.Font->Descent;\n\t\tpassword_font->ContainerAtlas = g.Font->ContainerAtlas;\n\t\tpassword_font->FallbackGlyph = glyph;\n\t\tpassword_font->FallbackAdvanceX = glyph->AdvanceX;\n\t\tIM_ASSERT(password_font->Glyphs.empty() && password_font->IndexAdvanceX.empty() && password_font->IndexLookup.empty());\n\t\tPushFont(password_font);\n\t}\n\n\t// NB: we are only allowed to access 'edit_state' if we are the active widget.\n\tImGuiTextEditState& edit_state = g.InputTextState;\n\n\tconst bool focus_requested = FocusableItemRegister(window, id, (flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_AllowTabInput)) == 0);    // Using completion callback disable keyboard tabbing\n\tconst bool focus_requested_by_code = focus_requested && (window->FocusIdxAllCounter == window->FocusIdxAllRequestCurrent);\n\tconst bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;\n\n\tconst bool user_clicked = hovered && io.MouseClicked[0];\n\tconst bool user_scrolled = is_multiline && g.ActiveId == 0 && edit_state.Id == id && g.ActiveIdPreviousFrame == draw_window->GetIDNoKeepAlive(\"#SCROLLY\");\n\n\tbool clear_active_id = false;\n\n\tbool select_all = (g.ActiveId != id) && (flags & ImGuiInputTextFlags_AutoSelectAll) != 0;\n\tif (focus_requested || user_clicked || user_scrolled)\n\t{\n\t\tif (g.ActiveId != id)\n\t\t{\n\t\t\t// Start edition\n\t\t\t// Take a copy of the initial buffer value (both in original UTF-8 format and converted to wchar)\n\t\t\t// From the moment we focused we are ignoring the content of 'buf' (unless we are in read-only mode)\n\t\t\tconst int prev_len_w = edit_state.CurLenW;\n\t\t\tedit_state.Text.resize(buf_size + 1);        // wchar count <= UTF-8 count. we use +1 to make sure that .Data isn't NULL so it doesn't crash.\n\t\t\tedit_state.InitialText.resize(buf_size + 1); // UTF-8. we use +1 to make sure that .Data isn't NULL so it doesn't crash.\n\t\t\tImStrncpy(edit_state.InitialText.Data, buf, edit_state.InitialText.Size);\n\t\t\tconst char* buf_end = NULL;\n\t\t\tedit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text.Data, edit_state.Text.Size, buf, NULL, &buf_end);\n\t\t\tedit_state.CurLenA = (int)(buf_end - buf); // We can't get the result from ImFormatString() above because it is not UTF-8 aware. Here we'll cut off malformed UTF-8.\n\t\t\tedit_state.CursorAnimReset();\n\n\t\t\t// Preserve cursor position and undo/redo stack if we come back to same widget\n\t\t\t// FIXME: We should probably compare the whole buffer to be on the safety side. Comparing buf (utf8) and edit_state.Text (wchar).\n\t\t\tconst bool recycle_state = (edit_state.Id == id) && (prev_len_w == edit_state.CurLenW);\n\t\t\tif (recycle_state)\n\t\t\t{\n\t\t\t\t// Recycle existing cursor/selection/undo stack but clamp position\n\t\t\t\t// Note a single mouse click will override the cursor/position immediately by calling stb_textedit_click handler.\n\t\t\t\tedit_state.CursorClamp();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tedit_state.Id = id;\n\t\t\t\tedit_state.ScrollX = 0.0f;\n\t\t\t\tstb_textedit_initialize_state(&edit_state.StbState, !is_multiline);\n\t\t\t\tif (!is_multiline && focus_requested_by_code)\n\t\t\t\t\tselect_all = true;\n\t\t\t}\n\t\t\tif (flags & ImGuiInputTextFlags_AlwaysInsertMode)\n\t\t\t\tedit_state.StbState.insert_mode = true;\n\t\t\tif (!is_multiline && (focus_requested_by_tab || (user_clicked && io.KeyCtrl)))\n\t\t\t\tselect_all = true;\n\t\t}\n\t\tSetActiveID(id, window);\n\t\tFocusWindow(window);\n\t}\n\telse if (io.MouseClicked[0])\n\t{\n\t\t// Release focus when we click outside\n\t\tclear_active_id = true;\n\t}\n\n\tbool value_changed = false;\n\tbool enter_pressed = false;\n\n\tif (g.ActiveId == id)\n\t{\n\t\tif (!is_editable && !g.ActiveIdIsJustActivated)\n\t\t{\n\t\t\t// When read-only we always use the live data passed to the function\n\t\t\tedit_state.Text.resize(buf_size + 1);\n\t\t\tconst char* buf_end = NULL;\n\t\t\tedit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text.Data, edit_state.Text.Size, buf, NULL, &buf_end);\n\t\t\tedit_state.CurLenA = (int)(buf_end - buf);\n\t\t\tedit_state.CursorClamp();\n\t\t}\n\n\t\tedit_state.BufSizeA = buf_size;\n\n\t\t// Although we are active we don't prevent mouse from hovering other elements unless we are interacting right now with the widget.\n\t\t// Down the line we should have a cleaner library-wide concept of Selected vs Active.\n\t\tg.ActiveIdAllowOverlap = !io.MouseDown[0];\n\t\tg.WantTextInputNextFrame = 1;\n\n\t\t// Edit in progress\n\t\tconst float mouse_x = (io.MousePos.x - frame_bb.Min.x - style.FramePadding.x) + edit_state.ScrollX;\n\t\tconst float mouse_y = (is_multiline ? (io.MousePos.y - draw_window->DC.CursorPos.y - style.FramePadding.y) : (g.FontSize * 0.5f));\n\n\t\tconst bool osx_double_click_selects_words = io.OptMacOSXBehaviors;      // OS X style: Double click selects by word instead of selecting whole text\n\t\tif (select_all || (hovered && !osx_double_click_selects_words && io.MouseDoubleClicked[0]))\n\t\t{\n\t\t\tedit_state.SelectAll();\n\t\t\tedit_state.SelectedAllMouseLock = true;\n\t\t}\n\t\telse if (hovered && osx_double_click_selects_words && io.MouseDoubleClicked[0])\n\t\t{\n\t\t\t// Select a word only, OS X style (by simulating keystrokes)\n\t\t\tedit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT);\n\t\t\tedit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT);\n\t\t}\n\t\telse if (io.MouseClicked[0] && !edit_state.SelectedAllMouseLock)\n\t\t{\n\t\t\tif (hovered)\n\t\t\t{\n\t\t\t\tstb_textedit_click(&edit_state, &edit_state.StbState, mouse_x, mouse_y);\n\t\t\t\tedit_state.CursorAnimReset();\n\t\t\t}\n\t\t}\n\t\telse if (io.MouseDown[0] && !edit_state.SelectedAllMouseLock && (io.MouseDelta.x != 0.0f || io.MouseDelta.y != 0.0f))\n\t\t{\n\t\t\tstb_textedit_drag(&edit_state, &edit_state.StbState, mouse_x, mouse_y);\n\t\t\tedit_state.CursorAnimReset();\n\t\t\tedit_state.CursorFollow = true;\n\t\t}\n\t\tif (edit_state.SelectedAllMouseLock && !io.MouseDown[0])\n\t\t\tedit_state.SelectedAllMouseLock = false;\n\n\t\tif (io.InputCharacters[0])\n\t\t{\n\t\t\t// Process text input (before we check for Return because using some IME will effectively send a Return?)\n\t\t\t// We ignore CTRL inputs, but need to allow CTRL+ALT as some keyboards (e.g. German) use AltGR - which is Alt+Ctrl - to input certain characters.\n\t\t\tif (!(io.KeyCtrl && !io.KeyAlt) && is_editable)\n\t\t\t{\n\t\t\t\tfor (int n = 0; n < IM_ARRAYSIZE(io.InputCharacters) && io.InputCharacters[n]; n++)\n\t\t\t\t\tif (unsigned int c = (unsigned int)io.InputCharacters[n])\n\t\t\t\t\t{\n\t\t\t\t\t\t// Insert character if they pass filtering\n\t\t\t\t\t\tif (!InputTextFilterCharacter(&c, flags, callback, user_data))\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tedit_state.OnKeyPressed((int)c);\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Consume characters\n\t\t\tmemset(g.IO.InputCharacters, 0, sizeof(g.IO.InputCharacters));\n\t\t}\n\t}\n\n\tbool cancel_edit = false;\n\tif (g.ActiveId == id && !g.ActiveIdIsJustActivated && !clear_active_id)\n\t{\n\t\t// Handle key-presses\n\t\tconst int k_mask = (io.KeyShift ? STB_TEXTEDIT_K_SHIFT : 0);\n\t\tconst bool is_shortcut_key_only = (io.OptMacOSXBehaviors ? (io.KeySuper && !io.KeyCtrl) : (io.KeyCtrl && !io.KeySuper)) && !io.KeyAlt && !io.KeyShift; // OS X style: Shortcuts using Cmd/Super instead of Ctrl\n\t\tconst bool is_wordmove_key_down = io.OptMacOSXBehaviors ? io.KeyAlt : io.KeyCtrl;                     // OS X style: Text editing cursor movement using Alt instead of Ctrl\n\t\tconst bool is_startend_key_down = io.OptMacOSXBehaviors && io.KeySuper && !io.KeyCtrl && !io.KeyAlt;  // OS X style: Line/Text Start and End using Cmd+Arrows instead of Home/End\n\t\tconst bool is_ctrl_key_only = io.KeyCtrl && !io.KeyShift && !io.KeyAlt && !io.KeySuper;\n\t\tconst bool is_shift_key_only = io.KeyShift && !io.KeyCtrl && !io.KeyAlt && !io.KeySuper;\n\n\t\tconst bool is_cut = ((is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_X)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Delete))) && is_editable && !is_password && (!is_multiline || edit_state.HasSelection());\n\t\tconst bool is_copy = ((is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_C)) || (is_ctrl_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && !is_password && (!is_multiline || edit_state.HasSelection());\n\t\tconst bool is_paste = ((is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_V)) || (is_shift_key_only && IsKeyPressedMap(ImGuiKey_Insert))) && is_editable;\n\n\t\tif (IsKeyPressedMap(ImGuiKey_LeftArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINESTART : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDLEFT : STB_TEXTEDIT_K_LEFT) | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_RightArrow)) { edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_LINEEND : is_wordmove_key_down ? STB_TEXTEDIT_K_WORDRIGHT : STB_TEXTEDIT_K_RIGHT) | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_UpArrow) && is_multiline) { if (io.KeyCtrl) SetWindowScrollY(draw_window, ImMax(draw_window->Scroll.y - g.FontSize, 0.0f)); else edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTSTART : STB_TEXTEDIT_K_UP) | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_DownArrow) && is_multiline) { if (io.KeyCtrl) SetWindowScrollY(draw_window, ImMin(draw_window->Scroll.y + g.FontSize, GetScrollMaxY())); else edit_state.OnKeyPressed((is_startend_key_down ? STB_TEXTEDIT_K_TEXTEND : STB_TEXTEDIT_K_DOWN) | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_Home)) { edit_state.OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTSTART | k_mask : STB_TEXTEDIT_K_LINESTART | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_End)) { edit_state.OnKeyPressed(io.KeyCtrl ? STB_TEXTEDIT_K_TEXTEND | k_mask : STB_TEXTEDIT_K_LINEEND | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_Delete) && is_editable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_DELETE | k_mask); }\n\t\telse if (IsKeyPressedMap(ImGuiKey_Backspace) && is_editable)\n\t\t{\n\t\t\tif (!edit_state.HasSelection())\n\t\t\t{\n\t\t\t\tif (is_wordmove_key_down) edit_state.OnKeyPressed(STB_TEXTEDIT_K_WORDLEFT | STB_TEXTEDIT_K_SHIFT);\n\t\t\t\telse if (io.OptMacOSXBehaviors && io.KeySuper && !io.KeyAlt && !io.KeyCtrl) edit_state.OnKeyPressed(STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT);\n\t\t\t}\n\t\t\tedit_state.OnKeyPressed(STB_TEXTEDIT_K_BACKSPACE | k_mask);\n\t\t}\n\t\telse if (IsKeyPressedMap(ImGuiKey_Enter))\n\t\t{\n\t\t\tbool ctrl_enter_for_new_line = (flags & ImGuiInputTextFlags_CtrlEnterForNewLine) != 0;\n\t\t\tif (!is_multiline || (ctrl_enter_for_new_line && !io.KeyCtrl) || (!ctrl_enter_for_new_line && io.KeyCtrl))\n\t\t\t{\n\t\t\t\tenter_pressed = clear_active_id = true;\n\t\t\t}\n\t\t\telse if (is_editable)\n\t\t\t{\n\t\t\t\tunsigned int c = '\\n'; // Insert new line\n\t\t\t\tif (InputTextFilterCharacter(&c, flags, callback, user_data))\n\t\t\t\t\tedit_state.OnKeyPressed((int)c);\n\t\t\t}\n\t\t}\n\t\telse if ((flags & ImGuiInputTextFlags_AllowTabInput) && IsKeyPressedMap(ImGuiKey_Tab) && !io.KeyCtrl && !io.KeyShift && !io.KeyAlt && is_editable)\n\t\t{\n\t\t\tunsigned int c = '\\t'; // Insert TAB\n\t\t\tif (InputTextFilterCharacter(&c, flags, callback, user_data))\n\t\t\t\tedit_state.OnKeyPressed((int)c);\n\t\t}\n\t\telse if (IsKeyPressedMap(ImGuiKey_Escape)) { clear_active_id = cancel_edit = true; }\n\t\telse if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_Z) && is_editable && is_undoable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_UNDO); edit_state.ClearSelection(); }\n\t\telse if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_Y) && is_editable && is_undoable) { edit_state.OnKeyPressed(STB_TEXTEDIT_K_REDO); edit_state.ClearSelection(); }\n\t\telse if (is_shortcut_key_only && IsKeyPressedMap(ImGuiKey_A)) { edit_state.SelectAll(); edit_state.CursorFollow = true; }\n\t\telse if (is_cut || is_copy)\n\t\t{\n\t\t\t// Cut, Copy\n\t\t\tif (io.SetClipboardTextFn)\n\t\t\t{\n\t\t\t\tconst int ib = edit_state.HasSelection() ? ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end) : 0;\n\t\t\t\tconst int ie = edit_state.HasSelection() ? ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end) : edit_state.CurLenW;\n\t\t\t\tedit_state.TempTextBuffer.resize((ie - ib) * 4 + 1);\n\t\t\t\tImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data + ib, edit_state.Text.Data + ie);\n\t\t\t\tSetClipboardText(edit_state.TempTextBuffer.Data);\n\t\t\t}\n\n\t\t\tif (is_cut)\n\t\t\t{\n\t\t\t\tif (!edit_state.HasSelection())\n\t\t\t\t\tedit_state.SelectAll();\n\t\t\t\tedit_state.CursorFollow = true;\n\t\t\t\tstb_textedit_cut(&edit_state, &edit_state.StbState);\n\t\t\t}\n\t\t}\n\t\telse if (is_paste)\n\t\t{\n\t\t\t// Paste\n\t\t\tif (const char* clipboard = GetClipboardText())\n\t\t\t{\n\t\t\t\t// Filter pasted buffer\n\t\t\t\tconst int clipboard_len = (int)strlen(clipboard);\n\t\t\t\tImWchar* clipboard_filtered = (ImWchar*)ImGui::MemAlloc((clipboard_len + 1) * sizeof(ImWchar));\n\t\t\t\tint clipboard_filtered_len = 0;\n\t\t\t\tfor (const char* s = clipboard; *s; )\n\t\t\t\t{\n\t\t\t\t\tunsigned int c;\n\t\t\t\t\ts += ImTextCharFromUtf8(&c, s, NULL);\n\t\t\t\t\tif (c == 0)\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tif (c >= 0x10000 || !InputTextFilterCharacter(&c, flags, callback, user_data))\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tclipboard_filtered[clipboard_filtered_len++] = (ImWchar)c;\n\t\t\t\t}\n\t\t\t\tclipboard_filtered[clipboard_filtered_len] = 0;\n\t\t\t\tif (clipboard_filtered_len > 0) // If everything was filtered, ignore the pasting operation\n\t\t\t\t{\n\t\t\t\t\tstb_textedit_paste(&edit_state, &edit_state.StbState, clipboard_filtered, clipboard_filtered_len);\n\t\t\t\t\tedit_state.CursorFollow = true;\n\t\t\t\t}\n\t\t\t\tImGui::MemFree(clipboard_filtered);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (g.ActiveId == id)\n\t{\n\t\tif (cancel_edit)\n\t\t{\n\t\t\t// Restore initial value\n\t\t\tif (is_editable)\n\t\t\t{\n\t\t\t\tImStrncpy(buf, edit_state.InitialText.Data, buf_size);\n\t\t\t\tvalue_changed = true;\n\t\t\t}\n\t\t}\n\n\t\t// When using 'ImGuiInputTextFlags_EnterReturnsTrue' as a special case we reapply the live buffer back to the input buffer before clearing ActiveId, even though strictly speaking it wasn't modified on this frame.\n\t\t// If we didn't do that, code like InputInt() with ImGuiInputTextFlags_EnterReturnsTrue would fail. Also this allows the user to use InputText() with ImGuiInputTextFlags_EnterReturnsTrue without maintaining any user-side storage.\n\t\tbool apply_edit_back_to_user_buffer = !cancel_edit || (enter_pressed && (flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0);\n\t\tif (apply_edit_back_to_user_buffer)\n\t\t{\n\t\t\t// Apply new value immediately - copy modified buffer back\n\t\t\t// Note that as soon as the input box is active, the in-widget value gets priority over any underlying modification of the input buffer\n\t\t\t// FIXME: We actually always render 'buf' when calling DrawList->AddText, making the comment above incorrect.\n\t\t\t// FIXME-OPT: CPU waste to do this every time the widget is active, should mark dirty state from the stb_textedit callbacks.\n\t\t\tif (is_editable)\n\t\t\t{\n\t\t\t\tedit_state.TempTextBuffer.resize(edit_state.Text.Size * 4);\n\t\t\t\tImTextStrToUtf8(edit_state.TempTextBuffer.Data, edit_state.TempTextBuffer.Size, edit_state.Text.Data, NULL);\n\t\t\t}\n\n\t\t\t// User callback\n\t\t\tif ((flags & (ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory | ImGuiInputTextFlags_CallbackAlways)) != 0)\n\t\t\t{\n\t\t\t\tIM_ASSERT(callback != NULL);\n\n\t\t\t\t// The reason we specify the usage semantic (Completion/History) is that Completion needs to disable keyboard TABBING at the moment.\n\t\t\t\tImGuiInputTextFlags event_flag = 0;\n\t\t\t\tImGuiKey event_key = ImGuiKey_COUNT;\n\t\t\t\tif ((flags & ImGuiInputTextFlags_CallbackCompletion) != 0 && IsKeyPressedMap(ImGuiKey_Tab))\n\t\t\t\t{\n\t\t\t\t\tevent_flag = ImGuiInputTextFlags_CallbackCompletion;\n\t\t\t\t\tevent_key = ImGuiKey_Tab;\n\t\t\t\t}\n\t\t\t\telse if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_UpArrow))\n\t\t\t\t{\n\t\t\t\t\tevent_flag = ImGuiInputTextFlags_CallbackHistory;\n\t\t\t\t\tevent_key = ImGuiKey_UpArrow;\n\t\t\t\t}\n\t\t\t\telse if ((flags & ImGuiInputTextFlags_CallbackHistory) != 0 && IsKeyPressedMap(ImGuiKey_DownArrow))\n\t\t\t\t{\n\t\t\t\t\tevent_flag = ImGuiInputTextFlags_CallbackHistory;\n\t\t\t\t\tevent_key = ImGuiKey_DownArrow;\n\t\t\t\t}\n\t\t\t\telse if (flags & ImGuiInputTextFlags_CallbackAlways)\n\t\t\t\t\tevent_flag = ImGuiInputTextFlags_CallbackAlways;\n\n\t\t\t\tif (event_flag)\n\t\t\t\t{\n\t\t\t\t\tImGuiTextEditCallbackData callback_data;\n\t\t\t\t\tmemset(&callback_data, 0, sizeof(ImGuiTextEditCallbackData));\n\t\t\t\t\tcallback_data.EventFlag = event_flag;\n\t\t\t\t\tcallback_data.Flags = flags;\n\t\t\t\t\tcallback_data.UserData = user_data;\n\t\t\t\t\tcallback_data.ReadOnly = !is_editable;\n\n\t\t\t\t\tcallback_data.EventKey = event_key;\n\t\t\t\t\tcallback_data.Buf = edit_state.TempTextBuffer.Data;\n\t\t\t\t\tcallback_data.BufTextLen = edit_state.CurLenA;\n\t\t\t\t\tcallback_data.BufSize = edit_state.BufSizeA;\n\t\t\t\t\tcallback_data.BufDirty = false;\n\n\t\t\t\t\t// We have to convert from wchar-positions to UTF-8-positions, which can be pretty slow (an incentive to ditch the ImWchar buffer, see https://github.com/nothings/stb/issues/188)\n\t\t\t\t\tImWchar* text = edit_state.Text.Data;\n\t\t\t\t\tconst int utf8_cursor_pos = callback_data.CursorPos = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.cursor);\n\t\t\t\t\tconst int utf8_selection_start = callback_data.SelectionStart = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.select_start);\n\t\t\t\t\tconst int utf8_selection_end = callback_data.SelectionEnd = ImTextCountUtf8BytesFromStr(text, text + edit_state.StbState.select_end);\n\n\t\t\t\t\t// Call user code\n\t\t\t\t\tcallback(&callback_data);\n\n\t\t\t\t\t// Read back what user may have modified\n\t\t\t\t\tIM_ASSERT(callback_data.Buf == edit_state.TempTextBuffer.Data);  // Invalid to modify those fields\n\t\t\t\t\tIM_ASSERT(callback_data.BufSize == edit_state.BufSizeA);\n\t\t\t\t\tIM_ASSERT(callback_data.Flags == flags);\n\t\t\t\t\tif (callback_data.CursorPos != utf8_cursor_pos)            edit_state.StbState.cursor = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.CursorPos);\n\t\t\t\t\tif (callback_data.SelectionStart != utf8_selection_start)  edit_state.StbState.select_start = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionStart);\n\t\t\t\t\tif (callback_data.SelectionEnd != utf8_selection_end)      edit_state.StbState.select_end = ImTextCountCharsFromUtf8(callback_data.Buf, callback_data.Buf + callback_data.SelectionEnd);\n\t\t\t\t\tif (callback_data.BufDirty)\n\t\t\t\t\t{\n\t\t\t\t\t\tIM_ASSERT(callback_data.BufTextLen == (int)strlen(callback_data.Buf)); // You need to maintain BufTextLen if you change the text!\n\t\t\t\t\t\tedit_state.CurLenW = ImTextStrFromUtf8(edit_state.Text.Data, edit_state.Text.Size, callback_data.Buf, NULL);\n\t\t\t\t\t\tedit_state.CurLenA = callback_data.BufTextLen;  // Assume correct length and valid UTF-8 from user, saves us an extra strlen()\n\t\t\t\t\t\tedit_state.CursorAnimReset();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Copy back to user buffer\n\t\t\tif (is_editable && strcmp(edit_state.TempTextBuffer.Data, buf) != 0)\n\t\t\t{\n\t\t\t\tImStrncpy(buf, edit_state.TempTextBuffer.Data, buf_size);\n\t\t\t\tvalue_changed = true;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Release active ID at the end of the function (so e.g. pressing Return still does a final application of the value)\n\tif (clear_active_id && g.ActiveId == id)\n\t\tClearActiveID();\n\n\t// Render\n\t// Select which buffer we are going to display. When ImGuiInputTextFlags_NoLiveEdit is set 'buf' might still be the old value. We set buf to NULL to prevent accidental usage from now on.\n\tconst char* buf_display = (g.ActiveId == id && is_editable) ? edit_state.TempTextBuffer.Data : buf; buf = NULL;\n\n\tif (!is_multiline)\n\t\tRenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n\n\tconst ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size\n\tImVec2 render_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;\n\tImVec2 text_size(0.f, 0.f);\n\tconst bool is_currently_scrolling = (edit_state.Id == id && is_multiline && g.ActiveId == draw_window->GetIDNoKeepAlive(\"#SCROLLY\"));\n\tif (g.ActiveId == id || is_currently_scrolling)\n\t{\n\t\tedit_state.CursorAnim += io.DeltaTime;\n\n\t\t// This is going to be messy. We need to:\n\t\t// - Display the text (this alone can be more easily clipped)\n\t\t// - Handle scrolling, highlight selection, display cursor (those all requires some form of 1d->2d cursor position calculation)\n\t\t// - Measure text height (for scrollbar)\n\t\t// We are attempting to do most of that in **one main pass** to minimize the computation cost (non-negligible for large amount of text) + 2nd pass for selection rendering (we could merge them by an extra refactoring effort)\n\t\t// FIXME: This should occur on buf_display but we'd need to maintain cursor/select_start/select_end for UTF-8.\n\t\tconst ImWchar* text_begin = edit_state.Text.Data;\n\t\tImVec2 cursor_offset, select_start_offset;\n\n\t\t{\n\t\t\t// Count lines + find lines numbers straddling 'cursor' and 'select_start' position.\n\t\t\tconst ImWchar* searches_input_ptr[2];\n\t\t\tsearches_input_ptr[0] = text_begin + edit_state.StbState.cursor;\n\t\t\tsearches_input_ptr[1] = NULL;\n\t\t\tint searches_remaining = 1;\n\t\t\tint searches_result_line_number[2] = { -1, -999 };\n\t\t\tif (edit_state.StbState.select_start != edit_state.StbState.select_end)\n\t\t\t{\n\t\t\t\tsearches_input_ptr[1] = text_begin + ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end);\n\t\t\t\tsearches_result_line_number[1] = -1;\n\t\t\t\tsearches_remaining++;\n\t\t\t}\n\n\t\t\t// Iterate all lines to find our line numbers\n\t\t\t// In multi-line mode, we never exit the loop until all lines are counted, so add one extra to the searches_remaining counter.\n\t\t\tsearches_remaining += is_multiline ? 1 : 0;\n\t\t\tint line_count = 0;\n\t\t\tfor (const ImWchar* s = text_begin; *s != 0; s++)\n\t\t\t\tif (*s == '\\n')\n\t\t\t\t{\n\t\t\t\t\tline_count++;\n\t\t\t\t\tif (searches_result_line_number[0] == -1 && s >= searches_input_ptr[0]) { searches_result_line_number[0] = line_count; if (--searches_remaining <= 0) break; }\n\t\t\t\t\tif (searches_result_line_number[1] == -1 && s >= searches_input_ptr[1]) { searches_result_line_number[1] = line_count; if (--searches_remaining <= 0) break; }\n\t\t\t\t}\n\t\t\tline_count++;\n\t\t\tif (searches_result_line_number[0] == -1) searches_result_line_number[0] = line_count;\n\t\t\tif (searches_result_line_number[1] == -1) searches_result_line_number[1] = line_count;\n\n\t\t\t// Calculate 2d position by finding the beginning of the line and measuring distance\n\t\t\tcursor_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[0], text_begin), searches_input_ptr[0]).x;\n\t\t\tcursor_offset.y = searches_result_line_number[0] * g.FontSize;\n\t\t\tif (searches_result_line_number[1] >= 0)\n\t\t\t{\n\t\t\t\tselect_start_offset.x = InputTextCalcTextSizeW(ImStrbolW(searches_input_ptr[1], text_begin), searches_input_ptr[1]).x;\n\t\t\t\tselect_start_offset.y = searches_result_line_number[1] * g.FontSize;\n\t\t\t}\n\n\t\t\t// Store text height (note that we haven't calculated text width at all, see GitHub issues #383, #1224)\n\t\t\tif (is_multiline)\n\t\t\t\ttext_size = ImVec2(size.x, line_count * g.FontSize);\n\t\t}\n\n\t\t// Scroll\n\t\tif (edit_state.CursorFollow)\n\t\t{\n\t\t\t// Horizontal scroll in chunks of quarter width\n\t\t\tif (!(flags & ImGuiInputTextFlags_NoHorizontalScroll))\n\t\t\t{\n\t\t\t\tconst float scroll_increment_x = size.x * 0.25f;\n\t\t\t\tif (cursor_offset.x < edit_state.ScrollX)\n\t\t\t\t\tedit_state.ScrollX = (float)(int)ImMax(0.0f, cursor_offset.x - scroll_increment_x);\n\t\t\t\telse if (cursor_offset.x - size.x >= edit_state.ScrollX)\n\t\t\t\t\tedit_state.ScrollX = (float)(int)(cursor_offset.x - size.x + scroll_increment_x);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tedit_state.ScrollX = 0.0f;\n\t\t\t}\n\n\t\t\t// Vertical scroll\n\t\t\tif (is_multiline)\n\t\t\t{\n\t\t\t\tfloat scroll_y = draw_window->Scroll.y;\n\t\t\t\tif (cursor_offset.y - g.FontSize < scroll_y)\n\t\t\t\t\tscroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);\n\t\t\t\telse if (cursor_offset.y - size.y >= scroll_y)\n\t\t\t\t\tscroll_y = cursor_offset.y - size.y;\n\t\t\t\tdraw_window->DC.CursorPos.y += (draw_window->Scroll.y - scroll_y);   // To avoid a frame of lag\n\t\t\t\tdraw_window->Scroll.y = scroll_y;\n\t\t\t\trender_pos.y = draw_window->DC.CursorPos.y;\n\t\t\t}\n\t\t}\n\t\tedit_state.CursorFollow = false;\n\t\tconst ImVec2 render_scroll = ImVec2(edit_state.ScrollX, 0.0f);\n\n\t\t// Draw selection\n\t\tif (edit_state.StbState.select_start != edit_state.StbState.select_end)\n\t\t{\n\t\t\tconst ImWchar* text_selected_begin = text_begin + ImMin(edit_state.StbState.select_start, edit_state.StbState.select_end);\n\t\t\tconst ImWchar* text_selected_end = text_begin + ImMax(edit_state.StbState.select_start, edit_state.StbState.select_end);\n\n\t\t\tfloat bg_offy_up = is_multiline ? 0.0f : -1.0f;    // FIXME: those offsets should be part of the style? they don't play so well with multi-line selection.\n\t\t\tfloat bg_offy_dn = is_multiline ? 0.0f : 2.0f;\n\t\t\tImU32 bg_color = GetColorU32(ImGuiCol_TextSelectedBg);\n\t\t\tImVec2 rect_pos = render_pos + select_start_offset - render_scroll;\n\t\t\tfor (const ImWchar* p = text_selected_begin; p < text_selected_end; )\n\t\t\t{\n\t\t\t\tif (rect_pos.y > clip_rect.w + g.FontSize)\n\t\t\t\t\tbreak;\n\t\t\t\tif (rect_pos.y < clip_rect.y)\n\t\t\t\t{\n\t\t\t\t\twhile (p < text_selected_end)\n\t\t\t\t\t\tif (*p++ == '\\n')\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tImVec2 rect_size = InputTextCalcTextSizeW(p, text_selected_end, &p, NULL, true);\n\t\t\t\t\tif (rect_size.x <= 0.0f) rect_size.x = (float)(int)(g.Font->GetCharAdvance((unsigned short)' ') * 0.50f); // So we can see selected empty lines\n\t\t\t\t\tImRect rect(rect_pos + ImVec2(0.0f, bg_offy_up - g.FontSize), rect_pos + ImVec2(rect_size.x, bg_offy_dn));\n\t\t\t\t\trect.ClipWith(clip_rect);\n\t\t\t\t\tif (rect.Overlaps(clip_rect))\n\t\t\t\t\t\tdraw_window->DrawList->AddRectFilled(rect.Min, rect.Max, bg_color);\n\t\t\t\t}\n\t\t\t\trect_pos.x = render_pos.x - render_scroll.x;\n\t\t\t\trect_pos.y += g.FontSize;\n\t\t\t}\n\t\t}\n\n\t\tdraw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + edit_state.CurLenA, 0.0f, is_multiline ? NULL : &clip_rect);\n\n\t\t// Draw blinking cursor\n\t\tbool cursor_is_visible = (!g.IO.OptCursorBlink) || (g.InputTextState.CursorAnim <= 0.0f) || fmodf(g.InputTextState.CursorAnim, 1.20f) <= 0.80f;\n\t\tImVec2 cursor_screen_pos = render_pos + cursor_offset - render_scroll;\n\t\tImRect cursor_screen_rect(cursor_screen_pos.x, cursor_screen_pos.y - g.FontSize + 0.5f, cursor_screen_pos.x + 1.0f, cursor_screen_pos.y - 1.5f);\n\t\tif (cursor_is_visible && cursor_screen_rect.Overlaps(clip_rect))\n\t\t\tdraw_window->DrawList->AddLine(cursor_screen_rect.Min, cursor_screen_rect.GetBL(), GetColorU32(ImGuiCol_Text));\n\n\t\t// Notify OS of text input position for advanced IME (-1 x offset so that Windows IME can cover our cursor. Bit of an extra nicety.)\n\t\tif (is_editable)\n\t\t\tg.OsImePosRequest = ImVec2(cursor_screen_pos.x - 1, cursor_screen_pos.y - g.FontSize);\n\t}\n\telse\n\t{\n\t\t// Render text only\n\t\tconst char* buf_end = NULL;\n\t\tif (is_multiline)\n\t\t\ttext_size = ImVec2(size.x, InputTextCalcTextLenAndLineCount(buf_display, &buf_end) * g.FontSize); // We don't need width\n\t\tdraw_window->DrawList->AddText(g.Font, g.FontSize, render_pos, GetColorU32(ImGuiCol_Text), buf_display, buf_end, 0.0f, is_multiline ? NULL : &clip_rect);\n\t}\n\n\tif (is_multiline)\n\t{\n\t\tDummy(text_size + ImVec2(0.0f, g.FontSize)); // Always add room to scroll an extra line\n\t\tEndChildFrame();\n\t\tEndGroup();\n\t}\n\n\tif (is_password)\n\t\tPopFont();\n\n\t// Log as text\n\tif (g.LogEnabled && !is_password)\n\t\tLogRenderedText(&render_pos, buf_display, NULL);\n\n\tif (label_size.x > 0)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n\tif ((flags & ImGuiInputTextFlags_EnterReturnsTrue) != 0)\n\t\treturn enter_pressed;\n\telse\n\t\treturn value_changed;\n}\n\nbool ImGui::InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)\n{\n\tIM_ASSERT(!(flags & ImGuiInputTextFlags_Multiline)); // call InputTextMultiline()\n\treturn InputTextEx(label, buf, (int)buf_size, ImVec2(0, 0), flags, callback, user_data);\n}\n\nbool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)\n{\n\treturn InputTextEx(label, buf, (int)buf_size, size, flags | ImGuiInputTextFlags_Multiline, callback, user_data);\n}\n\n// NB: scalar_format here must be a simple \"%xx\" format string with no prefix/suffix (unlike the Drag/Slider functions \"display_format\" argument)\nbool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\tBeginGroup();\n\tPushID(label);\n\tconst ImVec2 button_sz = ImVec2(GetFrameHeight(), GetFrameHeight());\n\tif (step_ptr)\n\t\tPushItemWidth(ImMax(1.0f, CalcItemWidth() - (button_sz.x + style.ItemInnerSpacing.x) * 2));\n\n\tchar buf[64];\n\tDataTypeFormatString(data_type, data_ptr, scalar_format, buf, IM_ARRAYSIZE(buf));\n\n\tbool value_changed = false;\n\tif (!(extra_flags & ImGuiInputTextFlags_CharsHexadecimal))\n\t\textra_flags |= ImGuiInputTextFlags_CharsDecimal;\n\textra_flags |= ImGuiInputTextFlags_AutoSelectAll;\n\tif (InputText(\"\", buf, IM_ARRAYSIZE(buf), extra_flags)) // PushId(label) + \"\" gives us the expected ID from outside point of view\n\t\tvalue_changed = DataTypeApplyOpFromText(buf, GImGui->InputTextState.InitialText.begin(), data_type, data_ptr, scalar_format);\n\n\t// Step buttons\n\tif (step_ptr)\n\t{\n\t\tPopItemWidth();\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\tif (ButtonEx(\"-\", button_sz, ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups))\n\t\t{\n\t\t\tDataTypeApplyOp(data_type, '-', data_ptr, g.IO.KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr);\n\t\t\tvalue_changed = true;\n\t\t}\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\tif (ButtonEx(\"+\", button_sz, ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups))\n\t\t{\n\t\t\tDataTypeApplyOp(data_type, '+', data_ptr, g.IO.KeyCtrl && step_fast_ptr ? step_fast_ptr : step_ptr);\n\t\t\tvalue_changed = true;\n\t\t}\n\t}\n\tPopID();\n\n\tif (label_size.x > 0)\n\t{\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\tRenderText(ImVec2(window->DC.CursorPos.x, window->DC.CursorPos.y + style.FramePadding.y), label);\n\t\tItemSize(label_size, style.FramePadding.y);\n\t}\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::InputFloat(const char* label, float* v, float step, float step_fast, int decimal_precision, ImGuiInputTextFlags extra_flags)\n{\n\tchar display_format[16];\n\tif (decimal_precision < 0)\n\t\tstrcpy(display_format, \"%f\");      // Ideally we'd have a minimum decimal precision of 1 to visually denote that this is a float, while hiding non-significant digits? %f doesn't have a minimum of 1\n\telse\n\t\tImFormatString(display_format, IM_ARRAYSIZE(display_format), \"%%.%df\", decimal_precision);\n\treturn InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step > 0.0f ? &step : NULL), (void*)(step_fast > 0.0f ? &step_fast : NULL), display_format, extra_flags);\n}\n\nbool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags extra_flags)\n{\n\t// Hexadecimal input provided as a convenience but the flag name is awkward. Typically you'd use InputText() to parse your own data, if you want to handle prefixes.\n\tconst char* scalar_format = (extra_flags & ImGuiInputTextFlags_CharsHexadecimal) ? \"%08X\" : \"%d\";\n\treturn InputScalarEx(label, ImGuiDataType_Int, (void*)v, (void*)(step > 0.0f ? &step : NULL), (void*)(step_fast > 0.0f ? &step_fast : NULL), scalar_format, extra_flags);\n}\n\nbool ImGui::InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tbool value_changed = false;\n\tBeginGroup();\n\tPushID(label);\n\tPushMultiItemsWidths(components);\n\tfor (int i = 0; i < components; i++)\n\t{\n\t\tPushID(i);\n\t\tvalue_changed |= InputFloat(\"##v\", &v[i], 0, 0, decimal_precision, extra_flags);\n\t\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\t\tPopID();\n\t\tPopItemWidth();\n\t}\n\tPopID();\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::InputFloat2(const char* label, float v[2], int decimal_precision, ImGuiInputTextFlags extra_flags)\n{\n\treturn InputFloatN(label, v, 2, decimal_precision, extra_flags);\n}\n\nbool ImGui::InputFloat3(const char* label, float v[3], int decimal_precision, ImGuiInputTextFlags extra_flags)\n{\n\treturn InputFloatN(label, v, 3, decimal_precision, extra_flags);\n}\n\nbool ImGui::InputFloat4(const char* label, float v[4], int decimal_precision, ImGuiInputTextFlags extra_flags)\n{\n\treturn InputFloatN(label, v, 4, decimal_precision, extra_flags);\n}\n\nbool ImGui::InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tbool value_changed = false;\n\tBeginGroup();\n\tPushID(label);\n\tPushMultiItemsWidths(components);\n\tfor (int i = 0; i < components; i++)\n\t{\n\t\tPushID(i);\n\t\tvalue_changed |= InputInt(\"##v\", &v[i], 0, 0, extra_flags);\n\t\tSameLine(0, g.Style.ItemInnerSpacing.x);\n\t\tPopID();\n\t\tPopItemWidth();\n\t}\n\tPopID();\n\n\tTextUnformatted(label, FindRenderedTextEnd(label));\n\tEndGroup();\n\n\treturn value_changed;\n}\n\nbool ImGui::InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags)\n{\n\treturn InputIntN(label, v, 2, extra_flags);\n}\n\nbool ImGui::InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags)\n{\n\treturn InputIntN(label, v, 3, extra_flags);\n}\n\nbool ImGui::InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags)\n{\n\treturn InputIntN(label, v, 4, extra_flags);\n}\n\nstatic float CalcMaxPopupHeightFromItemCount(int items_count)\n{\n\tImGuiContext& g = *GImGui;\n\tif (items_count <= 0)\n\t\treturn FLT_MAX;\n\treturn (g.FontSize + g.Style.ItemSpacing.y) * items_count - g.Style.ItemSpacing.y + (g.Style.WindowPadding.y * 2);\n}\n\nbool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags)\n{\n\t// Always consume the SetNextWindowSizeConstraint() call in our early return paths\n\tImGuiContext& g = *GImGui;\n\tImGuiCond backup_next_window_size_constraint = g.NextWindowData.SizeConstraintCond;\n\tg.NextWindowData.SizeConstraintCond = 0;\n\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\tconst float w = CalcItemWidth();\n\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\tconst ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));\n\tconst ImRect total_bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\tItemSize(total_bb, style.FramePadding.y);\n\tif (!ItemAdd(total_bb, id))\n\t\treturn false;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(frame_bb, id, &hovered, &held);\n\tbool popup_open = IsPopupOpen(id);\n\n\tconst float arrow_size = GetFrameHeight();\n\tconst ImRect value_bb(frame_bb.Min, frame_bb.Max - ImVec2(arrow_size, 0.0f));\n\tRenderFrame(frame_bb.Min, frame_bb.Max, GetColorU32(ImGuiCol_FrameBg), true, style.FrameRounding);\n\tRenderFrame(ImVec2(frame_bb.Max.x - arrow_size, frame_bb.Min.y), frame_bb.Max, GetColorU32(popup_open || hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button), true, style.FrameRounding); // FIXME-ROUNDING\n\tRenderTriangle(ImVec2(frame_bb.Max.x - arrow_size + style.FramePadding.y, frame_bb.Min.y + style.FramePadding.y), ImGuiDir_Down);\n\tif (preview_value != NULL)\n\t\tRenderTextClipped(frame_bb.Min + style.FramePadding, value_bb.Max, preview_value, NULL, NULL, ImVec2(0.0f, 0.0f));\n\tif (label_size.x > 0)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n\tif (pressed && !popup_open)\n\t{\n\t\tOpenPopupEx(id);\n\t\tpopup_open = true;\n\t}\n\n\tif (!popup_open)\n\t\treturn false;\n\n\tif (backup_next_window_size_constraint)\n\t{\n\t\tg.NextWindowData.SizeConstraintCond = backup_next_window_size_constraint;\n\t\tg.NextWindowData.SizeConstraintRect.Min.x = ImMax(g.NextWindowData.SizeConstraintRect.Min.x, w);\n\t}\n\telse\n\t{\n\t\tif ((flags & ImGuiComboFlags_HeightMask_) == 0)\n\t\t\tflags |= ImGuiComboFlags_HeightRegular;\n\t\tIM_ASSERT(ImIsPowerOfTwo(flags & ImGuiComboFlags_HeightMask_));    // Only one\n\t\tint popup_max_height_in_items = -1;\n\t\tif (flags & ImGuiComboFlags_HeightRegular)     popup_max_height_in_items = 8;\n\t\telse if (flags & ImGuiComboFlags_HeightSmall)  popup_max_height_in_items = 4;\n\t\telse if (flags & ImGuiComboFlags_HeightLarge)  popup_max_height_in_items = 20;\n\t\tSetNextWindowSizeConstraints(ImVec2(w, 0.0f), ImVec2(FLT_MAX, CalcMaxPopupHeightFromItemCount(popup_max_height_in_items)));\n\t}\n\n\tchar name[16];\n\tImFormatString(name, IM_ARRAYSIZE(name), \"##Combo_%02d\", g.CurrentPopupStack.Size); // Recycle windows based on depth\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Peak into expected window size so we can position it\n\tif (ImGuiWindow* popup_window = FindWindowByName(name))\n\t\tif (popup_window->WasActive)\n\t\t{\n\t\t\tImVec2 size_contents = CalcSizeContents(popup_window);\n\t\t\tImVec2 size_expected = CalcSizeAfterConstraint(popup_window, CalcSizeAutoFit(popup_window, size_contents));\n\t\t\tif (flags & ImGuiComboFlags_PopupAlignLeft)\n\t\t\t\tpopup_window->AutoPosLastDirection = ImGuiDir_Left;\n\t\t\tImVec2 pos = FindBestWindowPosForPopup(frame_bb.GetBL(), size_expected, &popup_window->AutoPosLastDirection, frame_bb, ImGuiPopupPositionPolicy_ComboBox);\n\t\t\tSetNextWindowPos(pos);\n\t\t}\n\n\tImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;\n\tif (!Begin(name, NULL, window_flags))\n\t{\n\t\tEndPopup();\n\t\tIM_ASSERT(0);   // This should never happen as we tested for IsPopupOpen() above\n\t\treturn false;\n\t}\n\n\t// Horizontally align ourselves with the framed text\n\tif (style.FramePadding.x != style.WindowPadding.x)\n\t\tIndent(style.FramePadding.x - style.WindowPadding.x);\n\n\treturn true;\n}\n\nvoid ImGui::EndCombo()\n{\n\tconst ImGuiStyle& style = GImGui->Style;\n\tif (style.FramePadding.x != style.WindowPadding.x)\n\t\tUnindent(style.FramePadding.x - style.WindowPadding.x);\n\tEndPopup();\n}\n\n// Old API, prefer using BeginCombo() nowadays if you can.\nbool ImGui::Combo(const char* label, int* current_item, bool(*items_getter)(void*, int, const char**), void* data, int items_count, int popup_max_height_in_items)\n{\n\tImGuiContext& g = *GImGui;\n\n\tconst char* preview_text = NULL;\n\tif (*current_item >= 0 && *current_item < items_count)\n\t\titems_getter(data, *current_item, &preview_text);\n\n\t// The old Combo() API exposed \"popup_max_height_in_items\", however the new more general BeginCombo() API doesn't, so we emulate it here.\n\tif (popup_max_height_in_items != -1 && !g.NextWindowData.SizeConstraintCond)\n\t{\n\t\tfloat popup_max_height = CalcMaxPopupHeightFromItemCount(popup_max_height_in_items);\n\t\tSetNextWindowSizeConstraints(ImVec2(0, 0), ImVec2(FLT_MAX, popup_max_height));\n\t}\n\n\tif (!BeginCombo(label, preview_text, 0))\n\t\treturn false;\n\n\t// Display items\n\t// FIXME-OPT: Use clipper (but we need to disable it on the appearing frame to make sure our call to SetItemDefaultFocus() is processed)\n\tbool value_changed = false;\n\tfor (int i = 0; i < items_count; i++)\n\t{\n\t\tPushID((void*)(intptr_t)i);\n\t\tconst bool item_selected = (i == *current_item);\n\t\tconst char* item_text;\n\t\tif (!items_getter(data, i, &item_text))\n\t\t\titem_text = \"*Unknown item*\";\n\t\tif (Selectable(item_text, item_selected))\n\t\t{\n\t\t\tvalue_changed = true;\n\t\t\t*current_item = i;\n\t\t}\n\t\tif (item_selected)\n\t\t\tSetItemDefaultFocus();\n\t\tPopID();\n\t}\n\n\tEndCombo();\n\treturn value_changed;\n}\n\nstatic bool Items_ArrayGetter(void* data, int idx, const char** out_text)\n{\n\tconst char* const* items = (const char* const*)data;\n\tif (out_text)\n\t\t*out_text = items[idx];\n\treturn true;\n}\n\nstatic bool Items_SingleStringGetter(void* data, int idx, const char** out_text)\n{\n\t// FIXME-OPT: we could pre-compute the indices to fasten this. But only 1 active combo means the waste is limited.\n\tconst char* items_separated_by_zeros = (const char*)data;\n\tint items_count = 0;\n\tconst char* p = items_separated_by_zeros;\n\twhile (*p)\n\t{\n\t\tif (idx == items_count)\n\t\t\tbreak;\n\t\tp += strlen(p) + 1;\n\t\titems_count++;\n\t}\n\tif (!*p)\n\t\treturn false;\n\tif (out_text)\n\t\t*out_text = p;\n\treturn true;\n}\n\n// Combo box helper allowing to pass an array of strings.\nbool ImGui::Combo(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items)\n{\n\tconst bool value_changed = Combo(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_in_items);\n\treturn value_changed;\n}\n\n// Combo box helper allowing to pass all items in a single string.\nbool ImGui::Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items)\n{\n\tint items_count = 0;\n\tconst char* p = items_separated_by_zeros;       // FIXME-OPT: Avoid computing this, or at least only when combo is open\n\twhile (*p)\n\t{\n\t\tp += strlen(p) + 1;\n\t\titems_count++;\n\t}\n\tbool value_changed = Combo(label, current_item, Items_SingleStringGetter, (void*)items_separated_by_zeros, items_count, height_in_items);\n\treturn value_changed;\n}\n\n// Tip: pass an empty label (e.g. \"##dummy\") then you can use the space to draw other text or image.\n// But you need to make sure the ID is unique, e.g. enclose calls in PushID/PopID.\nbool ImGui::Selectable(const char* label, bool selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\n\tif ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet) // FIXME-OPT: Avoid if vertically clipped.\n\t\tPopClipRect();\n\n\tImGuiID id = window->GetID(label);\n\tImVec2 label_size = CalcTextSize(label, NULL, true);\n\tImVec2 size(size_arg.x != 0.0f ? size_arg.x : label_size.x, size_arg.y != 0.0f ? size_arg.y : label_size.y);\n\tImVec2 pos = window->DC.CursorPos;\n\tpos.y += window->DC.CurrentLineTextBaseOffset;\n\tImRect bb(pos, pos + size);\n\tItemSize(bb);\n\n\t// Fill horizontal space.\n\tImVec2 window_padding = window->WindowPadding;\n\tfloat max_x = (flags & ImGuiSelectableFlags_SpanAllColumns) ? GetWindowContentRegionMax().x : GetContentRegionMax().x;\n\tfloat w_draw = ImMax(label_size.x, window->Pos.x + max_x - window_padding.x - window->DC.CursorPos.x);\n\tImVec2 size_draw((size_arg.x != 0 && !(flags & ImGuiSelectableFlags_DrawFillAvailWidth)) ? size_arg.x : w_draw, size_arg.y != 0.0f ? size_arg.y : size.y);\n\tImRect bb_with_spacing(pos, pos + size_draw);\n\tif (size_arg.x == 0.0f || (flags & ImGuiSelectableFlags_DrawFillAvailWidth))\n\t\tbb_with_spacing.Max.x += window_padding.x;\n\n\t// Selectables are tightly packed together, we extend the box to cover spacing between selectable.\n\tfloat spacing_L = (float)(int)(style.ItemSpacing.x * 0.5f);\n\tfloat spacing_U = (float)(int)(style.ItemSpacing.y * 0.5f);\n\tfloat spacing_R = style.ItemSpacing.x - spacing_L;\n\tfloat spacing_D = style.ItemSpacing.y - spacing_U;\n\tbb_with_spacing.Min.x -= spacing_L;\n\tbb_with_spacing.Min.y -= spacing_U;\n\tbb_with_spacing.Max.x += spacing_R;\n\tbb_with_spacing.Max.y += spacing_D;\n\tif (!ItemAdd(bb_with_spacing, id))\n\t{\n\t\tif ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)\n\t\t\tPushColumnClipRect();\n\t\treturn false;\n\t}\n\n\tImGuiButtonFlags button_flags = 0;\n\tif (flags & ImGuiSelectableFlags_Menu) button_flags |= ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_NoHoldingActiveID;\n\tif (flags & ImGuiSelectableFlags_MenuItem) button_flags |= ImGuiButtonFlags_PressedOnRelease;\n\tif (flags & ImGuiSelectableFlags_Disabled) button_flags |= ImGuiButtonFlags_Disabled;\n\tif (flags & ImGuiSelectableFlags_AllowDoubleClick) button_flags |= ImGuiButtonFlags_PressedOnClickRelease | ImGuiButtonFlags_PressedOnDoubleClick;\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb_with_spacing, id, &hovered, &held, button_flags);\n\tif (flags & ImGuiSelectableFlags_Disabled)\n\t\tselected = false;\n\n\t// Render\n\tif (hovered || selected)\n\t{\n\t\tconst ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_HeaderActive : hovered ? ImGuiCol_HeaderHovered : ImGuiCol_Header);\n\t\tRenderFrame(bb_with_spacing.Min, bb_with_spacing.Max, col, false, 0.0f);\n\t}\n\n\tif ((flags & ImGuiSelectableFlags_SpanAllColumns) && window->DC.ColumnsSet)\n\t{\n\t\tPushColumnClipRect();\n\t\tbb_with_spacing.Max.x -= (GetContentRegionMax().x - max_x);\n\t}\n\n\tif (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);\n\tRenderTextClipped(bb.Min, bb_with_spacing.Max, label, NULL, &label_size, ImVec2(0.0f, 0.0f));\n\tif (flags & ImGuiSelectableFlags_Disabled) PopStyleColor();\n\n\t// Automatically close popups\n\tif (pressed && (window->Flags & ImGuiWindowFlags_Popup) && !(flags & ImGuiSelectableFlags_DontClosePopups) && !(window->DC.ItemFlags & ImGuiItemFlags_SelectableDontClosePopup))\n\t\tCloseCurrentPopup();\n\treturn pressed;\n}\n\nbool ImGui::Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags, const ImVec2& size_arg)\n{\n\tif (Selectable(label, *p_selected, flags, size_arg))\n\t{\n\t\t*p_selected = !*p_selected;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\n// Helper to calculate the size of a listbox and display a label on the right.\n// Tip: To have a list filling the entire window width, PushItemWidth(-1) and pass an empty label \"##empty\"\nbool ImGui::ListBoxHeader(const char* label, const ImVec2& size_arg)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tconst ImGuiStyle& style = GetStyle();\n\tconst ImGuiID id = GetID(label);\n\tconst ImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\t// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.\n\tImVec2 size = CalcItemSize(size_arg, CalcItemWidth(), GetTextLineHeightWithSpacing() * 7.4f + style.ItemSpacing.y);\n\tImVec2 frame_size = ImVec2(size.x, ImMax(size.y, label_size.y));\n\tImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + frame_size);\n\tImRect bb(frame_bb.Min, frame_bb.Max + ImVec2(label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f, 0.0f));\n\twindow->DC.LastItemRect = bb;\n\n\tBeginGroup();\n\tif (label_size.x > 0)\n\t\tRenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);\n\n\tBeginChildFrame(id, frame_bb.GetSize());\n\treturn true;\n}\n\nbool ImGui::ListBoxHeader(const char* label, int items_count, int height_in_items)\n{\n\t// Size default to hold ~7 items. Fractional number of items helps seeing that we can scroll down/up without looking at scrollbar.\n\t// However we don't add +0.40f if items_count <= height_in_items. It is slightly dodgy, because it means a dynamic list of items will make the widget resize occasionally when it crosses that size.\n\t// I am expecting that someone will come and complain about this behavior in a remote future, then we can advise on a better solution.\n\tif (height_in_items < 0)\n\t\theight_in_items = ImMin(items_count, 7);\n\tfloat height_in_items_f = height_in_items < items_count ? (height_in_items + 0.40f) : (height_in_items + 0.00f);\n\n\t// We include ItemSpacing.y so that a list sized for the exact number of items doesn't make a scrollbar appears. We could also enforce that by passing a flag to BeginChild().\n\tImVec2 size;\n\tsize.x = 0.0f;\n\tsize.y = GetTextLineHeightWithSpacing() * height_in_items_f + GetStyle().ItemSpacing.y;\n\treturn ListBoxHeader(label, size);\n}\n\nvoid ImGui::ListBoxFooter()\n{\n\tImGuiWindow* parent_window = GetCurrentWindow()->ParentWindow;\n\tconst ImRect bb = parent_window->DC.LastItemRect;\n\tconst ImGuiStyle& style = GetStyle();\n\n\tEndChildFrame();\n\n\t// Redeclare item size so that it includes the label (we have stored the full size in LastItemRect)\n\t// We call SameLine() to restore DC.CurrentLine* data\n\tSameLine();\n\tparent_window->DC.CursorPos = bb.Min;\n\tItemSize(bb, style.FramePadding.y);\n\tEndGroup();\n}\n\nbool ImGui::ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_items)\n{\n\tconst bool value_changed = ListBox(label, current_item, Items_ArrayGetter, (void*)items, items_count, height_items);\n\treturn value_changed;\n}\n\nbool ImGui::ListBox(const char* label, int* current_item, bool(*items_getter)(void*, int, const char**), void* data, int items_count, int height_in_items)\n{\n\tif (!ListBoxHeader(label, items_count, height_in_items))\n\t\treturn false;\n\n\t// Assume all items have even height (= 1 line of text). If you need items of different or variable sizes you can create a custom version of ListBox() in your code without using the clipper.\n\tbool value_changed = false;\n\tImGuiListClipper clipper(items_count, GetTextLineHeightWithSpacing()); // We know exactly our line height here so we pass it as a minor optimization, but generally you don't need to.\n\twhile (clipper.Step())\n\t\tfor (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n\t\t{\n\t\t\tconst bool item_selected = (i == *current_item);\n\t\t\tconst char* item_text;\n\t\t\tif (!items_getter(data, i, &item_text))\n\t\t\t\titem_text = \"*Unknown item*\";\n\n\t\t\tPushID(i);\n\t\t\tif (Selectable(item_text, item_selected))\n\t\t\t{\n\t\t\t\t*current_item = i;\n\t\t\t\tvalue_changed = true;\n\t\t\t}\n\t\t\tPopID();\n\t\t}\n\tListBoxFooter();\n\treturn value_changed;\n}\n\nbool ImGui::MenuItem(const char* label, const char* shortcut, bool selected, bool enabled)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tImGuiStyle& style = g.Style;\n\tImVec2 pos = window->DC.CursorPos;\n\tImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\tImGuiSelectableFlags flags = ImGuiSelectableFlags_MenuItem | (enabled ? 0 : ImGuiSelectableFlags_Disabled);\n\tbool pressed;\n\tif (window->DC.LayoutType == ImGuiLayoutType_Horizontal)\n\t{\n\t\t// Mimic the exact layout spacing of BeginMenu() to allow MenuItem() inside a menu bar, which is a little misleading but may be useful\n\t\t// Note that in this situation we render neither the shortcut neither the selected tick mark\n\t\tfloat w = label_size.x;\n\t\twindow->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);\n\t\tPushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);\n\t\tpressed = Selectable(label, false, flags, ImVec2(w, 0.0f));\n\t\tPopStyleVar();\n\t\twindow->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().\n\t}\n\telse\n\t{\n\t\tImVec2 shortcut_size = shortcut ? CalcTextSize(shortcut, NULL) : ImVec2(0.0f, 0.0f);\n\t\tfloat w = window->MenuColumns.DeclColumns(label_size.x, shortcut_size.x, (float)(int)(g.FontSize * 1.20f)); // Feedback for next frame\n\t\tfloat extra_w = ImMax(0.0f, GetContentRegionAvail().x - w);\n\t\tpressed = Selectable(label, false, flags | ImGuiSelectableFlags_DrawFillAvailWidth, ImVec2(w, 0.0f));\n\t\tif (shortcut_size.x > 0.0f)\n\t\t{\n\t\t\tPushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);\n\t\t\tRenderText(pos + ImVec2(window->MenuColumns.Pos[1] + extra_w, 0.0f), shortcut, NULL, false);\n\t\t\tPopStyleColor();\n\t\t}\n\t\tif (selected)\n\t\t\tRenderCheckMark(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.40f, g.FontSize * 0.134f * 0.5f), GetColorU32(enabled ? ImGuiCol_Text : ImGuiCol_TextDisabled), g.FontSize * 0.866f);\n\t}\n\treturn pressed;\n}\n\nbool ImGui::MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled)\n{\n\tif (MenuItem(label, shortcut, p_selected ? *p_selected : false, enabled))\n\t{\n\t\tif (p_selected)\n\t\t\t*p_selected = !*p_selected;\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nbool ImGui::BeginMainMenuBar()\n{\n\tImGuiContext& g = *GImGui;\n\tSetNextWindowPos(ImVec2(0.0f, 0.0f));\n\tSetNextWindowSize(ImVec2(g.IO.DisplaySize.x, g.FontBaseSize + g.Style.FramePadding.y * 2.0f));\n\tPushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);\n\tPushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(0, 0));\n\tif (!Begin(\"##MainMenuBar\", NULL, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_MenuBar)\n\t\t|| !BeginMenuBar())\n\t{\n\t\tEnd();\n\t\tPopStyleVar(2);\n\t\treturn false;\n\t}\n\tg.CurrentWindow->DC.MenuBarOffsetX += g.Style.DisplaySafeAreaPadding.x;\n\treturn true;\n}\n\nvoid ImGui::EndMainMenuBar()\n{\n\tEndMenuBar();\n\tEnd();\n\tPopStyleVar(2);\n}\n\nbool ImGui::BeginMenuBar()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\tif (!(window->Flags & ImGuiWindowFlags_MenuBar))\n\t\treturn false;\n\n\tIM_ASSERT(!window->DC.MenuBarAppending);\n\tBeginGroup(); // Save position\n\tPushID(\"##menubar\");\n\n\t// We don't clip with regular window clipping rectangle as it is already set to the area below. However we clip with window full rect.\n\t// We remove 1 worth of rounding to Max.x to that text in long menus don't tend to display over the lower-right rounded area, which looks particularly glitchy.\n\tImRect bar_rect = window->MenuBarRect();\n\tImRect clip_rect(ImFloor(bar_rect.Min.x + 0.5f), ImFloor(bar_rect.Min.y + window->WindowBorderSize + 0.5f), ImFloor(ImMax(bar_rect.Min.x, bar_rect.Max.x - window->WindowRounding) + 0.5f), ImFloor(bar_rect.Max.y + 0.5f));\n\tclip_rect.ClipWith(window->WindowRectClipped);\n\tPushClipRect(clip_rect.Min, clip_rect.Max, false);\n\n\twindow->DC.CursorPos = ImVec2(bar_rect.Min.x + window->DC.MenuBarOffsetX, bar_rect.Min.y);// + g.Style.FramePadding.y);\n\twindow->DC.LayoutType = ImGuiLayoutType_Horizontal;\n\twindow->DC.MenuBarAppending = true;\n\tAlignTextToFramePadding();\n\treturn true;\n}\n\nvoid ImGui::EndMenuBar()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tIM_ASSERT(window->Flags & ImGuiWindowFlags_MenuBar);\n\tIM_ASSERT(window->DC.MenuBarAppending);\n\tPopClipRect();\n\tPopID();\n\twindow->DC.MenuBarOffsetX = window->DC.CursorPos.x - window->MenuBarRect().Min.x;\n\twindow->DC.GroupStack.back().AdvanceCursor = false;\n\tEndGroup();\n\twindow->DC.LayoutType = ImGuiLayoutType_Vertical;\n\twindow->DC.MenuBarAppending = false;\n}\n\nbool ImGui::BeginMenu(const char* label, bool enabled)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst ImGuiID id = window->GetID(label);\n\n\tImVec2 label_size = CalcTextSize(label, NULL, true);\n\n\tbool pressed;\n\tbool menu_is_open = IsPopupOpen(id);\n\tbool menuset_is_open = !(window->Flags & ImGuiWindowFlags_Popup) && (g.OpenPopupStack.Size > g.CurrentPopupStack.Size&& g.OpenPopupStack[g.CurrentPopupStack.Size].OpenParentId == window->IDStack.back());\n\tImGuiWindow* backed_nav_window = g.NavWindow;\n\tif (menuset_is_open)\n\t\tg.NavWindow = window;  // Odd hack to allow hovering across menus of a same menu-set (otherwise we wouldn't be able to hover parent)\n\n\t\t\t\t\t\t\t   // The reference position stored in popup_pos will be used by Begin() to find a suitable position for the child menu (using FindBestPopupWindowPos).\n\tImVec2 popup_pos, pos = window->DC.CursorPos;\n\tif (window->DC.LayoutType == ImGuiLayoutType_Horizontal)\n\t{\n\t\t// Menu inside an horizontal menu bar\n\t\t// Selectable extend their highlight by half ItemSpacing in each direction.\n\t\t// For ChildMenu, the popup position will be overwritten by the call to FindBestPopupWindowPos() in Begin()\n\t\tpopup_pos = ImVec2(pos.x - window->WindowPadding.x, pos.y - style.FramePadding.y + window->MenuBarHeight());\n\t\twindow->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * 0.5f);\n\t\tPushStyleVar(ImGuiStyleVar_ItemSpacing, style.ItemSpacing * 2.0f);\n\t\tfloat w = label_size.x;\n\t\tpressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));\n\t\tPopStyleVar();\n\t\twindow->DC.CursorPos.x += (float)(int)(style.ItemSpacing.x * (-1.0f + 0.5f)); // -1 spacing to compensate the spacing added when Selectable() did a SameLine(). It would also work to call SameLine() ourselves after the PopStyleVar().\n\t}\n\telse\n\t{\n\t\t// Menu inside a menu\n\t\tpopup_pos = ImVec2(pos.x, pos.y - style.WindowPadding.y);\n\t\tfloat w = window->MenuColumns.DeclColumns(label_size.x, 0.0f, (float)(int)(g.FontSize * 1.20f)); // Feedback to next frame\n\t\tfloat extra_w = ImMax(0.0f, GetContentRegionAvail().x - w);\n\t\tpressed = Selectable(label, menu_is_open, ImGuiSelectableFlags_Menu | ImGuiSelectableFlags_DontClosePopups | ImGuiSelectableFlags_DrawFillAvailWidth | (!enabled ? ImGuiSelectableFlags_Disabled : 0), ImVec2(w, 0.0f));\n\t\tif (!enabled) PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextDisabled]);\n\t\tRenderTriangle(pos + ImVec2(window->MenuColumns.Pos[2] + extra_w + g.FontSize * 0.30f, 0.0f), ImGuiDir_Right);\n\t\tif (!enabled) PopStyleColor();\n\t}\n\n\tconst bool hovered = enabled && ItemHoverable(window->DC.LastItemRect, id);\n\tif (menuset_is_open)\n\t\tg.NavWindow = backed_nav_window;\n\n\tbool want_open = false, want_close = false;\n\tif (window->DC.LayoutType != ImGuiLayoutType_Horizontal) // (window->Flags & (ImGuiWindowFlags_Popup|ImGuiWindowFlags_ChildMenu))\n\t{\n\t\t// Implement http://bjk5.com/post/44698559168/breaking-down-amazons-mega-dropdown to avoid using timers, so menus feels more reactive.\n\t\tbool moving_within_opened_triangle = false;\n\t\tif (g.HoveredWindow == window && g.OpenPopupStack.Size > g.CurrentPopupStack.Size&& g.OpenPopupStack[g.CurrentPopupStack.Size].ParentWindow == window)\n\t\t{\n\t\t\tif (ImGuiWindow* next_window = g.OpenPopupStack[g.CurrentPopupStack.Size].Window)\n\t\t\t{\n\t\t\t\tImRect next_window_rect = next_window->Rect();\n\t\t\t\tImVec2 ta = g.IO.MousePos - g.IO.MouseDelta;\n\t\t\t\tImVec2 tb = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetTL() : next_window_rect.GetTR();\n\t\t\t\tImVec2 tc = (window->Pos.x < next_window->Pos.x) ? next_window_rect.GetBL() : next_window_rect.GetBR();\n\t\t\t\tfloat extra = ImClamp(fabsf(ta.x - tb.x) * 0.30f, 5.0f, 30.0f); // add a bit of extra slack.\n\t\t\t\tta.x += (window->Pos.x < next_window->Pos.x) ? -0.5f : +0.5f;   // to avoid numerical issues\n\t\t\t\ttb.y = ta.y + ImMax((tb.y - extra) - ta.y, -100.0f);            // triangle is maximum 200 high to limit the slope and the bias toward large sub-menus // FIXME: Multiply by fb_scale?\n\t\t\t\ttc.y = ta.y + ImMin((tc.y + extra) - ta.y, +100.0f);\n\t\t\t\tmoving_within_opened_triangle = ImTriangleContainsPoint(ta, tb, tc, g.IO.MousePos);\n\t\t\t\t//window->DrawList->PushClipRectFullScreen(); window->DrawList->AddTriangleFilled(ta, tb, tc, moving_within_opened_triangle ? IM_COL32(0,128,0,128) : IM_COL32(128,0,0,128)); window->DrawList->PopClipRect(); // Debug\n\t\t\t}\n\t\t}\n\n\t\twant_close = (menu_is_open && !hovered && g.HoveredWindow == window && g.HoveredIdPreviousFrame != 0 && g.HoveredIdPreviousFrame != id && !moving_within_opened_triangle);\n\t\twant_open = (!menu_is_open && hovered && !moving_within_opened_triangle) || (!menu_is_open && hovered && pressed);\n\t}\n\telse\n\t{\n\t\t// Menu bar\n\t\tif (menu_is_open && pressed && menuset_is_open) // Click an open menu again to close it\n\t\t{\n\t\t\twant_close = true;\n\t\t\twant_open = menu_is_open = false;\n\t\t}\n\t\telse if (pressed || (hovered && menuset_is_open && !menu_is_open)) // First click to open, then hover to open others\n\t\t{\n\t\t\twant_open = true;\n\t\t}\n\t}\n\n\tif (!enabled) // explicitly close if an open menu becomes disabled, facilitate users code a lot in pattern such as 'if (BeginMenu(\"options\", has_object)) { ..use object.. }'\n\t\twant_close = true;\n\tif (want_close && IsPopupOpen(id))\n\t\tClosePopupToLevel(GImGui->CurrentPopupStack.Size);\n\n\tif (!menu_is_open && want_open && g.OpenPopupStack.Size > g.CurrentPopupStack.Size)\n\t{\n\t\t// Don't recycle same menu level in the same frame, first close the other menu and yield for a frame.\n\t\tOpenPopup(label);\n\t\treturn false;\n\t}\n\n\tmenu_is_open |= want_open;\n\tif (want_open)\n\t\tOpenPopup(label);\n\n\tif (menu_is_open)\n\t{\n\t\tSetNextWindowPos(popup_pos, ImGuiCond_Always);\n\t\tImGuiWindowFlags flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoSavedSettings | ((window->Flags & (ImGuiWindowFlags_Popup | ImGuiWindowFlags_ChildMenu)) ? ImGuiWindowFlags_ChildMenu | ImGuiWindowFlags_ChildWindow : ImGuiWindowFlags_ChildMenu);\n\t\tmenu_is_open = BeginPopupEx(id, flags); // menu_is_open can be 'false' when the popup is completely clipped (e.g. zero size display)\n\t}\n\n\treturn menu_is_open;\n}\n\nvoid ImGui::EndMenu()\n{\n\tEndPopup();\n}\n\n// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.\nvoid ImGui::ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\n\tint cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);\n\tBeginTooltipEx(0, true);\n\n\tconst char* text_end = text ? FindRenderedTextEnd(text, NULL) : text;\n\tif (text_end > text)\n\t{\n\t\tTextUnformatted(text, text_end);\n\t\tSeparator();\n\t}\n\n\tImVec2 sz(g.FontSize * 3 + g.Style.FramePadding.y * 2, g.FontSize * 3 + g.Style.FramePadding.y * 2);\n\tColorButton(\"##preview\", ImVec4(col[0], col[1], col[2], col[3]), (flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf)) | ImGuiColorEditFlags_NoTooltip, sz);\n\tSameLine();\n\tif (flags & ImGuiColorEditFlags_NoAlpha)\n\t\tText(\"#%02X%02X%02X\\nR: %d, G: %d, B: %d\\n(%.3f, %.3f, %.3f)\", cr, cg, cb, cr, cg, cb, col[0], col[1], col[2]);\n\telse\n\t\tText(\"#%02X%02X%02X%02X\\nR:%d, G:%d, B:%d, A:%d\\n(%.3f, %.3f, %.3f, %.3f)\", cr, cg, cb, ca, cr, cg, cb, ca, col[0], col[1], col[2], col[3]);\n\tEndTooltip();\n}\n\nstatic inline ImU32 ImAlphaBlendColor(ImU32 col_a, ImU32 col_b)\n{\n\tfloat t = ((col_b >> IM_COL32_A_SHIFT) & 0xFF) / 255.f;\n\tint r = ImLerp((int)(col_a >> IM_COL32_R_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_R_SHIFT) & 0xFF, t);\n\tint g = ImLerp((int)(col_a >> IM_COL32_G_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_G_SHIFT) & 0xFF, t);\n\tint b = ImLerp((int)(col_a >> IM_COL32_B_SHIFT) & 0xFF, (int)(col_b >> IM_COL32_B_SHIFT) & 0xFF, t);\n\treturn IM_COL32(r, g, b, 0xFF);\n}\n\n// NB: This is rather brittle and will show artifact when rounding this enabled if rounded corners overlap multiple cells. Caller currently responsible for avoiding that.\n// I spent a non reasonable amount of time trying to getting this right for ColorButton with rounding+anti-aliasing+ImGuiColorEditFlags_HalfAlphaPreview flag + various grid sizes and offsets, and eventually gave up... probably more reasonable to disable rounding alltogether.\nvoid ImGui::RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 col, float grid_step, ImVec2 grid_off, float rounding, int rounding_corners_flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (((col & IM_COL32_A_MASK) >> IM_COL32_A_SHIFT) < 0xFF)\n\t{\n\t\tImU32 col_bg1 = GetColorU32(ImAlphaBlendColor(IM_COL32(204, 204, 204, 255), col));\n\t\tImU32 col_bg2 = GetColorU32(ImAlphaBlendColor(IM_COL32(128, 128, 128, 255), col));\n\t\twindow->DrawList->AddRectFilled(p_min, p_max, col_bg1, rounding, rounding_corners_flags);\n\n\t\tint yi = 0;\n\t\tfor (float y = p_min.y + grid_off.y; y < p_max.y; y += grid_step, yi++)\n\t\t{\n\t\t\tfloat y1 = ImClamp(y, p_min.y, p_max.y), y2 = ImMin(y + grid_step, p_max.y);\n\t\t\tif (y2 <= y1)\n\t\t\t\tcontinue;\n\t\t\tfor (float x = p_min.x + grid_off.x + (yi & 1) * grid_step; x < p_max.x; x += grid_step * 2.0f)\n\t\t\t{\n\t\t\t\tfloat x1 = ImClamp(x, p_min.x, p_max.x), x2 = ImMin(x + grid_step, p_max.x);\n\t\t\t\tif (x2 <= x1)\n\t\t\t\t\tcontinue;\n\t\t\t\tint rounding_corners_flags_cell = 0;\n\t\t\t\tif (y1 <= p_min.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_TopRight; }\n\t\t\t\tif (y2 >= p_max.y) { if (x1 <= p_min.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotLeft; if (x2 >= p_max.x) rounding_corners_flags_cell |= ImDrawCornerFlags_BotRight; }\n\t\t\t\trounding_corners_flags_cell &= rounding_corners_flags;\n\t\t\t\twindow->DrawList->AddRectFilled(ImVec2(x1, y1), ImVec2(x2, y2), col_bg2, rounding_corners_flags_cell ? rounding : 0.0f, rounding_corners_flags_cell);\n\t\t\t}\n\t\t}\n\t}\n\telse\n\t{\n\t\twindow->DrawList->AddRectFilled(p_min, p_max, col, rounding, rounding_corners_flags);\n\t}\n}\n\nvoid ImGui::SetColorEditOptions(ImGuiColorEditFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tif ((flags & ImGuiColorEditFlags__InputsMask) == 0)\n\t\tflags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__InputsMask;\n\tif ((flags & ImGuiColorEditFlags__DataTypeMask) == 0)\n\t\tflags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__DataTypeMask;\n\tif ((flags & ImGuiColorEditFlags__PickerMask) == 0)\n\t\tflags |= ImGuiColorEditFlags__OptionsDefault & ImGuiColorEditFlags__PickerMask;\n\tIM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__InputsMask)));   // Check only 1 option is selected\n\tIM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__DataTypeMask))); // Check only 1 option is selected\n\tIM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask)));   // Check only 1 option is selected\n\tg.ColorEditOptions = flags;\n}\n\n// A little colored square. Return true when clicked.\n// FIXME: May want to display/ignore the alpha component in the color display? Yet show it in the tooltip.\n// 'desc_id' is not called 'label' because we don't display it next to the button, but only in the tooltip.\nbool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags, ImVec2 size)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiID id = window->GetID(desc_id);\n\tfloat default_size = GetFrameHeight();\n\tif (size.x == 0.0f)\n\t\tsize.x = default_size;\n\tif (size.y == 0.0f)\n\t\tsize.y = default_size;\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n\tItemSize(bb, (size.y >= default_size) ? g.Style.FramePadding.y : 0.0f);\n\tif (!ItemAdd(bb, id))\n\t\treturn false;\n\n\tbool hovered, held;\n\tbool pressed = ButtonBehavior(bb, id, &hovered, &held);\n\n\tif (flags & ImGuiColorEditFlags_NoAlpha)\n\t\tflags &= ~(ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf);\n\n\tImVec4 col_without_alpha(col.x, col.y, col.z, 1.0f);\n\tfloat grid_step = ImMin(size.x, size.y) / 2.99f;\n\tfloat rounding = ImMin(g.Style.FrameRounding, grid_step * 0.5f);\n\tImRect bb_inner = bb;\n\tfloat off = -0.75f; // The border (using Col_FrameBg) tends to look off when color is near-opaque and rounding is enabled. This offset seemed like a good middle ground to reduce those artifacts.\n\tbb_inner.Expand(off);\n\tif ((flags & ImGuiColorEditFlags_AlphaPreviewHalf) && col.w < 1.0f)\n\t{\n\t\tfloat mid_x = (float)(int)((bb_inner.Min.x + bb_inner.Max.x) * 0.5f + 0.5f);\n\t\tRenderColorRectWithAlphaCheckerboard(ImVec2(bb_inner.Min.x + grid_step, bb_inner.Min.y), bb_inner.Max, GetColorU32(col), grid_step, ImVec2(-grid_step + off, off), rounding, ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight);\n\t\twindow->DrawList->AddRectFilled(bb_inner.Min, ImVec2(mid_x, bb_inner.Max.y), GetColorU32(col_without_alpha), rounding, ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft);\n\t}\n\telse\n\t{\n\t\t// Because GetColorU32() multiplies by the global style Alpha and we don't want to display a checkerboard if the source code had no alpha\n\t\tImVec4 col_source = (flags & ImGuiColorEditFlags_AlphaPreview) ? col : col_without_alpha;\n\t\tif (col_source.w < 1.0f)\n\t\t\tRenderColorRectWithAlphaCheckerboard(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), grid_step, ImVec2(off, off), rounding);\n\t\telse\n\t\t\twindow->DrawList->AddRectFilled(bb_inner.Min, bb_inner.Max, GetColorU32(col_source), rounding, ImDrawCornerFlags_All);\n\t}\n\tif (g.Style.FrameBorderSize > 0.0f)\n\t\tRenderFrameBorder(bb.Min, bb.Max, rounding);\n\telse\n\t\twindow->DrawList->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_FrameBg), rounding); // Color button are often in need of some sort of border\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Drag and Drop Source\n\tif (g.ActiveId == id && BeginDragDropSource()) // NB: The ActiveId test is merely an optional micro-optimization\n\t{\n\t\tif (flags & ImGuiColorEditFlags_NoAlpha)\n\t\t\tSetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F, &col, sizeof(float) * 3, ImGuiCond_Once);\n\t\telse\n\t\t\tSetDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F, &col, sizeof(float) * 4, ImGuiCond_Once);\n\t\tColorButton(desc_id, col, flags);\n\t\tSameLine();\n\t\tTextUnformatted(\"Color\");\n\t\tEndDragDropSource();\n\t\thovered = false;\n\t}\n\n\t// Tooltip\n\tif (!(flags & ImGuiColorEditFlags_NoTooltip) && hovered)\n\t\tColorTooltip(desc_id, &col.x, flags & (ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf));\n\n\treturn pressed;\n}\n\nbool ImGui::ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags)\n{\n\treturn ColorEdit4(label, col, flags | ImGuiColorEditFlags_NoAlpha);\n}\n\nvoid ImGui::ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags)\n{\n\tbool allow_opt_inputs = !(flags & ImGuiColorEditFlags__InputsMask);\n\tbool allow_opt_datatype = !(flags & ImGuiColorEditFlags__DataTypeMask);\n\tif ((!allow_opt_inputs && !allow_opt_datatype) || !BeginPopup(\"context\"))\n\t\treturn;\n\tImGuiContext& g = *GImGui;\n\tImGuiColorEditFlags opts = g.ColorEditOptions;\n\tif (allow_opt_inputs)\n\t{\n\t\tif (RadioButton(\"RGB\", (opts & ImGuiColorEditFlags_RGB) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_RGB;\n\t\tif (RadioButton(\"HSV\", (opts & ImGuiColorEditFlags_HSV) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HSV;\n\t\tif (RadioButton(\"HEX\", (opts & ImGuiColorEditFlags_HEX) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__InputsMask) | ImGuiColorEditFlags_HEX;\n\t}\n\tif (allow_opt_datatype)\n\t{\n\t\tif (allow_opt_inputs) Separator();\n\t\tif (RadioButton(\"0..255\", (opts & ImGuiColorEditFlags_Uint8) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Uint8;\n\t\tif (RadioButton(\"0.00..1.00\", (opts & ImGuiColorEditFlags_Float) ? 1 : 0)) opts = (opts & ~ImGuiColorEditFlags__DataTypeMask) | ImGuiColorEditFlags_Float;\n\t}\n\n\tif (allow_opt_inputs || allow_opt_datatype)\n\t\tSeparator();\n\tif (Button(\"Copy as..\", ImVec2(-1, 0)))\n\t\tOpenPopup(\"Copy\");\n\tif (BeginPopup(\"Copy\"))\n\t{\n\t\tint cr = IM_F32_TO_INT8_SAT(col[0]), cg = IM_F32_TO_INT8_SAT(col[1]), cb = IM_F32_TO_INT8_SAT(col[2]), ca = (flags & ImGuiColorEditFlags_NoAlpha) ? 255 : IM_F32_TO_INT8_SAT(col[3]);\n\t\tchar buf[64];\n\t\tImFormatString(buf, IM_ARRAYSIZE(buf), \"(%.3ff, %.3ff, %.3ff, %.3ff)\", col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);\n\t\tif (Selectable(buf))\n\t\t\tSetClipboardText(buf);\n\t\tImFormatString(buf, IM_ARRAYSIZE(buf), \"(%d,%d,%d,%d)\", cr, cg, cb, ca);\n\t\tif (Selectable(buf))\n\t\t\tSetClipboardText(buf);\n\t\tif (flags & ImGuiColorEditFlags_NoAlpha)\n\t\t\tImFormatString(buf, IM_ARRAYSIZE(buf), \"0x%02X%02X%02X\", cr, cg, cb);\n\t\telse\n\t\t\tImFormatString(buf, IM_ARRAYSIZE(buf), \"0x%02X%02X%02X%02X\", cr, cg, cb, ca);\n\t\tif (Selectable(buf))\n\t\t\tSetClipboardText(buf);\n\t\tEndPopup();\n\t}\n\n\tg.ColorEditOptions = opts;\n\tEndPopup();\n}\n\nstatic void ColorPickerOptionsPopup(ImGuiColorEditFlags flags, const float* ref_col)\n{\n\tbool allow_opt_picker = !(flags & ImGuiColorEditFlags__PickerMask);\n\tbool allow_opt_alpha_bar = !(flags & ImGuiColorEditFlags_NoAlpha) && !(flags & ImGuiColorEditFlags_AlphaBar);\n\tif ((!allow_opt_picker && !allow_opt_alpha_bar) || !ImGui::BeginPopup(\"context\"))\n\t\treturn;\n\tImGuiContext& g = *GImGui;\n\tif (allow_opt_picker)\n\t{\n\t\tImVec2 picker_size(g.FontSize * 8, ImMax(g.FontSize * 8 - (ImGui::GetFrameHeight() + g.Style.ItemInnerSpacing.x), 1.0f)); // FIXME: Picker size copied from main picker function\n\t\tImGui::PushItemWidth(picker_size.x);\n\t\tfor (int picker_type = 0; picker_type < 2; picker_type++)\n\t\t{\n\t\t\t// Draw small/thumbnail version of each picker type (over an invisible button for selection)\n\t\t\tif (picker_type > 0) ImGui::Separator();\n\t\t\tImGui::PushID(picker_type);\n\t\t\tImGuiColorEditFlags picker_flags = ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoSidePreview | (flags & ImGuiColorEditFlags_NoAlpha);\n\t\t\tif (picker_type == 0) picker_flags |= ImGuiColorEditFlags_PickerHueBar;\n\t\t\tif (picker_type == 1) picker_flags |= ImGuiColorEditFlags_PickerHueWheel;\n\t\t\tImVec2 backup_pos = ImGui::GetCursorScreenPos();\n\t\t\tif (ImGui::Selectable(\"##selectable\", false, 0, picker_size)) // By default, Selectable() is closing popup\n\t\t\t\tg.ColorEditOptions = (g.ColorEditOptions & ~ImGuiColorEditFlags__PickerMask) | (picker_flags & ImGuiColorEditFlags__PickerMask);\n\t\t\tImGui::SetCursorScreenPos(backup_pos);\n\t\t\tImVec4 dummy_ref_col;\n\t\t\tmemcpy(&dummy_ref_col.x, ref_col, sizeof(float) * (picker_flags & ImGuiColorEditFlags_NoAlpha ? 3 : 4));\n\t\t\tImGui::ColorPicker4(\"##dummypicker\", &dummy_ref_col.x, picker_flags);\n\t\t\tImGui::PopID();\n\t\t}\n\t\tImGui::PopItemWidth();\n\t}\n\tif (allow_opt_alpha_bar)\n\t{\n\t\tif (allow_opt_picker) ImGui::Separator();\n\t\tImGui::CheckboxFlags(\"Alpha Bar\", (unsigned int*)&g.ColorEditOptions, ImGuiColorEditFlags_AlphaBar);\n\t}\n\tImGui::EndPopup();\n}\n\n// Edit colors components (each component in 0.0f..1.0f range). \n// See enum ImGuiColorEditFlags_ for available options. e.g. Only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.\n// With typical options: Left-click on colored square to open color picker. Right-click to open option menu. CTRL-Click over input fields to edit them and TAB to go to next item.\nbool ImGui::ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn false;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiStyle& style = g.Style;\n\tconst float square_sz = GetFrameHeight();\n\tconst float w_extra = (flags & ImGuiColorEditFlags_NoSmallPreview) ? 0.0f : (square_sz + style.ItemInnerSpacing.x);\n\tconst float w_items_all = CalcItemWidth() - w_extra;\n\tconst char* label_display_end = FindRenderedTextEnd(label);\n\n\tconst bool alpha = (flags & ImGuiColorEditFlags_NoAlpha) == 0;\n\tconst bool hdr = (flags & ImGuiColorEditFlags_HDR) != 0;\n\tconst int components = alpha ? 4 : 3;\n\tconst ImGuiColorEditFlags flags_untouched = flags;\n\n\tBeginGroup();\n\tPushID(label);\n\n\t// If we're not showing any slider there's no point in doing any HSV conversions\n\tif (flags & ImGuiColorEditFlags_NoInputs)\n\t\tflags = (flags & (~ImGuiColorEditFlags__InputsMask)) | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_NoOptions;\n\n\t// Context menu: display and modify options (before defaults are applied)\n\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\tColorEditOptionsPopup(col, flags);\n\n\t// Read stored options\n\tif (!(flags & ImGuiColorEditFlags__InputsMask))\n\t\tflags |= (g.ColorEditOptions & ImGuiColorEditFlags__InputsMask);\n\tif (!(flags & ImGuiColorEditFlags__DataTypeMask))\n\t\tflags |= (g.ColorEditOptions & ImGuiColorEditFlags__DataTypeMask);\n\tif (!(flags & ImGuiColorEditFlags__PickerMask))\n\t\tflags |= (g.ColorEditOptions & ImGuiColorEditFlags__PickerMask);\n\tflags |= (g.ColorEditOptions & ~(ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask));\n\n\t// Convert to the formats we need\n\tfloat f[4] = { col[0], col[1], col[2], alpha ? col[3] : 1.0f };\n\tif (flags & ImGuiColorEditFlags_HSV)\n\t\tColorConvertRGBtoHSV(f[0], f[1], f[2], f[0], f[1], f[2]);\n\tint i[4] = { IM_F32_TO_INT8_UNBOUND(f[0]), IM_F32_TO_INT8_UNBOUND(f[1]), IM_F32_TO_INT8_UNBOUND(f[2]), IM_F32_TO_INT8_UNBOUND(f[3]) };\n\n\tbool value_changed = false;\n\tbool value_changed_as_float = false;\n\n\tif ((flags & (ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV)) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)\n\t{\n\t\t// RGB/HSV 0..255 Sliders\n\t\tconst float w_item_one = ImMax(1.0f, (float)(int)((w_items_all - (style.ItemInnerSpacing.x) * (components - 1)) / (float)components));\n\t\tconst float w_item_last = ImMax(1.0f, (float)(int)(w_items_all - (w_item_one + style.ItemInnerSpacing.x) * (components - 1)));\n\n\t\tconst bool hide_prefix = (w_item_one <= CalcTextSize((flags & ImGuiColorEditFlags_Float) ? \"M:0.000\" : \"M:000\").x);\n\t\tconst char* ids[4] = { \"##X\", \"##Y\", \"##Z\", \"##W\" };\n\t\tconst char* fmt_table_int[3][4] =\n\t\t{\n\t\t\t{ \"%3.0f\",   \"%3.0f\",   \"%3.0f\",   \"%3.0f\" }, // Short display\n\t\t\t{ \"R:%3.0f\", \"G:%3.0f\", \"B:%3.0f\", \"A:%3.0f\" }, // Long display for RGBA\n\t\t\t{ \"H:%3.0f\", \"S:%3.0f\", \"V:%3.0f\", \"A:%3.0f\" }  // Long display for HSVA\n\t\t};\n\t\tconst char* fmt_table_float[3][4] =\n\t\t{\n\t\t\t{ \"%0.3f\",   \"%0.3f\",   \"%0.3f\",   \"%0.3f\" }, // Short display\n\t\t\t{ \"R:%0.3f\", \"G:%0.3f\", \"B:%0.3f\", \"A:%0.3f\" }, // Long display for RGBA\n\t\t\t{ \"H:%0.3f\", \"S:%0.3f\", \"V:%0.3f\", \"A:%0.3f\" }  // Long display for HSVA\n\t\t};\n\t\tconst int fmt_idx = hide_prefix ? 0 : (flags & ImGuiColorEditFlags_HSV) ? 2 : 1;\n\n\t\tPushItemWidth(w_item_one);\n\t\tfor (int n = 0; n < components; n++)\n\t\t{\n\t\t\tif (n > 0)\n\t\t\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\t\tif (n + 1 == components)\n\t\t\t\tPushItemWidth(w_item_last);\n\t\t\tif (flags & ImGuiColorEditFlags_Float)\n\t\t\t\tvalue_changed = value_changed_as_float = value_changed | DragFloat(ids[n], &f[n], 1.0f / 255.0f, 0.0f, hdr ? 0.0f : 1.0f, fmt_table_float[fmt_idx][n]);\n\t\t\telse\n\t\t\t\tvalue_changed |= DragInt(ids[n], &i[n], 1.0f, 0, hdr ? 0 : 255, fmt_table_int[fmt_idx][n]);\n\t\t\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\t\t\tOpenPopupOnItemClick(\"context\");\n\t\t}\n\t\tPopItemWidth();\n\t\tPopItemWidth();\n\t}\n\telse if ((flags & ImGuiColorEditFlags_HEX) != 0 && (flags & ImGuiColorEditFlags_NoInputs) == 0)\n\t{\n\t\t// RGB Hexadecimal Input\n\t\tchar buf[64];\n\t\tif (alpha)\n\t\t\tImFormatString(buf, IM_ARRAYSIZE(buf), \"#%02X%02X%02X%02X\", ImClamp(i[0], 0, 255), ImClamp(i[1], 0, 255), ImClamp(i[2], 0, 255), ImClamp(i[3], 0, 255));\n\t\telse\n\t\t\tImFormatString(buf, IM_ARRAYSIZE(buf), \"#%02X%02X%02X\", ImClamp(i[0], 0, 255), ImClamp(i[1], 0, 255), ImClamp(i[2], 0, 255));\n\t\tPushItemWidth(w_items_all);\n\t\tif (InputText(\"##Text\", buf, IM_ARRAYSIZE(buf), ImGuiInputTextFlags_CharsHexadecimal | ImGuiInputTextFlags_CharsUppercase))\n\t\t{\n\t\t\tvalue_changed = true;\n\t\t\tchar* p = buf;\n\t\t\twhile (*p == '#' || ImCharIsSpace(*p))\n\t\t\t\tp++;\n\t\t\ti[0] = i[1] = i[2] = i[3] = 0;\n\t\t\tif (alpha)\n\t\t\t\tsscanf(p, \"%02X%02X%02X%02X\", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2], (unsigned int*)&i[3]); // Treat at unsigned (%X is unsigned)\n\t\t\telse\n\t\t\t\tsscanf(p, \"%02X%02X%02X\", (unsigned int*)&i[0], (unsigned int*)&i[1], (unsigned int*)&i[2]);\n\t\t}\n\t\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\t\tOpenPopupOnItemClick(\"context\");\n\t\tPopItemWidth();\n\t}\n\n\tImGuiWindow* picker_active_window = NULL;\n\tif (!(flags & ImGuiColorEditFlags_NoSmallPreview))\n\t{\n\t\tif (!(flags & ImGuiColorEditFlags_NoInputs))\n\t\t\tSameLine(0, style.ItemInnerSpacing.x);\n\n\t\tconst ImVec4 col_v4(col[0], col[1], col[2], alpha ? col[3] : 1.0f);\n\t\tif (ColorButton(\"##ColorButton\", col_v4, flags))\n\t\t{\n\t\t\tif (!(flags & ImGuiColorEditFlags_NoPicker))\n\t\t\t{\n\t\t\t\t// Store current color and open a picker\n\t\t\t\tg.ColorPickerRef = col_v4;\n\t\t\t\tOpenPopup(\"picker\");\n\t\t\t\tSetNextWindowPos(window->DC.LastItemRect.GetBL() + ImVec2(-1, style.ItemSpacing.y));\n\t\t\t}\n\t\t}\n\t\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\t\tOpenPopupOnItemClick(\"context\");\n\n\t\tif (BeginPopup(\"picker\"))\n\t\t{\n\t\t\tpicker_active_window = g.CurrentWindow;\n\t\t\tif (label != label_display_end)\n\t\t\t{\n\t\t\t\tTextUnformatted(label, label_display_end);\n\t\t\t\tSeparator();\n\t\t\t}\n\t\t\tImGuiColorEditFlags picker_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags__PickerMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_AlphaBar;\n\t\t\tImGuiColorEditFlags picker_flags = (flags_untouched & picker_flags_to_forward) | ImGuiColorEditFlags__InputsMask | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaPreviewHalf;\n\t\t\tPushItemWidth(square_sz * 12.0f); // Use 256 + bar sizes?\n\t\t\tvalue_changed |= ColorPicker4(\"##picker\", col, picker_flags, &g.ColorPickerRef.x);\n\t\t\tPopItemWidth();\n\t\t\tEndPopup();\n\t\t}\n\t}\n\n\tif (label != label_display_end && !(flags & ImGuiColorEditFlags_NoLabel))\n\t{\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\tTextUnformatted(label, label_display_end);\n\t}\n\n\t// Convert back\n\tif (picker_active_window == NULL)\n\t{\n\t\tif (!value_changed_as_float)\n\t\t\tfor (int n = 0; n < 4; n++)\n\t\t\t\tf[n] = i[n] / 255.0f;\n\t\tif (flags & ImGuiColorEditFlags_HSV)\n\t\t\tColorConvertHSVtoRGB(f[0], f[1], f[2], f[0], f[1], f[2]);\n\t\tif (value_changed)\n\t\t{\n\t\t\tcol[0] = f[0];\n\t\t\tcol[1] = f[1];\n\t\t\tcol[2] = f[2];\n\t\t\tif (alpha)\n\t\t\t\tcol[3] = f[3];\n\t\t}\n\t}\n\n\tPopID();\n\tEndGroup();\n\n\t// Drag and Drop Target\n\tif (window->DC.LastItemRectHoveredRect && BeginDragDropTarget()) // NB: The LastItemRectHoveredRect test is merely an optional micro-optimization\n\t{\n\t\tif (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_3F))\n\t\t{\n\t\t\tmemcpy((float*)col, payload->Data, sizeof(float) * 3);\n\t\t\tvalue_changed = true;\n\t\t}\n\t\tif (const ImGuiPayload* payload = AcceptDragDropPayload(IMGUI_PAYLOAD_TYPE_COLOR_4F))\n\t\t{\n\t\t\tmemcpy((float*)col, payload->Data, sizeof(float) * components);\n\t\t\tvalue_changed = true;\n\t\t}\n\t\tEndDragDropTarget();\n\t}\n\n\t// When picker is being actively used, use its active id so IsItemActive() will function on ColorEdit4().\n\tif (picker_active_window && g.ActiveId != 0 && g.ActiveIdWindow == picker_active_window)\n\t\twindow->DC.LastItemId = g.ActiveId;\n\n\treturn value_changed;\n}\n\nbool ImGui::ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags)\n{\n\tfloat col4[4] = { col[0], col[1], col[2], 1.0f };\n\tif (!ColorPicker4(label, col4, flags | ImGuiColorEditFlags_NoAlpha))\n\t\treturn false;\n\tcol[0] = col4[0]; col[1] = col4[1]; col[2] = col4[2];\n\treturn true;\n}\n\n// 'pos' is position of the arrow tip. half_sz.x is length from base to tip. half_sz.y is length on each side.\nstatic void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col)\n{\n\tswitch (direction)\n\t{\n\tcase ImGuiDir_Left:  draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), pos, col); return;\n\tcase ImGuiDir_Right: draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), pos, col); return;\n\tcase ImGuiDir_Up:    draw_list->AddTriangleFilled(ImVec2(pos.x + half_sz.x, pos.y + half_sz.y), ImVec2(pos.x - half_sz.x, pos.y + half_sz.y), pos, col); return;\n\tcase ImGuiDir_Down:  draw_list->AddTriangleFilled(ImVec2(pos.x - half_sz.x, pos.y - half_sz.y), ImVec2(pos.x + half_sz.x, pos.y - half_sz.y), pos, col); return;\n\tcase ImGuiDir_None: case ImGuiDir_Count_: break; // Fix warnings\n\t}\n}\n\nstatic void RenderArrowsForVerticalBar(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, float bar_w)\n{\n\tRenderArrow(draw_list, ImVec2(pos.x + half_sz.x + 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Right, IM_COL32_BLACK);\n\tRenderArrow(draw_list, ImVec2(pos.x + half_sz.x, pos.y), half_sz, ImGuiDir_Right, IM_COL32_WHITE);\n\tRenderArrow(draw_list, ImVec2(pos.x + bar_w - half_sz.x - 1, pos.y), ImVec2(half_sz.x + 2, half_sz.y + 1), ImGuiDir_Left, IM_COL32_BLACK);\n\tRenderArrow(draw_list, ImVec2(pos.x + bar_w - half_sz.x, pos.y), half_sz, ImGuiDir_Left, IM_COL32_WHITE);\n}\n\n// ColorPicker\n// Note: only access 3 floats if ImGuiColorEditFlags_NoAlpha flag is set.\n// FIXME: we adjust the big color square height based on item width, which may cause a flickering feedback loop (if automatic height makes a vertical scrollbar appears, affecting automatic width..) \nbool ImGui::ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags, const float* ref_col)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\tImDrawList* draw_list = window->DrawList;\n\n\tImGuiStyle& style = g.Style;\n\tImGuiIO& io = g.IO;\n\n\tPushID(label);\n\tBeginGroup();\n\n\tif (!(flags & ImGuiColorEditFlags_NoSidePreview))\n\t\tflags |= ImGuiColorEditFlags_NoSmallPreview;\n\n\t// Context menu: display and store options.\n\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\tColorPickerOptionsPopup(flags, col);\n\n\t// Read stored options\n\tif (!(flags & ImGuiColorEditFlags__PickerMask))\n\t\tflags |= ((g.ColorEditOptions & ImGuiColorEditFlags__PickerMask) ? g.ColorEditOptions : ImGuiColorEditFlags__OptionsDefault) & ImGuiColorEditFlags__PickerMask;\n\tIM_ASSERT(ImIsPowerOfTwo((int)(flags & ImGuiColorEditFlags__PickerMask))); // Check that only 1 is selected\n\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\tflags |= (g.ColorEditOptions & ImGuiColorEditFlags_AlphaBar);\n\n\t// Setup\n\tint components = (flags & ImGuiColorEditFlags_NoAlpha) ? 3 : 4;\n\tbool alpha_bar = (flags & ImGuiColorEditFlags_AlphaBar) && !(flags & ImGuiColorEditFlags_NoAlpha);\n\tImVec2 picker_pos = window->DC.CursorPos;\n\tfloat square_sz = GetFrameHeight();\n\tfloat bars_width = square_sz; // Arbitrary smallish width of Hue/Alpha picking bars\n\tfloat sv_picker_size = ImMax(bars_width * 1, CalcItemWidth() - (alpha_bar ? 2 : 1) * (bars_width + style.ItemInnerSpacing.x)); // Saturation/Value picking box\n\tfloat bar0_pos_x = picker_pos.x + sv_picker_size + style.ItemInnerSpacing.x;\n\tfloat bar1_pos_x = bar0_pos_x + bars_width + style.ItemInnerSpacing.x;\n\tfloat bars_triangles_half_sz = (float)(int)(bars_width * 0.20f);\n\n\tfloat backup_initial_col[4];\n\tmemcpy(backup_initial_col, col, components * sizeof(float));\n\n\tfloat wheel_thickness = sv_picker_size * 0.08f;\n\tfloat wheel_r_outer = sv_picker_size * 0.50f;\n\tfloat wheel_r_inner = wheel_r_outer - wheel_thickness;\n\tImVec2 wheel_center(picker_pos.x + (sv_picker_size + bars_width) * 0.5f, picker_pos.y + sv_picker_size * 0.5f);\n\n\t// Note: the triangle is displayed rotated with triangle_pa pointing to Hue, but most coordinates stays unrotated for logic.\n\tfloat triangle_r = wheel_r_inner - (int)(sv_picker_size * 0.027f);\n\tImVec2 triangle_pa = ImVec2(triangle_r, 0.0f); // Hue point.\n\tImVec2 triangle_pb = ImVec2(triangle_r * -0.5f, triangle_r * -0.866025f); // Black point.\n\tImVec2 triangle_pc = ImVec2(triangle_r * -0.5f, triangle_r * +0.866025f); // White point.\n\n\tfloat H, S, V;\n\tColorConvertRGBtoHSV(col[0], col[1], col[2], H, S, V);\n\n\tbool value_changed = false, value_changed_h = false, value_changed_sv = false;\n\n\tif (flags & ImGuiColorEditFlags_PickerHueWheel)\n\t{\n\t\t// Hue wheel + SV triangle logic\n\t\tInvisibleButton(\"hsv\", ImVec2(sv_picker_size + style.ItemInnerSpacing.x + bars_width, sv_picker_size));\n\t\tif (IsItemActive())\n\t\t{\n\t\t\tImVec2 initial_off = g.IO.MouseClickedPos[0] - wheel_center;\n\t\t\tImVec2 current_off = g.IO.MousePos - wheel_center;\n\t\t\tfloat initial_dist2 = ImLengthSqr(initial_off);\n\t\t\tif (initial_dist2 >= (wheel_r_inner - 1) * (wheel_r_inner - 1) && initial_dist2 <= (wheel_r_outer + 1) * (wheel_r_outer + 1))\n\t\t\t{\n\t\t\t\t// Interactive with Hue wheel\n\t\t\t\tH = atan2f(current_off.y, current_off.x) / IM_PI * 0.5f;\n\t\t\t\tif (H < 0.0f)\n\t\t\t\t\tH += 1.0f;\n\t\t\t\tvalue_changed = value_changed_h = true;\n\t\t\t}\n\t\t\tfloat cos_hue_angle = cosf(-H * 2.0f * IM_PI);\n\t\t\tfloat sin_hue_angle = sinf(-H * 2.0f * IM_PI);\n\t\t\tif (ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, ImRotate(initial_off, cos_hue_angle, sin_hue_angle)))\n\t\t\t{\n\t\t\t\t// Interacting with SV triangle\n\t\t\t\tImVec2 current_off_unrotated = ImRotate(current_off, cos_hue_angle, sin_hue_angle);\n\t\t\t\tif (!ImTriangleContainsPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated))\n\t\t\t\t\tcurrent_off_unrotated = ImTriangleClosestPoint(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated);\n\t\t\t\tfloat uu, vv, ww;\n\t\t\t\tImTriangleBarycentricCoords(triangle_pa, triangle_pb, triangle_pc, current_off_unrotated, uu, vv, ww);\n\t\t\t\tV = ImClamp(1.0f - vv, 0.0001f, 1.0f);\n\t\t\t\tS = ImClamp(uu / V, 0.0001f, 1.0f);\n\t\t\t\tvalue_changed = value_changed_sv = true;\n\t\t\t}\n\t\t}\n\t\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\t\tOpenPopupOnItemClick(\"context\");\n\t}\n\telse if (flags & ImGuiColorEditFlags_PickerHueBar)\n\t{\n\t\t// SV rectangle logic\n\t\tInvisibleButton(\"sv\", ImVec2(sv_picker_size, sv_picker_size));\n\t\tif (IsItemActive())\n\t\t{\n\t\t\tS = ImSaturate((io.MousePos.x - picker_pos.x) / (sv_picker_size - 1));\n\t\t\tV = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));\n\t\t\tvalue_changed = value_changed_sv = true;\n\t\t}\n\t\tif (!(flags & ImGuiColorEditFlags_NoOptions))\n\t\t\tOpenPopupOnItemClick(\"context\");\n\n\t\t// Hue bar logic\n\t\tSetCursorScreenPos(ImVec2(bar0_pos_x, picker_pos.y));\n\t\tInvisibleButton(\"hue\", ImVec2(bars_width, sv_picker_size));\n\t\tif (IsItemActive())\n\t\t{\n\t\t\tH = ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));\n\t\t\tvalue_changed = value_changed_h = true;\n\t\t}\n\t}\n\n\t// Alpha bar logic\n\tif (alpha_bar)\n\t{\n\t\tSetCursorScreenPos(ImVec2(bar1_pos_x, picker_pos.y));\n\t\tInvisibleButton(\"alpha\", ImVec2(bars_width, sv_picker_size));\n\t\tif (IsItemActive())\n\t\t{\n\t\t\tcol[3] = 1.0f - ImSaturate((io.MousePos.y - picker_pos.y) / (sv_picker_size - 1));\n\t\t\tvalue_changed = true;\n\t\t}\n\t}\n\n\tif (!(flags & ImGuiColorEditFlags_NoSidePreview))\n\t{\n\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\tBeginGroup();\n\t}\n\n\tif (!(flags & ImGuiColorEditFlags_NoLabel))\n\t{\n\t\tconst char* label_display_end = FindRenderedTextEnd(label);\n\t\tif (label != label_display_end)\n\t\t{\n\t\t\tif ((flags & ImGuiColorEditFlags_NoSidePreview))\n\t\t\t\tSameLine(0, style.ItemInnerSpacing.x);\n\t\t\tTextUnformatted(label, label_display_end);\n\t\t}\n\t}\n\n\tif (!(flags & ImGuiColorEditFlags_NoSidePreview))\n\t{\n\t\tImVec4 col_v4(col[0], col[1], col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : col[3]);\n\t\tif ((flags & ImGuiColorEditFlags_NoLabel))\n\t\t\tText(\"Current\");\n\t\tColorButton(\"##current\", col_v4, (flags & (ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf | ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2));\n\t\tif (ref_col != NULL)\n\t\t{\n\t\t\tText(\"Original\");\n\t\t\tImVec4 ref_col_v4(ref_col[0], ref_col[1], ref_col[2], (flags & ImGuiColorEditFlags_NoAlpha) ? 1.0f : ref_col[3]);\n\t\t\tif (ColorButton(\"##original\", ref_col_v4, (flags & (ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf | ImGuiColorEditFlags_NoTooltip)), ImVec2(square_sz * 3, square_sz * 2)))\n\t\t\t{\n\t\t\t\tmemcpy(col, ref_col, components * sizeof(float));\n\t\t\t\tvalue_changed = true;\n\t\t\t}\n\t\t}\n\t\tEndGroup();\n\t}\n\n\t// Convert back color to RGB\n\tif (value_changed_h || value_changed_sv)\n\t\tColorConvertHSVtoRGB(H >= 1.0f ? H - 10 * 1e-6f : H, S > 0.0f ? S : 10 * 1e-6f, V > 0.0f ? V : 1e-6f, col[0], col[1], col[2]);\n\n\t// R,G,B and H,S,V slider color editor\n\tif ((flags & ImGuiColorEditFlags_NoInputs) == 0)\n\t{\n\t\tPushItemWidth((alpha_bar ? bar1_pos_x : bar0_pos_x) + bars_width - picker_pos.x);\n\t\tImGuiColorEditFlags sub_flags_to_forward = ImGuiColorEditFlags__DataTypeMask | ImGuiColorEditFlags_HDR | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_NoOptions | ImGuiColorEditFlags_NoSmallPreview | ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaPreviewHalf;\n\t\tImGuiColorEditFlags sub_flags = (flags & sub_flags_to_forward) | ImGuiColorEditFlags_NoPicker;\n\t\tif (flags & ImGuiColorEditFlags_RGB || (flags & ImGuiColorEditFlags__InputsMask) == 0)\n\t\t\tvalue_changed |= ColorEdit4(\"##rgb\", col, sub_flags | ImGuiColorEditFlags_RGB);\n\t\tif (flags & ImGuiColorEditFlags_HSV || (flags & ImGuiColorEditFlags__InputsMask) == 0)\n\t\t\tvalue_changed |= ColorEdit4(\"##hsv\", col, sub_flags | ImGuiColorEditFlags_HSV);\n\t\tif (flags & ImGuiColorEditFlags_HEX || (flags & ImGuiColorEditFlags__InputsMask) == 0)\n\t\t\tvalue_changed |= ColorEdit4(\"##hex\", col, sub_flags | ImGuiColorEditFlags_HEX);\n\t\tPopItemWidth();\n\t}\n\n\t// Try to cancel hue wrap (after ColorEdit), if any\n\tif (value_changed)\n\t{\n\t\tfloat new_H, new_S, new_V;\n\t\tColorConvertRGBtoHSV(col[0], col[1], col[2], new_H, new_S, new_V);\n\t\tif (new_H <= 0 && H > 0)\n\t\t{\n\t\t\tif (new_V <= 0 && V != new_V)\n\t\t\t\tColorConvertHSVtoRGB(H, S, new_V <= 0 ? V * 0.5f : new_V, col[0], col[1], col[2]);\n\t\t\telse if (new_S <= 0)\n\t\t\t\tColorConvertHSVtoRGB(H, new_S <= 0 ? S * 0.5f : new_S, new_V, col[0], col[1], col[2]);\n\t\t}\n\t}\n\n\tImVec4 hue_color_f(1, 1, 1, 1); ColorConvertHSVtoRGB(H, 1, 1, hue_color_f.x, hue_color_f.y, hue_color_f.z);\n\tImU32 hue_color32 = ColorConvertFloat4ToU32(hue_color_f);\n\tImU32 col32_no_alpha = ColorConvertFloat4ToU32(ImVec4(col[0], col[1], col[2], 1.0f));\n\n\tconst ImU32 hue_colors[6 + 1] = { IM_COL32(255,0,0,255), IM_COL32(255,255,0,255), IM_COL32(0,255,0,255), IM_COL32(0,255,255,255), IM_COL32(0,0,255,255), IM_COL32(255,0,255,255), IM_COL32(255,0,0,255) };\n\tImVec2 sv_cursor_pos;\n\n\tif (flags & ImGuiColorEditFlags_PickerHueWheel)\n\t{\n\t\t// Render Hue Wheel\n\t\tconst float aeps = 1.5f / wheel_r_outer; // Half a pixel arc length in radians (2pi cancels out).\n\t\tconst int segment_per_arc = ImMax(4, (int)wheel_r_outer / 12);\n\t\tfor (int n = 0; n < 6; n++)\n\t\t{\n\t\t\tconst float a0 = (n) / 6.0f * 2.0f * IM_PI - aeps;\n\t\t\tconst float a1 = (n + 1.0f) / 6.0f * 2.0f * IM_PI + aeps;\n\t\t\tconst int vert_start_idx = draw_list->VtxBuffer.Size;\n\t\t\tdraw_list->PathArcTo(wheel_center, (wheel_r_inner + wheel_r_outer) * 0.5f, a0, a1, segment_per_arc);\n\t\t\tdraw_list->PathStroke(IM_COL32_WHITE, false, wheel_thickness);\n\t\t\tconst int vert_end_idx = draw_list->VtxBuffer.Size;\n\n\t\t\t// Paint colors over existing vertices\n\t\t\tImVec2 gradient_p0(wheel_center.x + cosf(a0) * wheel_r_inner, wheel_center.y + sinf(a0) * wheel_r_inner);\n\t\t\tImVec2 gradient_p1(wheel_center.x + cosf(a1) * wheel_r_inner, wheel_center.y + sinf(a1) * wheel_r_inner);\n\t\t\tShadeVertsLinearColorGradientKeepAlpha(draw_list->VtxBuffer.Data + vert_start_idx, draw_list->VtxBuffer.Data + vert_end_idx, gradient_p0, gradient_p1, hue_colors[n], hue_colors[n + 1]);\n\t\t}\n\n\t\t// Render Cursor + preview on Hue Wheel\n\t\tfloat cos_hue_angle = cosf(H * 2.0f * IM_PI);\n\t\tfloat sin_hue_angle = sinf(H * 2.0f * IM_PI);\n\t\tImVec2 hue_cursor_pos(wheel_center.x + cos_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f, wheel_center.y + sin_hue_angle * (wheel_r_inner + wheel_r_outer) * 0.5f);\n\t\tfloat hue_cursor_rad = value_changed_h ? wheel_thickness * 0.65f : wheel_thickness * 0.55f;\n\t\tint hue_cursor_segments = ImClamp((int)(hue_cursor_rad / 1.4f), 9, 32);\n\t\tdraw_list->AddCircleFilled(hue_cursor_pos, hue_cursor_rad, hue_color32, hue_cursor_segments);\n\t\tdraw_list->AddCircle(hue_cursor_pos, hue_cursor_rad + 1, IM_COL32(128, 128, 128, 255), hue_cursor_segments);\n\t\tdraw_list->AddCircle(hue_cursor_pos, hue_cursor_rad, IM_COL32_WHITE, hue_cursor_segments);\n\n\t\t// Render SV triangle (rotated according to hue)\n\t\tImVec2 tra = wheel_center + ImRotate(triangle_pa, cos_hue_angle, sin_hue_angle);\n\t\tImVec2 trb = wheel_center + ImRotate(triangle_pb, cos_hue_angle, sin_hue_angle);\n\t\tImVec2 trc = wheel_center + ImRotate(triangle_pc, cos_hue_angle, sin_hue_angle);\n\t\tImVec2 uv_white = GetFontTexUvWhitePixel();\n\t\tdraw_list->PrimReserve(6, 6);\n\t\tdraw_list->PrimVtx(tra, uv_white, hue_color32);\n\t\tdraw_list->PrimVtx(trb, uv_white, hue_color32);\n\t\tdraw_list->PrimVtx(trc, uv_white, IM_COL32_WHITE);\n\t\tdraw_list->PrimVtx(tra, uv_white, IM_COL32_BLACK_TRANS);\n\t\tdraw_list->PrimVtx(trb, uv_white, IM_COL32_BLACK);\n\t\tdraw_list->PrimVtx(trc, uv_white, IM_COL32_BLACK_TRANS);\n\t\tdraw_list->AddTriangle(tra, trb, trc, IM_COL32(128, 128, 128, 255), 1.5f);\n\t\tsv_cursor_pos = ImLerp(ImLerp(trc, tra, ImSaturate(S)), trb, ImSaturate(1 - V));\n\t}\n\telse if (flags & ImGuiColorEditFlags_PickerHueBar)\n\t{\n\t\t// Render SV Square\n\t\tdraw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), IM_COL32_WHITE, hue_color32, hue_color32, IM_COL32_WHITE);\n\t\tdraw_list->AddRectFilledMultiColor(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), IM_COL32_BLACK_TRANS, IM_COL32_BLACK_TRANS, IM_COL32_BLACK, IM_COL32_BLACK);\n\t\tRenderFrameBorder(picker_pos, picker_pos + ImVec2(sv_picker_size, sv_picker_size), 0.0f);\n\t\tsv_cursor_pos.x = ImClamp((float)(int)(picker_pos.x + ImSaturate(S) * sv_picker_size + 0.5f), picker_pos.x + 2, picker_pos.x + sv_picker_size - 2); // Sneakily prevent the circle to stick out too much\n\t\tsv_cursor_pos.y = ImClamp((float)(int)(picker_pos.y + ImSaturate(1 - V) * sv_picker_size + 0.5f), picker_pos.y + 2, picker_pos.y + sv_picker_size - 2);\n\n\t\t// Render Hue Bar\n\t\tfor (int i = 0; i < 6; ++i)\n\t\t\tdraw_list->AddRectFilledMultiColor(ImVec2(bar0_pos_x, picker_pos.y + i * (sv_picker_size / 6)), ImVec2(bar0_pos_x + bars_width, picker_pos.y + (i + 1) * (sv_picker_size / 6)), hue_colors[i], hue_colors[i], hue_colors[i + 1], hue_colors[i + 1]);\n\t\tfloat bar0_line_y = (float)(int)(picker_pos.y + H * sv_picker_size + 0.5f);\n\t\tRenderFrameBorder(ImVec2(bar0_pos_x, picker_pos.y), ImVec2(bar0_pos_x + bars_width, picker_pos.y + sv_picker_size), 0.0f);\n\t\tRenderArrowsForVerticalBar(draw_list, ImVec2(bar0_pos_x - 1, bar0_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f);\n\t}\n\n\t// Render cursor/preview circle (clamp S/V within 0..1 range because floating points colors may lead HSV values to be out of range)\n\tfloat sv_cursor_rad = value_changed_sv ? 10.0f : 6.0f;\n\tdraw_list->AddCircleFilled(sv_cursor_pos, sv_cursor_rad, col32_no_alpha, 12);\n\tdraw_list->AddCircle(sv_cursor_pos, sv_cursor_rad + 1, IM_COL32(128, 128, 128, 255), 12);\n\tdraw_list->AddCircle(sv_cursor_pos, sv_cursor_rad, IM_COL32_WHITE, 12);\n\n\t// Render alpha bar\n\tif (alpha_bar)\n\t{\n\t\tfloat alpha = ImSaturate(col[3]);\n\t\tImRect bar1_bb(bar1_pos_x, picker_pos.y, bar1_pos_x + bars_width, picker_pos.y + sv_picker_size);\n\t\tRenderColorRectWithAlphaCheckerboard(bar1_bb.Min, bar1_bb.Max, IM_COL32(0, 0, 0, 0), bar1_bb.GetWidth() / 2.0f, ImVec2(0.0f, 0.0f));\n\t\tdraw_list->AddRectFilledMultiColor(bar1_bb.Min, bar1_bb.Max, col32_no_alpha, col32_no_alpha, col32_no_alpha & ~IM_COL32_A_MASK, col32_no_alpha & ~IM_COL32_A_MASK);\n\t\tfloat bar1_line_y = (float)(int)(picker_pos.y + (1.0f - alpha) * sv_picker_size + 0.5f);\n\t\tRenderFrameBorder(bar1_bb.Min, bar1_bb.Max, 0.0f);\n\t\tRenderArrowsForVerticalBar(draw_list, ImVec2(bar1_pos_x - 1, bar1_line_y), ImVec2(bars_triangles_half_sz + 1, bars_triangles_half_sz), bars_width + 2.0f);\n\t}\n\n\tEndGroup();\n\tPopID();\n\n\treturn value_changed && memcmp(backup_initial_col, col, components * sizeof(float));\n}\n\n// Horizontal separating line.\nvoid ImGui::Separator()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\tImGuiContext& g = *GImGui;\n\n\tImGuiWindowFlags flags = 0;\n\tif ((flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical)) == 0)\n\t\tflags |= (window->DC.LayoutType == ImGuiLayoutType_Horizontal) ? ImGuiSeparatorFlags_Vertical : ImGuiSeparatorFlags_Horizontal;\n\tIM_ASSERT(ImIsPowerOfTwo((int)(flags & (ImGuiSeparatorFlags_Horizontal | ImGuiSeparatorFlags_Vertical))));   // Check that only 1 option is selected\n\tif (flags & ImGuiSeparatorFlags_Vertical)\n\t{\n\t\tVerticalSeparator();\n\t\treturn;\n\t}\n\n\t// Horizontal Separator\n\tif (window->DC.ColumnsSet)\n\t\tPopClipRect();\n\n\tfloat x1 = window->Pos.x;\n\tfloat x2 = window->Pos.x + window->Size.x;\n\tif (!window->DC.GroupStack.empty())\n\t\tx1 += window->DC.IndentX;\n\n\tconst ImRect bb(ImVec2(x1, window->DC.CursorPos.y), ImVec2(x2, window->DC.CursorPos.y + 1.0f));\n\tItemSize(ImVec2(0.0f, 0.0f)); // NB: we don't provide our width so that it doesn't get feed back into AutoFit, we don't provide height to not alter layout.\n\tif (!ItemAdd(bb, 0))\n\t{\n\t\tif (window->DC.ColumnsSet)\n\t\t\tPushColumnClipRect();\n\t\treturn;\n\t}\n\n\twindow->DrawList->AddLine(bb.Min, ImVec2(bb.Max.x, bb.Min.y), GetColorU32(ImGuiCol_Separator));\n\n\tif (g.LogEnabled)\n\t\tLogRenderedText(NULL, IM_NEWLINE \"--------------------------------\");\n\n\tif (window->DC.ColumnsSet)\n\t{\n\t\tPushColumnClipRect();\n\t\twindow->DC.ColumnsSet->CellMinY = window->DC.CursorPos.y;\n\t}\n}\n\nvoid ImGui::VerticalSeparator()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\tImGuiContext& g = *GImGui;\n\n\tfloat y1 = window->DC.CursorPos.y;\n\tfloat y2 = window->DC.CursorPos.y + window->DC.CurrentLineHeight;\n\tconst ImRect bb(ImVec2(window->DC.CursorPos.x, y1), ImVec2(window->DC.CursorPos.x + 1.0f, y2));\n\tItemSize(ImVec2(bb.GetWidth(), 0.0f));\n\tif (!ItemAdd(bb, 0))\n\t\treturn;\n\n\twindow->DrawList->AddLine(ImVec2(bb.Min.x, bb.Min.y), ImVec2(bb.Min.x, bb.Max.y), GetColorU32(ImGuiCol_Separator));\n\tif (g.LogEnabled)\n\t\tLogText(\" |\");\n}\n\nbool ImGui::SplitterBehavior(ImGuiID id, const ImRect& bb, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tconst ImGuiItemFlags item_flags_backup = window->DC.ItemFlags;\n#ifdef IMGUI_HAS_NAV\n\twindow->DC.ItemFlags |= ImGuiItemFlags_NoNav | ImGuiItemFlags_NoNavDefaultFocus;\n#endif\n\tbool add = ItemAdd(bb, id);\n\twindow->DC.ItemFlags = item_flags_backup;\n\tif (!add)\n\t\treturn false;\n\n\tbool hovered, held;\n\tImRect bb_interact = bb;\n\tbb_interact.Expand(axis == ImGuiAxis_Y ? ImVec2(0.0f, hover_extend) : ImVec2(hover_extend, 0.0f));\n\tButtonBehavior(bb_interact, id, &hovered, &held, ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_AllowItemOverlap);\n\tif (g.ActiveId != id)\n\t\tSetItemAllowOverlap();\n\n\tif (held || (g.HoveredId == id && g.HoveredIdPreviousFrame == id))\n\t\tSetMouseCursor(axis == ImGuiAxis_Y ? ImGuiMouseCursor_ResizeNS : ImGuiMouseCursor_ResizeEW);\n\n\tImRect bb_render = bb;\n\tif (held)\n\t{\n\t\tImVec2 mouse_delta_2d = g.IO.MousePos - g.ActiveIdClickOffset - bb_interact.Min;\n\t\tfloat mouse_delta = (axis == ImGuiAxis_Y) ? mouse_delta_2d.y : mouse_delta_2d.x;\n\n\t\t// Minimum pane size\n\t\tif (mouse_delta < min_size1 - *size1)\n\t\t\tmouse_delta = min_size1 - *size1;\n\t\tif (mouse_delta > * size2 - min_size2)\n\t\t\tmouse_delta = *size2 - min_size2;\n\n\t\t// Apply resize\n\t\t*size1 += mouse_delta;\n\t\t*size2 -= mouse_delta;\n\t\tbb_render.Translate((axis == ImGuiAxis_X) ? ImVec2(mouse_delta, 0.0f) : ImVec2(0.0f, mouse_delta));\n\t}\n\n\t// Render\n\tconst ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);\n\twindow->DrawList->AddRectFilled(bb_render.Min, bb_render.Max, col, g.Style.FrameRounding);\n\n\treturn held;\n}\n\nvoid ImGui::Spacing()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\tItemSize(ImVec2(0, 0));\n}\n\nvoid ImGui::Dummy(const ImVec2& size)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tconst ImRect bb(window->DC.CursorPos, window->DC.CursorPos + size);\n\tItemSize(bb);\n\tItemAdd(bb, 0);\n}\n\nbool ImGui::IsRectVisible(const ImVec2& size)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));\n}\n\nbool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->ClipRect.Overlaps(ImRect(rect_min, rect_max));\n}\n\n// Lock horizontal starting position + capture group bounding box into one \"item\" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)\nvoid ImGui::BeginGroup()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\n\twindow->DC.GroupStack.resize(window->DC.GroupStack.Size + 1);\n\tImGuiGroupData& group_data = window->DC.GroupStack.back();\n\tgroup_data.BackupCursorPos = window->DC.CursorPos;\n\tgroup_data.BackupCursorMaxPos = window->DC.CursorMaxPos;\n\tgroup_data.BackupIndentX = window->DC.IndentX;\n\tgroup_data.BackupGroupOffsetX = window->DC.GroupOffsetX;\n\tgroup_data.BackupCurrentLineHeight = window->DC.CurrentLineHeight;\n\tgroup_data.BackupCurrentLineTextBaseOffset = window->DC.CurrentLineTextBaseOffset;\n\tgroup_data.BackupLogLinePosY = window->DC.LogLinePosY;\n\tgroup_data.BackupActiveIdIsAlive = GImGui->ActiveIdIsAlive;\n\tgroup_data.AdvanceCursor = true;\n\n\twindow->DC.GroupOffsetX = window->DC.CursorPos.x - window->Pos.x - window->DC.ColumnsOffsetX;\n\twindow->DC.IndentX = window->DC.GroupOffsetX;\n\twindow->DC.CursorMaxPos = window->DC.CursorPos;\n\twindow->DC.CurrentLineHeight = 0.0f;\n\twindow->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;\n}\n\nvoid ImGui::EndGroup()\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\n\tIM_ASSERT(!window->DC.GroupStack.empty());    // Mismatched BeginGroup()/EndGroup() calls\n\n\tImGuiGroupData& group_data = window->DC.GroupStack.back();\n\n\tImRect group_bb(group_data.BackupCursorPos, window->DC.CursorMaxPos);\n\tgroup_bb.Max = ImMax(group_bb.Min, group_bb.Max);\n\n\twindow->DC.CursorPos = group_data.BackupCursorPos;\n\twindow->DC.CursorMaxPos = ImMax(group_data.BackupCursorMaxPos, window->DC.CursorMaxPos);\n\twindow->DC.CurrentLineHeight = group_data.BackupCurrentLineHeight;\n\twindow->DC.CurrentLineTextBaseOffset = group_data.BackupCurrentLineTextBaseOffset;\n\twindow->DC.IndentX = group_data.BackupIndentX;\n\twindow->DC.GroupOffsetX = group_data.BackupGroupOffsetX;\n\twindow->DC.LogLinePosY = window->DC.CursorPos.y - 9999.0f;\n\n\tif (group_data.AdvanceCursor)\n\t{\n\t\twindow->DC.CurrentLineTextBaseOffset = ImMax(window->DC.PrevLineTextBaseOffset, group_data.BackupCurrentLineTextBaseOffset);      // FIXME: Incorrect, we should grab the base offset from the *first line* of the group but it is hard to obtain now.\n\t\tItemSize(group_bb.GetSize(), group_data.BackupCurrentLineTextBaseOffset);\n\t\tItemAdd(group_bb, 0);\n\t}\n\n\t// If the current ActiveId was declared within the boundary of our group, we copy it to LastItemId so IsItemActive() will be functional on the entire group.\n\t// It would be be neater if we replaced window.DC.LastItemId by e.g. 'bool LastItemIsActive', but if you search for LastItemId you'll notice it is only used in that context.\n\tconst bool active_id_within_group = (!group_data.BackupActiveIdIsAlive && g.ActiveIdIsAlive && g.ActiveId && g.ActiveIdWindow->RootWindow == window->RootWindow);\n\tif (active_id_within_group)\n\t\twindow->DC.LastItemId = g.ActiveId;\n\twindow->DC.LastItemRect = group_bb;\n\n\twindow->DC.GroupStack.pop_back();\n\n\t//window->DrawList->AddRect(group_bb.Min, group_bb.Max, IM_COL32(255,0,255,255));   // [Debug]\n}\n\n// Gets back to previous line and continue with horizontal layout\n//      pos_x == 0      : follow right after previous item\n//      pos_x != 0      : align to specified x position (relative to window/group left)\n//      spacing_w < 0   : use default spacing if pos_x == 0, no spacing if pos_x != 0\n//      spacing_w >= 0  : enforce spacing amount\nvoid ImGui::SameLine(float pos_x, float spacing_w)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tif (pos_x != 0.0f)\n\t{\n\t\tif (spacing_w < 0.0f) spacing_w = 0.0f;\n\t\twindow->DC.CursorPos.x = window->Pos.x - window->Scroll.x + pos_x + spacing_w + window->DC.GroupOffsetX + window->DC.ColumnsOffsetX;\n\t\twindow->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;\n\t}\n\telse\n\t{\n\t\tif (spacing_w < 0.0f) spacing_w = g.Style.ItemSpacing.x;\n\t\twindow->DC.CursorPos.x = window->DC.CursorPosPrevLine.x + spacing_w;\n\t\twindow->DC.CursorPos.y = window->DC.CursorPosPrevLine.y;\n\t}\n\twindow->DC.CurrentLineHeight = window->DC.PrevLineHeight;\n\twindow->DC.CurrentLineTextBaseOffset = window->DC.PrevLineTextBaseOffset;\n}\n\nvoid ImGui::NewLine()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiLayoutType backup_layout_type = window->DC.LayoutType;\n\twindow->DC.LayoutType = ImGuiLayoutType_Vertical;\n\tif (window->DC.CurrentLineHeight > 0.0f)     // In the event that we are on a line with items that is smaller that FontSize high, we will preserve its height.\n\t\tItemSize(ImVec2(0, 0));\n\telse\n\t\tItemSize(ImVec2(0.0f, g.FontSize));\n\twindow->DC.LayoutType = backup_layout_type;\n}\n\nvoid ImGui::NextColumn()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tif (window->SkipItems || window->DC.ColumnsSet == NULL)\n\t\treturn;\n\n\tImGuiContext& g = *GImGui;\n\tPopItemWidth();\n\tPopClipRect();\n\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tcolumns->CellMaxY = ImMax(columns->CellMaxY, window->DC.CursorPos.y);\n\tif (++columns->Current < columns->Count)\n\t{\n\t\t// Columns 1+ cancel out IndentX\n\t\twindow->DC.ColumnsOffsetX = GetColumnOffset(columns->Current) - window->DC.IndentX + g.Style.ItemSpacing.x;\n\t\twindow->DrawList->ChannelsSetCurrent(columns->Current);\n\t}\n\telse\n\t{\n\t\twindow->DC.ColumnsOffsetX = 0.0f;\n\t\twindow->DrawList->ChannelsSetCurrent(0);\n\t\tcolumns->Current = 0;\n\t\tcolumns->CellMinY = columns->CellMaxY;\n\t}\n\twindow->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX);\n\twindow->DC.CursorPos.y = columns->CellMinY;\n\twindow->DC.CurrentLineHeight = 0.0f;\n\twindow->DC.CurrentLineTextBaseOffset = 0.0f;\n\n\tPushColumnClipRect();\n\tPushItemWidth(GetColumnWidth() * 0.65f);  // FIXME: Move on columns setup\n}\n\nint ImGui::GetColumnIndex()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.ColumnsSet ? window->DC.ColumnsSet->Current : 0;\n}\n\nint ImGui::GetColumnsCount()\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\treturn window->DC.ColumnsSet ? window->DC.ColumnsSet->Count : 1;\n}\n\nstatic float OffsetNormToPixels(const ImGuiColumnsSet* columns, float offset_norm)\n{\n\treturn offset_norm * (columns->MaxX - columns->MinX);\n}\n\nstatic float PixelsToOffsetNorm(const ImGuiColumnsSet* columns, float offset)\n{\n\treturn offset / (columns->MaxX - columns->MinX);\n}\n\nstatic inline float GetColumnsRectHalfWidth() { return 4.0f; }\n\nstatic float GetDraggedColumnOffset(ImGuiColumnsSet* columns, int column_index)\n{\n\t// Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing\n\t// window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tIM_ASSERT(column_index > 0); // We cannot drag column 0. If you get this assert you may have a conflict between the ID of your columns and another widgets.\n\tIM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));\n\n\tfloat x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + GetColumnsRectHalfWidth() - window->Pos.x;\n\tx = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);\n\tif ((columns->Flags & ImGuiColumnsFlags_NoPreserveWidths))\n\t\tx = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);\n\n\treturn x;\n}\n\nfloat ImGui::GetColumnOffset(int column_index)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tIM_ASSERT(columns != NULL);\n\n\tif (column_index < 0)\n\t\tcolumn_index = columns->Current;\n\tIM_ASSERT(column_index < columns->Columns.Size);\n\n\t/*\n\tif (g.ActiveId)\n\t{\n\tImGuiContext& g = *GImGui;\n\tconst ImGuiID column_id = columns->ColumnsSetId + ImGuiID(column_index);\n\tif (g.ActiveId == column_id)\n\treturn GetDraggedColumnOffset(columns, column_index);\n\t}\n\t*/\n\n\tconst float t = columns->Columns[column_index].OffsetNorm;\n\tconst float x_offset = ImLerp(columns->MinX, columns->MaxX, t);\n\treturn x_offset;\n}\n\nstatic float GetColumnWidthEx(ImGuiColumnsSet* columns, int column_index, bool before_resize = false)\n{\n\tif (column_index < 0)\n\t\tcolumn_index = columns->Current;\n\n\tfloat offset_norm;\n\tif (before_resize)\n\t\toffset_norm = columns->Columns[column_index + 1].OffsetNormBeforeResize - columns->Columns[column_index].OffsetNormBeforeResize;\n\telse\n\t\toffset_norm = columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm;\n\treturn OffsetNormToPixels(columns, offset_norm);\n}\n\nfloat ImGui::GetColumnWidth(int column_index)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tIM_ASSERT(columns != NULL);\n\n\tif (column_index < 0)\n\t\tcolumn_index = columns->Current;\n\treturn OffsetNormToPixels(columns, columns->Columns[column_index + 1].OffsetNorm - columns->Columns[column_index].OffsetNorm);\n}\n\nvoid ImGui::SetColumnOffset(int column_index, float offset)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tIM_ASSERT(columns != NULL);\n\n\tif (column_index < 0)\n\t\tcolumn_index = columns->Current;\n\tIM_ASSERT(column_index < columns->Columns.Size);\n\n\tconst bool preserve_width = !(columns->Flags & ImGuiColumnsFlags_NoPreserveWidths) && (column_index < columns->Count - 1);\n\tconst float width = preserve_width ? GetColumnWidthEx(columns, column_index, columns->IsBeingResized) : 0.0f;\n\n\tif (!(columns->Flags & ImGuiColumnsFlags_NoForceWithinWindow))\n\t\toffset = ImMin(offset, columns->MaxX - g.Style.ColumnsMinSpacing * (columns->Count - column_index));\n\tcolumns->Columns[column_index].OffsetNorm = PixelsToOffsetNorm(columns, offset - columns->MinX);\n\n\tif (preserve_width)\n\t\tSetColumnOffset(column_index + 1, offset + ImMax(g.Style.ColumnsMinSpacing, width));\n}\n\nvoid ImGui::SetColumnWidth(int column_index, float width)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tIM_ASSERT(columns != NULL);\n\n\tif (column_index < 0)\n\t\tcolumn_index = columns->Current;\n\tSetColumnOffset(column_index + 1, GetColumnOffset(column_index) + width);\n}\n\nvoid ImGui::PushColumnClipRect(int column_index)\n{\n\tImGuiWindow* window = GetCurrentWindowRead();\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tif (column_index < 0)\n\t\tcolumn_index = columns->Current;\n\n\tPushClipRect(columns->Columns[column_index].ClipRect.Min, columns->Columns[column_index].ClipRect.Max, false);\n}\n\nstatic ImGuiColumnsSet* FindOrAddColumnsSet(ImGuiWindow* window, ImGuiID id)\n{\n\tfor (int n = 0; n < window->ColumnsStorage.Size; n++)\n\t\tif (window->ColumnsStorage[n].ID == id)\n\t\t\treturn &window->ColumnsStorage[n];\n\n\twindow->ColumnsStorage.push_back(ImGuiColumnsSet());\n\tImGuiColumnsSet* columns = &window->ColumnsStorage.back();\n\tcolumns->ID = id;\n\treturn columns;\n}\n\nvoid ImGui::BeginColumns(const char* str_id, int columns_count, ImGuiColumnsFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\n\tIM_ASSERT(columns_count > 1);\n\tIM_ASSERT(window->DC.ColumnsSet == NULL); // Nested columns are currently not supported\n\n\t\t\t\t\t\t\t\t\t\t\t  // Differentiate column ID with an arbitrary prefix for cases where users name their columns set the same as another widget.\n\t\t\t\t\t\t\t\t\t\t\t  // In addition, when an identifier isn't explicitly provided we include the number of columns in the hash to make it uniquer.\n\tPushID(0x11223347 + (str_id ? 0 : columns_count));\n\tImGuiID id = window->GetID(str_id ? str_id : \"columns\");\n\tPopID();\n\n\t// Acquire storage for the columns set\n\tImGuiColumnsSet* columns = FindOrAddColumnsSet(window, id);\n\tIM_ASSERT(columns->ID == id);\n\tcolumns->Current = 0;\n\tcolumns->Count = columns_count;\n\tcolumns->Flags = flags;\n\twindow->DC.ColumnsSet = columns;\n\n\t// Set state for first column\n\tconst float content_region_width = (window->SizeContentsExplicit.x != 0.0f) ? (window->SizeContentsExplicit.x) : (window->Size.x - window->ScrollbarSizes.x);\n\tcolumns->MinX = window->DC.IndentX - g.Style.ItemSpacing.x; // Lock our horizontal range\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//column->MaxX = content_region_width - window->Scroll.x - ((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarSize);// - window->WindowPadding().x;\n\tcolumns->MaxX = content_region_width - window->Scroll.x;\n\tcolumns->StartPosY = window->DC.CursorPos.y;\n\tcolumns->StartMaxPosX = window->DC.CursorMaxPos.x;\n\tcolumns->CellMinY = columns->CellMaxY = window->DC.CursorPos.y;\n\twindow->DC.ColumnsOffsetX = 0.0f;\n\twindow->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX);\n\n\t// Clear data if columns count changed\n\tif (columns->Columns.Size != 0 && columns->Columns.Size != columns_count + 1)\n\t\tcolumns->Columns.resize(0);\n\n\t// Initialize defaults\n\tcolumns->IsFirstFrame = (columns->Columns.Size == 0);\n\tif (columns->Columns.Size == 0)\n\t{\n\t\tcolumns->Columns.reserve(columns_count + 1);\n\t\tfor (int n = 0; n < columns_count + 1; n++)\n\t\t{\n\t\t\tImGuiColumnData column;\n\t\t\tcolumn.OffsetNorm = n / (float)columns_count;\n\t\t\tcolumns->Columns.push_back(column);\n\t\t}\n\t}\n\n\tfor (int n = 0; n < columns_count + 1; n++)\n\t{\n\t\t// Clamp position\n\t\tImGuiColumnData* column = &columns->Columns[n];\n\t\tfloat t = column->OffsetNorm;\n\t\tif (!(columns->Flags & ImGuiColumnsFlags_NoForceWithinWindow))\n\t\t\tt = ImMin(t, PixelsToOffsetNorm(columns, (columns->MaxX - columns->MinX) - g.Style.ColumnsMinSpacing * (columns->Count - n)));\n\t\tcolumn->OffsetNorm = t;\n\n\t\tif (n == columns_count)\n\t\t\tcontinue;\n\n\t\t// Compute clipping rectangle\n\t\tfloat clip_x1 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(n) - 1.0f);\n\t\tfloat clip_x2 = ImFloor(0.5f + window->Pos.x + GetColumnOffset(n + 1) - 1.0f);\n\t\tcolumn->ClipRect = ImRect(clip_x1, -FLT_MAX, clip_x2, +FLT_MAX);\n\t\tcolumn->ClipRect.ClipWith(window->ClipRect);\n\t}\n\n\twindow->DrawList->ChannelsSplit(columns->Count);\n\tPushColumnClipRect();\n\tPushItemWidth(GetColumnWidth() * 0.65f);\n}\n\nvoid ImGui::EndColumns()\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\tImGuiColumnsSet* columns = window->DC.ColumnsSet;\n\tIM_ASSERT(columns != NULL);\n\n\tPopItemWidth();\n\tPopClipRect();\n\twindow->DrawList->ChannelsMerge();\n\n\tcolumns->CellMaxY = ImMax(columns->CellMaxY, window->DC.CursorPos.y);\n\twindow->DC.CursorPos.y = columns->CellMaxY;\n\tif (!(columns->Flags & ImGuiColumnsFlags_GrowParentContentsSize))\n\t\twindow->DC.CursorMaxPos.x = ImMax(columns->StartMaxPosX, columns->MaxX);  // Restore cursor max pos, as columns don't grow parent\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  // Draw columns borders and handle resize\n\tbool is_being_resized = false;\n\tif (!(columns->Flags & ImGuiColumnsFlags_NoBorder) && !window->SkipItems)\n\t{\n\t\tconst float y1 = columns->StartPosY;\n\t\tconst float y2 = window->DC.CursorPos.y;\n\t\tint dragging_column = -1;\n\t\tfor (int n = 1; n < columns->Count; n++)\n\t\t{\n\t\t\tfloat x = window->Pos.x + GetColumnOffset(n);\n\t\t\tconst ImGuiID column_id = columns->ID + ImGuiID(n);\n\t\t\tconst float column_hw = GetColumnsRectHalfWidth(); // Half-width for interaction\n\t\t\tconst ImRect column_rect(ImVec2(x - column_hw, y1), ImVec2(x + column_hw, y2));\n\t\t\tKeepAliveID(column_id);\n\t\t\tif (IsClippedEx(column_rect, column_id, false))\n\t\t\t\tcontinue;\n\n\t\t\tbool hovered = false, held = false;\n\t\t\tif (!(columns->Flags & ImGuiColumnsFlags_NoResize))\n\t\t\t{\n\t\t\t\tButtonBehavior(column_rect, column_id, &hovered, &held);\n\t\t\t\tif (hovered || held)\n\t\t\t\t\tg.MouseCursor = ImGuiMouseCursor_ResizeEW;\n\t\t\t\tif (held && !(columns->Columns[n].Flags & ImGuiColumnsFlags_NoResize))\n\t\t\t\t\tdragging_column = n;\n\t\t\t}\n\n\t\t\t// Draw column (we clip the Y boundaries CPU side because very long triangles are mishandled by some GPU drivers.)\n\t\t\tconst ImU32 col = GetColorU32(held ? ImGuiCol_SeparatorActive : hovered ? ImGuiCol_SeparatorHovered : ImGuiCol_Separator);\n\t\t\tconst float xi = (float)(int)x;\n\t\t\twindow->DrawList->AddLine(ImVec2(xi, ImMax(y1 + 1.0f, window->ClipRect.Min.y)), ImVec2(xi, ImMin(y2, window->ClipRect.Max.y)), col);\n\t\t}\n\n\t\t// Apply dragging after drawing the column lines, so our rendered lines are in sync with how items were displayed during the frame.\n\t\tif (dragging_column != -1)\n\t\t{\n\t\t\tif (!columns->IsBeingResized)\n\t\t\t\tfor (int n = 0; n < columns->Count + 1; n++)\n\t\t\t\t\tcolumns->Columns[n].OffsetNormBeforeResize = columns->Columns[n].OffsetNorm;\n\t\t\tcolumns->IsBeingResized = is_being_resized = true;\n\t\t\tfloat x = GetDraggedColumnOffset(columns, dragging_column);\n\t\t\tSetColumnOffset(dragging_column, x);\n\t\t}\n\t}\n\tcolumns->IsBeingResized = is_being_resized;\n\n\twindow->DC.ColumnsSet = NULL;\n\twindow->DC.ColumnsOffsetX = 0.0f;\n\twindow->DC.CursorPos.x = (float)(int)(window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX);\n}\n\n// [2017/12: This is currently the only public API, while we are working on making BeginColumns/EndColumns user-facing]\nvoid ImGui::Columns(int columns_count, const char* id, bool border)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tIM_ASSERT(columns_count >= 1);\n\tif (window->DC.ColumnsSet != NULL && window->DC.ColumnsSet->Count != columns_count)\n\t\tEndColumns();\n\n\tImGuiColumnsFlags flags = (border ? 0 : ImGuiColumnsFlags_NoBorder);\n\t//flags |= ImGuiColumnsFlags_NoPreserveWidths; // NB: Legacy behavior\n\tif (columns_count != 1)\n\t\tBeginColumns(id, columns_count, flags);\n}\n\nvoid ImGui::Indent(float indent_w)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.IndentX += (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing;\n\twindow->DC.CursorPos.x = window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX;\n}\n\nvoid ImGui::Unindent(float indent_w)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = GetCurrentWindow();\n\twindow->DC.IndentX -= (indent_w != 0.0f) ? indent_w : g.Style.IndentSpacing;\n\twindow->DC.CursorPos.x = window->Pos.x + window->DC.IndentX + window->DC.ColumnsOffsetX;\n}\n\nvoid ImGui::TreePush(const char* str_id)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tIndent();\n\twindow->DC.TreeDepth++;\n\tPushID(str_id ? str_id : \"#TreePush\");\n}\n\nvoid ImGui::TreePush(const void* ptr_id)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tIndent();\n\twindow->DC.TreeDepth++;\n\tPushID(ptr_id ? ptr_id : (const void*)\"#TreePush\");\n}\n\nvoid ImGui::TreePushRawID(ImGuiID id)\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tIndent();\n\twindow->DC.TreeDepth++;\n\twindow->IDStack.push_back(id);\n}\n\nvoid ImGui::TreePop()\n{\n\tImGuiWindow* window = GetCurrentWindow();\n\tUnindent();\n\twindow->DC.TreeDepth--;\n\tPopID();\n}\n\nvoid ImGui::Value(const char* prefix, bool b)\n{\n\tText(\"%s: %s\", prefix, (b ? \"true\" : \"false\"));\n}\n\nvoid ImGui::Value(const char* prefix, int v)\n{\n\tText(\"%s: %d\", prefix, v);\n}\n\nvoid ImGui::Value(const char* prefix, unsigned int v)\n{\n\tText(\"%s: %d\", prefix, v);\n}\n\nvoid ImGui::Value(const char* prefix, float v, const char* float_format)\n{\n\tif (float_format)\n\t{\n\t\tchar fmt[64];\n\t\tImFormatString(fmt, IM_ARRAYSIZE(fmt), \"%%s: %s\", float_format);\n\t\tText(fmt, prefix, v);\n\t}\n\telse\n\t{\n\t\tText(\"%s: %.3f\", prefix, v);\n\t}\n}\n\n//-----------------------------------------------------------------------------\n// DRAG AND DROP\n//-----------------------------------------------------------------------------\n\nvoid ImGui::ClearDragDrop()\n{\n\tImGuiContext& g = *GImGui;\n\tg.DragDropActive = false;\n\tg.DragDropPayload.Clear();\n\tg.DragDropAcceptIdCurr = g.DragDropAcceptIdPrev = 0;\n\tg.DragDropAcceptIdCurrRectSurface = FLT_MAX;\n\tg.DragDropAcceptFrameCount = -1;\n}\n\n// Call when current ID is active. \n// When this returns true you need to: a) call SetDragDropPayload() exactly once, b) you may render the payload visual/description, c) call EndDragDropSource()\nbool ImGui::BeginDragDropSource(ImGuiDragDropFlags flags, int mouse_button)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\n\tbool source_drag_active = false;\n\tImGuiID source_id = 0;\n\tImGuiID source_parent_id = 0;\n\tif (!(flags & ImGuiDragDropFlags_SourceExtern))\n\t{\n\t\tsource_id = window->DC.LastItemId;\n\t\tif (source_id != 0 && g.ActiveId != source_id) // Early out for most common case\n\t\t\treturn false;\n\t\tif (g.IO.MouseDown[mouse_button] == false)\n\t\t\treturn false;\n\n\t\tif (source_id == 0)\n\t\t{\n\t\t\t// If you want to use BeginDragDropSource() on an item with no unique identifier for interaction, such as Text() or Image(), you need to:\n\t\t\t// A) Read the explanation below, B) Use the ImGuiDragDropFlags_SourceAllowNullID flag, C) Swallow your programmer pride.\n\t\t\tif (!(flags & ImGuiDragDropFlags_SourceAllowNullID))\n\t\t\t{\n\t\t\t\tIM_ASSERT(0);\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Magic fallback (=somehow reprehensible) to handle items with no assigned ID, e.g. Text(), Image()\n\t\t\t// We build a throwaway ID based on current ID stack + relative AABB of items in window. \n\t\t\t// THE IDENTIFIER WON'T SURVIVE ANY REPOSITIONING OF THE WIDGET, so if your widget moves your dragging operation will be canceled. \n\t\t\t// We don't need to maintain/call ClearActiveID() as releasing the button will early out this function and trigger !ActiveIdIsAlive.\n\t\t\tbool is_hovered = window->DC.LastItemRectHoveredRect;\n\t\t\tif (!is_hovered && (g.ActiveId == 0 || g.ActiveIdWindow != window))\n\t\t\t\treturn false;\n\t\t\tsource_id = window->DC.LastItemId = window->GetIDFromRectangle(window->DC.LastItemRect);\n\t\t\tif (is_hovered)\n\t\t\t\tSetHoveredID(source_id);\n\t\t\tif (is_hovered && g.IO.MouseClicked[mouse_button])\n\t\t\t{\n\t\t\t\tSetActiveID(source_id, window);\n\t\t\t\tFocusWindow(window);\n\t\t\t}\n\t\t\tif (g.ActiveId == source_id) // Allow the underlying widget to display/return hovered during the mouse release frame, else we would get a flicker.\n\t\t\t\tg.ActiveIdAllowOverlap = is_hovered;\n\t\t}\n\t\tif (g.ActiveId != source_id)\n\t\t\treturn false;\n\t\tsource_parent_id = window->IDStack.back();\n\t\tsource_drag_active = IsMouseDragging(mouse_button);\n\t}\n\telse\n\t{\n\t\twindow = NULL;\n\t\tsource_id = ImHash(\"#SourceExtern\", 0);\n\t\tsource_drag_active = true;\n\t}\n\n\tif (source_drag_active)\n\t{\n\t\tif (!g.DragDropActive)\n\t\t{\n\t\t\tIM_ASSERT(source_id != 0);\n\t\t\tClearDragDrop();\n\t\t\tImGuiPayload& payload = g.DragDropPayload;\n\t\t\tpayload.SourceId = source_id;\n\t\t\tpayload.SourceParentId = source_parent_id;\n\t\t\tg.DragDropActive = true;\n\t\t\tg.DragDropSourceFlags = flags;\n\t\t\tg.DragDropMouseButton = mouse_button;\n\t\t}\n\n\t\tif (!(flags & ImGuiDragDropFlags_SourceNoPreviewTooltip))\n\t\t{\n\t\t\t// FIXME-DRAG\n\t\t\t//SetNextWindowPos(g.IO.MousePos - g.ActiveIdClickOffset - g.Style.WindowPadding);\n\t\t\t//PushStyleVar(ImGuiStyleVar_Alpha, g.Style.Alpha * 0.60f); // This is better but e.g ColorButton with checkboard has issue with transparent colors :(\n\t\t\tSetNextWindowPos(g.IO.MousePos);\n\t\t\tPushStyleColor(ImGuiCol_PopupBg, GetStyleColorVec4(ImGuiCol_PopupBg) * ImVec4(1.0f, 1.0f, 1.0f, 0.6f));\n\t\t\tBeginTooltipEx(ImGuiWindowFlags_NoInputs);\n\t\t}\n\n\t\tif (!(flags & ImGuiDragDropFlags_SourceNoDisableHover) && !(flags & ImGuiDragDropFlags_SourceExtern))\n\t\t\twindow->DC.LastItemRectHoveredRect = false;\n\n\t\treturn true;\n\t}\n\treturn false;\n}\n\nvoid ImGui::EndDragDropSource()\n{\n\tImGuiContext& g = *GImGui;\n\tIM_ASSERT(g.DragDropActive);\n\n\tif (!(g.DragDropSourceFlags & ImGuiDragDropFlags_SourceNoPreviewTooltip))\n\t{\n\t\tEndTooltip();\n\t\tPopStyleColor();\n\t\t//PopStyleVar();\n\t}\n\n\t// Discard the drag if have not called SetDragDropPayload()\n\tif (g.DragDropPayload.DataFrameCount == -1)\n\t\tClearDragDrop();\n}\n\n// Use 'cond' to choose to submit payload on drag start or every frame\nbool ImGui::SetDragDropPayload(const char* type, const void* data, size_t data_size, ImGuiCond cond)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiPayload& payload = g.DragDropPayload;\n\tif (cond == 0)\n\t\tcond = ImGuiCond_Always;\n\n\tIM_ASSERT(type != NULL);\n\tIM_ASSERT(strlen(type) < IM_ARRAYSIZE(payload.DataType) && \"Payload type can be at most 12 characters long\");\n\tIM_ASSERT((data != NULL && data_size > 0) || (data == NULL && data_size == 0));\n\tIM_ASSERT(cond == ImGuiCond_Always || cond == ImGuiCond_Once);\n\tIM_ASSERT(payload.SourceId != 0);                               // Not called between BeginDragDropSource() and EndDragDropSource()\n\n\tif (cond == ImGuiCond_Always || payload.DataFrameCount == -1)\n\t{\n\t\t// Copy payload\n\t\tImStrncpy(payload.DataType, type, IM_ARRAYSIZE(payload.DataType));\n\t\tg.DragDropPayloadBufHeap.resize(0);\n\t\tif (data_size > sizeof(g.DragDropPayloadBufLocal))\n\t\t{\n\t\t\t// Store in heap\n\t\t\tg.DragDropPayloadBufHeap.resize((int)data_size);\n\t\t\tpayload.Data = g.DragDropPayloadBufHeap.Data;\n\t\t\tmemcpy((void*)payload.Data, data, data_size);\n\t\t}\n\t\telse if (data_size > 0)\n\t\t{\n\t\t\t// Store locally\n\t\t\tmemset(&g.DragDropPayloadBufLocal, 0, sizeof(g.DragDropPayloadBufLocal));\n\t\t\tpayload.Data = g.DragDropPayloadBufLocal;\n\t\t\tmemcpy((void*)payload.Data, data, data_size);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tpayload.Data = NULL;\n\t\t}\n\t\tpayload.DataSize = (int)data_size;\n\t}\n\tpayload.DataFrameCount = g.FrameCount;\n\n\treturn (g.DragDropAcceptFrameCount == g.FrameCount) || (g.DragDropAcceptFrameCount == g.FrameCount - 1);\n}\n\nbool ImGui::BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id)\n{\n\tImGuiContext& g = *GImGui;\n\tif (!g.DragDropActive)\n\t\treturn false;\n\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (g.HoveredWindow == NULL || window->RootWindow != g.HoveredWindow->RootWindow)\n\t\treturn false;\n\tIM_ASSERT(id != 0);\n\tif (!IsMouseHoveringRect(bb.Min, bb.Max) || (id == g.DragDropPayload.SourceId))\n\t\treturn false;\n\n\tg.DragDropTargetRect = bb;\n\tg.DragDropTargetId = id;\n\treturn true;\n}\n\n// We don't use BeginDragDropTargetCustom() and duplicate its code because:\n// 1) we use LastItemRectHoveredRect which handles items that pushes a temporarily clip rectangle in their code. Calling BeginDragDropTargetCustom(LastItemRect) would not handle them.\n// 2) and it's faster. as this code may be very frequently called, we want to early out as fast as we can.\n// Also note how the HoveredWindow test is positioned differently in both functions (in both functions we optimize for the cheapest early out case)\nbool ImGui::BeginDragDropTarget()\n{\n\tImGuiContext& g = *GImGui;\n\tif (!g.DragDropActive)\n\t\treturn false;\n\n\tImGuiWindow* window = g.CurrentWindow;\n\tif (!window->DC.LastItemRectHoveredRect)\n\t\treturn false;\n\tif (g.HoveredWindow == NULL || window->RootWindow != g.HoveredWindow->RootWindow)\n\t\treturn false;\n\n\tImGuiID id = window->DC.LastItemId;\n\tif (id == 0)\n\t\tid = window->GetIDFromRectangle(window->DC.LastItemRect);\n\tif (g.DragDropPayload.SourceId == id)\n\t\treturn false;\n\n\tg.DragDropTargetRect = window->DC.LastItemRect;\n\tg.DragDropTargetId = id;\n\treturn true;\n}\n\nbool ImGui::IsDragDropPayloadBeingAccepted()\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.DragDropActive && g.DragDropAcceptIdPrev != 0;\n}\n\nconst ImGuiPayload* ImGui::AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags)\n{\n\tImGuiContext& g = *GImGui;\n\tImGuiWindow* window = g.CurrentWindow;\n\tImGuiPayload& payload = g.DragDropPayload;\n\tIM_ASSERT(g.DragDropActive);                        // Not called between BeginDragDropTarget() and EndDragDropTarget() ?\n\tIM_ASSERT(payload.DataFrameCount != -1);            // Forgot to call EndDragDropTarget() ? \n\tif (type != NULL && !payload.IsDataType(type))\n\t\treturn NULL;\n\n\t// Accept smallest drag target bounding box, this allows us to nest drag targets conveniently without ordering constraints.\n\t// NB: We currently accept NULL id as target. However, overlapping targets requires a unique ID to function!\n\tconst bool was_accepted_previously = (g.DragDropAcceptIdPrev == g.DragDropTargetId);\n\tImRect r = g.DragDropTargetRect;\n\tfloat r_surface = r.GetWidth() * r.GetHeight();\n\tif (r_surface < g.DragDropAcceptIdCurrRectSurface)\n\t{\n\t\tg.DragDropAcceptIdCurr = g.DragDropTargetId;\n\t\tg.DragDropAcceptIdCurrRectSurface = r_surface;\n\t}\n\n\t// Render default drop visuals\n\tpayload.Preview = was_accepted_previously;\n\tflags |= (g.DragDropSourceFlags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect); // Source can also inhibit the preview (useful for external sources that lives for 1 frame)\n\tif (!(flags & ImGuiDragDropFlags_AcceptNoDrawDefaultRect) && payload.Preview)\n\t{\n\t\t// FIXME-DRAG: Settle on a proper default visuals for drop target.\n\t\tr.Expand(3.5f);\n\t\tbool push_clip_rect = !window->ClipRect.Contains(r);\n\t\tif (push_clip_rect) window->DrawList->PushClipRectFullScreen();\n\t\twindow->DrawList->AddRect(r.Min, r.Max, GetColorU32(ImGuiCol_DragDropTarget), 0.0f, ~0, 2.0f);\n\t\tif (push_clip_rect) window->DrawList->PopClipRect();\n\t}\n\n\tg.DragDropAcceptFrameCount = g.FrameCount;\n\tpayload.Delivery = was_accepted_previously && !IsMouseDown(g.DragDropMouseButton); // For extern drag sources affecting os window focus, it's easier to just test !IsMouseDown() instead of IsMouseReleased()\n\tif (!payload.Delivery && !(flags & ImGuiDragDropFlags_AcceptBeforeDelivery))\n\t\treturn NULL;\n\n\treturn &payload;\n}\n\n// We don't really use/need this now, but added it for the sake of consistency and because we might need it later.\nvoid ImGui::EndDragDropTarget()\n{\n\tImGuiContext& g = *GImGui; (void)g;\n\tIM_ASSERT(g.DragDropActive);\n}\n\n//-----------------------------------------------------------------------------\n// PLATFORM DEPENDENT HELPERS\n//-----------------------------------------------------------------------------\n\n#if defined(_WIN32) && !defined(_WINDOWS_) && (!defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS) || !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS))\n#undef WIN32_LEAN_AND_MEAN\n#define WIN32_LEAN_AND_MEAN\n#ifndef __MINGW32__\n#include <Windows.h>\n#else\n#include <windows.h>\n#endif\n#endif\n\n// Win32 API clipboard implementation\n#if defined(_WIN32) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS)\n\n#ifdef _MSC_VER\n#pragma comment(lib, \"user32\")\n#endif\n\nstatic const char* GetClipboardTextFn_DefaultImpl(void*)\n{\n\tstatic ImVector<char> buf_local;\n\tbuf_local.clear();\n\tif (!OpenClipboard(NULL))\n\t\treturn NULL;\n\tHANDLE wbuf_handle = GetClipboardData(CF_UNICODETEXT);\n\tif (wbuf_handle == NULL)\n\t{\n\t\tCloseClipboard();\n\t\treturn NULL;\n\t}\n\tif (ImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle))\n\t{\n\t\tint buf_len = ImTextCountUtf8BytesFromStr(wbuf_global, NULL) + 1;\n\t\tbuf_local.resize(buf_len);\n\t\tImTextStrToUtf8(buf_local.Data, buf_len, wbuf_global, NULL);\n\t}\n\tGlobalUnlock(wbuf_handle);\n\tCloseClipboard();\n\treturn buf_local.Data;\n}\n\nstatic void SetClipboardTextFn_DefaultImpl(void*, const char* text)\n{\n\tif (!OpenClipboard(NULL))\n\t\treturn;\n\tconst int wbuf_length = ImTextCountCharsFromUtf8(text, NULL) + 1;\n\tHGLOBAL wbuf_handle = GlobalAlloc(GMEM_MOVEABLE, (SIZE_T)wbuf_length * sizeof(ImWchar));\n\tif (wbuf_handle == NULL)\n\t{\n\t\tCloseClipboard();\n\t\treturn;\n\t}\n\tImWchar* wbuf_global = (ImWchar*)GlobalLock(wbuf_handle);\n\tImTextStrFromUtf8(wbuf_global, wbuf_length, text, NULL);\n\tGlobalUnlock(wbuf_handle);\n\tEmptyClipboard();\n\tSetClipboardData(CF_UNICODETEXT, wbuf_handle);\n\tCloseClipboard();\n}\n\n#else\n\n// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers\nstatic const char* GetClipboardTextFn_DefaultImpl(void*)\n{\n\tImGuiContext& g = *GImGui;\n\treturn g.PrivateClipboard.empty() ? NULL : g.PrivateClipboard.begin();\n}\n\n// Local ImGui-only clipboard implementation, if user hasn't defined better clipboard handlers\nstatic void SetClipboardTextFn_DefaultImpl(void*, const char* text)\n{\n\tImGuiContext& g = *GImGui;\n\tg.PrivateClipboard.clear();\n\tconst char* text_end = text + strlen(text);\n\tg.PrivateClipboard.resize((int)(text_end - text) + 1);\n\tmemcpy(&g.PrivateClipboard[0], text, (size_t)(text_end - text));\n\tg.PrivateClipboard[(int)(text_end - text)] = 0;\n}\n\n#endif\n\n// Win32 API IME support (for Asian languages, etc.)\n#if defined(_WIN32) && !defined(__GNUC__) && !defined(IMGUI_DISABLE_WIN32_DEFAULT_IME_FUNCTIONS)\n\n#include <imm.h>\n#ifdef _MSC_VER\n#pragma comment(lib, \"imm32\")\n#endif\n\nstatic void ImeSetInputScreenPosFn_DefaultImpl(int x, int y)\n{\n\t// Notify OS Input Method Editor of text input position\n\tif (HWND hwnd = (HWND)GImGui->IO.ImeWindowHandle)\n\t\tif (HIMC himc = ImmGetContext(hwnd))\n\t\t{\n\t\t\tCOMPOSITIONFORM cf;\n\t\t\tcf.ptCurrentPos.x = x;\n\t\t\tcf.ptCurrentPos.y = y;\n\t\t\tcf.dwStyle = CFS_FORCE_POSITION;\n\t\t\tImmSetCompositionWindow(himc, &cf);\n\t\t}\n}\n\n#else\n\nstatic void ImeSetInputScreenPosFn_DefaultImpl(int, int) {}\n\n#endif\n\n//-----------------------------------------------------------------------------\n// HELP\n//-----------------------------------------------------------------------------\n\nvoid ImGui::ShowMetricsWindow(bool* p_open)\n{\n\tif (ImGui::Begin(\"ImGui Metrics\", p_open))\n\t{\n\t\tImGui::Text(\"Dear ImGui %s\", ImGui::GetVersion());\n\t\tImGui::Text(\"Application average %.3f ms/frame (%.1f FPS)\", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);\n\t\tImGui::Text(\"%d vertices, %d indices (%d triangles)\", ImGui::GetIO().MetricsRenderVertices, ImGui::GetIO().MetricsRenderIndices, ImGui::GetIO().MetricsRenderIndices / 3);\n\t\tImGui::Text(\"%d allocations\", ImGui::GetIO().MetricsAllocs);\n\t\tstatic bool show_clip_rects = true;\n\t\tImGui::Checkbox(\"Show clipping rectangles when hovering an ImDrawCmd\", &show_clip_rects);\n\t\tImGui::Separator();\n\n\t\tstruct Funcs\n\t\t{\n\t\t\tstatic void NodeDrawList(ImGuiWindow* window, ImDrawList* draw_list, const char* label)\n\t\t\t{\n\t\t\t\tbool node_open = ImGui::TreeNode(draw_list, \"%s: '%s' %d vtx, %d indices, %d cmds\", label, draw_list->_OwnerName ? draw_list->_OwnerName : \"\", draw_list->VtxBuffer.Size, draw_list->IdxBuffer.Size, draw_list->CmdBuffer.Size);\n\t\t\t\tif (draw_list == ImGui::GetWindowDrawList())\n\t\t\t\t{\n\t\t\t\t\tImGui::SameLine();\n\t\t\t\t\tImGui::TextColored(ImColor(255, 100, 100), \"CURRENTLY APPENDING\"); // Can't display stats for active draw list! (we don't have the data double-buffered)\n\t\t\t\t\tif (node_open) ImGui::TreePop();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tImDrawList* overlay_draw_list = &GImGui->OverlayDrawList;   // Render additional visuals into the top-most draw list\n\t\t\t\tif (window && ImGui::IsItemHovered())\n\t\t\t\t\toverlay_draw_list->AddRect(window->Pos, window->Pos + window->Size, IM_COL32(255, 255, 0, 255));\n\t\t\t\tif (!node_open)\n\t\t\t\t\treturn;\n\n\t\t\t\tint elem_offset = 0;\n\t\t\t\tfor (const ImDrawCmd* pcmd = draw_list->CmdBuffer.begin(); pcmd < draw_list->CmdBuffer.end(); elem_offset += pcmd->ElemCount, pcmd++)\n\t\t\t\t{\n\t\t\t\t\tif (pcmd->UserCallback == NULL && pcmd->ElemCount == 0)\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tif (pcmd->UserCallback)\n\t\t\t\t\t{\n\t\t\t\t\t\tImGui::BulletText(\"Callback %p, user_data %p\", pcmd->UserCallback, pcmd->UserCallbackData);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tImDrawIdx* idx_buffer = (draw_list->IdxBuffer.Size > 0) ? draw_list->IdxBuffer.Data : NULL;\n\t\t\t\t\tbool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), \"Draw %-4d %s vtx, tex = %p, clip_rect = (%.0f,%.0f)..(%.0f,%.0f)\", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? \"indexed\" : \"non-indexed\", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);\n\t\t\t\t\tif (show_clip_rects && ImGui::IsItemHovered())\n\t\t\t\t\t{\n\t\t\t\t\t\tImRect clip_rect = pcmd->ClipRect;\n\t\t\t\t\t\tImRect vtxs_rect;\n\t\t\t\t\t\tfor (int i = elem_offset; i < elem_offset + (int)pcmd->ElemCount; i++)\n\t\t\t\t\t\t\tvtxs_rect.Add(draw_list->VtxBuffer[idx_buffer ? idx_buffer[i] : i].pos);\n\t\t\t\t\t\tclip_rect.Floor(); overlay_draw_list->AddRect(clip_rect.Min, clip_rect.Max, IM_COL32(255, 255, 0, 255));\n\t\t\t\t\t\tvtxs_rect.Floor(); overlay_draw_list->AddRect(vtxs_rect.Min, vtxs_rect.Max, IM_COL32(255, 0, 255, 255));\n\t\t\t\t\t}\n\t\t\t\t\tif (!pcmd_node_open)\n\t\t\t\t\t\tcontinue;\n\n\t\t\t\t\t// Display individual triangles/vertices. Hover on to get the corresponding triangle highlighted.\n\t\t\t\t\tImGuiListClipper clipper(pcmd->ElemCount / 3); // Manually coarse clip our print out of individual vertices to save CPU, only items that may be visible.\n\t\t\t\t\twhile (clipper.Step())\n\t\t\t\t\t\tfor (int prim = clipper.DisplayStart, vtx_i = elem_offset + clipper.DisplayStart * 3; prim < clipper.DisplayEnd; prim++)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tchar buf[300];\n\t\t\t\t\t\t\tchar* buf_p = buf, * buf_end = buf + IM_ARRAYSIZE(buf);\n\t\t\t\t\t\t\tImVec2 triangles_pos[3];\n\t\t\t\t\t\t\tfor (int n = 0; n < 3; n++, vtx_i++)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tImDrawVert& v = draw_list->VtxBuffer[idx_buffer ? idx_buffer[vtx_i] : vtx_i];\n\t\t\t\t\t\t\t\ttriangles_pos[n] = v.pos;\n\t\t\t\t\t\t\t\tbuf_p += ImFormatString(buf_p, (int)(buf_end - buf_p), \"%s %04d { pos = (%8.2f,%8.2f), uv = (%.6f,%.6f), col = %08X }\\n\", (n == 0) ? \"vtx\" : \"   \", vtx_i, v.pos.x, v.pos.y, v.uv.x, v.uv.y, v.col);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tImGui::Selectable(buf, false);\n\t\t\t\t\t\t\tif (ImGui::IsItemHovered())\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tImDrawListFlags backup_flags = overlay_draw_list->Flags;\n\t\t\t\t\t\t\t\toverlay_draw_list->Flags &= ~ImDrawListFlags_AntiAliasedLines; // Disable AA on triangle outlines at is more readable for very large and thin triangles.\n\t\t\t\t\t\t\t\toverlay_draw_list->AddPolyline(triangles_pos, 3, IM_COL32(255, 255, 0, 255), true, 1.0f);\n\t\t\t\t\t\t\t\toverlay_draw_list->Flags = backup_flags;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\tImGui::TreePop();\n\t\t\t\t}\n\t\t\t\tImGui::TreePop();\n\t\t\t}\n\n\t\t\tstatic void NodeWindows(ImVector<ImGuiWindow*>& windows, const char* label)\n\t\t\t{\n\t\t\t\tif (!ImGui::TreeNode(label, \"%s (%d)\", label, windows.Size))\n\t\t\t\t\treturn;\n\t\t\t\tfor (int i = 0; i < windows.Size; i++)\n\t\t\t\t\tFuncs::NodeWindow(windows[i], \"Window\");\n\t\t\t\tImGui::TreePop();\n\t\t\t}\n\n\t\t\tstatic void NodeWindow(ImGuiWindow* window, const char* label)\n\t\t\t{\n\t\t\t\tif (!ImGui::TreeNode(window, \"%s '%s', %d @ 0x%p\", label, window->Name, window->Active || window->WasActive, window))\n\t\t\t\t\treturn;\n\t\t\t\tNodeDrawList(window, window->DrawList, \"DrawList\");\n\t\t\t\tImGui::BulletText(\"Pos: (%.1f,%.1f), Size: (%.1f,%.1f), SizeContents (%.1f,%.1f)\", window->Pos.x, window->Pos.y, window->Size.x, window->Size.y, window->SizeContents.x, window->SizeContents.y);\n\t\t\t\tImGui::BulletText(\"Scroll: (%.2f/%.2f,%.2f/%.2f)\", window->Scroll.x, GetScrollMaxX(window), window->Scroll.y, GetScrollMaxY(window));\n\t\t\t\tImGui::BulletText(\"Active: %d, WriteAccessed: %d\", window->Active, window->WriteAccessed);\n\t\t\t\tif (window->RootWindow != window) NodeWindow(window->RootWindow, \"RootWindow\");\n\t\t\t\tif (window->DC.ChildWindows.Size > 0) NodeWindows(window->DC.ChildWindows, \"ChildWindows\");\n\t\t\t\tImGui::BulletText(\"Storage: %d bytes\", window->StateStorage.Data.Size * (int)sizeof(ImGuiStorage::Pair));\n\t\t\t\tImGui::TreePop();\n\t\t\t}\n\t\t};\n\n\t\t// Access private state, we are going to display the draw lists from last frame\n\t\tImGuiContext& g = *GImGui;\n\t\tFuncs::NodeWindows(g.Windows, \"Windows\");\n\t\tif (ImGui::TreeNode(\"DrawList\", \"Active DrawLists (%d)\", g.DrawDataBuilder.Layers[0].Size))\n\t\t{\n\t\t\tfor (int i = 0; i < g.DrawDataBuilder.Layers[0].Size; i++)\n\t\t\t\tFuncs::NodeDrawList(NULL, g.DrawDataBuilder.Layers[0][i], \"DrawList\");\n\t\t\tImGui::TreePop();\n\t\t}\n\t\tif (ImGui::TreeNode(\"Popups\", \"Open Popups Stack (%d)\", g.OpenPopupStack.Size))\n\t\t{\n\t\t\tfor (int i = 0; i < g.OpenPopupStack.Size; i++)\n\t\t\t{\n\t\t\t\tImGuiWindow* window = g.OpenPopupStack[i].Window;\n\t\t\t\tImGui::BulletText(\"PopupID: %08x, Window: '%s'%s%s\", g.OpenPopupStack[i].PopupId, window ? window->Name : \"NULL\", window && (window->Flags & ImGuiWindowFlags_ChildWindow) ? \" ChildWindow\" : \"\", window && (window->Flags & ImGuiWindowFlags_ChildMenu) ? \" ChildMenu\" : \"\");\n\t\t\t}\n\t\t\tImGui::TreePop();\n\t\t}\n\t\tif (ImGui::TreeNode(\"Basic state\"))\n\t\t{\n\t\t\tImGui::Text(\"HoveredWindow: '%s'\", g.HoveredWindow ? g.HoveredWindow->Name : \"NULL\");\n\t\t\tImGui::Text(\"HoveredRootWindow: '%s'\", g.HoveredRootWindow ? g.HoveredRootWindow->Name : \"NULL\");\n\t\t\tImGui::Text(\"HoveredId: 0x%08X/0x%08X (%.2f sec)\", g.HoveredId, g.HoveredIdPreviousFrame, g.HoveredIdTimer); // Data is \"in-flight\" so depending on when the Metrics window is called we may see current frame information or not\n\t\t\tImGui::Text(\"ActiveId: 0x%08X/0x%08X (%.2f sec)\", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer);\n\t\t\tImGui::Text(\"ActiveIdWindow: '%s'\", g.ActiveIdWindow ? g.ActiveIdWindow->Name : \"NULL\");\n\t\t\tImGui::Text(\"NavWindow: '%s'\", g.NavWindow ? g.NavWindow->Name : \"NULL\");\n\t\t\tImGui::Text(\"DragDrop: %d, SourceId = 0x%08X, Payload \\\"%s\\\" (%d bytes)\", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize);\n\t\t\tImGui::TreePop();\n\t\t}\n\t}\n\tImGui::End();\n}\n\n//-----------------------------------------------------------------------------\n\n// Include imgui_user.inl at the end of imgui.cpp to access private data/functions that aren't exposed.\n// Prefer just including imgui_internal.h from your code rather than using this define. If a declaration is missing from imgui_internal.h add it or request it on the github.\n#ifdef IMGUI_INCLUDE_IMGUI_USER_INL\n#include \"imgui_user.inl\"\n#endif\n\n//-----------------------------------------------------------------------------\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n// dear imgui, v1.54 WIP\n// (headers)\n\n// See imgui.cpp file for documentation.\n// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.\n// Read 'Programmer guide' in imgui.cpp for notes on how to setup ImGui in your codebase.\n// Get latest version at https://github.com/ocornut/imgui\n\n#pragma once\n#if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H)\n#include \"imconfig.h\"       // User-editable configuration file\n#endif\n#include <float.h>          // FLT_MAX\n#include <stdarg.h>         // va_list\n#include <stddef.h>         // ptrdiff_t, NULL\n#include <string.h>         // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp\n\n#define IMGUI_VERSION       \"1.54 WIP\"\n\n// Define attributes of all API symbols declarations, e.g. for DLL under Windows.\n#ifndef IMGUI_API\n#define IMGUI_API\n#endif\n\n// Define assertion handler.\n#ifndef IM_ASSERT\n#include <assert.h>\n#define IM_ASSERT(_EXPR)    assert(_EXPR)\n#endif\n\n// Helpers\n// Some compilers support applying printf-style warnings to user functions.\n#if defined(__clang__) || defined(__GNUC__)\n#define IM_FMTARGS(FMT)             __attribute__((format(printf, FMT, FMT+1)))\n#define IM_FMTLIST(FMT)             __attribute__((format(printf, FMT, 0)))\n#else\n#define IM_FMTARGS(FMT)\n#define IM_FMTLIST(FMT)\n#endif\n#define IM_ARRAYSIZE(_ARR)          ((int)(sizeof(_ARR)/sizeof(*_ARR)))\n#define IM_OFFSETOF(_TYPE,_MEMBER)  ((size_t)&(((_TYPE*)0)->_MEMBER))       // Offset of _MEMBER within _TYPE. Standardized as offsetof() in modern C++.\n\n#if defined(__clang__)\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wold-style-cast\"\n#endif\n\n// Forward declarations\nstruct ImDrawChannel;               // Temporary storage for outputting drawing commands out of order, used by ImDrawList::ChannelsSplit()\nstruct ImDrawCmd;                   // A single draw command within a parent ImDrawList (generally maps to 1 GPU draw call)\nstruct ImDrawData;                  // All draw command lists required to render the frame\nstruct ImDrawList;                  // A single draw command list (generally one per window)\nstruct ImDrawListSharedData;        // Data shared among multiple draw lists (typically owned by parent ImGui context, but you may create one yourself)\nstruct ImDrawVert;                  // A single vertex (20 bytes by default, override layout with IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT)\nstruct ImFont;                      // Runtime data for a single font within a parent ImFontAtlas\nstruct ImFontAtlas;                 // Runtime data for multiple fonts, bake multiple fonts into a single texture, TTF/OTF font loader\nstruct ImFontConfig;                // Configuration data when adding a font or merging fonts\nstruct ImColor;                     // Helper functions to create a color that can be converted to either u32 or float4\nstruct ImGuiIO;                     // Main configuration and I/O between your application and ImGui\nstruct ImGuiOnceUponAFrame;         // Simple helper for running a block of code not more than once a frame, used by IMGUI_ONCE_UPON_A_FRAME macro\nstruct ImGuiStorage;                // Simple custom key value storage\nstruct ImGuiStyle;                  // Runtime data for styling/colors\nstruct ImGuiTextFilter;             // Parse and apply text filters. In format \"aaaaa[,bbbb][,ccccc]\"\nstruct ImGuiTextBuffer;             // Text buffer for logging/accumulating text\nstruct ImGuiTextEditCallbackData;   // Shared state of ImGui::InputText() when using custom ImGuiTextEditCallback (rare/advanced use)\nstruct ImGuiSizeCallbackData;       // Structure used to constraint window size in custom ways when using custom ImGuiSizeCallback (rare/advanced use)\nstruct ImGuiListClipper;            // Helper to manually clip large list of items\nstruct ImGuiPayload;                // User data payload for drag and drop operations\nstruct ImGuiContext;                // ImGui context (opaque)\n\n\t\t\t\t\t\t\t\t\t// Typedefs and Enumerations (declared as int for compatibility and to not pollute the top of this file)\ntypedef unsigned int ImU32;         // 32-bit unsigned integer (typically used to store packed colors)\ntypedef unsigned int ImGuiID;       // unique ID used by widgets (typically hashed from a stack of string)\ntypedef unsigned short ImWchar;     // character for keyboard input/display\ntypedef void* ImTextureID;          // user data to identify a texture (this is whatever to you want it to be! read the FAQ about ImTextureID in imgui.cpp)\ntypedef int ImGuiCol;               // enum: a color identifier for styling     // enum ImGuiCol_\ntypedef int ImGuiCond;              // enum: a condition for Set*()             // enum ImGuiCond_\ntypedef int ImGuiKey;               // enum: a key identifier (ImGui-side enum) // enum ImGuiKey_\ntypedef int ImGuiMouseCursor;       // enum: a mouse cursor identifier          // enum ImGuiMouseCursor_\ntypedef int ImGuiStyleVar;          // enum: a variable identifier for styling  // enum ImGuiStyleVar_\ntypedef int ImDrawCornerFlags;      // flags: for ImDrawList::AddRect*() etc.   // enum ImDrawCornerFlags_\ntypedef int ImDrawListFlags;        // flags: for ImDrawList                    // enum ImDrawListFlags_\ntypedef int ImGuiColorEditFlags;    // flags: for ColorEdit*(), ColorPicker*()  // enum ImGuiColorEditFlags_\ntypedef int ImGuiColumnsFlags;      // flags: for *Columns*()                   // enum ImGuiColumnsFlags_\ntypedef int ImGuiDragDropFlags;     // flags: for *DragDrop*()                  // enum ImGuiDragDropFlags_\ntypedef int ImGuiComboFlags;        // flags: for BeginCombo()                  // enum ImGuiComboFlags_\ntypedef int ImGuiFocusedFlags;      // flags: for IsWindowFocused()             // enum ImGuiFocusedFlags_\ntypedef int ImGuiHoveredFlags;      // flags: for IsItemHovered() etc.          // enum ImGuiHoveredFlags_\ntypedef int ImGuiInputTextFlags;    // flags: for InputText*()                  // enum ImGuiInputTextFlags_\ntypedef int ImGuiSelectableFlags;   // flags: for Selectable()                  // enum ImGuiSelectableFlags_\ntypedef int ImGuiTreeNodeFlags;     // flags: for TreeNode*(),CollapsingHeader()// enum ImGuiTreeNodeFlags_\ntypedef int ImGuiWindowFlags;       // flags: for Begin*()                      // enum ImGuiWindowFlags_\ntypedef int(*ImGuiTextEditCallback)(ImGuiTextEditCallbackData* data);\ntypedef void(*ImGuiSizeCallback)(ImGuiSizeCallbackData* data);\n#if defined(_MSC_VER) && !defined(__clang__)\ntypedef unsigned __int64 ImU64;     // 64-bit unsigned integer\n#else\ntypedef unsigned long long ImU64;   // 64-bit unsigned integer\n#endif \n\n\t\t\t\t\t\t\t\t\t// Others helpers at bottom of the file:\n\t\t\t\t\t\t\t\t\t// class ImVector<>                 // Lightweight std::vector like class.\n\t\t\t\t\t\t\t\t\t// IMGUI_ONCE_UPON_A_FRAME          // Execute a block of code once per frame only (convenient for creating UI within deep-nested code that runs multiple times)\n\nstruct ImVec2\n{\n\tfloat x, y;\n\tImVec2() { x = y = 0.0f; }\n\tImVec2(float _x, float _y) { x = _x; y = _y; }\n#ifdef IM_VEC2_CLASS_EXTRA          // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec2.\n\tIM_VEC2_CLASS_EXTRA\n#endif\n};\n\nstruct ImVec4\n{\n\tfloat x, y, z, w;\n\tImVec4() { x = y = z = w = 0.0f; }\n\tImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }\n#ifdef IM_VEC4_CLASS_EXTRA          // Define constructor and implicit cast operators in imconfig.h to convert back<>forth from your math types and ImVec4.\n\tIM_VEC4_CLASS_EXTRA\n#endif\n};\n\n// ImGui end-user API\n// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)\nnamespace ImGui\n{\n\t// Main\n\tIMGUI_API ImGuiIO& GetIO();\n\tIMGUI_API ImGuiStyle& GetStyle();\n\tIMGUI_API ImDrawData* GetDrawData();                              // same value as passed to your io.RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame()\n\tIMGUI_API void          NewFrame();                                 // start a new ImGui frame, you can submit any command from this point until Render()/EndFrame().\n\tIMGUI_API void          Render();                                   // ends the ImGui frame, finalize the draw data, then call your io.RenderDrawListsFn() function if set.\n\tIMGUI_API void          EndFrame();                                 // ends the ImGui frame. automatically called by Render(), so most likely don't need to ever call that yourself directly. If you don't need to render you may call EndFrame() but you'll have wasted CPU already. If you don't need to render, better to not create any imgui windows instead!\n\tIMGUI_API void          Shutdown();\n\n\t// Demo, Debug, Informations\n\tIMGUI_API void          ShowDemoWindow(bool* p_open = NULL);        // create demo/test window (previously called ShowTestWindow). demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!\n\tIMGUI_API void          ShowMetricsWindow(bool* p_open = NULL);     // create metrics window. display ImGui internals: draw commands (with individual draw calls and vertices), window list, basic internal state, etc.\n\tIMGUI_API void          ShowStyleEditor(ImGuiStyle* ref = NULL);    // add style editor block (not a window). you can pass in a reference ImGuiStyle structure to compare to, revert to and save to (else it uses the default style)\n\tIMGUI_API bool          ShowStyleSelector(const char* label);\n\tIMGUI_API void          ShowFontSelector(const char* label);\n\tIMGUI_API void          ShowUserGuide();                            // add basic help/info block (not a window): how to manipulate ImGui as a end-user (mouse/keyboard controls).\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Window\n\tIMGUI_API bool          Begin(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);   // push window to the stack and start appending to it. see .cpp for details. return false when window is collapsed (so you can early out in your code) but you always need to call End() regardless. 'bool* p_open' creates a widget on the upper-right to close the window (which sets your bool to false).\n\tIMGUI_API void          End();                                                              // always call even if Begin() return false (which indicates a collapsed window)! finish appending to current window, pop it off the window stack.\n\tIMGUI_API bool          BeginChild(const char* str_id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);  // begin a scrolling region. size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). size>0.0f: fixed size. each axis can use a different mode, e.g. ImVec2(0,400).\n\tIMGUI_API bool          BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0, 0), bool border = false, ImGuiWindowFlags flags = 0);          // \"\n\tIMGUI_API void          EndChild();                                                         // always call even if BeginChild() return false (which indicates a collapsed or clipping child window)\n\tIMGUI_API ImVec2        GetContentRegionMax();                                              // current content boundaries (typically window boundaries including scrolling, or current column boundaries), in windows coordinates\n\tIMGUI_API ImVec2        GetContentRegionAvail();                                            // == GetContentRegionMax() - GetCursorPos()\n\tIMGUI_API float         GetContentRegionAvailWidth();                                       //\n\tIMGUI_API ImVec2        GetWindowContentRegionMin();                                        // content boundaries min (roughly (0,0)-Scroll), in window coordinates\n\tIMGUI_API ImVec2        GetWindowContentRegionMax();                                        // content boundaries max (roughly (0,0)+Size-Scroll) where Size can be override with SetNextWindowContentSize(), in window coordinates\n\tIMGUI_API float         GetWindowContentRegionWidth();                                      //\n\tIMGUI_API ImDrawList* GetWindowDrawList();                                                // get rendering command-list if you want to append your own draw primitives\n\tIMGUI_API ImVec2        GetWindowPos();                                                     // get current window position in screen space (useful if you want to do your own drawing via the DrawList api)\n\tIMGUI_API ImVec2        GetWindowSize();                                                    // get current window size\n\tIMGUI_API float         GetWindowWidth();\n\tIMGUI_API float         GetWindowHeight();\n\tIMGUI_API bool          IsWindowCollapsed();\n\tIMGUI_API bool          IsWindowAppearing();\n\tIMGUI_API void          SetWindowFontScale(float scale);                                    // per-window font scale. Adjust IO.FontGlobalScale if you want to scale all windows\n\n\tIMGUI_API void          SetNextWindowPos(const ImVec2& pos, ImGuiCond cond = 0, const ImVec2& pivot = ImVec2(0, 0)); // set next window position. call before Begin(). use pivot=(0.5f,0.5f) to center on given point, etc.\n\tIMGUI_API void          SetNextWindowSize(const ImVec2& size, ImGuiCond cond = 0);          // set next window size. set axis to 0.0f to force an auto-fit on this axis. call before Begin()\n\tIMGUI_API void          SetNextWindowSizeConstraints(const ImVec2& size_min, const ImVec2& size_max, ImGuiSizeCallback custom_callback = NULL, void* custom_callback_data = NULL); // set next window size limits. use -1,-1 on either X/Y axis to preserve the current size. Use callback to apply non-trivial programmatic constraints.\n\tIMGUI_API void          SetNextWindowContentSize(const ImVec2& size);                       // set next window content size (~ enforce the range of scrollbars). not including window decorations (title bar, menu bar, etc.). set an axis to 0.0f to leave it automatic. call before Begin()\n\tIMGUI_API void          SetNextWindowCollapsed(bool collapsed, ImGuiCond cond = 0);         // set next window collapsed state. call before Begin()\n\tIMGUI_API void          SetNextWindowFocus();                                               // set next window to be focused / front-most. call before Begin()\n\tIMGUI_API void          SetWindowPos(const ImVec2& pos, ImGuiCond cond = 0);                // (not recommended) set current window position - call within Begin()/End(). prefer using SetNextWindowPos(), as this may incur tearing and side-effects.\n\tIMGUI_API void          SetWindowSize(const ImVec2& size, ImGuiCond cond = 0);              // (not recommended) set current window size - call within Begin()/End(). set to ImVec2(0,0) to force an auto-fit. prefer using SetNextWindowSize(), as this may incur tearing and minor side-effects.    \n\tIMGUI_API void          SetWindowCollapsed(bool collapsed, ImGuiCond cond = 0);             // (not recommended) set current window collapsed state. prefer using SetNextWindowCollapsed().\n\tIMGUI_API void          SetWindowFocus();                                                   // (not recommended) set current window to be focused / front-most. prefer using SetNextWindowFocus().\n\tIMGUI_API void          SetWindowPos(const char* name, const ImVec2& pos, ImGuiCond cond = 0);      // set named window position.\n\tIMGUI_API void          SetWindowSize(const char* name, const ImVec2& size, ImGuiCond cond = 0);    // set named window size. set axis to 0.0f to force an auto-fit on this axis.\n\tIMGUI_API void          SetWindowCollapsed(const char* name, bool collapsed, ImGuiCond cond = 0);   // set named window collapsed state\n\tIMGUI_API void          SetWindowFocus(const char* name);                                           // set named window to be focused / front-most. use NULL to remove focus.\n\n\tIMGUI_API float         GetScrollX();                                                       // get scrolling amount [0..GetScrollMaxX()]\n\tIMGUI_API float         GetScrollY();                                                       // get scrolling amount [0..GetScrollMaxY()]\n\tIMGUI_API float         GetScrollMaxX();                                                    // get maximum scrolling amount ~~ ContentSize.X - WindowSize.X\n\tIMGUI_API float         GetScrollMaxY();                                                    // get maximum scrolling amount ~~ ContentSize.Y - WindowSize.Y\n\tIMGUI_API void          SetScrollX(float scroll_x);                                         // set scrolling amount [0..GetScrollMaxX()]\n\tIMGUI_API void          SetScrollY(float scroll_y);                                         // set scrolling amount [0..GetScrollMaxY()]\n\tIMGUI_API void          SetScrollHere(float center_y_ratio = 0.5f);                         // adjust scrolling amount to make current cursor position visible. center_y_ratio=0.0: top, 0.5: center, 1.0: bottom. When using to make a \"default/current item\" visible, consider using SetItemDefaultFocus() instead.\n\tIMGUI_API void          SetScrollFromPosY(float pos_y, float center_y_ratio = 0.5f);        // adjust scrolling amount to make given position valid. use GetCursorPos() or GetCursorStartPos()+offset to get valid positions.\n\tIMGUI_API void          SetStateStorage(ImGuiStorage* tree);                                // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it)\n\tIMGUI_API ImGuiStorage* GetStateStorage();\n\n\t// Parameters stacks (shared)\n\tIMGUI_API void          PushFont(ImFont* font);                                             // use NULL as a shortcut to push default font\n\tIMGUI_API void          PopFont();\n\tIMGUI_API void          PushStyleColor(ImGuiCol idx, ImU32 col);\n\tIMGUI_API void          PushStyleColor(ImGuiCol idx, const ImVec4& col);\n\tIMGUI_API void          PopStyleColor(int count = 1);\n\tIMGUI_API void          PushStyleVar(ImGuiStyleVar idx, float val);\n\tIMGUI_API void          PushStyleVar(ImGuiStyleVar idx, const ImVec2& val);\n\tIMGUI_API void          PopStyleVar(int count = 1);\n\tIMGUI_API const ImVec4& GetStyleColorVec4(ImGuiCol idx);                                    // retrieve style color as stored in ImGuiStyle structure. use to feed back into PushStyleColor(), otherwhise use GetColorU32() to get style color + style alpha.\n\tIMGUI_API ImFont* GetFont();                                                          // get current font\n\tIMGUI_API float         GetFontSize();                                                      // get current font size (= height in pixels) of current font with current scale applied\n\tIMGUI_API ImVec2        GetFontTexUvWhitePixel();                                           // get UV coordinate for a while pixel, useful to draw custom shapes via the ImDrawList API\n\tIMGUI_API ImU32         GetColorU32(ImGuiCol idx, float alpha_mul = 1.0f);                  // retrieve given style color with style alpha applied and optional extra alpha multiplier\n\tIMGUI_API ImU32         GetColorU32(const ImVec4& col);                                     // retrieve given color with style alpha applied\n\tIMGUI_API ImU32         GetColorU32(ImU32 col);                                             // retrieve given color with style alpha applied\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Parameters stacks (current window)\n\tIMGUI_API void          PushItemWidth(float item_width);                                    // width of items for the common item+label case, pixels. 0.0f = default to ~2/3 of windows width, >0.0f: width in pixels, <0.0f align xx pixels to the right of window (so -1.0f always align width to the right side)\n\tIMGUI_API void          PopItemWidth();\n\tIMGUI_API float         CalcItemWidth();                                                    // width of item given pushed settings and current cursor position\n\tIMGUI_API void          PushTextWrapPos(float wrap_pos_x = 0.0f);                           // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space\n\tIMGUI_API void          PopTextWrapPos();\n\tIMGUI_API void          PushAllowKeyboardFocus(bool allow_keyboard_focus);                  // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets\n\tIMGUI_API void          PopAllowKeyboardFocus();\n\tIMGUI_API void          PushButtonRepeat(bool repeat);                                      // in 'repeat' mode, Button*() functions return repeated true in a typematic manner (using io.KeyRepeatDelay/io.KeyRepeatRate setting). Note that you can call IsItemActive() after any Button() to tell if the button is held in the current frame.\n\tIMGUI_API void          PopButtonRepeat();\n\n\t// Cursor / Layout\n\tIMGUI_API void          Separator();                                                        // separator, generally horizontal. inside a menu bar or in horizontal layout mode, this becomes a vertical separator.\n\tIMGUI_API void          SameLine(float pos_x = 0.0f, float spacing_w = -1.0f);              // call between widgets or groups to layout them horizontally\n\tIMGUI_API void          NewLine();                                                          // undo a SameLine()\n\tIMGUI_API void          Spacing();                                                          // add vertical spacing\n\tIMGUI_API void          Dummy(const ImVec2& size);                                          // add a dummy item of given size\n\tIMGUI_API void          Indent(float indent_w = 0.0f);                                      // move content position toward the right, by style.IndentSpacing or indent_w if != 0\n\tIMGUI_API void          Unindent(float indent_w = 0.0f);                                    // move content position back to the left, by style.IndentSpacing or indent_w if != 0\n\tIMGUI_API void          BeginGroup();                                                       // lock horizontal starting position + capture group bounding box into one \"item\" (so you can use IsItemHovered() or layout primitives such as SameLine() on whole group, etc.)\n\tIMGUI_API void          EndGroup();\n\tIMGUI_API ImVec2        GetCursorPos();                                                     // cursor position is relative to window position\n\tIMGUI_API float         GetCursorPosX();                                                    // \"\n\tIMGUI_API float         GetCursorPosY();                                                    // \"\n\tIMGUI_API void          SetCursorPos(const ImVec2& local_pos);                              // \"\n\tIMGUI_API void          SetCursorPosX(float x);                                             // \"\n\tIMGUI_API void          SetCursorPosY(float y);                                             // \"\n\tIMGUI_API int           FindKeybind(int s1);                                                // \"\n\tIMGUI_API ImVec2        GetCursorStartPos();                                                // initial cursor position\n\tIMGUI_API ImVec2        GetCursorScreenPos();                                               // cursor position in absolute screen coordinates [0..io.DisplaySize] (useful to work with ImDrawList API)\n\tIMGUI_API void          SetCursorScreenPos(const ImVec2& pos);                              // cursor position in absolute screen coordinates [0..io.DisplaySize]\n\tIMGUI_API void          AlignTextToFramePadding();                                          // vertically align/lower upcoming text to FramePadding.y so that it will aligns to upcoming widgets (call if you have text on a line before regular widgets)\n\tIMGUI_API float         GetTextLineHeight();                                                // ~ FontSize\n\tIMGUI_API float         GetTextLineHeightWithSpacing();                                     // ~ FontSize + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of text)\n\tIMGUI_API float         GetFrameHeight();                                                   // ~ FontSize + style.FramePadding.y * 2\n\tIMGUI_API float         GetFrameHeightWithSpacing();                                        // ~ FontSize + style.FramePadding.y * 2 + style.ItemSpacing.y (distance in pixels between 2 consecutive lines of framed widgets)\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Columns\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// You can also use SameLine(pos_x) for simplified columns. The columns API is still work-in-progress and rather lacking.\n\tIMGUI_API void          Columns(int count = 1, const char* id = NULL, bool border = true);\n\tIMGUI_API void          NextColumn();                                                       // next column, defaults to current row or next row if the current row is finished\n\tIMGUI_API int           GetColumnIndex();                                                   // get current column index\n\tIMGUI_API float         GetColumnWidth(int column_index = -1);                              // get column width (in pixels). pass -1 to use current column\n\tIMGUI_API void          SetColumnWidth(int column_index, float width);                      // set column width (in pixels). pass -1 to use current column\n\tIMGUI_API float         GetColumnOffset(int column_index = -1);                             // get position of column line (in pixels, from the left side of the contents region). pass -1 to use current column, otherwise 0..GetColumnsCount() inclusive. column 0 is typically 0.0f\n\tIMGUI_API void          SetColumnOffset(int column_index, float offset_x);                  // set position of column line (in pixels, from the left side of the contents region). pass -1 to use current column\n\tIMGUI_API int           GetColumnsCount();\n\n\t// ID scopes\n\t// If you are creating widgets in a loop you most likely want to push a unique identifier (e.g. object pointer, loop index) so ImGui can differentiate them.\n\t// You can also use the \"##foobar\" syntax within widget label to distinguish them from each others. Read \"A primer on the use of labels/IDs\" in the FAQ for more details.\n\tIMGUI_API void          PushID(const char* str_id);                                         // push identifier into the ID stack. IDs are hash of the entire stack!\n\tIMGUI_API void          PushID(const char* str_id_begin, const char* str_id_end);\n\tIMGUI_API void          PushID(const void* ptr_id);\n\tIMGUI_API void          PushID(int int_id);\n\tIMGUI_API void          PopID();\n\tIMGUI_API ImGuiID       GetID(const char* str_id);                                          // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself\n\tIMGUI_API ImGuiID       GetID(const char* str_id_begin, const char* str_id_end);\n\tIMGUI_API ImGuiID       GetID(const void* ptr_id);\n\n\t// Widgets: Text\n\tIMGUI_API void          TextUnformatted(const char* text, const char* text_end = NULL);               // raw text without formatting. Roughly equivalent to Text(\"%s\", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.\n\tIMGUI_API void          Text(const char* fmt, ...)                                     IM_FMTARGS(1); // simple formatted text\n\tIMGUI_API void          TextV(const char* fmt, va_list args)                           IM_FMTLIST(1);\n\tIMGUI_API void          TextColored(const ImVec4& col, const char* fmt, ...)           IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();\n\tIMGUI_API void          TextColoredV(const ImVec4& col, const char* fmt, va_list args) IM_FMTLIST(2);\n\tIMGUI_API void          TextDisabled(const char* fmt, ...)                             IM_FMTARGS(1); // shortcut for PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); Text(fmt, ...); PopStyleColor();\n\tIMGUI_API void          TextDisabledV(const char* fmt, va_list args)                   IM_FMTLIST(1);\n\tIMGUI_API void          TextWrapped(const char* fmt, ...)                              IM_FMTARGS(1); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();. Note that this won't work on an auto-resizing window if there's no other widgets to extend the window width, yoy may need to set a size using SetNextWindowSize().\n\tIMGUI_API void          TextWrappedV(const char* fmt, va_list args)                    IM_FMTLIST(1);\n\tIMGUI_API void          LabelText(const char* label, const char* fmt, ...)             IM_FMTARGS(2); // display text+label aligned the same way as value+label widgets\n\tIMGUI_API void          LabelTextV(const char* label, const char* fmt, va_list args)   IM_FMTLIST(2);\n\tIMGUI_API void          BulletText(const char* fmt, ...)                               IM_FMTARGS(1); // shortcut for Bullet()+Text()\n\tIMGUI_API void          BulletTextV(const char* fmt, va_list args)                     IM_FMTLIST(1);\n\tIMGUI_API void          Bullet();                                                                     // draw a small circle and keep the cursor on the same line. advance cursor x position by GetTreeNodeToLabelSpacing(), same distance that TreeNode() uses\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  // Widgets: Main\n\tIMGUI_API bool          Button(const char* label, const ImVec2& size = ImVec2(0, 0));            // button\n\tIMGUI_API bool          SmallButton(const char* label);                                         // button with FramePadding=(0,0) to easily embed within text\n\tIMGUI_API bool          InvisibleButton(const char* str_id, const ImVec2& size);                // button behavior without the visuals, useful to build custom behaviors using the public api (along with IsItemActive, IsItemHovered, etc.)\n\tIMGUI_API void          Image(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), const ImVec4& tint_col = ImVec4(1, 1, 1, 1), const ImVec4& border_col = ImVec4(0, 0, 0, 0));\n\tIMGUI_API bool          ImageButton(ImTextureID user_texture_id, const ImVec2& size, const ImVec2& uv0 = ImVec2(0, 0), const ImVec2& uv1 = ImVec2(1, 1), int frame_padding = -1, const ImVec4& bg_col = ImVec4(0, 0, 0, 0), const ImVec4& tint_col = ImVec4(1, 1, 1, 1));    // <0 frame_padding uses default frame padding settings. 0 for no padding\n\tIMGUI_API bool          Switch(const char* label, bool* v);\n\tIMGUI_API bool          Checkbox(const char* label, bool* v);\n\tIMGUI_API bool          CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);\n\tIMGUI_API bool          RadioButton(const char* label, bool active);\n\tIMGUI_API bool          RadioButton(const char* label, int* v, int v_button);\n\tIMGUI_API void          PlotLines(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));\n\tIMGUI_API void          PlotLines(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));\n\tIMGUI_API void          PlotHistogram(const char* label, const float* values, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0), int stride = sizeof(float));\n\tIMGUI_API void          PlotHistogram(const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset = 0, const char* overlay_text = NULL, float scale_min = FLT_MAX, float scale_max = FLT_MAX, ImVec2 graph_size = ImVec2(0, 0));\n\tIMGUI_API void          ProgressBar(float fraction, const ImVec2& size_arg = ImVec2(-1, 0), const char* overlay = NULL);\n\n\t// Widgets: Combo Box\n\t// The new BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it. \n\t// The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose.\n\tIMGUI_API bool          BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0);\n\tIMGUI_API void          EndCombo(); // only call EndCombo() if BeginCombo() returns true!\n\tIMGUI_API bool          Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1);\n\tIMGUI_API bool          Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1);      // Separate items with \\0 within a string, end item-list with \\0\\0. e.g. \"One\\0Two\\0Three\\0\"\n\tIMGUI_API bool          Combo(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int popup_max_height_in_items = -1);\n\n\t// Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard. manually input values aren't clamped, can go off-bounds)\n\t// For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x\n\tIMGUI_API bool          DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = \"%.3f\", float power = 1.0f);     // If v_min >= v_max we have no bound\n\tIMGUI_API bool          DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = \"%.3f\", const char* display_format_max = NULL, float power = 1.0f);\n\tIMGUI_API bool          DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = \"%.0f\");                                       // If v_min >= v_max we have no bound\n\tIMGUI_API bool          DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = \"%.0f\", const char* display_format_max = NULL);\n\n\t// Widgets: Input with Keyboard\n\tIMGUI_API bool          InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);\n\tIMGUI_API bool          InputTextMultiline(const char* label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);\n\tIMGUI_API bool          InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputFloat2(const char* label, float v[2], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputFloat3(const char* label, float v[3], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputFloat4(const char* label, float v[4], int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);\n\tIMGUI_API bool          InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);\n\n\t// Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard. manually input values aren't clamped, can go off-bounds)\n\tIMGUI_API bool          SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = \"%.3f\", float power = 1.0f);     // adjust display_format to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for logarithmic sliders\n\tIMGUI_API bool          SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);\n\tIMGUI_API bool          SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = \"%.0f\");\n\tIMGUI_API bool          VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = \"%.3f\", float power = 1.0f);\n\tIMGUI_API bool          VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = \"%.0f\");\n\n\t// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)\n\t// Note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can the pass the address of a first float element out of a contiguous structure, e.g. &myvector.x\n\tIMGUI_API bool          ColorEdit3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);\n\tIMGUI_API bool          ColorEdit4(const char* label, float col[4], ImGuiColorEditFlags flags = 0);\n\tIMGUI_API bool          ColorPicker3(const char* label, float col[3], ImGuiColorEditFlags flags = 0);\n\tIMGUI_API bool          ColorPicker4(const char* label, float col[4], ImGuiColorEditFlags flags = 0, const float* ref_col = NULL);\n\tIMGUI_API bool          ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFlags flags = 0, ImVec2 size = ImVec2(0, 0));  // display a colored square/button, hover for details, return true when pressed.\n\tIMGUI_API void          SetColorEditOptions(ImGuiColorEditFlags flags);                         // initialize current options (generally on application startup) if you want to select a default format, picker type, etc. User will be able to change many settings, unless you pass the _NoOptions flag to your calls.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Widgets: Trees\n\tIMGUI_API bool          TreeNode(const char* label);                                            // if returning 'true' the node is open and the tree id is pushed into the id stack. user is responsible for calling TreePop().\n\tIMGUI_API bool          TreeNode(const char* str_id, const char* fmt, ...) IM_FMTARGS(2);       // read the FAQ about why and how to use ID. to align arbitrary text at the same level as a TreeNode() you can use Bullet().\n\tIMGUI_API bool          TreeNode(const void* ptr_id, const char* fmt, ...) IM_FMTARGS(2);       // \"\n\tIMGUI_API bool          TreeNodeV(const char* str_id, const char* fmt, va_list args) IM_FMTLIST(2);\n\tIMGUI_API bool          TreeNodeV(const void* ptr_id, const char* fmt, va_list args) IM_FMTLIST(2);\n\tIMGUI_API bool          TreeNodeEx(const char* label, ImGuiTreeNodeFlags flags = 0);\n\tIMGUI_API bool          TreeNodeEx(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3);\n\tIMGUI_API bool          TreeNodeEx(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, ...) IM_FMTARGS(3);\n\tIMGUI_API bool          TreeNodeExV(const char* str_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);\n\tIMGUI_API bool          TreeNodeExV(const void* ptr_id, ImGuiTreeNodeFlags flags, const char* fmt, va_list args) IM_FMTLIST(3);\n\tIMGUI_API void          TreePush(const char* str_id);                                           // ~ Indent()+PushId(). Already called by TreeNode() when returning true, but you can call Push/Pop yourself for layout purpose\n\tIMGUI_API void          TreePush(const void* ptr_id = NULL);                                    // \"\n\tIMGUI_API void          TreePop();                                                              // ~ Unindent()+PopId()\n\tIMGUI_API void          TreeAdvanceToLabelPos();                                                // advance cursor x position by GetTreeNodeToLabelSpacing()\n\tIMGUI_API float         GetTreeNodeToLabelSpacing();                                            // horizontal distance preceding label when using TreeNode*() or Bullet() == (g.FontSize + style.FramePadding.x*2) for a regular unframed TreeNode\n\tIMGUI_API void          SetNextTreeNodeOpen(bool is_open, ImGuiCond cond = 0);                  // set next TreeNode/CollapsingHeader open state.\n\tIMGUI_API bool          CollapsingHeader(const char* label, ImGuiTreeNodeFlags flags = 0);      // if returning 'true' the header is open. doesn't indent nor push on ID stack. user doesn't have to call TreePop().\n\tIMGUI_API bool          CollapsingHeader(const char* label, bool* p_open, ImGuiTreeNodeFlags flags = 0); // when 'p_open' isn't NULL, display an additional small close button on upper right of the header\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // Widgets: Selectable / Lists\n\tIMGUI_API bool          Selectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));  // \"bool selected\" carry the selection state (read-only). Selectable() is clicked is returns true so you can modify your selection state. size.x==0.0: use remaining width, size.x>0.0: specify width. size.y==0.0: use label height, size.y>0.0: specify height\n\tIMGUI_API bool          Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0, 0));       // \"bool* p_selected\" point to the selection state (read-write), as a convenient helper.\n\tIMGUI_API bool          ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1);\n\tIMGUI_API bool          ListBox(const char* label, int* current_item, bool(*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);\n\tIMGUI_API bool          ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0, 0));     // use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards.\n\tIMGUI_API bool          ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // \"\n\tIMGUI_API void          ListBoxFooter();                                                        // terminate the scrolling region\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Widgets: Value() Helpers. Output single value in \"name: value\" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)\n\tIMGUI_API void          Value(const char* prefix, bool b);\n\tIMGUI_API void          Value(const char* prefix, int v);\n\tIMGUI_API void          Value(const char* prefix, unsigned int v);\n\tIMGUI_API void          Value(const char* prefix, float v, const char* float_format = NULL);\n\n\t// Tooltips\n\tIMGUI_API void          SetTooltip(const char* fmt, ...) IM_FMTARGS(1);                     // set text tooltip under mouse-cursor, typically use with ImGui::IsItemHovered(). overidde any previous call to SetTooltip().\n\tIMGUI_API void          SetTooltipV(const char* fmt, va_list args) IM_FMTLIST(1);\n\tIMGUI_API void          BeginTooltip();                                                     // begin/append a tooltip window. to create full-featured tooltip (with any kind of contents).\n\tIMGUI_API void          EndTooltip();\n\n\t// Menus\n\tIMGUI_API bool          BeginMainMenuBar();                                                 // create and append to a full screen menu-bar.\n\tIMGUI_API void          EndMainMenuBar();                                                   // only call EndMainMenuBar() if BeginMainMenuBar() returns true!\n\tIMGUI_API bool          BeginMenuBar();                                                     // append to menu-bar of current window (requires ImGuiWindowFlags_MenuBar flag set on parent window).\n\tIMGUI_API void          EndMenuBar();                                                       // only call EndMenuBar() if BeginMenuBar() returns true!\n\tIMGUI_API bool          BeginMenu(const char* label, bool enabled = true);                  // create a sub-menu entry. only call EndMenu() if this returns true!\n\tIMGUI_API void          EndMenu();                                                          // only call EndBegin() if BeginMenu() returns true!\n\tIMGUI_API bool          MenuItem(const char* label, const char* shortcut = NULL, bool selected = false, bool enabled = true);  // return true when activated. shortcuts are displayed for convenience but not processed by ImGui at the moment\n\tIMGUI_API bool          MenuItem(const char* label, const char* shortcut, bool* p_selected, bool enabled = true);              // return true when activated + toggle (*p_selected) if p_selected != NULL\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   // Popups\n\tIMGUI_API void          OpenPopup(const char* str_id);                                      // call to mark popup as open (don't call every frame!). popups are closed when user click outside, or if CloseCurrentPopup() is called within a BeginPopup()/EndPopup() block. By default, Selectable()/MenuItem() are calling CloseCurrentPopup(). Popup identifiers are relative to the current ID-stack (so OpenPopup and BeginPopup needs to be at the same level).\n\tIMGUI_API bool          BeginPopup(const char* str_id, ImGuiWindowFlags flags = 0);                                             // return true if the popup is open, and you can start outputting to it. only call EndPopup() if BeginPopup() returns true!\n\tIMGUI_API bool          BeginPopupContextItem(const char* str_id = NULL, int mouse_button = 1);                                 // helper to open and begin popup when clicked on last item. if you can pass a NULL str_id only if the previous item had an id. If you want to use that on a non-interactive item such as Text() you need to pass in an explicit ID here. read comments in .cpp!\n\tIMGUI_API bool          BeginPopupContextWindow(const char* str_id = NULL, int mouse_button = 1, bool also_over_items = true);  // helper to open and begin popup when clicked on current window.\n\tIMGUI_API bool          BeginPopupContextVoid(const char* str_id = NULL, int mouse_button = 1);                                 // helper to open and begin popup when clicked in void (where there are no imgui windows).\n\tIMGUI_API bool          BeginPopupModal(const char* name, bool* p_open = NULL, ImGuiWindowFlags flags = 0);                     // modal dialog (regular window with title bar, block interactions behind the modal window, can't close the modal window by clicking outside)\n\tIMGUI_API void          EndPopup();                                                                                             // only call EndPopup() if BeginPopupXXX() returns true!\n\tIMGUI_API bool          OpenPopupOnItemClick(const char* str_id = NULL, int mouse_button = 1);                                  // helper to open popup when clicked on last item. return true when just opened.\n\tIMGUI_API bool          IsPopupOpen(const char* str_id);                                    // return true if the popup is open\n\tIMGUI_API void          CloseCurrentPopup();                                                // close the popup we have begin-ed into. clicking on a MenuItem or Selectable automatically close the current popup.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Logging/Capture: all text output from interface is captured to tty/file/clipboard. By default, tree nodes are automatically opened during logging.\n\tIMGUI_API void          LogToTTY(int max_depth = -1);                                       // start logging to tty\n\tIMGUI_API void          LogToFile(int max_depth = -1, const char* filename = NULL);         // start logging to file\n\tIMGUI_API void          LogToClipboard(int max_depth = -1);                                 // start logging to OS clipboard\n\tIMGUI_API void          LogFinish();                                                        // stop logging (close file, etc.)\n\tIMGUI_API void          LogButtons();                                                       // helper to display buttons for logging to tty/file/clipboard\n\tIMGUI_API void          LogText(const char* fmt, ...) IM_FMTARGS(1);                        // pass text data straight to log (without being displayed)\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Drag and Drop\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// [BETA API] Missing Demo code. API may evolve.\n\tIMGUI_API bool          BeginDragDropSource(ImGuiDragDropFlags flags = 0, int mouse_button = 0);                // call when the current item is active. If this return true, you can call SetDragDropPayload() + EndDragDropSource()\n\tIMGUI_API bool          SetDragDropPayload(const char* type, const void* data, size_t size, ImGuiCond cond = 0);// type is a user defined string of maximum 12 characters. Strings starting with '_' are reserved for dear imgui internal types. Data is copied and held by imgui.\n\tIMGUI_API void          EndDragDropSource();                                                                    // only call EndDragDropSource() if BeginDragDropSource() returns true!\n\tIMGUI_API bool          BeginDragDropTarget();                                                                  // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget()\n\tIMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0);            // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released.\n\tIMGUI_API void          EndDragDropTarget();                                                                    // only call EndDragDropTarget() if BeginDragDropTarget() returns true!\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Clipping\n\tIMGUI_API void          PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);\n\tIMGUI_API void          PopClipRect();\n\n\t// Styles\n\tIMGUI_API void          StyleColorsClassic(ImGuiStyle* dst = NULL);\n\tIMGUI_API void          StyleColorsDark(ImGuiStyle* dst = NULL);\n\tIMGUI_API void          StyleColorsLight(ImGuiStyle* dst = NULL);\n\n\t// Focus\n\t// (FIXME: Those functions will be reworked after we merge the navigation branch + have a pass at focusing/tabbing features.)\n\t// (Prefer using \"SetItemDefaultFocus()\" over \"if (IsWindowAppearing()) SetScrollHere()\" when applicable, to make your code more forward compatible when navigation branch is merged)\n\tIMGUI_API void          SetItemDefaultFocus();                                              // make last item the default focused item of a window (WIP navigation branch only). Pleaase use instead of SetScrollHere().\n\tIMGUI_API void          SetKeyboardFocusHere(int offset = 0);                               // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget. Use -1 to access previous widget.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Utilities\n\tIMGUI_API bool          IsItemHovered(ImGuiHoveredFlags flags = 0);                         // is the last item hovered? (and usable, aka not blocked by a popup, etc.). See ImGuiHoveredFlags for more options.\n\tIMGUI_API bool          IsItemActive();                                                     // is the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)\n\tIMGUI_API bool          IsItemClicked(int mouse_button = 0);                                // is the last item clicked? (e.g. button/node just clicked on)\n\tIMGUI_API bool          IsItemVisible();                                                    // is the last item visible? (aka not out of sight due to clipping/scrolling.)\n\tIMGUI_API bool          IsAnyItemHovered();\n\tIMGUI_API bool          IsAnyItemActive();\n\tIMGUI_API ImVec2        GetItemRectMin();                                                   // get bounding rectangle of last item, in screen space\n\tIMGUI_API ImVec2        GetItemRectMax();                                                   // \"\n\tIMGUI_API ImVec2        GetItemRectSize();                                                  // get size of last item, in screen space\n\tIMGUI_API void          SetItemAllowOverlap();                                              // allow last item to be overlapped by a subsequent item. sometimes useful with invisible buttons, selectables, etc. to catch unused area.\n\tIMGUI_API bool          IsWindowFocused(ImGuiFocusedFlags flags = 0);                       // is current window focused? or its root/child, depending on flags. see flags for options.\n\tIMGUI_API bool          IsWindowHovered(ImGuiHoveredFlags flags = 0);                       // is current window hovered (and typically: not blocked by a popup/modal)? see flags for options.\n\tIMGUI_API bool          IsRectVisible(const ImVec2& size);                                  // test if rectangle (of given size, starting from cursor position) is visible / not clipped.\n\tIMGUI_API bool          IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max);      // test if rectangle (in screen space) is visible / not clipped. to perform coarse clipping on user's side.\n\tIMGUI_API float         GetTime();\n\tIMGUI_API int           GetFrameCount();\n\tIMGUI_API ImDrawList* GetOverlayDrawList();                                               // this draw list will be the last rendered one, useful to quickly draw overlays shapes/text\n\tIMGUI_API ImDrawListSharedData* GetDrawListSharedData();\n\tIMGUI_API const char* GetStyleColorName(ImGuiCol idx);\n\tIMGUI_API ImVec2        CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);\n\tIMGUI_API void          CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end);    // calculate coarse clipping for large list of evenly sized items. Prefer using the ImGuiListClipper higher-level helper if you can.\n\n\tIMGUI_API bool          BeginChildFrame(ImGuiID id, const ImVec2& size, ImGuiWindowFlags flags = 0); // helper to create a child window / scrolling region that looks like a normal widget frame\n\tIMGUI_API void          EndChildFrame();                                                    // always call EndChildFrame() regardless of BeginChildFrame() return values (which indicates a collapsed/clipped window)\n\n\tIMGUI_API ImVec4        ColorConvertU32ToFloat4(ImU32 in);\n\tIMGUI_API ImU32         ColorConvertFloat4ToU32(const ImVec4& in);\n\tIMGUI_API void          ColorConvertRGBtoHSV(float r, float g, float b, float& out_h, float& out_s, float& out_v);\n\tIMGUI_API void          ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);\n\n\t// Inputs\n\tIMGUI_API int           GetKeyIndex(ImGuiKey imgui_key);                                    // map ImGuiKey_* values into user's key index. == io.KeyMap[key]\n\tIMGUI_API bool          IsKeyDown(int user_key_index);                                      // is key being held. == io.KeysDown[user_key_index]. note that imgui doesn't know the semantic of each entry of io.KeyDown[]. Use your own indices/enums according to how your backend/engine stored them into KeyDown[]!\n\tIMGUI_API bool          IsKeyPressed(int user_key_index, bool repeat = true);               // was key pressed (went from !Down to Down). if repeat=true, uses io.KeyRepeatDelay / KeyRepeatRate\n\tIMGUI_API bool          IsKeyReleased(int user_key_index);                                  // was key released (went from Down to !Down)..\n\tIMGUI_API int           GetKeyPressedAmount(int key_index, float repeat_delay, float rate); // uses provided repeat rate/delay. return a count, most often 0 or 1 but might be >1 if RepeatRate is small enough that DeltaTime > RepeatRate\n\tIMGUI_API bool          IsMouseDown(int button);                                            // is mouse button held\n\tIMGUI_API bool          IsMouseClicked(int button, bool repeat = false);                    // did mouse button clicked (went from !Down to Down)\n\tIMGUI_API bool          IsMouseDoubleClicked(int button);                                   // did mouse button double-clicked. a double-click returns false in IsMouseClicked(). uses io.MouseDoubleClickTime.\n\tIMGUI_API bool          IsMouseReleased(int button);                                        // did mouse button released (went from Down to !Down)\n\tIMGUI_API bool          IsMouseDragging(int button = 0, float lock_threshold = -1.0f);      // is mouse dragging. if lock_threshold < -1.0f uses io.MouseDraggingThreshold\n\tIMGUI_API bool          IsMouseHoveringRect(const ImVec2& r_min, const ImVec2& r_max, bool clip = true);  // is mouse hovering given bounding rect (in screen space). clipped by current clipping settings. disregarding of consideration of focus/window ordering/blocked by a popup.\n\tIMGUI_API bool          IsMousePosValid(const ImVec2* mouse_pos = NULL);                    //\n\tIMGUI_API ImVec2        GetMousePos();                                                      // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls\n\tIMGUI_API ImVec2        GetMousePosOnOpeningCurrentPopup();                                 // retrieve backup of mouse positioning at the time of opening popup we have BeginPopup() into\n\tIMGUI_API ImVec2        GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f);    // dragging amount since clicking. if lock_threshold < -1.0f uses io.MouseDraggingThreshold\n\tIMGUI_API void          ResetMouseDragDelta(int button = 0);                                //\n\tIMGUI_API ImGuiMouseCursor GetMouseCursor();                                                // get desired cursor type, reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you\n\tIMGUI_API void          SetMouseCursor(ImGuiMouseCursor type);                              // set desired cursor type\n\tIMGUI_API void          CaptureKeyboardFromApp(bool capture = true);                        // manually override io.WantCaptureKeyboard flag next frame (said flag is entirely left for your application handle). e.g. force capture keyboard when your widget is being hovered.\n\tIMGUI_API void          CaptureMouseFromApp(bool capture = true);                           // manually override io.WantCaptureMouse flag next frame (said flag is entirely left for your application handle).\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Helpers functions to access functions pointers in ImGui::GetIO()\n\tIMGUI_API void* MemAlloc(size_t sz);\n\tIMGUI_API void          MemFree(void* ptr);\n\tIMGUI_API const char* GetClipboardText();\n\tIMGUI_API void          SetClipboardText(const char* text);\n\n\t// Internal context access - if you want to use multiple context, share context between modules (e.g. DLL). There is a default context created and active by default.\n\t// All contexts share a same ImFontAtlas by default. If you want different font atlas, you can new() them and overwrite the GetIO().Fonts variable of an ImGui context.\n\tIMGUI_API const char* GetVersion();\n\tIMGUI_API ImGuiContext* CreateContext(void* (*malloc_fn)(size_t) = NULL, void(*free_fn)(void*) = NULL);\n\tIMGUI_API void          DestroyContext(ImGuiContext* ctx);\n\tIMGUI_API ImGuiContext* GetCurrentContext();\n\tIMGUI_API void          SetCurrentContext(ImGuiContext* ctx);\n\n} // namespace ImGui\n\n  // Flags for ImGui::Begin()\nenum ImGuiWindowFlags_\n{\n\tImGuiWindowFlags_NoTitleBar = 1 << 0,   // Disable title-bar\n\tImGuiWindowFlags_NoResize = 1 << 1,   // Disable user resizing with the lower-right grip\n\tImGuiWindowFlags_NoMove = 1 << 2,   // Disable user moving the window\n\tImGuiWindowFlags_NoScrollbar = 1 << 3,   // Disable scrollbars (window can still scroll with mouse or programatically)\n\tImGuiWindowFlags_NoScrollWithMouse = 1 << 4,   // Disable user vertically scrolling with mouse wheel. On child window, mouse wheel will be forwarded to the parent unless NoScrollbar is also set.\n\tImGuiWindowFlags_NoCollapse = 1 << 5,   // Disable user collapsing window by double-clicking on it\n\tImGuiWindowFlags_AlwaysAutoResize = 1 << 6,   // Resize every window to its content every frame\n\t\t\t\t\t\t\t\t\t\t\t\t  //ImGuiWindowFlags_ShowBorders          = 1 << 7,   // Show borders around windows and items (OBSOLETE! Use e.g. style.FrameBorderSize=1.0f to enable borders).\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_NoSavedSettings = 1 << 8,   // Never load/save settings in .ini file\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_NoInputs = 1 << 9,   // Disable catching mouse or keyboard inputs, hovering test with pass through.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_MenuBar = 1 << 10,  // Has a menu-bar\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_HorizontalScrollbar = 1 << 11,  // Allow horizontal scrollbar to appear (off by default). You may use SetNextWindowContentSize(ImVec2(width,0.0f)); prior to calling Begin() to specify width. Read code in imgui_demo in the \"Horizontal Scrolling\" section.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_NoFocusOnAppearing = 1 << 12,  // Disable taking focus when transitioning from hidden to visible state\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_NoBringToFrontOnFocus = 1 << 13,  // Disable bringing window to front when taking focus (e.g. clicking on it or programatically giving it focus)\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_AlwaysVerticalScrollbar = 1 << 14,  // Always show vertical scrollbar (even if ContentSize.y < Size.y)\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_AlwaysHorizontalScrollbar = 1 << 15,  // Always show horizontal scrollbar (even if ContentSize.x < Size.x)\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_AlwaysUseWindowPadding = 1 << 16,  // Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient)\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiWindowFlags_ResizeFromAnySide = 1 << 17,  // (WIP) Enable resize from any corners and borders. Your back-end needs to honor the different values of io.MouseCursor set by imgui.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // [Internal]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiWindowFlags_ChildWindow = 1 << 24,  // Don't use! For internal use by BeginChild()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiWindowFlags_Tooltip = 1 << 25,  // Don't use! For internal use by BeginTooltip()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiWindowFlags_Popup = 1 << 26,  // Don't use! For internal use by BeginPopup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiWindowFlags_Modal = 1 << 27,  // Don't use! For internal use by BeginPopupModal()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiWindowFlags_ChildMenu = 1 << 28   // Don't use! For internal use by BeginMenu()\n};\n\n// Flags for ImGui::InputText()\nenum ImGuiInputTextFlags_\n{\n\tImGuiInputTextFlags_CharsDecimal = 1 << 0,   // Allow 0123456789.+-*/\n\tImGuiInputTextFlags_CharsHexadecimal = 1 << 1,   // Allow 0123456789ABCDEFabcdef\n\tImGuiInputTextFlags_CharsUppercase = 1 << 2,   // Turn a..z into A..Z\n\tImGuiInputTextFlags_CharsNoBlank = 1 << 3,   // Filter out spaces, tabs\n\tImGuiInputTextFlags_AutoSelectAll = 1 << 4,   // Select entire text when first taking mouse focus\n\tImGuiInputTextFlags_EnterReturnsTrue = 1 << 5,   // Return 'true' when Enter is pressed (as opposed to when the value was modified)\n\tImGuiInputTextFlags_CallbackCompletion = 1 << 6,   // Call user function on pressing TAB (for completion handling)\n\tImGuiInputTextFlags_CallbackHistory = 1 << 7,   // Call user function on pressing Up/Down arrows (for history handling)\n\tImGuiInputTextFlags_CallbackAlways = 1 << 8,   // Call user function every time. User code may query cursor position, modify text buffer.\n\tImGuiInputTextFlags_CallbackCharFilter = 1 << 9,   // Call user function to filter character. Modify data->EventChar to replace/filter input, or return 1 to discard character.\n\tImGuiInputTextFlags_AllowTabInput = 1 << 10,  // Pressing TAB input a '\\t' character into the text field\n\tImGuiInputTextFlags_CtrlEnterForNewLine = 1 << 11,  // In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite: unfocus with Ctrl+Enter, add line with Enter).\n\tImGuiInputTextFlags_NoHorizontalScroll = 1 << 12,  // Disable following the cursor horizontally\n\tImGuiInputTextFlags_AlwaysInsertMode = 1 << 13,  // Insert mode\n\tImGuiInputTextFlags_ReadOnly = 1 << 14,  // Read-only mode\n\tImGuiInputTextFlags_Password = 1 << 15,  // Password mode, display all characters as '*'\n\tImGuiInputTextFlags_NoUndoRedo = 1 << 16,  // Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().\n\t\t\t\t\t\t\t\t\t\t\t   // [Internal]\n\t\t\t\t\t\t\t\t\t\t\t   ImGuiInputTextFlags_Multiline = 1 << 20   // For internal use by InputTextMultiline()\n};\n\n// Flags for ImGui::TreeNodeEx(), ImGui::CollapsingHeader*()\nenum ImGuiTreeNodeFlags_\n{\n\tImGuiTreeNodeFlags_Selected = 1 << 0,   // Draw as selected\n\tImGuiTreeNodeFlags_Framed = 1 << 1,   // Full colored frame (e.g. for CollapsingHeader)\n\tImGuiTreeNodeFlags_AllowItemOverlap = 1 << 2,   // Hit testing to allow subsequent widgets to overlap this one\n\tImGuiTreeNodeFlags_NoTreePushOnOpen = 1 << 3,   // Don't do a TreePush() when open (e.g. for CollapsingHeader) = no extra indent nor pushing on ID stack\n\tImGuiTreeNodeFlags_NoAutoOpenOnLog = 1 << 4,   // Don't automatically and temporarily open node when Logging is active (by default logging will automatically open tree nodes)\n\tImGuiTreeNodeFlags_DefaultOpen = 1 << 5,   // Default node to be open\n\tImGuiTreeNodeFlags_OpenOnDoubleClick = 1 << 6,   // Need double-click to open node\n\tImGuiTreeNodeFlags_OpenOnArrow = 1 << 7,   // Only open when clicking on the arrow part. If ImGuiTreeNodeFlags_OpenOnDoubleClick is also set, single-click arrow or double-click all box to open.\n\tImGuiTreeNodeFlags_Leaf = 1 << 8,   // No collapsing, no arrow (use as a convenience for leaf nodes). \n\tImGuiTreeNodeFlags_Bullet = 1 << 9,   // Display a bullet instead of arrow\n\tImGuiTreeNodeFlags_FramePadding = 1 << 10,  // Use FramePadding (even for an unframed text node) to vertically align text baseline to regular widget height. Equivalent to calling AlignTextToFramePadding().\n\t\t\t\t\t\t\t\t\t\t\t\t//ImGuITreeNodeFlags_SpanAllAvailWidth  = 1 << 11,  // FIXME: TODO: Extend hit box horizontally even if not framed\n\t\t\t\t\t\t\t\t\t\t\t\t//ImGuiTreeNodeFlags_NoScrollOnOpen     = 1 << 12,  // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible\n\t\t\t\t\t\t\t\t\t\t\t\tImGuiTreeNodeFlags_CollapsingHeader = ImGuiTreeNodeFlags_Framed | ImGuiTreeNodeFlags_NoAutoOpenOnLog\n\n\t\t\t\t\t\t\t\t\t\t\t\t// Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\t, ImGuiTreeNodeFlags_AllowOverlapMode = ImGuiTreeNodeFlags_AllowItemOverlap\n#endif\n};\n\n// Flags for ImGui::Selectable()\nenum ImGuiSelectableFlags_\n{\n\tImGuiSelectableFlags_DontClosePopups = 1 << 0,   // Clicking this don't close parent popup window\n\tImGuiSelectableFlags_SpanAllColumns = 1 << 1,   // Selectable frame can span all columns (text will still fit in current column)\n\tImGuiSelectableFlags_AllowDoubleClick = 1 << 2    // Generate press events on double clicks too\n};\n\n// Flags for ImGui::BeginCombo()\nenum ImGuiComboFlags_\n{\n\tImGuiComboFlags_PopupAlignLeft = 1 << 0,   // Align the popup toward the left by default\n\tImGuiComboFlags_HeightSmall = 1 << 1,   // Max ~4 items visible. Tip: If you want your combo popup to be a specific size you can use SetNextWindowSizeConstraints() prior to calling BeginCombo()\n\tImGuiComboFlags_HeightRegular = 1 << 2,   // Max ~8 items visible (default)\n\tImGuiComboFlags_HeightLarge = 1 << 3,   // Max ~20 items visible\n\tImGuiComboFlags_HeightLargest = 1 << 4,   // As many fitting items as possible\n\tImGuiComboFlags_HeightMask_ = ImGuiComboFlags_HeightSmall | ImGuiComboFlags_HeightRegular | ImGuiComboFlags_HeightLarge | ImGuiComboFlags_HeightLargest\n};\n\n// Flags for ImGui::IsWindowFocused()\nenum ImGuiFocusedFlags_\n{\n\tImGuiFocusedFlags_ChildWindows = 1 << 0,   // IsWindowFocused(): Return true if any children of the window is focused\n\tImGuiFocusedFlags_RootWindow = 1 << 1,   // IsWindowFocused(): Test from root window (top most parent of the current hierarchy)\n\tImGuiFocusedFlags_AnyWindow = 1 << 2,   // IsWindowFocused(): Return true if any window is focused\n\tImGuiFocusedFlags_RootAndChildWindows = ImGuiFocusedFlags_RootWindow | ImGuiFocusedFlags_ChildWindows\n};\n\n// Flags for ImGui::IsItemHovered(), ImGui::IsWindowHovered()\nenum ImGuiHoveredFlags_\n{\n\tImGuiHoveredFlags_Default = 0,        // Return true if directly over the item/window, not obstructed by another window, not obstructed by an active popup or modal blocking inputs under them.\n\tImGuiHoveredFlags_ChildWindows = 1 << 0,   // IsWindowHovered() only: Return true if any children of the window is hovered\n\tImGuiHoveredFlags_RootWindow = 1 << 1,   // IsWindowHovered() only: Test from root window (top most parent of the current hierarchy)\n\tImGuiHoveredFlags_AnyWindow = 1 << 2,   // IsWindowHovered() only: Return true if any window is hovered\n\tImGuiHoveredFlags_AllowWhenBlockedByPopup = 1 << 3,   // Return true even if a popup window is normally blocking access to this item/window\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  //ImGuiHoveredFlags_AllowWhenBlockedByModal     = 1 << 4,   // Return true even if a modal popup window is normally blocking access to this item/window. FIXME-TODO: Unavailable yet.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiHoveredFlags_AllowWhenBlockedByActiveItem = 1 << 5,   // Return true even if an active item is blocking access to this item/window. Useful for Drag and Drop patterns.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiHoveredFlags_AllowWhenOverlapped = 1 << 6,   // Return true even if the position is overlapped by another window\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiHoveredFlags_RectOnly = ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem | ImGuiHoveredFlags_AllowWhenOverlapped,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiHoveredFlags_RootAndChildWindows = ImGuiHoveredFlags_RootWindow | ImGuiHoveredFlags_ChildWindows\n};\n\n// Flags for ImGui::BeginDragDropSource(), ImGui::AcceptDragDropPayload()\nenum ImGuiDragDropFlags_\n{\n\t// BeginDragDropSource() flags\n\tImGuiDragDropFlags_SourceNoPreviewTooltip = 1 << 0,       // By default, a successful call to BeginDragDropSource opens a tooltip so you can display a preview or description of the source contents. This flag disable this behavior.\n\tImGuiDragDropFlags_SourceNoDisableHover = 1 << 1,       // By default, when dragging we clear data so that IsItemHovered() will return true, to avoid subsequent user code submitting tooltips. This flag disable this behavior so you can still call IsItemHovered() on the source item.\n\tImGuiDragDropFlags_SourceNoHoldToOpenOthers = 1 << 2,       // Disable the behavior that allows to open tree nodes and collapsing header by holding over them while dragging a source item.\n\tImGuiDragDropFlags_SourceAllowNullID = 1 << 3,       // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.\n\tImGuiDragDropFlags_SourceExtern = 1 << 4,       // External source (from outside of imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.\n\t\t\t\t\t\t\t\t\t\t\t\t\t// AcceptDragDropPayload() flags\n\t\t\t\t\t\t\t\t\t\t\t\t\tImGuiDragDropFlags_AcceptBeforeDelivery = 1 << 10,      // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.\n\t\t\t\t\t\t\t\t\t\t\t\t\tImGuiDragDropFlags_AcceptNoDrawDefaultRect = 1 << 11,      // Do not draw the default highlight rectangle when hovering over target.\n\t\t\t\t\t\t\t\t\t\t\t\t\tImGuiDragDropFlags_AcceptPeekOnly = ImGuiDragDropFlags_AcceptBeforeDelivery | ImGuiDragDropFlags_AcceptNoDrawDefaultRect  // For peeking ahead and inspecting the payload before delivery.\n};\n\n// Standard Drag and Drop payload types. You can define you own payload types using 12-characters long strings. Types starting with '_' are defined by Dear ImGui.\n#define IMGUI_PAYLOAD_TYPE_COLOR_3F     \"_COL3F\"    // float[3]     // Standard type for colors, without alpha. User code may use this type. \n#define IMGUI_PAYLOAD_TYPE_COLOR_4F     \"_COL4F\"    // float[4]     // Standard type for colors. User code may use this type.\n\n// User fill ImGuiIO.KeyMap[] array with indices into the ImGuiIO.KeysDown[512] array\nenum ImGuiKey_\n{\n\tImGuiKey_Tab,       // for tabbing through fields\n\tImGuiKey_LeftArrow, // for text edit\n\tImGuiKey_RightArrow,// for text edit\n\tImGuiKey_UpArrow,   // for text edit\n\tImGuiKey_DownArrow, // for text edit\n\tImGuiKey_PageUp,\n\tImGuiKey_PageDown,\n\tImGuiKey_Home,      // for text edit\n\tImGuiKey_End,       // for text edit\n\tImGuiKey_Insert,    // for text edit\n\tImGuiKey_Delete,    // for text edit\n\tImGuiKey_Backspace, // for text edit\n\tImGuiKey_Enter,     // for text edit\n\tImGuiKey_Escape,    // for text edit\n\tImGuiKey_A,         // for text edit CTRL+A: select all\n\tImGuiKey_C,         // for text edit CTRL+C: copy\n\tImGuiKey_V,         // for text edit CTRL+V: paste\n\tImGuiKey_X,         // for text edit CTRL+X: cut\n\tImGuiKey_Y,         // for text edit CTRL+Y: redo\n\tImGuiKey_Z,         // for text edit CTRL+Z: undo\n\tImGuiKey_COUNT\n};\n\n// Enumeration for PushStyleColor() / PopStyleColor()\nenum ImGuiCol_\n{\n\tImGuiCol_Text,\n\tImGuiCol_TextDisabled,\n\tImGuiCol_WindowBg,              // Background of normal windows\n\tImGuiCol_ChildBg,               // Background of child windows\n\tImGuiCol_PopupBg,               // Background of popups, menus, tooltips windows\n\tImGuiCol_Border,\n\tImGuiCol_BorderShadow,\n\tImGuiCol_FrameBg,               // Background of checkbox, radio button, plot, slider, text input\n\tImGuiCol_FrameBgHovered,\n\tImGuiCol_FrameBgActive,\n\tImGuiCol_TitleBg,\n\tImGuiCol_TitleBgActive,\n\tImGuiCol_TitleBgCollapsed,\n\tImGuiCol_MenuBarBg,\n\tImGuiCol_ScrollbarBg,\n\tImGuiCol_ScrollbarGrab,\n\tImGuiCol_ScrollbarGrabHovered,\n\tImGuiCol_ScrollbarGrabActive,\n\tImGuiCol_CheckMark,\n\tImGuiCol_SliderGrab,\n\tImGuiCol_SliderGrabActive,\n\tImGuiCol_Button,\n\tImGuiCol_ButtonHovered,\n\tImGuiCol_ButtonActive,\n\tImGuiCol_Header,\n\tImGuiCol_HeaderHovered,\n\tImGuiCol_HeaderActive,\n\tImGuiCol_Separator,\n\tImGuiCol_SeparatorHovered,\n\tImGuiCol_SeparatorActive,\n\tImGuiCol_ResizeGrip,\n\tImGuiCol_ResizeGripHovered,\n\tImGuiCol_ResizeGripActive,\n\tImGuiCol_CloseButton,\n\tImGuiCol_CloseButtonHovered,\n\tImGuiCol_CloseButtonActive,\n\tImGuiCol_PlotLines,\n\tImGuiCol_PlotLinesHovered,\n\tImGuiCol_PlotHistogram,\n\tImGuiCol_PlotHistogramHovered,\n\tImGuiCol_TextSelectedBg,\n\tImGuiCol_ModalWindowDarkening,  // darken entire screen when a modal window is active\n\tImGuiCol_DragDropTarget,\n\tImGuiCol_COUNT\n\n\t// Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\t//, ImGuiCol_ComboBg = ImGuiCol_PopupBg     // ComboBg has been merged with PopupBg, so a redirect isn't accurate.\n\t, ImGuiCol_ChildWindowBg = ImGuiCol_ChildBg, ImGuiCol_Column = ImGuiCol_Separator, ImGuiCol_ColumnHovered = ImGuiCol_SeparatorHovered, ImGuiCol_ColumnActive = ImGuiCol_SeparatorActive\n#endif\n};\n\n// Enumeration for PushStyleVar() / PopStyleVar() to temporarily modify the ImGuiStyle structure.\n// NB: the enum only refers to fields of ImGuiStyle which makes sense to be pushed/popped inside UI code. During initialization, feel free to just poke into ImGuiStyle directly.\n// NB: if changing this enum, you need to update the associated internal table GStyleVarInfo[] accordingly. This is where we link enum values to members offset/type.\nenum ImGuiStyleVar_\n{\n\t// Enum name ......................// Member in ImGuiStyle structure (see ImGuiStyle for descriptions)\n\tImGuiStyleVar_Alpha,               // float     Alpha\n\tImGuiStyleVar_WindowPadding,       // ImVec2    WindowPadding\n\tImGuiStyleVar_WindowRounding,      // float     WindowRounding\n\tImGuiStyleVar_WindowBorderSize,    // float     WindowBorderSize\n\tImGuiStyleVar_WindowMinSize,       // ImVec2    WindowMinSize\n\tImGuiStyleVar_ChildRounding,       // float     ChildRounding\n\tImGuiStyleVar_ChildBorderSize,     // float     ChildBorderSize\n\tImGuiStyleVar_PopupRounding,       // float     PopupRounding\n\tImGuiStyleVar_PopupBorderSize,     // float     PopupBorderSize\n\tImGuiStyleVar_FramePadding,        // ImVec2    FramePadding\n\tImGuiStyleVar_FrameRounding,       // float     FrameRounding\n\tImGuiStyleVar_FrameBorderSize,     // float     FrameBorderSize\n\tImGuiStyleVar_ItemSpacing,         // ImVec2    ItemSpacing\n\tImGuiStyleVar_ItemInnerSpacing,    // ImVec2    ItemInnerSpacing\n\tImGuiStyleVar_IndentSpacing,       // float     IndentSpacing\n\tImGuiStyleVar_GrabMinSize,         // float     GrabMinSize\n\tImGuiStyleVar_ButtonTextAlign,     // ImVec2    ButtonTextAlign\n\tImGuiStyleVar_Count_\n\n\t// Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\t, ImGuiStyleVar_ChildWindowRounding = ImGuiStyleVar_ChildRounding\n#endif\n};\n\n// Enumeration for ColorEdit3() / ColorEdit4() / ColorPicker3() / ColorPicker4() / ColorButton()\nenum ImGuiColorEditFlags_\n{\n\tImGuiColorEditFlags_NoAlpha = 1 << 1,   //              // ColorEdit, ColorPicker, ColorButton: ignore Alpha component (read 3 components from the input pointer).\n\tImGuiColorEditFlags_NoPicker = 1 << 2,   //              // ColorEdit: disable picker when clicking on colored square.\n\tImGuiColorEditFlags_NoOptions = 1 << 3,   //              // ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.\n\tImGuiColorEditFlags_NoSmallPreview = 1 << 4,   //              // ColorEdit, ColorPicker: disable colored square preview next to the inputs. (e.g. to show only the inputs)\n\tImGuiColorEditFlags_NoInputs = 1 << 5,   //              // ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview colored square).\n\tImGuiColorEditFlags_NoTooltip = 1 << 6,   //              // ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.\n\tImGuiColorEditFlags_NoLabel = 1 << 7,   //              // ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).\n\tImGuiColorEditFlags_NoSidePreview = 1 << 8,   //              // ColorPicker: disable bigger color preview on right side of the picker, use small colored square preview instead.\n\t\t\t\t\t\t\t\t\t\t\t\t  // User Options (right-click on widget to change some of them). You can set application defaults using SetColorEditOptions(). The idea is that you probably don't want to override them in most of your calls, let the user choose and/or call SetColorEditOptions() during startup.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_AlphaBar = 1 << 9,   //              // ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_AlphaPreview = 1 << 10,  //              // ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_AlphaPreviewHalf = 1 << 11,  //              // ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_HDR = 1 << 12,  //              // (WIP) ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_RGB = 1 << 13,  // [Inputs]     // ColorEdit: choose one among RGB/HSV/HEX. ColorPicker: choose any combination using RGB/HSV/HEX.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_HSV = 1 << 14,  // [Inputs]     // \"\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_HEX = 1 << 15,  // [Inputs]     // \"\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_Uint8 = 1 << 16,  // [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0..255. \n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_Float = 1 << 17,  // [DataType]   // ColorEdit, ColorPicker, ColorButton: _display_ values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_PickerHueBar = 1 << 18,  // [PickerMode] // ColorPicker: bar for Hue, rectangle for Sat/Value.\n\t\t\t\t\t\t\t\t\t\t\t\t  ImGuiColorEditFlags_PickerHueWheel = 1 << 19,  // [PickerMode] // ColorPicker: wheel for Hue, triangle for Sat/Value.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // Internals/Masks\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiColorEditFlags__InputsMask = ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_HSV | ImGuiColorEditFlags_HEX,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiColorEditFlags__DataTypeMask = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_Float,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiColorEditFlags__PickerMask = ImGuiColorEditFlags_PickerHueWheel | ImGuiColorEditFlags_PickerHueBar,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ImGuiColorEditFlags__OptionsDefault = ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_RGB | ImGuiColorEditFlags_PickerHueBar    // Change application default using SetColorEditOptions()\n};\n\n// Enumeration for GetMouseCursor()\nenum ImGuiMouseCursor_\n{\n\tImGuiMouseCursor_None = -1,\n\tImGuiMouseCursor_Arrow = 0,\n\tImGuiMouseCursor_TextInput,         // When hovering over InputText, etc.\n\tImGuiMouseCursor_Move,              // Unused\n\tImGuiMouseCursor_ResizeNS,          // When hovering over an horizontal border\n\tImGuiMouseCursor_ResizeEW,          // When hovering over a vertical border or a column\n\tImGuiMouseCursor_ResizeNESW,        // When hovering over the bottom-left corner of a window\n\tImGuiMouseCursor_ResizeNWSE,        // When hovering over the bottom-right corner of a window\n\tImGuiMouseCursor_Count_\n};\n\n// Condition for ImGui::SetWindow***(), SetNextWindow***(), SetNextTreeNode***() functions\n// All those functions treat 0 as a shortcut to ImGuiCond_Always. From the point of view of the user use this as an enum (don't combine multiple values into flags).\nenum ImGuiCond_\n{\n\tImGuiCond_Always = 1 << 0,   // Set the variable\n\tImGuiCond_Once = 1 << 1,   // Set the variable once per runtime session (only the first call with succeed)\n\tImGuiCond_FirstUseEver = 1 << 2,   // Set the variable if the window has no saved data (if doesn't exist in the .ini file)\n\tImGuiCond_Appearing = 1 << 3    // Set the variable if the window is appearing after being hidden/inactive (or the first time)\n\n\t\t\t\t\t\t\t\t\t// Obsolete names (will be removed)\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\t, ImGuiSetCond_Always = ImGuiCond_Always, ImGuiSetCond_Once = ImGuiCond_Once, ImGuiSetCond_FirstUseEver = ImGuiCond_FirstUseEver, ImGuiSetCond_Appearing = ImGuiCond_Appearing\n#endif\n};\n\nstruct ImGuiStyle\n{\n\tfloat       Alpha;                      // Global alpha applies to everything in ImGui\n\tImVec2      WindowPadding;              // Padding within a window\n\tfloat       WindowRounding;             // Radius of window corners rounding. Set to 0.0f to have rectangular windows\n\tfloat       WindowBorderSize;           // Thickness of border around windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)\n\tImVec2      WindowMinSize;              // Minimum window size\n\tImVec2      WindowTitleAlign;           // Alignment for title bar text. Defaults to (0.0f,0.5f) for left-aligned,vertically centered.\n\tfloat       ChildRounding;              // Radius of child window corners rounding. Set to 0.0f to have rectangular windows.\n\tfloat       ChildBorderSize;            // Thickness of border around child windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)\n\tfloat       PopupRounding;              // Radius of popup window corners rounding.\n\tfloat       PopupBorderSize;            // Thickness of border around popup windows. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)\n\tImVec2      FramePadding;               // Padding within a framed rectangle (used by most widgets)\n\tfloat       FrameRounding;              // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).\n\tfloat       FrameBorderSize;            // Thickness of border around frames. Generally set to 0.0f or 1.0f. (Other values are not well tested and more CPU/GPU costly)\n\tImVec2      ItemSpacing;                // Horizontal and vertical spacing between widgets/lines\n\tImVec2      ItemInnerSpacing;           // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)\n\tImVec2      TouchExtraPadding;          // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!\n\tfloat       IndentSpacing;              // Horizontal indentation when e.g. entering a tree node. Generally == (FontSize + FramePadding.x*2).\n\tfloat       ColumnsMinSpacing;          // Minimum horizontal spacing between two columns\n\tfloat       ScrollbarSize;              // Width of the vertical scrollbar, Height of the horizontal scrollbar\n\tfloat       ScrollbarRounding;          // Radius of grab corners for scrollbar\n\tfloat       GrabMinSize;                // Minimum width/height of a grab box for slider/scrollbar.\n\tfloat       GrabRounding;               // Radius of grabs corners rounding. Set to 0.0f to have rectangular slider grabs.\n\tImVec2      ButtonTextAlign;            // Alignment of button text when button is larger than text. Defaults to (0.5f,0.5f) for horizontally+vertically centered.\n\tImVec2      DisplayWindowPadding;       // Window positions are clamped to be visible within the display area by at least this amount. Only covers regular windows.\n\tImVec2      DisplaySafeAreaPadding;     // If you cannot see the edge of your screen (e.g. on a TV) increase the safe area padding. Covers popups/tooltips as well regular windows.\n\tbool        AntiAliasedLines;           // Enable anti-aliasing on lines/borders. Disable if you are really tight on CPU/GPU.\n\tbool        AntiAliasedFill;            // Enable anti-aliasing on filled shapes (rounded rectangles, circles, etc.)\n\tfloat       CurveTessellationTol;       // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.\n\tImVec4      Colors[ImGuiCol_COUNT];\n\n\tIMGUI_API ImGuiStyle();\n\tIMGUI_API void ScaleAllSizes(float scale_factor);\n};\n\n// This is where your app communicate with ImGui. Access via ImGui::GetIO().\n// Read 'Programmer guide' section in .cpp file for general usage.\nstruct ImGuiIO\n{\n\t//------------------------------------------------------------------\n\t// Settings (fill once)                 // Default value:\n\t//------------------------------------------------------------------\n\n\tImVec2        DisplaySize;              // <unset>              // Display size, in pixels. For clamping windows positions.\n\tfloat         DeltaTime;                // = 1.0f/60.0f         // Time elapsed since last frame, in seconds.\n\tfloat         IniSavingRate;            // = 5.0f               // Maximum time between saving positions/sizes to .ini file, in seconds.\n\tconst char* IniFilename;              // = \"imgui.ini\"        // Path to .ini file. NULL to disable .ini saving.\n\tconst char* LogFilename;              // = \"imgui_log.txt\"    // Path to .log file (default parameter to ImGui::LogToFile when no file is specified).\n\tfloat         MouseDoubleClickTime;     // = 0.30f              // Time for a double-click, in seconds.\n\tfloat         MouseDoubleClickMaxDist;  // = 6.0f               // Distance threshold to stay in to validate a double-click, in pixels.\n\tfloat         MouseDragThreshold;       // = 6.0f               // Distance threshold before considering we are dragging.\n\tint           KeyMap[ImGuiKey_COUNT];   // <unset>              // Map of indices into the KeysDown[512] entries array which represent your \"native\" keyboard state.\n\tfloat         KeyRepeatDelay;           // = 0.250f             // When holding a key/button, time before it starts repeating, in seconds (for buttons in Repeat mode, etc.).\n\tfloat         KeyRepeatRate;            // = 0.050f             // When holding a key/button, rate at which it repeats, in seconds.\n\tvoid* UserData;                 // = NULL               // Store your own data for retrieval by callbacks.\n\n\tImFontAtlas* Fonts;                    // <auto>               // Load and assemble one or more fonts into a single tightly packed texture. Output to Fonts array.\n\tfloat         FontGlobalScale;          // = 1.0f               // Global scale all fonts\n\tbool          FontAllowUserScaling;     // = false              // Allow user scaling text of individual window with CTRL+Wheel.\n\tImFont* FontDefault;              // = NULL               // Font to use on NewFrame(). Use NULL to uses Fonts->Fonts[0].\n\tImVec2        DisplayFramebufferScale;  // = (1.0f,1.0f)        // For retina display or other situations where window coordinates are different from framebuffer coordinates. User storage only, presently not used by ImGui.\n\tImVec2        DisplayVisibleMin;        // <unset> (0.0f,0.0f)  // If you use DisplaySize as a virtual space larger than your screen, set DisplayVisibleMin/Max to the visible area.\n\tImVec2        DisplayVisibleMax;        // <unset> (0.0f,0.0f)  // If the values are the same, we defaults to Min=(0.0f) and Max=DisplaySize\n\n\t\t\t\t\t\t\t\t\t\t\t// Advanced/subtle behaviors\n\tbool          OptMacOSXBehaviors;       // = defined(__APPLE__) // OS X style: Text editing cursor movement using Alt instead of Ctrl, Shortcuts using Cmd/Super instead of Ctrl, Line/Text Start and End using Cmd+Arrows instead of Home/End, Double click selects by word instead of selecting whole text, Multi-selection in lists uses Cmd/Super instead of Ctrl\n\tbool          OptCursorBlink;           // = true               // Enable blinking cursor, for users who consider it annoying.\n\n\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t// Settings (User Functions)\n\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\n\t\t\t\t\t\t\t\t\t\t\t// Rendering function, will be called in Render().\n\t\t\t\t\t\t\t\t\t\t\t// Alternatively you can keep this to NULL and call GetDrawData() after Render() to get the same pointer.\n\t\t\t\t\t\t\t\t\t\t\t// See example applications if you are unsure of how to implement this.\n\tvoid(*RenderDrawListsFn)(ImDrawData* data);\n\n\t// Optional: access OS clipboard\n\t// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)\n\tconst char* (*GetClipboardTextFn)(void* user_data);\n\tvoid(*SetClipboardTextFn)(void* user_data, const char* text);\n\tvoid* ClipboardUserData;\n\n\t// Optional: override memory allocations. MemFreeFn() may be called with a NULL pointer.\n\t// (default to posix malloc/free)\n\tvoid* (*MemAllocFn)(size_t sz);\n\tvoid(*MemFreeFn)(void* ptr);\n\n\t// Optional: notify OS Input Method Editor of the screen position of your cursor for text input position (e.g. when using Japanese/Chinese IME in Windows)\n\t// (default to use native imm32 api on Windows)\n\tvoid(*ImeSetInputScreenPosFn)(int x, int y);\n\tvoid* ImeWindowHandle;            // (Windows) Set this to your HWND to get automatic IME cursor positioning.\n\n\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t// Input - Fill before calling NewFrame()\n\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\n\tImVec2      MousePos;                   // Mouse position, in pixels. Set to ImVec2(-FLT_MAX,-FLT_MAX) if mouse is unavailable (on another screen, etc.)\n\tbool        MouseDown[5];               // Mouse buttons: left, right, middle + extras. ImGui itself mostly only uses left button (BeginPopupContext** are using right button). Others buttons allows us to track if the mouse is being used by your application + available to user as a convenience via IsMouse** API.\n\tfloat       MouseWheel;                 // Mouse wheel: 1 unit scrolls about 5 lines text.\n\tbool        MouseDrawCursor;            // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).\n\tbool        KeyCtrl;                    // Keyboard modifier pressed: Control\n\tbool        KeyShift;                   // Keyboard modifier pressed: Shift\n\tbool        KeyAlt;                     // Keyboard modifier pressed: Alt\n\tbool        KeySuper;                   // Keyboard modifier pressed: Cmd/Super/Windows\n\tbool        KeysDown[512];              // Keyboard keys that are pressed (ideally left in the \"native\" order your engine has access to keyboard keys, so you can use your own defines/enums for keys).\n\tImWchar     InputCharacters[16 + 1];      // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.\n\n\t\t\t\t\t\t\t\t\t\t\t  // Functions\n\tIMGUI_API void AddInputCharacter(ImWchar c);                        // Add new character into InputCharacters[]\n\tIMGUI_API void AddInputCharactersUTF8(const char* utf8_chars);      // Add new characters into InputCharacters[] from an UTF-8 string\n\tinline void    ClearInputCharacters() { InputCharacters[0] = 0; }   // Clear the text input buffer manually\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Output - Retrieve after calling NewFrame()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\n\tbool        WantCaptureMouse;           // When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application. This is set by ImGui when it wants to use your mouse (e.g. unclicked mouse is hovering a window, or a widget is active). \n\tbool        WantCaptureKeyboard;        // When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application. This is set by ImGui when it wants to use your keyboard inputs.\n\tbool        WantTextInput;              // Mobile/console: when io.WantTextInput is true, you may display an on-screen keyboard. This is set by ImGui when it wants textual keyboard input to happen (e.g. when a InputText widget is active).\n\tbool        WantMoveMouse;              // [BETA-NAV] MousePos has been altered, back-end should reposition mouse on next frame. Set only when 'NavMovesMouse=true'.\n\tfloat       Framerate;                  // Application framerate estimation, in frame per second. Solely for convenience. Rolling average estimation based on IO.DeltaTime over 120 frames\n\tint         MetricsAllocs;              // Number of active memory allocations\n\tint         MetricsRenderVertices;      // Vertices output during last call to Render()\n\tint         MetricsRenderIndices;       // Indices output during last call to Render() = number of triangles * 3\n\tint         MetricsActiveWindows;       // Number of visible root windows (exclude child windows)\n\tImVec2      MouseDelta;                 // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.\n\n\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t\t// [Internal] ImGui will maintain those fields. Forward compatibility not guaranteed!\n\t\t\t\t\t\t\t\t\t\t\t//------------------------------------------------------------------\n\n\tImVec2      MousePosPrev;               // Previous mouse position temporary storage (nb: not for public use, set to MousePos in NewFrame())\n\tImVec2      MouseClickedPos[5];         // Position at time of clicking\n\tfloat       MouseClickedTime[5];        // Time of last click (used to figure out double-click)\n\tbool        MouseClicked[5];            // Mouse button went from !Down to Down\n\tbool        MouseDoubleClicked[5];      // Has mouse button been double-clicked?\n\tbool        MouseReleased[5];           // Mouse button went from Down to !Down\n\tbool        MouseDownOwned[5];          // Track if button was clicked inside a window. We don't request mouse capture from the application if click started outside ImGui bounds.\n\tfloat       MouseDownDuration[5];       // Duration the mouse button has been down (0.0f == just clicked)\n\tfloat       MouseDownDurationPrev[5];   // Previous time the mouse button has been down\n\tImVec2      MouseDragMaxDistanceAbs[5]; // Maximum distance, absolute, on each axis, of how much mouse has traveled from the clicking point\n\tfloat       MouseDragMaxDistanceSqr[5]; // Squared maximum distance of how much mouse has traveled from the clicking point\n\tfloat       KeysDownDuration[512];      // Duration the keyboard key has been down (0.0f == just pressed)\n\tfloat       KeysDownDurationPrev[512];  // Previous duration the key has been down\n\n\tIMGUI_API   ImGuiIO();\n};\n\n//-----------------------------------------------------------------------------\n// Obsolete functions (Will be removed! Read 'API BREAKING CHANGES' section in imgui.cpp for details)\n//-----------------------------------------------------------------------------\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\nnamespace ImGui\n{\n\t// OBSOLETED in 1.54 (from Dec 2017)\n\tstatic inline bool  IsAnyWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_AnyWindow); }\n\tstatic inline bool  IsAnyWindowHovered() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }\n\tstatic inline ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = 0.f) { (void)on_edge; (void)outward; IM_ASSERT(0); return pos; }\n\t// OBSOLETED in 1.53 (between Oct 2017 and Dec 2017)\n\tstatic inline void  ShowTestWindow() { return ShowDemoWindow(); }\n\tstatic inline bool  IsRootWindowFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootWindow); }\n\tstatic inline bool  IsRootWindowOrAnyChildFocused() { return IsWindowFocused(ImGuiFocusedFlags_RootAndChildWindows); }\n\tstatic inline void  SetNextWindowContentWidth(float w) { SetNextWindowContentSize(ImVec2(w, 0.0f)); }\n\t// OBSOLETED in 1.52 (between Aug 2017 and Oct 2017)\n\tbool                Begin(const char* name, bool* p_open, const ImVec2& size_on_first_use, float bg_alpha_override = -1.0f, ImGuiWindowFlags flags = 0); // Use SetNextWindowSize() instead if you want to set a window size.\n\tstatic inline bool  IsRootWindowOrAnyChildHovered() { return IsItemHovered(ImGuiHoveredFlags_RootAndChildWindows); }\n\tstatic inline void  AlignFirstTextHeightToWidgets() { AlignTextToFramePadding(); }\n\tstatic inline void  SetNextWindowPosCenter(ImGuiCond c = 0) { ImGuiIO& io = GetIO(); SetNextWindowPos(ImVec2(io.DisplaySize.x * 0.5f, io.DisplaySize.y * 0.5f), c, ImVec2(0.5f, 0.5f)); }\n\t// OBSOLETED in 1.51 (between Jun 2017 and Aug 2017)\n\tstatic inline bool  IsItemHoveredRect() { return IsItemHovered(ImGuiHoveredFlags_RectOnly); }\n\tstatic inline bool  IsPosHoveringAnyWindow(const ImVec2&) { IM_ASSERT(0); return false; } // This was misleading and partly broken. You probably want to use the ImGui::GetIO().WantCaptureMouse flag instead.\n\tstatic inline bool  IsMouseHoveringAnyWindow() { return IsWindowHovered(ImGuiHoveredFlags_AnyWindow); }\n\tstatic inline bool  IsMouseHoveringWindow() { return IsWindowHovered(ImGuiHoveredFlags_AllowWhenBlockedByPopup | ImGuiHoveredFlags_AllowWhenBlockedByActiveItem); }\n\t// OBSOLETED IN 1.49 (between Apr 2016 and May 2016)\n\tstatic inline bool  CollapsingHeader(const char* label, const char* str_id, bool framed = true, bool default_open = false) { (void)str_id; (void)framed; ImGuiTreeNodeFlags default_open_flags = 1 << 5; return CollapsingHeader(label, (default_open ? default_open_flags : 0)); }\n}\n#endif\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n// Lightweight std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).\n// Our implementation does NOT call C++ constructors/destructors. This is intentional and we do not require it. Do not use this class as a straight std::vector replacement in your code!\ntemplate<typename T>\nclass ImVector\n{\npublic:\n\tint                         Size;\n\tint                         Capacity;\n\tT* Data;\n\n\ttypedef T                   value_type;\n\ttypedef value_type* iterator;\n\ttypedef const value_type* const_iterator;\n\n\tinline ImVector() { Size = Capacity = 0; Data = NULL; }\n\tinline ~ImVector() { if (Data) ImGui::MemFree(Data); }\n\n\tinline bool                 empty() const { return Size == 0; }\n\tinline int                  size() const { return Size; }\n\tinline int                  capacity() const { return Capacity; }\n\n\tinline value_type& operator[](int i) { IM_ASSERT(i < Size); return Data[i]; }\n\tinline const value_type& operator[](int i) const { IM_ASSERT(i < Size); return Data[i]; }\n\n\tinline void                 clear() { if (Data) { Size = Capacity = 0; ImGui::MemFree(Data); Data = NULL; } }\n\tinline iterator             begin() { return Data; }\n\tinline const_iterator       begin() const { return Data; }\n\tinline iterator             end() { return Data + Size; }\n\tinline const_iterator       end() const { return Data + Size; }\n\tinline value_type& front() { IM_ASSERT(Size > 0); return Data[0]; }\n\tinline const value_type& front() const { IM_ASSERT(Size > 0); return Data[0]; }\n\tinline value_type& back() { IM_ASSERT(Size > 0); return Data[Size - 1]; }\n\tinline const value_type& back() const { IM_ASSERT(Size > 0); return Data[Size - 1]; }\n\tinline void                 swap(ImVector<T>& rhs) { int rhs_size = rhs.Size; rhs.Size = Size; Size = rhs_size; int rhs_cap = rhs.Capacity; rhs.Capacity = Capacity; Capacity = rhs_cap; value_type* rhs_data = rhs.Data; rhs.Data = Data; Data = rhs_data; }\n\n\tinline int                  _grow_capacity(int sz) const { int new_capacity = Capacity ? (Capacity + Capacity / 2) : 8; return new_capacity > sz ? new_capacity : sz; }\n\n\tinline void                 resize(int new_size) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); Size = new_size; }\n\tinline void                 resize(int new_size, const T& v) { if (new_size > Capacity) reserve(_grow_capacity(new_size)); if (new_size > Size) for (int n = Size; n < new_size; n++) Data[n] = v; Size = new_size; }\n\tinline void                 reserve(int new_capacity)\n\t{\n\t\tif (new_capacity <= Capacity)\n\t\t\treturn;\n\t\tT* new_data = (value_type*)ImGui::MemAlloc((size_t)new_capacity * sizeof(T));\n\t\tif (Data)\n\t\t\tmemcpy(new_data, Data, (size_t)Size * sizeof(T));\n\t\tImGui::MemFree(Data);\n\t\tData = new_data;\n\t\tCapacity = new_capacity;\n\t}\n\n\tinline void                 push_back(const value_type& v) { if (Size == Capacity) reserve(_grow_capacity(Size + 1)); Data[Size++] = v; }\n\tinline void                 pop_back() { IM_ASSERT(Size > 0); Size--; }\n\tinline void                 push_front(const value_type& v) { if (Size == 0) push_back(v); else insert(Data, v); }\n\n\tinline iterator             erase(const_iterator it) { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; memmove(Data + off, Data + off + 1, ((size_t)Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; }\n\tinline iterator             insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= Data && it <= Data + Size); const ptrdiff_t off = it - Data; if (Size == Capacity) reserve(_grow_capacity(Size + 1)); if (off < (int)Size) memmove(Data + off + 1, Data + off, ((size_t)Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; return Data + off; }\n\tinline bool                 contains(const value_type& v) const { const T* data = Data;  const T* data_end = Data + Size; while (data < data_end) if (*data++ == v) return true; return false; }\n};\n\n// Helper: execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.\n// Usage:\n//   static ImGuiOnceUponAFrame oaf;\n//   if (oaf)\n//       ImGui::Text(\"This will be called only once per frame\");\nstruct ImGuiOnceUponAFrame\n{\n\tImGuiOnceUponAFrame() { RefFrame = -1; }\n\tmutable int RefFrame;\n\toperator bool() const { int current_frame = ImGui::GetFrameCount(); if (RefFrame == current_frame) return false; RefFrame = current_frame; return true; }\n};\n\n// Helper macro for ImGuiOnceUponAFrame. Attention: The macro expands into 2 statement so make sure you don't use it within e.g. an if() statement without curly braces.\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS    // Will obsolete\n#define IMGUI_ONCE_UPON_A_FRAME     static ImGuiOnceUponAFrame imgui_oaf; if (imgui_oaf)\n#endif\n\n// Helper: Parse and apply text filters. In format \"aaaaa[,bbbb][,ccccc]\"\nstruct ImGuiTextFilter\n{\n\tstruct TextRange\n\t{\n\t\tconst char* b;\n\t\tconst char* e;\n\n\t\tTextRange() { b = e = NULL; }\n\t\tTextRange(const char* _b, const char* _e) { b = _b; e = _e; }\n\t\tconst char* begin() const { return b; }\n\t\tconst char* end() const { return e; }\n\t\tbool empty() const { return b == e; }\n\t\tchar front() const { return *b; }\n\t\tstatic bool is_blank(char c) { return c == ' ' || c == '\\t'; }\n\t\tvoid trim_blanks() { while (b < e && is_blank(*b)) b++; while (e > b&& is_blank(*(e - 1))) e--; }\n\t\tIMGUI_API void split(char separator, ImVector<TextRange>& out);\n\t};\n\n\tchar                InputBuf[256];\n\tImVector<TextRange> Filters;\n\tint                 CountGrep;\n\n\tIMGUI_API           ImGuiTextFilter(const char* default_filter = \"\");\n\tIMGUI_API bool      Draw(const char* label = \"Filter (inc,-exc)\", float width = 0.0f);    // Helper calling InputText+Build\n\tIMGUI_API bool      PassFilter(const char* text, const char* text_end = NULL) const;\n\tIMGUI_API void      Build();\n\tvoid                Clear() { InputBuf[0] = 0; Build(); }\n\tbool                IsActive() const { return !Filters.empty(); }\n};\n\n// Helper: Text buffer for logging/accumulating text\nstruct ImGuiTextBuffer\n{\n\tImVector<char>      Buf;\n\n\tImGuiTextBuffer() { Buf.push_back(0); }\n\tinline char         operator[](int i) { return Buf.Data[i]; }\n\tconst char* begin() const { return &Buf.front(); }\n\tconst char* end() const { return &Buf.back(); }      // Buf is zero-terminated, so end() will point on the zero-terminator\n\tint                 size() const { return Buf.Size - 1; }\n\tbool                empty() { return Buf.Size <= 1; }\n\tvoid                clear() { Buf.clear(); Buf.push_back(0); }\n\tvoid                reserve(int capacity) { Buf.reserve(capacity); }\n\tconst char* c_str() const { return Buf.Data; }\n\tIMGUI_API void      appendf(const char* fmt, ...) IM_FMTARGS(2);\n\tIMGUI_API void      appendfv(const char* fmt, va_list args) IM_FMTLIST(2);\n};\n\n// Helper: Simple Key->value storage\n// Typically you don't have to worry about this since a storage is held within each Window.\n// We use it to e.g. store collapse state for a tree (Int 0/1), store color edit options. \n// This is optimized for efficient reading (dichotomy into a contiguous buffer), rare writing (typically tied to user interactions)\n// You can use it as custom user storage for temporary values. Declare your own storage if, for example:\n// - You want to manipulate the open/close state of a particular sub-tree in your interface (tree node uses Int 0/1 to store their state).\n// - You want to store custom debug data easily without adding or editing structures in your code (probably not efficient, but convenient)\n// Types are NOT stored, so it is up to you to make sure your Key don't collide with different types.\nstruct ImGuiStorage\n{\n\tstruct Pair\n\t{\n\t\tImGuiID key;\n\t\tunion { int val_i; float val_f; void* val_p; };\n\t\tPair(ImGuiID _key, int _val_i) { key = _key; val_i = _val_i; }\n\t\tPair(ImGuiID _key, float _val_f) { key = _key; val_f = _val_f; }\n\t\tPair(ImGuiID _key, void* _val_p) { key = _key; val_p = _val_p; }\n\t};\n\tImVector<Pair>      Data;\n\n\t// - Get***() functions find pair, never add/allocate. Pairs are sorted so a query is O(log N)\n\t// - Set***() functions find pair, insertion on demand if missing.\n\t// - Sorted insertion is costly, paid once. A typical frame shouldn't need to insert any new pair.\n\tvoid                Clear() { Data.clear(); }\n\tIMGUI_API int       GetInt(ImGuiID key, int default_val = 0) const;\n\tIMGUI_API void      SetInt(ImGuiID key, int val);\n\tIMGUI_API bool      GetBool(ImGuiID key, bool default_val = false) const;\n\tIMGUI_API void      SetBool(ImGuiID key, bool val);\n\tIMGUI_API float     GetFloat(ImGuiID key, float default_val = 0.0f) const;\n\tIMGUI_API void      SetFloat(ImGuiID key, float val);\n\tIMGUI_API void* GetVoidPtr(ImGuiID key) const; // default_val is NULL\n\tIMGUI_API void      SetVoidPtr(ImGuiID key, void* val);\n\n\t// - Get***Ref() functions finds pair, insert on demand if missing, return pointer. Useful if you intend to do Get+Set.\n\t// - References are only valid until a new value is added to the storage. Calling a Set***() function or a Get***Ref() function invalidates the pointer.\n\t// - A typical use case where this is convenient for quick hacking (e.g. add storage during a live Edit&Continue session if you can't modify existing struct)\n\t//      float* pvar = ImGui::GetFloatRef(key); ImGui::SliderFloat(\"var\", pvar, 0, 100.0f); some_var += *pvar;\n\tIMGUI_API int* GetIntRef(ImGuiID key, int default_val = 0);\n\tIMGUI_API bool* GetBoolRef(ImGuiID key, bool default_val = false);\n\tIMGUI_API float* GetFloatRef(ImGuiID key, float default_val = 0.0f);\n\tIMGUI_API void** GetVoidPtrRef(ImGuiID key, void* default_val = NULL);\n\n\t// Use on your own storage if you know only integer are being stored (open/close all tree nodes)\n\tIMGUI_API void      SetAllInt(int val);\n\n\t// For quicker full rebuild of a storage (instead of an incremental one), you may add all your contents and then sort once.\n\tIMGUI_API void      BuildSortByKey();\n};\n\n// Shared state of InputText(), passed to callback when a ImGuiInputTextFlags_Callback* flag is used and the corresponding callback is triggered.\nstruct ImGuiTextEditCallbackData\n{\n\tImGuiInputTextFlags EventFlag;      // One of ImGuiInputTextFlags_Callback* // Read-only\n\tImGuiInputTextFlags Flags;          // What user passed to InputText()      // Read-only\n\tvoid* UserData;       // What user passed to InputText()      // Read-only\n\tbool                ReadOnly;       // Read-only mode                       // Read-only\n\n\t\t\t\t\t\t\t\t\t\t// CharFilter event:\n\tImWchar             EventChar;      // Character input                      // Read-write (replace character or set to zero)\n\n\t\t\t\t\t\t\t\t\t\t// Completion,History,Always events:\n\t\t\t\t\t\t\t\t\t\t// If you modify the buffer contents make sure you update 'BufTextLen' and set 'BufDirty' to true.\n\tImGuiKey            EventKey;       // Key pressed (Up/Down/TAB)            // Read-only\n\tchar* Buf;            // Current text buffer                  // Read-write (pointed data only, can't replace the actual pointer)\n\tint                 BufTextLen;     // Current text length in bytes         // Read-write\n\tint                 BufSize;        // Maximum text length in bytes         // Read-only\n\tbool                BufDirty;       // Set if you modify Buf/BufTextLen!!   // Write\n\tint                 CursorPos;      //                                      // Read-write\n\tint                 SelectionStart; //                                      // Read-write (== to SelectionEnd when no selection)\n\tint                 SelectionEnd;   //                                      // Read-write\n\n\t\t\t\t\t\t\t\t\t\t// NB: Helper functions for text manipulation. Calling those function loses selection.\n\tIMGUI_API void    DeleteChars(int pos, int bytes_count);\n\tIMGUI_API void    InsertChars(int pos, const char* text, const char* text_end = NULL);\n\tbool              HasSelection() const { return SelectionStart != SelectionEnd; }\n};\n\n// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin().\n// NB: For basic min/max size constraint on each axis you don't need to use the callback! The SetNextWindowSizeConstraints() parameters are enough.\nstruct ImGuiSizeCallbackData\n{\n\tvoid* UserData;       // Read-only.   What user passed to SetNextWindowSizeConstraints()\n\tImVec2  Pos;            // Read-only.   Window position, for reference.\n\tImVec2  CurrentSize;    // Read-only.   Current window size.\n\tImVec2  DesiredSize;    // Read-write.  Desired size, based on user's mouse position. Write to this field to restrain resizing.\n};\n\n// Data payload for Drag and Drop operations\nstruct ImGuiPayload\n{\n\t// Members\n\tconst void* Data;               // Data (copied and owned by dear imgui)\n\tint             DataSize;           // Data size\n\n\t\t\t\t\t\t\t\t\t\t// [Internal]\n\tImGuiID         SourceId;           // Source item id\n\tImGuiID         SourceParentId;     // Source parent id (if available)\n\tint             DataFrameCount;     // Data timestamp\n\tchar            DataType[12 + 1];   // Data type tag (short user-supplied string, 12 characters max)\n\tbool            Preview;            // Set when AcceptDragDropPayload() was called and mouse has been hovering the target item (nb: handle overlapping drag targets)\n\tbool            Delivery;           // Set when AcceptDragDropPayload() was called and mouse button is released over the target item.\n\n\tImGuiPayload() { Clear(); }\n\tvoid Clear() { SourceId = SourceParentId = 0; Data = NULL; DataSize = 0; memset(DataType, 0, sizeof(DataType)); DataFrameCount = -1; Preview = Delivery = false; }\n\tbool IsDataType(const char* type) const { return DataFrameCount != -1 && strcmp(type, DataType) == 0; }\n\tbool IsPreview() const { return Preview; }\n\tbool IsDelivery() const { return Delivery; }\n};\n\n// Helpers macros to generate 32-bits encoded colors\n#ifdef IMGUI_USE_BGRA_PACKED_COLOR\n#define IM_COL32_R_SHIFT    16\n#define IM_COL32_G_SHIFT    8\n#define IM_COL32_B_SHIFT    0\n#define IM_COL32_A_SHIFT    24\n#define IM_COL32_A_MASK     0xFF000000\n#else\n#define IM_COL32_R_SHIFT    0\n#define IM_COL32_G_SHIFT    8\n#define IM_COL32_B_SHIFT    16\n#define IM_COL32_A_SHIFT    24\n#define IM_COL32_A_MASK     0xFF000000\n#endif\n#define IM_COL32(R,G,B,A)    (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT))\n#define IM_COL32_WHITE       IM_COL32(255,255,255,255)  // Opaque white = 0xFFFFFFFF\n#define IM_COL32_BLACK       IM_COL32(0,0,0,255)        // Opaque black\n#define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0)          // Transparent black = 0x00000000\n\n// ImColor() helper to implicity converts colors to either ImU32 (packed 4x1 byte) or ImVec4 (4x1 float)\n// Prefer using IM_COL32() macros if you want a guaranteed compile-time ImU32 for usage with ImDrawList API.\n// **Avoid storing ImColor! Store either u32 of ImVec4. This is not a full-featured color class. MAY OBSOLETE.\n// **None of the ImGui API are using ImColor directly but you can use it as a convenience to pass colors in either ImU32 or ImVec4 formats. Explicitly cast to ImU32 or ImVec4 if needed.\nstruct ImColor\n{\n\tImVec4              Value;\n\n\tImColor() { Value.x = Value.y = Value.z = Value.w = 0.0f; }\n\tImColor(int r, int g, int b, int a = 255) { float sc = 1.0f / 255.0f; Value.x = (float)r * sc; Value.y = (float)g * sc; Value.z = (float)b * sc; Value.w = (float)a * sc; }\n\tImColor(ImU32 rgba) { float sc = 1.0f / 255.0f; Value.x = (float)((rgba >> IM_COL32_R_SHIFT) & 0xFF)* sc; Value.y = (float)((rgba >> IM_COL32_G_SHIFT) & 0xFF)* sc; Value.z = (float)((rgba >> IM_COL32_B_SHIFT) & 0xFF)* sc; Value.w = (float)((rgba >> IM_COL32_A_SHIFT) & 0xFF)* sc; }\n\tImColor(float r, float g, float b, float a = 1.0f) { Value.x = r; Value.y = g; Value.z = b; Value.w = a; }\n\tImColor(const ImVec4& col) { Value = col; }\n\tinline operator ImU32() const { return ImGui::ColorConvertFloat4ToU32(Value); }\n\tinline operator ImVec4() const { return Value; }\n\n\t// FIXME-OBSOLETE: May need to obsolete/cleanup those helpers.\n\tinline void    SetHSV(float h, float s, float v, float a = 1.0f) { ImGui::ColorConvertHSVtoRGB(h, s, v, Value.x, Value.y, Value.z); Value.w = a; }\n\tstatic ImColor HSV(float h, float s, float v, float a = 1.0f) { float r, g, b; ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b); return ImColor(r, g, b, a); }\n};\n\n// Helper: Manually clip large list of items.\n// If you are submitting lots of evenly spaced items and you have a random access to the list, you can perform coarse clipping based on visibility to save yourself from processing those items at all.\n// The clipper calculates the range of visible items and advance the cursor to compensate for the non-visible items we have skipped. \n// ImGui already clip items based on their bounds but it needs to measure text size to do so. Coarse clipping before submission makes this cost and your own data fetching/submission cost null.\n// Usage:\n//     ImGuiListClipper clipper(1000);  // we have 1000 elements, evenly spaced.\n//     while (clipper.Step())\n//         for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)\n//             ImGui::Text(\"line number %d\", i);\n// - Step 0: the clipper let you process the first element, regardless of it being visible or not, so we can measure the element height (step skipped if we passed a known height as second arg to constructor).\n// - Step 1: the clipper infer height from first element, calculate the actual range of elements to display, and position the cursor before the first element.\n// - (Step 2: dummy step only required if an explicit items_height was passed to constructor or Begin() and user call Step(). Does nothing and switch to Step 3.)\n// - Step 3: the clipper validate that we have reached the expected Y position (corresponding to element DisplayEnd), advance the cursor to the end of the list and then returns 'false' to end the loop.\nstruct ImGuiListClipper\n{\n\tfloat   StartPosY;\n\tfloat   ItemsHeight;\n\tint     ItemsCount, StepNo, DisplayStart, DisplayEnd;\n\n\t// items_count:  Use -1 to ignore (you can call Begin later). Use INT_MAX if you don't know how many items you have (in which case the cursor won't be advanced in the final step).\n\t// items_height: Use -1.0f to be calculated automatically on first step. Otherwise pass in the distance between your items, typically GetTextLineHeightWithSpacing() or GetFrameHeightWithSpacing().\n\t// If you don't specify an items_height, you NEED to call Step(). If you specify items_height you may call the old Begin()/End() api directly, but prefer calling Step().\n\tImGuiListClipper(int items_count = -1, float items_height = -1.0f) { Begin(items_count, items_height); } // NB: Begin() initialize every fields (as we allow user to call Begin/End multiple times on a same instance if they want).\n\t~ImGuiListClipper() { IM_ASSERT(ItemsCount == -1); }      // Assert if user forgot to call End() or Step() until false.\n\n\tIMGUI_API bool Step();                                              // Call until it returns false. The DisplayStart/DisplayEnd fields will be set and you can process/draw those items.\n\tIMGUI_API void Begin(int items_count, float items_height = -1.0f);  // Automatically called by constructor if you passed 'items_count' or by Step() in Step 1.\n\tIMGUI_API void End();                                               // Automatically called on the last call of Step() that returns false.\n};\n\n//-----------------------------------------------------------------------------\n// Draw List\n// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.\n//-----------------------------------------------------------------------------\n\n// Draw callbacks for advanced uses.\n// NB- You most likely do NOT need to use draw callbacks just to create your own widget or customized UI rendering (you can poke into the draw list for that)\n// Draw callback may be useful for example, A) Change your GPU render state, B) render a complex 3D scene inside a UI element (without an intermediate texture/render target), etc.\n// The expected behavior from your rendering function is 'if (cmd.UserCallback != NULL) cmd.UserCallback(parent_list, cmd); else RenderTriangles()'\ntypedef void(*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* cmd);\n\n// Typically, 1 command = 1 GPU draw call (unless command is a callback)\nstruct ImDrawCmd\n{\n\tunsigned int    ElemCount;              // Number of indices (multiple of 3) to be rendered as triangles. Vertices are stored in the callee ImDrawList's vtx_buffer[] array, indices in idx_buffer[].\n\tImVec4          ClipRect;               // Clipping rectangle (x1, y1, x2, y2)\n\tImTextureID     TextureId;              // User-provided texture ID. Set by user in ImfontAtlas::SetTexID() for fonts or passed to Image*() functions. Ignore if never using images or multiple fonts atlas.\n\tImDrawCallback  UserCallback;           // If != NULL, call the function instead of rendering the vertices. clip_rect and texture_id will be set normally.\n\tvoid* UserCallbackData;       // The draw callback code can access this.\n\n\tImDrawCmd() { ElemCount = 0; ClipRect.x = ClipRect.y = ClipRect.z = ClipRect.w = 0.0f; TextureId = NULL; UserCallback = NULL; UserCallbackData = NULL; }\n};\n\n// Vertex index (override with '#define ImDrawIdx unsigned int' inside in imconfig.h)\n#ifndef ImDrawIdx\ntypedef unsigned short ImDrawIdx;\n#endif\n\n// Vertex layout\n#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT\nstruct ImDrawVert\n{\n\tImVec2  pos;\n\tImVec2  uv;\n\tImU32   col;\n};\n#else\n// You can override the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h\n// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.\n// The type has to be described within the macro (you can either declare the struct or use a typedef)\n// NOTE: IMGUI DOESN'T CLEAR THE STRUCTURE AND DOESN'T CALL A CONSTRUCTOR SO ANY CUSTOM FIELD WILL BE UNINITIALIZED. IF YOU ADD EXTRA FIELDS (SUCH AS A 'Z' COORDINATES) YOU WILL NEED TO CLEAR THEM DURING RENDER OR TO IGNORE THEM. \nIMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;\n#endif\n\n// Draw channels are used by the Columns API to \"split\" the render list into different channels while building, so items of each column can be batched together.\n// You can also use them to simulate drawing layers and submit primitives in a different order than how they will be rendered.\nstruct ImDrawChannel\n{\n\tImVector<ImDrawCmd>     CmdBuffer;\n\tImVector<ImDrawIdx>     IdxBuffer;\n};\n\nenum ImDrawCornerFlags_\n{\n\tImDrawCornerFlags_TopLeft = 1 << 0, // 0x1\n\tImDrawCornerFlags_TopRight = 1 << 1, // 0x2\n\tImDrawCornerFlags_BotLeft = 1 << 2, // 0x4\n\tImDrawCornerFlags_BotRight = 1 << 3, // 0x8\n\tImDrawCornerFlags_Top = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_TopRight,   // 0x3\n\tImDrawCornerFlags_Bot = ImDrawCornerFlags_BotLeft | ImDrawCornerFlags_BotRight,   // 0xC\n\tImDrawCornerFlags_Left = ImDrawCornerFlags_TopLeft | ImDrawCornerFlags_BotLeft,    // 0x5\n\tImDrawCornerFlags_Right = ImDrawCornerFlags_TopRight | ImDrawCornerFlags_BotRight,  // 0xA\n\tImDrawCornerFlags_All = 0xF     // In your function calls you may use ~0 (= all bits sets) instead of ImDrawCornerFlags_All, as a convenience\n};\n\nenum ImDrawListFlags_\n{\n\tImDrawListFlags_AntiAliasedLines = 1 << 0,\n\tImDrawListFlags_AntiAliasedFill = 1 << 1\n};\n\n// Draw command list\n// This is the low-level list of polygons that ImGui functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.\n// Each ImGui window contains its own ImDrawList. You can use ImGui::GetWindowDrawList() to access the current window draw list and draw custom primitives.\n// You can interleave normal ImGui:: calls and adding primitives to the current draw list.\n// All positions are generally in pixel coordinates (top-left at (0,0), bottom-right at io.DisplaySize), however you are totally free to apply whatever transformation matrix to want to the data (if you apply such transformation you'll want to apply it to ClipRect as well)\n// Important: Primitives are always added to the list and not culled (culling is done at higher-level by ImGui:: functions), if you use this API a lot consider coarse culling your drawn objects.\nstruct ImDrawList\n{\n\t// This is what you have to render\n\tImVector<ImDrawCmd>     CmdBuffer;          // Draw commands. Typically 1 command = 1 GPU draw call, unless the command is a callback.\n\tImVector<ImDrawIdx>     IdxBuffer;          // Index buffer. Each command consume ImDrawCmd::ElemCount of those\n\tImVector<ImDrawVert>    VtxBuffer;          // Vertex buffer.\n\n\t\t\t\t\t\t\t\t\t\t\t\t// [Internal, used while building lists]\n\tImDrawListFlags         Flags;              // Flags, you may poke into these to adjust anti-aliasing settings per-primitive.\n\tconst ImDrawListSharedData* _Data;          // Pointer to shared draw data (you can use ImGui::GetDrawListSharedData() to get the one from current ImGui context)\n\tconst char* _OwnerName;         // Pointer to owner window's name for debugging\n\tunsigned int            _VtxCurrentIdx;     // [Internal] == VtxBuffer.Size\n\tImDrawVert* _VtxWritePtr;       // [Internal] point within VtxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)\n\tImDrawIdx* _IdxWritePtr;       // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)\n\tImVector<ImVec4>        _ClipRectStack;     // [Internal]\n\tImVector<ImTextureID>   _TextureIdStack;    // [Internal]\n\tImVector<ImVec2>        _Path;              // [Internal] current path building\n\tint                     _ChannelsCurrent;   // [Internal] current channel number (0)\n\tint                     _ChannelsCount;     // [Internal] number of active channels (1+)\n\tImVector<ImDrawChannel> _Channels;          // [Internal] draw channels for columns API (not resized down so _ChannelsCount may be smaller than _Channels.Size)\n\n\tImDrawList(const ImDrawListSharedData* shared_data) { _Data = shared_data; _OwnerName = NULL; Clear(); }\n\t~ImDrawList() { ClearFreeMemory(); }\n\tIMGUI_API void  PushClipRect(ImVec2 clip_rect_min, ImVec2 clip_rect_max, bool intersect_with_current_clip_rect = false);  // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)\n\tIMGUI_API void  PushClipRectFullScreen();\n\tIMGUI_API void  PopClipRect();\n\tIMGUI_API void  PushTextureID(const ImTextureID& texture_id);\n\tIMGUI_API void  PopTextureID();\n\tinline ImVec2   GetClipRectMin() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.x, cr.y); }\n\tinline ImVec2   GetClipRectMax() const { const ImVec4& cr = _ClipRectStack.back(); return ImVec2(cr.z, cr.w); }\n\n\t// Primitives\n\tIMGUI_API void  AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);\n\tIMGUI_API void  AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All, float thickness = 1.0f);   // a: upper-left, b: lower-right, rounding_corners_flags: 4-bits corresponding to which corner to round\n\tIMGUI_API void  AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All);                     // a: upper-left, b: lower-right\n\tIMGUI_API void  AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left);\n\tIMGUI_API void  AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness = 1.0f);\n\tIMGUI_API void  AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col);\n\tIMGUI_API void  AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness = 1.0f);\n\tIMGUI_API void  AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);\n\tIMGUI_API void  AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12, float thickness = 1.0f);\n\tIMGUI_API void  AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);\n\tIMGUI_API void  AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL);\n\tIMGUI_API void  AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);\n\tIMGUI_API void  AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a = ImVec2(0, 0), const ImVec2& uv_b = ImVec2(1, 1), ImU32 col = 0xFFFFFFFF);\n\tIMGUI_API void  AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a = ImVec2(0, 0), const ImVec2& uv_b = ImVec2(1, 0), const ImVec2& uv_c = ImVec2(1, 1), const ImVec2& uv_d = ImVec2(0, 1), ImU32 col = 0xFFFFFFFF);\n\tIMGUI_API void  AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col, float rounding, int rounding_corners = ImDrawCornerFlags_All);\n\tIMGUI_API void  AddPolyline(const ImVec2* points, const int num_points, ImU32 col, bool closed, float thickness);\n\tIMGUI_API void  AddConvexPolyFilled(const ImVec2* points, const int num_points, ImU32 col);\n\tIMGUI_API void  AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments = 0);\n\n\t// Stateful path API, add points then finish with PathFill() or PathStroke()\n\tinline    void  PathClear() { _Path.resize(0); }\n\tinline    void  PathLineTo(const ImVec2& pos) { _Path.push_back(pos); }\n\tinline    void  PathLineToMergeDuplicate(const ImVec2& pos) { if (_Path.Size == 0 || memcmp(&_Path[_Path.Size - 1], &pos, 8) != 0) _Path.push_back(pos); }\n\tinline    void  PathFillConvex(ImU32 col) { AddConvexPolyFilled(_Path.Data, _Path.Size, col); PathClear(); }\n\tinline    void  PathStroke(ImU32 col, bool closed, float thickness = 1.0f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); PathClear(); }\n\tIMGUI_API void  PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments = 10);\n\tIMGUI_API void  PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12);                                // Use precomputed angles for a 12 steps circle\n\tIMGUI_API void  PathBezierCurveTo(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, int num_segments = 0);\n\tIMGUI_API void  PathRect(const ImVec2& rect_min, const ImVec2& rect_max, float rounding = 0.0f, int rounding_corners_flags = ImDrawCornerFlags_All);\n\n\t// Channels\n\t// - Use to simulate layers. By switching channels to can render out-of-order (e.g. submit foreground primitives before background primitives)\n\t// - Use to minimize draw calls (e.g. if going back-and-forth between multiple non-overlapping clipping rectangles, prefer to append into separate channels then merge at the end)\n\tIMGUI_API void  ChannelsSplit(int channels_count);\n\tIMGUI_API void  ChannelsMerge();\n\tIMGUI_API void  ChannelsSetCurrent(int channel_index);\n\n\t// Advanced\n\tIMGUI_API void  AddCallback(ImDrawCallback callback, void* callback_data);  // Your rendering function must check for 'UserCallback' in ImDrawCmd and call the function instead of rendering triangles.\n\tIMGUI_API void  AddDrawCmd();                                               // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Internal helpers\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// NB: all primitives needs to be reserved via PrimReserve() beforehand!\n\tIMGUI_API void  Clear();\n\tIMGUI_API void  ClearFreeMemory();\n\tIMGUI_API void  PrimReserve(int idx_count, int vtx_count);\n\tIMGUI_API void  PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col);      // Axis aligned rectangle (composed of two triangles)\n\tIMGUI_API void  PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);\n\tIMGUI_API void  PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col);\n\tinline    void  PrimWriteVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }\n\tinline    void  PrimWriteIdx(ImDrawIdx idx) { *_IdxWritePtr = idx; _IdxWritePtr++; }\n\tinline    void  PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }\n\tIMGUI_API void  UpdateClipRect();\n\tIMGUI_API void  UpdateTextureID();\n};\n\n// All draw data to render an ImGui frame\nstruct ImDrawData\n{\n\tbool            Valid;                  // Only valid after Render() is called and before the next NewFrame() is called.\n\tImDrawList** CmdLists;\n\tint             CmdListsCount;\n\tint             TotalVtxCount;          // For convenience, sum of all cmd_lists vtx_buffer.Size\n\tint             TotalIdxCount;          // For convenience, sum of all cmd_lists idx_buffer.Size\n\n\t\t\t\t\t\t\t\t\t\t\t// Functions\n\tImDrawData() { Clear(); }\n\tvoid Clear() { Valid = false; CmdLists = NULL; CmdListsCount = TotalVtxCount = TotalIdxCount = 0; } // Draw lists are owned by the ImGuiContext and only pointed to here.\n\tIMGUI_API void DeIndexAllBuffers();               // For backward compatibility or convenience: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!\n\tIMGUI_API void ScaleClipRects(const ImVec2& sc);  // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.\n};\n\nstruct ImFontConfig\n{\n\tvoid* FontData;                   //          // TTF/OTF data\n\tint             FontDataSize;               //          // TTF/OTF data size\n\tbool            FontDataOwnedByAtlas;       // true     // TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).\n\tint             FontNo;                     // 0        // Index of font within TTF/OTF file\n\tfloat           SizePixels;                 //          // Size in pixels for rasterizer.\n\tint             OversampleH, OversampleV;   // 3, 1     // Rasterize at higher quality for sub-pixel positioning. We don't use sub-pixel positions on the Y axis.\n\tbool            PixelSnapH;                 // false    // Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.\n\tImVec2          GlyphExtraSpacing;          // 0, 0     // Extra spacing (in pixels) between glyphs. Only X axis is supported for now.\n\tImVec2          GlyphOffset;                // 0, 0     // Offset all glyphs from this font input.\n\tconst ImWchar* GlyphRanges;                // NULL     // Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.\n\tbool            MergeMode;                  // false    // Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.\n\tunsigned int    RasterizerFlags;            // 0x00     // Settings for custom font rasterizer (e.g. ImGuiFreeType). Leave as zero if you aren't using one.\n\tfloat           RasterizerMultiply;         // 1.0f     // Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.\n\n\t\t\t\t\t\t\t\t\t\t\t\t// [Internal]\n\tchar            Name[32];                               // Name (strictly to ease debugging)\n\tImFont* DstFont;\n\n\tIMGUI_API ImFontConfig();\n};\n\nstruct ImFontGlyph\n{\n\tImWchar         Codepoint;          // 0x0000..0xFFFF\n\tfloat           AdvanceX;           // Distance to next character (= data from font + ImFontConfig::GlyphExtraSpacing.x baked in)\n\tfloat           X0, Y0, X1, Y1;     // Glyph corners\n\tfloat           U0, V0, U1, V1;     // Texture coordinates\n};\n\n// Load and rasterize multiple TTF/OTF fonts into a same texture.\n// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering.\n// We also add custom graphic data into the texture that serves for ImGui.\n//  1. (Optional) Call AddFont*** functions. If you don't call any, the default font will be loaded for you.\n//  2. Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data.\n//  3. Upload the pixels data into a texture within your graphics system.\n//  4. Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture. This value will be passed back to you during rendering to identify the texture.\n// IMPORTANT: If you pass a 'glyph_ranges' array to AddFont*** functions, you need to make sure that your array persist up until the ImFont is build (when calling GetTextData*** or Build()). We only copy the pointer, not the data.\nstruct ImFontAtlas\n{\n\tIMGUI_API ImFontAtlas();\n\tIMGUI_API ~ImFontAtlas();\n\tIMGUI_API ImFont* AddFont(const ImFontConfig* font_cfg);\n\tIMGUI_API ImFont* AddFontDefault(const ImFontConfig* font_cfg = NULL);\n\tIMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL);\n\tIMGUI_API ImFont* AddFontFromMemoryTTF(void* font_data, int font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // Note: Transfer ownership of 'ttf_data' to ImFontAtlas! Will be deleted after Build(). Set font_cfg->FontDataOwnedByAtlas to false to keep ownership.\n\tIMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* compressed_font_data, int compressed_font_size, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL); // 'compressed_font_data' still owned by caller. Compress with binary_to_compressed_c.cpp.\n\tIMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(const char* compressed_font_data_base85, float size_pixels, const ImFontConfig* font_cfg = NULL, const ImWchar* glyph_ranges = NULL);              // 'compressed_font_data_base85' still owned by caller. Compress with binary_to_compressed_c.cpp with -base85 parameter.\n\tIMGUI_API void              ClearTexData();             // Clear the CPU-side texture data. Saves RAM once the texture has been copied to graphics memory.\n\tIMGUI_API void              ClearInputData();           // Clear the input TTF data (inc sizes, glyph ranges)\n\tIMGUI_API void              ClearFonts();               // Clear the ImGui-side font data (glyphs storage, UV coordinates)\n\tIMGUI_API void              Clear();                    // Clear all\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Build atlas, retrieve pixel data.\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// User is in charge of copying the pixels into graphics memory (e.g. create a texture with your engine). Then store your texture handle with SetTexID().\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// RGBA32 format is provided for convenience and compatibility, but note that unless you use CustomRect to draw color data, the RGB pixels emitted from Fonts will all be white (~75% of waste). \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Pitch = Width * BytesPerPixels\n\tIMGUI_API bool              Build();                    // Build pixels data. This is called automatically for you by the GetTexData*** functions.\n\tIMGUI_API void              GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL);  // 1 byte per-pixel\n\tIMGUI_API void              GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel = NULL);  // 4 bytes-per-pixel\n\tvoid                        SetTexID(ImTextureID id) { TexID = id; }\n\n\t//-------------------------------------------\n\t// Glyph Ranges\n\t//-------------------------------------------\n\n\t// Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)\n\t// NB: Make sure that your string are UTF-8 and NOT in your local code page. In C++11, you can create UTF-8 string literal using the u8\"Hello world\" syntax. See FAQ for details.\n\tIMGUI_API const ImWchar* GetGlyphRangesDefault();    // Basic Latin, Extended Latin\n\tIMGUI_API const ImWchar* GetGlyphRangesKorean();     // Default + Korean characters\n\tIMGUI_API const ImWchar* GetGlyphRangesJapanese();   // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs\n\tIMGUI_API const ImWchar* GetGlyphRangesChinese();    // Default + Japanese + full set of about 21000 CJK Unified Ideographs\n\tIMGUI_API const ImWchar* GetGlyphRangesCyrillic();   // Default + about 400 Cyrillic characters\n\tIMGUI_API const ImWchar* GetGlyphRangesThai();       // Default + Thai characters\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Helpers to build glyph ranges from text data. Feed your application strings/characters to it then call BuildRanges().\n\tstruct GlyphRangesBuilder\n\t{\n\t\tImVector<unsigned char> UsedChars;  // Store 1-bit per Unicode code point (0=unused, 1=used)\n\t\tGlyphRangesBuilder() { UsedChars.resize(0x10000 / 8); memset(UsedChars.Data, 0, 0x10000 / 8); }\n\t\tbool           GetBit(int n) { return (UsedChars[n >> 3] & (1 << (n & 7))) != 0; }\n\t\tvoid           SetBit(int n) { UsedChars[n >> 3] |= 1 << (n & 7); }  // Set bit 'c' in the array\n\t\tvoid           AddChar(ImWchar c) { SetBit(c); }                          // Add character\n\t\tIMGUI_API void AddText(const char* text, const char* text_end = NULL);      // Add string (each character of the UTF-8 string are added)\n\t\tIMGUI_API void AddRanges(const ImWchar* ranges);                            // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault) to force add all of ASCII/Latin+Ext\n\t\tIMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges);                  // Output new ranges\n\t};\n\n\t//-------------------------------------------\n\t// Custom Rectangles/Glyphs API\n\t//-------------------------------------------\n\n\t// You can request arbitrary rectangles to be packed into the atlas, for your own purposes. After calling Build(), you can query the rectangle position and render your pixels.\n\t// You can also request your rectangles to be mapped as font glyph (given a font + Unicode point), so you can render e.g. custom colorful icons and use them as regular glyphs.\n\tstruct CustomRect\n\t{\n\t\tunsigned int    ID;             // Input    // User ID. Use <0x10000 to map into a font glyph, >=0x10000 for other/internal/custom texture data.\n\t\tunsigned short  Width, Height;  // Input    // Desired rectangle dimension\n\t\tunsigned short  X, Y;           // Output   // Packed position in Atlas\n\t\tfloat           GlyphAdvanceX;  // Input    // For custom font glyphs only (ID<0x10000): glyph xadvance\n\t\tImVec2          GlyphOffset;    // Input    // For custom font glyphs only (ID<0x10000): glyph display offset\n\t\tImFont* Font;           // Input    // For custom font glyphs only (ID<0x10000): target font\n\t\tCustomRect() { ID = 0xFFFFFFFF; Width = Height = 0; X = Y = 0xFFFF; GlyphAdvanceX = 0.0f; GlyphOffset = ImVec2(0, 0); Font = NULL; }\n\t\tbool IsPacked() const { return X != 0xFFFF; }\n\t};\n\n\tIMGUI_API int       AddCustomRectRegular(unsigned int id, int width, int height);                                                                   // Id needs to be >= 0x10000. Id >= 0x80000000 are reserved for ImGui and ImDrawList\n\tIMGUI_API int       AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset = ImVec2(0, 0));   // Id needs to be < 0x10000 to register a rectangle to map into a specific font.\n\tIMGUI_API void      CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max);\n\tconst CustomRect* GetCustomRectByIndex(int index) const { if (index < 0) return NULL; return &CustomRects[index]; }\n\n\t//-------------------------------------------\n\t// Members\n\t//-------------------------------------------\n\n\tImTextureID                 TexID;              // User data to refer to the texture once it has been uploaded to user's graphic systems. It is passed back to you during rendering via the ImDrawCmd structure.\n\tint                         TexDesiredWidth;    // Texture width desired by user before Build(). Must be a power-of-two. If have many glyphs your graphics API have texture size restrictions you may want to increase texture width to decrease height.\n\tint                         TexGlyphPadding;    // Padding between glyphs within texture in pixels. Defaults to 1.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t// [Internal]\n\t\t\t\t\t\t\t\t\t\t\t\t\t// NB: Access texture data via GetTexData*() calls! Which will setup a default font for you.\n\tunsigned char* TexPixelsAlpha8;    // 1 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight\n\tunsigned int* TexPixelsRGBA32;    // 4 component per pixel, each component is unsigned 8-bit. Total size = TexWidth * TexHeight * 4\n\tint                         TexWidth;           // Texture width calculated during Build().\n\tint                         TexHeight;          // Texture height calculated during Build().\n\tImVec2                      TexUvWhitePixel;    // Texture coordinates to a white pixel\n\tImVector<ImFont*>           Fonts;              // Hold all the fonts returned by AddFont*. Fonts[0] is the default font upon calling ImGui::NewFrame(), use ImGui::PushFont()/PopFont() to change the current font.\n\tImVector<CustomRect>        CustomRects;        // Rectangles for packing custom texture data into the atlas.\n\tImVector<ImFontConfig>      ConfigData;         // Internal data\n\tint                         CustomRectIds[1];   // Identifiers of custom texture rectangle used by ImFontAtlas/ImDrawList\n};\n\n// Font runtime data and rendering\n// ImFontAtlas automatically loads a default embedded font for you when you call GetTexDataAsAlpha8() or GetTexDataAsRGBA32().\nstruct ImFont\n{\n\t// Members: Hot ~62/78 bytes\n\tfloat                       FontSize;           // <user set>   // Height of characters, set during loading (don't change after loading)\n\tfloat                       Scale;              // = 1.f        // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()\n\tImVec2                      DisplayOffset;      // = (0.f,1.f)  // Offset font rendering by xx pixels\n\tImVector<ImFontGlyph>       Glyphs;             //              // All glyphs.\n\tImVector<float>             IndexAdvanceX;      //              // Sparse. Glyphs->AdvanceX in a directly indexable way (more cache-friendly, for CalcTextSize functions which are often bottleneck in large UI).\n\tImVector<unsigned short>    IndexLookup;        //              // Sparse. Index glyphs by Unicode code-point.\n\tconst ImFontGlyph* FallbackGlyph;      // == FindGlyph(FontFallbackChar)\n\tfloat                       FallbackAdvanceX;   // == FallbackGlyph->AdvanceX\n\tImWchar                     FallbackChar;       // = '?'        // Replacement glyph if one isn't found. Only set via SetFallbackChar()\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Members: Cold ~18/26 bytes\n\tshort                       ConfigDataCount;    // ~ 1          // Number of ImFontConfig involved in creating this font. Bigger than 1 when merging multiple font sources into one ImFont.\n\tImFontConfig* ConfigData;         //              // Pointer within ContainerAtlas->ConfigData\n\tImFontAtlas* ContainerAtlas;     //              // What we has been loaded into\n\tfloat                       Ascent, Descent;    //              // Ascent: distance from top to bottom of e.g. 'A' [0..FontSize]\n\tint                         MetricsTotalSurface;//              // Total surface in pixels to get an idea of the font rasterization/texture cost (not exact, we approximate the cost of padding between glyphs)\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Methods\n\tIMGUI_API ImFont();\n\tIMGUI_API ~ImFont();\n\tIMGUI_API void              ClearOutputData();\n\tIMGUI_API void              BuildLookupTable();\n\tIMGUI_API const ImFontGlyph* FindGlyph(ImWchar c) const;\n\tIMGUI_API void              SetFallbackChar(ImWchar c);\n\tfloat                       GetCharAdvance(ImWchar c) const { return ((int)c < IndexAdvanceX.Size) ? IndexAdvanceX[(int)c] : FallbackAdvanceX; }\n\tbool                        IsLoaded() const { return ContainerAtlas != NULL; }\n\tconst char* GetDebugName() const { return ConfigData ? ConfigData->Name : \"<unknown>\"; }\n\n\t// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.\n\t// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.\n\tIMGUI_API ImVec2            CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end = NULL, const char** remaining = NULL) const; // utf8\n\tIMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;\n\tIMGUI_API void              RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const;\n\tIMGUI_API void              RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) const;\n\n\t// [Internal]\n\tIMGUI_API void              GrowIndex(int new_size);\n\tIMGUI_API void              AddGlyph(ImWchar c, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x);\n\tIMGUI_API void              AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst = true); // Makes 'dst' character/glyph points to 'src' character/glyph. Currently needs to be called AFTER fonts have been built.\n\n#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS\n\ttypedef ImFontGlyph Glyph; // OBSOLETE 1.52+\n#endif\n};\n\n#if defined(__clang__)\n#pragma clang diagnostic pop\n#endif\n\n// Include imgui_user.h at the end of imgui.h (convenient for user to only explicitly include vanilla imgui.h)\n#ifdef IMGUI_INCLUDE_IMGUI_USER_H\n#include \"imgui_user.h\"\n#endif\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui_draw.cpp",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n// dear imgui, v1.54 WIP\n// (drawing and font code)\n\n// Contains implementation for\n// - Default styles\n// - ImDrawList\n// - ImDrawData\n// - ImFontAtlas\n// - ImFont\n// - Default font data\n\n#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)\n#define _CRT_SECURE_NO_WARNINGS\n#endif\n\n#include \"imgui.h\"\n#define IMGUI_DEFINE_MATH_OPERATORS\n#include \"imgui_internal.h\"\n\n#include <stdio.h>      // vsnprintf, sscanf, printf\n#if !defined(alloca)\n#ifdef _WIN32\n#include <malloc.h>     // alloca\n#if !defined(alloca)\n#define alloca _alloca  // for clang with MS Codegen\n#endif\n#elif defined(__GLIBC__) || defined(__sun)\n#include <alloca.h>     // alloca\n#else\n#include <stdlib.h>     // alloca\n#endif\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)\n#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen\n#define snprintf _snprintf\n#endif\n\n#ifdef __clang__\n#pragma clang diagnostic ignored \"-Wold-style-cast\"         // warning : use of old-style cast                              // yes, they are more terse.\n#pragma clang diagnostic ignored \"-Wfloat-equal\"            // warning : comparing floating point with == or != is unsafe   // storing and comparing against same constants ok.\n#pragma clang diagnostic ignored \"-Wglobal-constructors\"    // warning : declaration requires a global destructor           // similar to above, not sure what the exact difference it.\n#pragma clang diagnostic ignored \"-Wsign-conversion\"        // warning : implicit conversion changes signedness             //\n#if __has_warning(\"-Wcomma\")\n#pragma clang diagnostic ignored \"-Wcomma\"                  // warning : possible misuse of comma operator here             //\n#endif\n#if __has_warning(\"-Wreserved-id-macro\")\n#pragma clang diagnostic ignored \"-Wreserved-id-macro\"      // warning : macro name is a reserved identifier                //\n#endif\n#if __has_warning(\"-Wdouble-promotion\")\n#pragma clang diagnostic ignored \"-Wdouble-promotion\"       // warning: implicit conversion from 'float' to 'double' when passing argument to function\n#endif\n#elif defined(__GNUC__)\n#pragma GCC diagnostic ignored \"-Wunused-function\"          // warning: 'xxxx' defined but not used\n#pragma GCC diagnostic ignored \"-Wdouble-promotion\"         // warning: implicit conversion from 'float' to 'double' when passing argument to function\n#pragma GCC diagnostic ignored \"-Wconversion\"               // warning: conversion to 'xxxx' from 'xxxx' may alter its value\n#pragma GCC diagnostic ignored \"-Wcast-qual\"                // warning: cast from type 'xxxx' to type 'xxxx' casts away qualifiers\n#endif\n\n//-------------------------------------------------------------------------\n// STB libraries implementation\n//-------------------------------------------------------------------------\n\n//#define IMGUI_STB_NAMESPACE     ImGuiStb\n//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION\n//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION\n\n#ifdef IMGUI_STB_NAMESPACE\nnamespace IMGUI_STB_NAMESPACE\n{\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (push)\n#pragma warning (disable: 4456)                             // declaration of 'xx' hides previous local declaration\n#endif\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-function\"\n#pragma clang diagnostic ignored \"-Wmissing-prototypes\"\n#pragma clang diagnostic ignored \"-Wimplicit-fallthrough\"\n#endif\n\n#ifdef __GNUC__\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wtype-limits\"              // warning: comparison is always true due to limited range of data type [-Wtype-limits]\n#endif\n\n#define STBRP_ASSERT(x)    IM_ASSERT(x)\n#ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION\n#define STBRP_STATIC\n#define STB_RECT_PACK_IMPLEMENTATION\n#endif\n#include \"stb_rect_pack.h\"\n\n#define STBTT_malloc(x,u)  ((void)(u), ImGui::MemAlloc(x))\n#define STBTT_free(x,u)    ((void)(u), ImGui::MemFree(x))\n#define STBTT_assert(x)    IM_ASSERT(x)\n#ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION\n#define STBTT_STATIC\n#define STB_TRUETYPE_IMPLEMENTATION\n#else\n#define STBTT_DEF extern\n#endif\n#include \"stb_truetype.h\"\n\n#ifdef __GNUC__\n#pragma GCC diagnostic pop\n#endif\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (pop)\n#endif\n\n#ifdef IMGUI_STB_NAMESPACE\n} // namespace ImGuiStb\nusing namespace IMGUI_STB_NAMESPACE;\n#endif\n\n//-----------------------------------------------------------------------------\n// Style functions\n//-----------------------------------------------------------------------------\n\nvoid ImGui::StyleColorsClassic(ImGuiStyle* dst)\n{\n\tImGuiStyle* style = dst ? dst : &ImGui::GetStyle();\n\tImVec4* colors = style->Colors;\n\n\tcolors[ImGuiCol_Text] = ImVec4(0.90f, 0.90f, 0.90f, 1.00f);\n\tcolors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);\n\tcolors[ImGuiCol_WindowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.70f);\n\tcolors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\tcolors[ImGuiCol_PopupBg] = ImVec4(0.11f, 0.11f, 0.14f, 0.92f);\n\tcolors[ImGuiCol_Border] = ImVec4(0.50f, 0.50f, 0.50f, 0.50f);\n\tcolors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\tcolors[ImGuiCol_FrameBg] = ImVec4(0.43f, 0.43f, 0.43f, 0.39f);\n\tcolors[ImGuiCol_FrameBgHovered] = ImVec4(0.47f, 0.47f, 0.69f, 0.40f);\n\tcolors[ImGuiCol_FrameBgActive] = ImVec4(0.42f, 0.41f, 0.64f, 0.69f);\n\tcolors[ImGuiCol_TitleBg] = ImVec4(0.27f, 0.27f, 0.54f, 0.83f);\n\tcolors[ImGuiCol_TitleBgActive] = ImVec4(0.32f, 0.32f, 0.63f, 0.87f);\n\tcolors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.40f, 0.40f, 0.80f, 0.20f);\n\tcolors[ImGuiCol_MenuBarBg] = ImVec4(0.40f, 0.40f, 0.55f, 0.80f);\n\tcolors[ImGuiCol_ScrollbarBg] = ImVec4(0.20f, 0.25f, 0.30f, 0.60f);\n\tcolors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.80f, 0.30f);\n\tcolors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.40f, 0.40f, 0.80f, 0.40f);\n\tcolors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.41f, 0.39f, 0.80f, 0.60f);\n\tcolors[ImGuiCol_CheckMark] = ImVec4(0.90f, 0.90f, 0.90f, 0.50f);\n\tcolors[ImGuiCol_SliderGrab] = ImVec4(1.00f, 1.00f, 1.00f, 0.30f);\n\tcolors[ImGuiCol_SliderGrabActive] = ImVec4(0.41f, 0.39f, 0.80f, 0.60f);\n\tcolors[ImGuiCol_Button] = ImVec4(0.35f, 0.40f, 0.61f, 0.62f);\n\tcolors[ImGuiCol_ButtonHovered] = ImVec4(0.40f, 0.48f, 0.71f, 0.79f);\n\tcolors[ImGuiCol_ButtonActive] = ImVec4(0.46f, 0.54f, 0.80f, 1.00f);\n\tcolors[ImGuiCol_Header] = ImVec4(0.40f, 0.40f, 0.90f, 0.45f);\n\tcolors[ImGuiCol_HeaderHovered] = ImVec4(0.45f, 0.45f, 0.90f, 0.80f);\n\tcolors[ImGuiCol_HeaderActive] = ImVec4(0.53f, 0.53f, 0.87f, 0.80f);\n\tcolors[ImGuiCol_Separator] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);\n\tcolors[ImGuiCol_SeparatorHovered] = ImVec4(0.60f, 0.60f, 0.70f, 1.00f);\n\tcolors[ImGuiCol_SeparatorActive] = ImVec4(0.70f, 0.70f, 0.90f, 1.00f);\n\tcolors[ImGuiCol_ResizeGrip] = ImVec4(1.00f, 1.00f, 1.00f, 0.16f);\n\tcolors[ImGuiCol_ResizeGripHovered] = ImVec4(0.78f, 0.82f, 1.00f, 0.60f);\n\tcolors[ImGuiCol_ResizeGripActive] = ImVec4(0.78f, 0.82f, 1.00f, 0.90f);\n\tcolors[ImGuiCol_CloseButton] = ImVec4(0.50f, 0.50f, 0.90f, 0.50f);\n\tcolors[ImGuiCol_CloseButtonHovered] = ImVec4(0.70f, 0.70f, 0.90f, 0.60f);\n\tcolors[ImGuiCol_CloseButtonActive] = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);\n\tcolors[ImGuiCol_PlotLines] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n\tcolors[ImGuiCol_PlotLinesHovered] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_TextSelectedBg] = ImVec4(0.00f, 0.00f, 1.00f, 0.35f);\n\tcolors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);\n\tcolors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);\n}\n\nvoid ImGui::StyleColorsDark(ImGuiStyle* dst)\n{\n\tImGuiStyle* style = dst ? dst : &ImGui::GetStyle();\n\tImVec4* colors = style->Colors;\n\n\tcolors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n\tcolors[ImGuiCol_TextDisabled] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);\n\tcolors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.06f, 0.06f, 0.94f);\n\tcolors[ImGuiCol_ChildBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.00f);\n\tcolors[ImGuiCol_PopupBg] = ImVec4(0.08f, 0.08f, 0.08f, 0.94f);\n\tcolors[ImGuiCol_Border] = ImVec4(0.43f, 0.43f, 0.50f, 0.50f);\n\tcolors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\tcolors[ImGuiCol_FrameBg] = ImVec4(0.16f, 0.29f, 0.48f, 0.54f);\n\tcolors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n\tcolors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n\tcolors[ImGuiCol_TitleBg] = ImVec4(0.04f, 0.04f, 0.04f, 1.00f);\n\tcolors[ImGuiCol_TitleBgActive] = ImVec4(0.16f, 0.29f, 0.48f, 1.00f);\n\tcolors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.00f, 0.00f, 0.00f, 0.51f);\n\tcolors[ImGuiCol_MenuBarBg] = ImVec4(0.14f, 0.14f, 0.14f, 1.00f);\n\tcolors[ImGuiCol_ScrollbarBg] = ImVec4(0.02f, 0.02f, 0.02f, 0.53f);\n\tcolors[ImGuiCol_ScrollbarGrab] = ImVec4(0.31f, 0.31f, 0.31f, 1.00f);\n\tcolors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.41f, 0.41f, 0.41f, 1.00f);\n\tcolors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.51f, 0.51f, 0.51f, 1.00f);\n\tcolors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_SliderGrab] = ImVec4(0.24f, 0.52f, 0.88f, 1.00f);\n\tcolors[ImGuiCol_SliderGrabActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n\tcolors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);\n\tcolors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);\n\tcolors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_Separator] = colors[ImGuiCol_Border];//ImVec4(0.61f, 0.61f, 0.61f, 1.00f);\n\tcolors[ImGuiCol_SeparatorHovered] = ImVec4(0.10f, 0.40f, 0.75f, 0.78f);\n\tcolors[ImGuiCol_SeparatorActive] = ImVec4(0.10f, 0.40f, 0.75f, 1.00f);\n\tcolors[ImGuiCol_ResizeGrip] = ImVec4(0.26f, 0.59f, 0.98f, 0.25f);\n\tcolors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n\tcolors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);\n\tcolors[ImGuiCol_CloseButton] = ImVec4(0.41f, 0.41f, 0.41f, 0.50f);\n\tcolors[ImGuiCol_CloseButtonHovered] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);\n\tcolors[ImGuiCol_CloseButtonActive] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);\n\tcolors[ImGuiCol_PlotLines] = ImVec4(0.61f, 0.61f, 0.61f, 1.00f);\n\tcolors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);\n\tcolors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.60f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);\n\tcolors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.80f, 0.80f, 0.80f, 0.35f);\n\tcolors[ImGuiCol_DragDropTarget] = ImVec4(1.00f, 1.00f, 0.00f, 0.90f);\n}\n\n// Those light colors are better suited with a thicker font than the default one + FrameBorder\nvoid ImGui::StyleColorsLight(ImGuiStyle* dst)\n{\n\tImGuiStyle* style = dst ? dst : &ImGui::GetStyle();\n\tImVec4* colors = style->Colors;\n\n\tcolors[ImGuiCol_Text] = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_TextDisabled] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);\n\t//colors[ImGuiCol_TextHovered]          = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n\t//colors[ImGuiCol_TextActive]           = ImVec4(1.00f, 1.00f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_WindowBg] = ImVec4(0.94f, 0.94f, 0.94f, 1.00f);\n\tcolors[ImGuiCol_ChildBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\tcolors[ImGuiCol_PopupBg] = ImVec4(1.00f, 1.00f, 1.00f, 0.98f);\n\tcolors[ImGuiCol_Border] = ImVec4(0.00f, 0.00f, 0.00f, 0.30f);\n\tcolors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);\n\tcolors[ImGuiCol_FrameBg] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);\n\tcolors[ImGuiCol_FrameBgHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n\tcolors[ImGuiCol_FrameBgActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n\tcolors[ImGuiCol_TitleBg] = ImVec4(0.96f, 0.96f, 0.96f, 1.00f);\n\tcolors[ImGuiCol_TitleBgActive] = ImVec4(0.82f, 0.82f, 0.82f, 1.00f);\n\tcolors[ImGuiCol_TitleBgCollapsed] = ImVec4(1.00f, 1.00f, 1.00f, 0.51f);\n\tcolors[ImGuiCol_MenuBarBg] = ImVec4(0.86f, 0.86f, 0.86f, 1.00f);\n\tcolors[ImGuiCol_ScrollbarBg] = ImVec4(0.98f, 0.98f, 0.98f, 0.53f);\n\tcolors[ImGuiCol_ScrollbarGrab] = ImVec4(0.69f, 0.69f, 0.69f, 0.80f);\n\tcolors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.49f, 0.49f, 0.49f, 0.80f);\n\tcolors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.49f, 0.49f, 0.49f, 1.00f);\n\tcolors[ImGuiCol_CheckMark] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_SliderGrab] = ImVec4(0.26f, 0.59f, 0.98f, 0.78f);\n\tcolors[ImGuiCol_SliderGrabActive] = ImVec4(0.46f, 0.54f, 0.80f, 0.60f);\n\tcolors[ImGuiCol_Button] = ImVec4(0.26f, 0.59f, 0.98f, 0.40f);\n\tcolors[ImGuiCol_ButtonHovered] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_ButtonActive] = ImVec4(0.06f, 0.53f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_Header] = ImVec4(0.26f, 0.59f, 0.98f, 0.31f);\n\tcolors[ImGuiCol_HeaderHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.80f);\n\tcolors[ImGuiCol_HeaderActive] = ImVec4(0.26f, 0.59f, 0.98f, 1.00f);\n\tcolors[ImGuiCol_Separator] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);\n\tcolors[ImGuiCol_SeparatorHovered] = ImVec4(0.14f, 0.44f, 0.80f, 0.78f);\n\tcolors[ImGuiCol_SeparatorActive] = ImVec4(0.14f, 0.44f, 0.80f, 1.00f);\n\tcolors[ImGuiCol_ResizeGrip] = ImVec4(0.80f, 0.80f, 0.80f, 0.56f);\n\tcolors[ImGuiCol_ResizeGripHovered] = ImVec4(0.26f, 0.59f, 0.98f, 0.67f);\n\tcolors[ImGuiCol_ResizeGripActive] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);\n\tcolors[ImGuiCol_CloseButton] = ImVec4(0.59f, 0.59f, 0.59f, 0.50f);\n\tcolors[ImGuiCol_CloseButtonHovered] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);\n\tcolors[ImGuiCol_CloseButtonActive] = ImVec4(0.98f, 0.39f, 0.36f, 1.00f);\n\tcolors[ImGuiCol_PlotLines] = ImVec4(0.39f, 0.39f, 0.39f, 1.00f);\n\tcolors[ImGuiCol_PlotLinesHovered] = ImVec4(1.00f, 0.43f, 0.35f, 1.00f);\n\tcolors[ImGuiCol_PlotHistogram] = ImVec4(0.90f, 0.70f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_PlotHistogramHovered] = ImVec4(1.00f, 0.45f, 0.00f, 1.00f);\n\tcolors[ImGuiCol_TextSelectedBg] = ImVec4(0.26f, 0.59f, 0.98f, 0.35f);\n\tcolors[ImGuiCol_ModalWindowDarkening] = ImVec4(0.20f, 0.20f, 0.20f, 0.35f);\n\tcolors[ImGuiCol_DragDropTarget] = ImVec4(0.26f, 0.59f, 0.98f, 0.95f);\n}\n\n//-----------------------------------------------------------------------------\n// ImDrawListData\n//-----------------------------------------------------------------------------\n\nImDrawListSharedData::ImDrawListSharedData()\n{\n\tFont = NULL;\n\tFontSize = 0.0f;\n\tCurveTessellationTol = 0.0f;\n\tClipRectFullscreen = ImVec4(-8192.0f, -8192.0f, +8192.0f, +8192.0f);\n\n\t// Const data\n\tfor (int i = 0; i < IM_ARRAYSIZE(CircleVtx12); i++)\n\t{\n\t\tconst float a = ((float)i * 2 * IM_PI) / (float)IM_ARRAYSIZE(CircleVtx12);\n\t\tCircleVtx12[i] = ImVec2(cosf(a), sinf(a));\n\t}\n}\n\n//-----------------------------------------------------------------------------\n// ImDrawList\n//-----------------------------------------------------------------------------\n\nvoid ImDrawList::Clear()\n{\n\tCmdBuffer.resize(0);\n\tIdxBuffer.resize(0);\n\tVtxBuffer.resize(0);\n\tFlags = ImDrawListFlags_AntiAliasedLines | ImDrawListFlags_AntiAliasedFill;\n\t_VtxCurrentIdx = 0;\n\t_VtxWritePtr = NULL;\n\t_IdxWritePtr = NULL;\n\t_ClipRectStack.resize(0);\n\t_TextureIdStack.resize(0);\n\t_Path.resize(0);\n\t_ChannelsCurrent = 0;\n\t_ChannelsCount = 1;\n\t// NB: Do not clear channels so our allocations are re-used after the first frame.\n}\n\nvoid ImDrawList::ClearFreeMemory()\n{\n\tCmdBuffer.clear();\n\tIdxBuffer.clear();\n\tVtxBuffer.clear();\n\t_VtxCurrentIdx = 0;\n\t_VtxWritePtr = NULL;\n\t_IdxWritePtr = NULL;\n\t_ClipRectStack.clear();\n\t_TextureIdStack.clear();\n\t_Path.clear();\n\t_ChannelsCurrent = 0;\n\t_ChannelsCount = 1;\n\tfor (int i = 0; i < _Channels.Size; i++)\n\t{\n\t\tif (i == 0) memset(&_Channels[0], 0, sizeof(_Channels[0]));  // channel 0 is a copy of CmdBuffer/IdxBuffer, don't destruct again\n\t\t_Channels[i].CmdBuffer.clear();\n\t\t_Channels[i].IdxBuffer.clear();\n\t}\n\t_Channels.clear();\n}\n\n// Using macros because C++ is a terrible language, we want guaranteed inline, no code in header, and no overhead in Debug builds\n#define GetCurrentClipRect()    (_ClipRectStack.Size ? _ClipRectStack.Data[_ClipRectStack.Size-1]  : _Data->ClipRectFullscreen)\n#define GetCurrentTextureId()   (_TextureIdStack.Size ? _TextureIdStack.Data[_TextureIdStack.Size-1] : NULL)\n\nvoid ImDrawList::AddDrawCmd()\n{\n\tImDrawCmd draw_cmd;\n\tdraw_cmd.ClipRect = GetCurrentClipRect();\n\tdraw_cmd.TextureId = GetCurrentTextureId();\n\n\tIM_ASSERT(draw_cmd.ClipRect.x <= draw_cmd.ClipRect.z && draw_cmd.ClipRect.y <= draw_cmd.ClipRect.w);\n\tCmdBuffer.push_back(draw_cmd);\n}\n\nvoid ImDrawList::AddCallback(ImDrawCallback callback, void* callback_data)\n{\n\tImDrawCmd* current_cmd = CmdBuffer.Size ? &CmdBuffer.back() : NULL;\n\tif (!current_cmd || current_cmd->ElemCount != 0 || current_cmd->UserCallback != NULL)\n\t{\n\t\tAddDrawCmd();\n\t\tcurrent_cmd = &CmdBuffer.back();\n\t}\n\tcurrent_cmd->UserCallback = callback;\n\tcurrent_cmd->UserCallbackData = callback_data;\n\n\tAddDrawCmd(); // Force a new command after us (see comment below)\n}\n\n// Our scheme may appears a bit unusual, basically we want the most-common calls AddLine AddRect etc. to not have to perform any check so we always have a command ready in the stack.\n// The cost of figuring out if a new command has to be added or if we can merge is paid in those Update** functions only.\nvoid ImDrawList::UpdateClipRect()\n{\n\t// If current command is used with different settings we need to add a new command\n\tconst ImVec4 curr_clip_rect = GetCurrentClipRect();\n\tImDrawCmd* curr_cmd = CmdBuffer.Size > 0 ? &CmdBuffer.Data[CmdBuffer.Size - 1] : NULL;\n\tif (!curr_cmd || (curr_cmd->ElemCount != 0 && memcmp(&curr_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) != 0) || curr_cmd->UserCallback != NULL)\n\t{\n\t\tAddDrawCmd();\n\t\treturn;\n\t}\n\n\t// Try to merge with previous command if it matches, else use current command\n\tImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;\n\tif (curr_cmd->ElemCount == 0 && prev_cmd && memcmp(&prev_cmd->ClipRect, &curr_clip_rect, sizeof(ImVec4)) == 0 && prev_cmd->TextureId == GetCurrentTextureId() && prev_cmd->UserCallback == NULL)\n\t\tCmdBuffer.pop_back();\n\telse\n\t\tcurr_cmd->ClipRect = curr_clip_rect;\n}\n\nvoid ImDrawList::UpdateTextureID()\n{\n\t// If current command is used with different settings we need to add a new command\n\tconst ImTextureID curr_texture_id = GetCurrentTextureId();\n\tImDrawCmd* curr_cmd = CmdBuffer.Size ? &CmdBuffer.back() : NULL;\n\tif (!curr_cmd || (curr_cmd->ElemCount != 0 && curr_cmd->TextureId != curr_texture_id) || curr_cmd->UserCallback != NULL)\n\t{\n\t\tAddDrawCmd();\n\t\treturn;\n\t}\n\n\t// Try to merge with previous command if it matches, else use current command\n\tImDrawCmd* prev_cmd = CmdBuffer.Size > 1 ? curr_cmd - 1 : NULL;\n\tif (curr_cmd->ElemCount == 0 && prev_cmd && prev_cmd->TextureId == curr_texture_id && memcmp(&prev_cmd->ClipRect, &GetCurrentClipRect(), sizeof(ImVec4)) == 0 && prev_cmd->UserCallback == NULL)\n\t\tCmdBuffer.pop_back();\n\telse\n\t\tcurr_cmd->TextureId = curr_texture_id;\n}\n\n#undef GetCurrentClipRect\n#undef GetCurrentTextureId\n\n// Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)\nvoid ImDrawList::PushClipRect(ImVec2 cr_min, ImVec2 cr_max, bool intersect_with_current_clip_rect)\n{\n\tImVec4 cr(cr_min.x, cr_min.y, cr_max.x, cr_max.y);\n\tif (intersect_with_current_clip_rect && _ClipRectStack.Size)\n\t{\n\t\tImVec4 current = _ClipRectStack.Data[_ClipRectStack.Size - 1];\n\t\tif (cr.x < current.x) cr.x = current.x;\n\t\tif (cr.y < current.y) cr.y = current.y;\n\t\tif (cr.z > current.z) cr.z = current.z;\n\t\tif (cr.w > current.w) cr.w = current.w;\n\t}\n\tcr.z = ImMax(cr.x, cr.z);\n\tcr.w = ImMax(cr.y, cr.w);\n\n\t_ClipRectStack.push_back(cr);\n\tUpdateClipRect();\n}\n\nvoid ImDrawList::PushClipRectFullScreen()\n{\n\tPushClipRect(ImVec2(_Data->ClipRectFullscreen.x, _Data->ClipRectFullscreen.y), ImVec2(_Data->ClipRectFullscreen.z, _Data->ClipRectFullscreen.w));\n}\n\nvoid ImDrawList::PopClipRect()\n{\n\tIM_ASSERT(_ClipRectStack.Size > 0);\n\t_ClipRectStack.pop_back();\n\tUpdateClipRect();\n}\n\nvoid ImDrawList::PushTextureID(const ImTextureID& texture_id)\n{\n\t_TextureIdStack.push_back(texture_id);\n\tUpdateTextureID();\n}\n\nvoid ImDrawList::PopTextureID()\n{\n\tIM_ASSERT(_TextureIdStack.Size > 0);\n\t_TextureIdStack.pop_back();\n\tUpdateTextureID();\n}\n\nvoid ImDrawList::ChannelsSplit(int channels_count)\n{\n\tIM_ASSERT(_ChannelsCurrent == 0 && _ChannelsCount == 1);\n\tint old_channels_count = _Channels.Size;\n\tif (old_channels_count < channels_count)\n\t\t_Channels.resize(channels_count);\n\t_ChannelsCount = channels_count;\n\n\t// _Channels[] (24/32 bytes each) hold storage that we'll swap with this->_CmdBuffer/_IdxBuffer\n\t// The content of _Channels[0] at this point doesn't matter. We clear it to make state tidy in a debugger but we don't strictly need to.\n\t// When we switch to the next channel, we'll copy _CmdBuffer/_IdxBuffer into _Channels[0] and then _Channels[1] into _CmdBuffer/_IdxBuffer\n\tmemset(&_Channels[0], 0, sizeof(ImDrawChannel));\n\tfor (int i = 1; i < channels_count; i++)\n\t{\n\t\tif (i >= old_channels_count)\n\t\t{\n\t\t\tIM_PLACEMENT_NEW(&_Channels[i]) ImDrawChannel();\n\t\t}\n\t\telse\n\t\t{\n\t\t\t_Channels[i].CmdBuffer.resize(0);\n\t\t\t_Channels[i].IdxBuffer.resize(0);\n\t\t}\n\t\tif (_Channels[i].CmdBuffer.Size == 0)\n\t\t{\n\t\t\tImDrawCmd draw_cmd;\n\t\t\tdraw_cmd.ClipRect = _ClipRectStack.back();\n\t\t\tdraw_cmd.TextureId = _TextureIdStack.back();\n\t\t\t_Channels[i].CmdBuffer.push_back(draw_cmd);\n\t\t}\n\t}\n}\n\nvoid ImDrawList::ChannelsMerge()\n{\n\t// Note that we never use or rely on channels.Size because it is merely a buffer that we never shrink back to 0 to keep all sub-buffers ready for use.\n\tif (_ChannelsCount <= 1)\n\t\treturn;\n\n\tChannelsSetCurrent(0);\n\tif (CmdBuffer.Size && CmdBuffer.back().ElemCount == 0)\n\t\tCmdBuffer.pop_back();\n\n\tint new_cmd_buffer_count = 0, new_idx_buffer_count = 0;\n\tfor (int i = 1; i < _ChannelsCount; i++)\n\t{\n\t\tImDrawChannel& ch = _Channels[i];\n\t\tif (ch.CmdBuffer.Size && ch.CmdBuffer.back().ElemCount == 0)\n\t\t\tch.CmdBuffer.pop_back();\n\t\tnew_cmd_buffer_count += ch.CmdBuffer.Size;\n\t\tnew_idx_buffer_count += ch.IdxBuffer.Size;\n\t}\n\tCmdBuffer.resize(CmdBuffer.Size + new_cmd_buffer_count);\n\tIdxBuffer.resize(IdxBuffer.Size + new_idx_buffer_count);\n\n\tImDrawCmd* cmd_write = CmdBuffer.Data + CmdBuffer.Size - new_cmd_buffer_count;\n\t_IdxWritePtr = IdxBuffer.Data + IdxBuffer.Size - new_idx_buffer_count;\n\tfor (int i = 1; i < _ChannelsCount; i++)\n\t{\n\t\tImDrawChannel& ch = _Channels[i];\n\t\tif (int sz = ch.CmdBuffer.Size) { memcpy(cmd_write, ch.CmdBuffer.Data, sz * sizeof(ImDrawCmd)); cmd_write += sz; }\n\t\tif (int sz = ch.IdxBuffer.Size) { memcpy(_IdxWritePtr, ch.IdxBuffer.Data, sz * sizeof(ImDrawIdx)); _IdxWritePtr += sz; }\n\t}\n\tUpdateClipRect(); // We call this instead of AddDrawCmd(), so that empty channels won't produce an extra draw call.\n\t_ChannelsCount = 1;\n}\n\nvoid ImDrawList::ChannelsSetCurrent(int idx)\n{\n\tIM_ASSERT(idx < _ChannelsCount);\n\tif (_ChannelsCurrent == idx) return;\n\tmemcpy(&_Channels.Data[_ChannelsCurrent].CmdBuffer, &CmdBuffer, sizeof(CmdBuffer)); // copy 12 bytes, four times\n\tmemcpy(&_Channels.Data[_ChannelsCurrent].IdxBuffer, &IdxBuffer, sizeof(IdxBuffer));\n\t_ChannelsCurrent = idx;\n\tmemcpy(&CmdBuffer, &_Channels.Data[_ChannelsCurrent].CmdBuffer, sizeof(CmdBuffer));\n\tmemcpy(&IdxBuffer, &_Channels.Data[_ChannelsCurrent].IdxBuffer, sizeof(IdxBuffer));\n\t_IdxWritePtr = IdxBuffer.Data + IdxBuffer.Size;\n}\n\n// NB: this can be called with negative count for removing primitives (as long as the result does not underflow)\nvoid ImDrawList::PrimReserve(int idx_count, int vtx_count)\n{\n\tImDrawCmd& draw_cmd = CmdBuffer.Data[CmdBuffer.Size - 1];\n\tdraw_cmd.ElemCount += idx_count;\n\n\tint vtx_buffer_old_size = VtxBuffer.Size;\n\tVtxBuffer.resize(vtx_buffer_old_size + vtx_count);\n\t_VtxWritePtr = VtxBuffer.Data + vtx_buffer_old_size;\n\n\tint idx_buffer_old_size = IdxBuffer.Size;\n\tIdxBuffer.resize(idx_buffer_old_size + idx_count);\n\t_IdxWritePtr = IdxBuffer.Data + idx_buffer_old_size;\n}\n\n// Fully unrolled with inline call to keep our debug builds decently fast.\nvoid ImDrawList::PrimRect(const ImVec2& a, const ImVec2& c, ImU32 col)\n{\n\tImVec2 b(c.x, a.y), d(a.x, c.y), uv(_Data->TexUvWhitePixel);\n\tImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;\n\t_IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx + 1); _IdxWritePtr[2] = (ImDrawIdx)(idx + 2);\n\t_IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx + 3);\n\t_VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;\n\t_VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col;\n\t_VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col;\n\t_VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv; _VtxWritePtr[3].col = col;\n\t_VtxWritePtr += 4;\n\t_VtxCurrentIdx += 4;\n\t_IdxWritePtr += 6;\n}\n\nvoid ImDrawList::PrimRectUV(const ImVec2& a, const ImVec2& c, const ImVec2& uv_a, const ImVec2& uv_c, ImU32 col)\n{\n\tImVec2 b(c.x, a.y), d(a.x, c.y), uv_b(uv_c.x, uv_a.y), uv_d(uv_a.x, uv_c.y);\n\tImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;\n\t_IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx + 1); _IdxWritePtr[2] = (ImDrawIdx)(idx + 2);\n\t_IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx + 3);\n\t_VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;\n\t_VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;\n\t_VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;\n\t_VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;\n\t_VtxWritePtr += 4;\n\t_VtxCurrentIdx += 4;\n\t_IdxWritePtr += 6;\n}\n\nvoid ImDrawList::PrimQuadUV(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col)\n{\n\tImDrawIdx idx = (ImDrawIdx)_VtxCurrentIdx;\n\t_IdxWritePtr[0] = idx; _IdxWritePtr[1] = (ImDrawIdx)(idx + 1); _IdxWritePtr[2] = (ImDrawIdx)(idx + 2);\n\t_IdxWritePtr[3] = idx; _IdxWritePtr[4] = (ImDrawIdx)(idx + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx + 3);\n\t_VtxWritePtr[0].pos = a; _VtxWritePtr[0].uv = uv_a; _VtxWritePtr[0].col = col;\n\t_VtxWritePtr[1].pos = b; _VtxWritePtr[1].uv = uv_b; _VtxWritePtr[1].col = col;\n\t_VtxWritePtr[2].pos = c; _VtxWritePtr[2].uv = uv_c; _VtxWritePtr[2].col = col;\n\t_VtxWritePtr[3].pos = d; _VtxWritePtr[3].uv = uv_d; _VtxWritePtr[3].col = col;\n\t_VtxWritePtr += 4;\n\t_VtxCurrentIdx += 4;\n\t_IdxWritePtr += 6;\n}\n\n// TODO: Thickness anti-aliased lines cap are missing their AA fringe.\nvoid ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32 col, bool closed, float thickness)\n{\n\tif (points_count < 2)\n\t\treturn;\n\n\tconst ImVec2 uv = _Data->TexUvWhitePixel;\n\n\tint count = points_count;\n\tif (!closed)\n\t\tcount = points_count - 1;\n\n\tconst bool thick_line = thickness > 1.0f;\n\tif (Flags & ImDrawListFlags_AntiAliasedLines)\n\t{\n\t\t// Anti-aliased stroke\n\t\tconst float AA_SIZE = 1.0f;\n\t\tconst ImU32 col_trans = col & ~IM_COL32_A_MASK;\n\n\t\tconst int idx_count = thick_line ? count * 18 : count * 12;\n\t\tconst int vtx_count = thick_line ? points_count * 4 : points_count * 3;\n\t\tPrimReserve(idx_count, vtx_count);\n\n\t\t// Temporary buffer\n\t\tImVec2* temp_normals = (ImVec2*)alloca(points_count * (thick_line ? 5 : 3) * sizeof(ImVec2));\n\t\tImVec2* temp_points = temp_normals + points_count;\n\n\t\tfor (int i1 = 0; i1 < count; i1++)\n\t\t{\n\t\t\tconst int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;\n\t\t\tImVec2 diff = points[i2] - points[i1];\n\t\t\tdiff *= ImInvLength(diff, 1.0f);\n\t\t\ttemp_normals[i1].x = diff.y;\n\t\t\ttemp_normals[i1].y = -diff.x;\n\t\t}\n\t\tif (!closed)\n\t\t\ttemp_normals[points_count - 1] = temp_normals[points_count - 2];\n\n\t\tif (!thick_line)\n\t\t{\n\t\t\tif (!closed)\n\t\t\t{\n\t\t\t\ttemp_points[0] = points[0] + temp_normals[0] * AA_SIZE;\n\t\t\t\ttemp_points[1] = points[0] - temp_normals[0] * AA_SIZE;\n\t\t\t\ttemp_points[(points_count - 1) * 2 + 0] = points[points_count - 1] + temp_normals[points_count - 1] * AA_SIZE;\n\t\t\t\ttemp_points[(points_count - 1) * 2 + 1] = points[points_count - 1] - temp_normals[points_count - 1] * AA_SIZE;\n\t\t\t}\n\n\t\t\t// FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.\n\t\t\tunsigned int idx1 = _VtxCurrentIdx;\n\t\t\tfor (int i1 = 0; i1 < count; i1++)\n\t\t\t{\n\t\t\t\tconst int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;\n\t\t\t\tunsigned int idx2 = (i1 + 1) == points_count ? _VtxCurrentIdx : idx1 + 3;\n\n\t\t\t\t// Average normals\n\t\t\t\tImVec2 dm = (temp_normals[i1] + temp_normals[i2]) * 0.5f;\n\t\t\t\tfloat dmr2 = dm.x*dm.x + dm.y*dm.y;\n\t\t\t\tif (dmr2 > 0.000001f)\n\t\t\t\t{\n\t\t\t\t\tfloat scale = 1.0f / dmr2;\n\t\t\t\t\tif (scale > 100.0f) scale = 100.0f;\n\t\t\t\t\tdm *= scale;\n\t\t\t\t}\n\t\t\t\tdm *= AA_SIZE;\n\t\t\t\ttemp_points[i2 * 2 + 0] = points[i2] + dm;\n\t\t\t\ttemp_points[i2 * 2 + 1] = points[i2] - dm;\n\n\t\t\t\t// Add indexes\n\t\t\t\t_IdxWritePtr[0] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2);\n\t\t\t\t_IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 0);\n\t\t\t\t_IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0);\n\t\t\t\t_IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1);\n\t\t\t\t_IdxWritePtr += 12;\n\n\t\t\t\tidx1 = idx2;\n\t\t\t}\n\n\t\t\t// Add vertexes\n\t\t\tfor (int i = 0; i < points_count; i++)\n\t\t\t{\n\t\t\t\t_VtxWritePtr[0].pos = points[i];          _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;\n\t\t\t\t_VtxWritePtr[1].pos = temp_points[i * 2 + 0]; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans;\n\t\t\t\t_VtxWritePtr[2].pos = temp_points[i * 2 + 1]; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col_trans;\n\t\t\t\t_VtxWritePtr += 3;\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tconst float half_inner_thickness = (thickness - AA_SIZE) * 0.5f;\n\t\t\tif (!closed)\n\t\t\t{\n\t\t\t\ttemp_points[0] = points[0] + temp_normals[0] * (half_inner_thickness + AA_SIZE);\n\t\t\t\ttemp_points[1] = points[0] + temp_normals[0] * (half_inner_thickness);\n\t\t\t\ttemp_points[2] = points[0] - temp_normals[0] * (half_inner_thickness);\n\t\t\t\ttemp_points[3] = points[0] - temp_normals[0] * (half_inner_thickness + AA_SIZE);\n\t\t\t\ttemp_points[(points_count - 1) * 4 + 0] = points[points_count - 1] + temp_normals[points_count - 1] * (half_inner_thickness + AA_SIZE);\n\t\t\t\ttemp_points[(points_count - 1) * 4 + 1] = points[points_count - 1] + temp_normals[points_count - 1] * (half_inner_thickness);\n\t\t\t\ttemp_points[(points_count - 1) * 4 + 2] = points[points_count - 1] - temp_normals[points_count - 1] * (half_inner_thickness);\n\t\t\t\ttemp_points[(points_count - 1) * 4 + 3] = points[points_count - 1] - temp_normals[points_count - 1] * (half_inner_thickness + AA_SIZE);\n\t\t\t}\n\n\t\t\t// FIXME-OPT: Merge the different loops, possibly remove the temporary buffer.\n\t\t\tunsigned int idx1 = _VtxCurrentIdx;\n\t\t\tfor (int i1 = 0; i1 < count; i1++)\n\t\t\t{\n\t\t\t\tconst int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;\n\t\t\t\tunsigned int idx2 = (i1 + 1) == points_count ? _VtxCurrentIdx : idx1 + 4;\n\n\t\t\t\t// Average normals\n\t\t\t\tImVec2 dm = (temp_normals[i1] + temp_normals[i2]) * 0.5f;\n\t\t\t\tfloat dmr2 = dm.x*dm.x + dm.y*dm.y;\n\t\t\t\tif (dmr2 > 0.000001f)\n\t\t\t\t{\n\t\t\t\t\tfloat scale = 1.0f / dmr2;\n\t\t\t\t\tif (scale > 100.0f) scale = 100.0f;\n\t\t\t\t\tdm *= scale;\n\t\t\t\t}\n\t\t\t\tImVec2 dm_out = dm * (half_inner_thickness + AA_SIZE);\n\t\t\t\tImVec2 dm_in = dm * half_inner_thickness;\n\t\t\t\ttemp_points[i2 * 4 + 0] = points[i2] + dm_out;\n\t\t\t\ttemp_points[i2 * 4 + 1] = points[i2] + dm_in;\n\t\t\t\ttemp_points[i2 * 4 + 2] = points[i2] - dm_in;\n\t\t\t\ttemp_points[i2 * 4 + 3] = points[i2] - dm_out;\n\n\t\t\t\t// Add indexes\n\t\t\t\t_IdxWritePtr[0] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[1] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[2] = (ImDrawIdx)(idx1 + 2);\n\t\t\t\t_IdxWritePtr[3] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[4] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[5] = (ImDrawIdx)(idx2 + 1);\n\t\t\t\t_IdxWritePtr[6] = (ImDrawIdx)(idx2 + 1); _IdxWritePtr[7] = (ImDrawIdx)(idx1 + 1); _IdxWritePtr[8] = (ImDrawIdx)(idx1 + 0);\n\t\t\t\t_IdxWritePtr[9] = (ImDrawIdx)(idx1 + 0); _IdxWritePtr[10] = (ImDrawIdx)(idx2 + 0); _IdxWritePtr[11] = (ImDrawIdx)(idx2 + 1);\n\t\t\t\t_IdxWritePtr[12] = (ImDrawIdx)(idx2 + 2); _IdxWritePtr[13] = (ImDrawIdx)(idx1 + 2); _IdxWritePtr[14] = (ImDrawIdx)(idx1 + 3);\n\t\t\t\t_IdxWritePtr[15] = (ImDrawIdx)(idx1 + 3); _IdxWritePtr[16] = (ImDrawIdx)(idx2 + 3); _IdxWritePtr[17] = (ImDrawIdx)(idx2 + 2);\n\t\t\t\t_IdxWritePtr += 18;\n\n\t\t\t\tidx1 = idx2;\n\t\t\t}\n\n\t\t\t// Add vertexes\n\t\t\tfor (int i = 0; i < points_count; i++)\n\t\t\t{\n\t\t\t\t_VtxWritePtr[0].pos = temp_points[i * 4 + 0]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col_trans;\n\t\t\t\t_VtxWritePtr[1].pos = temp_points[i * 4 + 1]; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col;\n\t\t\t\t_VtxWritePtr[2].pos = temp_points[i * 4 + 2]; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col;\n\t\t\t\t_VtxWritePtr[3].pos = temp_points[i * 4 + 3]; _VtxWritePtr[3].uv = uv; _VtxWritePtr[3].col = col_trans;\n\t\t\t\t_VtxWritePtr += 4;\n\t\t\t}\n\t\t}\n\t\t_VtxCurrentIdx += (ImDrawIdx)vtx_count;\n\t}\n\telse\n\t{\n\t\t// Non Anti-aliased Stroke\n\t\tconst int idx_count = count * 6;\n\t\tconst int vtx_count = count * 4;      // FIXME-OPT: Not sharing edges\n\t\tPrimReserve(idx_count, vtx_count);\n\n\t\tfor (int i1 = 0; i1 < count; i1++)\n\t\t{\n\t\t\tconst int i2 = (i1 + 1) == points_count ? 0 : i1 + 1;\n\t\t\tconst ImVec2& p1 = points[i1];\n\t\t\tconst ImVec2& p2 = points[i2];\n\t\t\tImVec2 diff = p2 - p1;\n\t\t\tdiff *= ImInvLength(diff, 1.0f);\n\n\t\t\tconst float dx = diff.x * (thickness * 0.5f);\n\t\t\tconst float dy = diff.y * (thickness * 0.5f);\n\t\t\t_VtxWritePtr[0].pos.x = p1.x + dy; _VtxWritePtr[0].pos.y = p1.y - dx; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;\n\t\t\t_VtxWritePtr[1].pos.x = p2.x + dy; _VtxWritePtr[1].pos.y = p2.y - dx; _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col;\n\t\t\t_VtxWritePtr[2].pos.x = p2.x - dy; _VtxWritePtr[2].pos.y = p2.y + dx; _VtxWritePtr[2].uv = uv; _VtxWritePtr[2].col = col;\n\t\t\t_VtxWritePtr[3].pos.x = p1.x - dy; _VtxWritePtr[3].pos.y = p1.y + dx; _VtxWritePtr[3].uv = uv; _VtxWritePtr[3].col = col;\n\t\t\t_VtxWritePtr += 4;\n\n\t\t\t_IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + 2);\n\t\t\t_IdxWritePtr[3] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[4] = (ImDrawIdx)(_VtxCurrentIdx + 2); _IdxWritePtr[5] = (ImDrawIdx)(_VtxCurrentIdx + 3);\n\t\t\t_IdxWritePtr += 6;\n\t\t\t_VtxCurrentIdx += 4;\n\t\t}\n\t}\n}\n\nvoid ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_count, ImU32 col)\n{\n\tconst ImVec2 uv = _Data->TexUvWhitePixel;\n\n\tif (Flags & ImDrawListFlags_AntiAliasedFill)\n\t{\n\t\t// Anti-aliased Fill\n\t\tconst float AA_SIZE = 1.0f;\n\t\tconst ImU32 col_trans = col & ~IM_COL32_A_MASK;\n\t\tconst int idx_count = (points_count - 2) * 3 + points_count * 6;\n\t\tconst int vtx_count = (points_count * 2);\n\t\tPrimReserve(idx_count, vtx_count);\n\n\t\t// Add indexes for fill\n\t\tunsigned int vtx_inner_idx = _VtxCurrentIdx;\n\t\tunsigned int vtx_outer_idx = _VtxCurrentIdx + 1;\n\t\tfor (int i = 2; i < points_count; i++)\n\t\t{\n\t\t\t_IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + ((i - 1) << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_inner_idx + (i << 1));\n\t\t\t_IdxWritePtr += 3;\n\t\t}\n\n\t\t// Compute normals\n\t\tImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2));\n\t\tfor (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)\n\t\t{\n\t\t\tconst ImVec2& p0 = points[i0];\n\t\t\tconst ImVec2& p1 = points[i1];\n\t\t\tImVec2 diff = p1 - p0;\n\t\t\tdiff *= ImInvLength(diff, 1.0f);\n\t\t\ttemp_normals[i0].x = diff.y;\n\t\t\ttemp_normals[i0].y = -diff.x;\n\t\t}\n\n\t\tfor (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)\n\t\t{\n\t\t\t// Average normals\n\t\t\tconst ImVec2& n0 = temp_normals[i0];\n\t\t\tconst ImVec2& n1 = temp_normals[i1];\n\t\t\tImVec2 dm = (n0 + n1) * 0.5f;\n\t\t\tfloat dmr2 = dm.x*dm.x + dm.y*dm.y;\n\t\t\tif (dmr2 > 0.000001f)\n\t\t\t{\n\t\t\t\tfloat scale = 1.0f / dmr2;\n\t\t\t\tif (scale > 100.0f) scale = 100.0f;\n\t\t\t\tdm *= scale;\n\t\t\t}\n\t\t\tdm *= AA_SIZE * 0.5f;\n\n\t\t\t// Add vertices\n\t\t\t_VtxWritePtr[0].pos = (points[i1] - dm); _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;        // Inner\n\t\t\t_VtxWritePtr[1].pos = (points[i1] + dm); _VtxWritePtr[1].uv = uv; _VtxWritePtr[1].col = col_trans;  // Outer\n\t\t\t_VtxWritePtr += 2;\n\n\t\t\t// Add indexes for fringes\n\t\t\t_IdxWritePtr[0] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1)); _IdxWritePtr[1] = (ImDrawIdx)(vtx_inner_idx + (i0 << 1)); _IdxWritePtr[2] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1));\n\t\t\t_IdxWritePtr[3] = (ImDrawIdx)(vtx_outer_idx + (i0 << 1)); _IdxWritePtr[4] = (ImDrawIdx)(vtx_outer_idx + (i1 << 1)); _IdxWritePtr[5] = (ImDrawIdx)(vtx_inner_idx + (i1 << 1));\n\t\t\t_IdxWritePtr += 6;\n\t\t}\n\t\t_VtxCurrentIdx += (ImDrawIdx)vtx_count;\n\t}\n\telse\n\t{\n\t\t// Non Anti-aliased Fill\n\t\tconst int idx_count = (points_count - 2) * 3;\n\t\tconst int vtx_count = points_count;\n\t\tPrimReserve(idx_count, vtx_count);\n\t\tfor (int i = 0; i < vtx_count; i++)\n\t\t{\n\t\t\t_VtxWritePtr[0].pos = points[i]; _VtxWritePtr[0].uv = uv; _VtxWritePtr[0].col = col;\n\t\t\t_VtxWritePtr++;\n\t\t}\n\t\tfor (int i = 2; i < points_count; i++)\n\t\t{\n\t\t\t_IdxWritePtr[0] = (ImDrawIdx)(_VtxCurrentIdx); _IdxWritePtr[1] = (ImDrawIdx)(_VtxCurrentIdx + i - 1); _IdxWritePtr[2] = (ImDrawIdx)(_VtxCurrentIdx + i);\n\t\t\t_IdxWritePtr += 3;\n\t\t}\n\t\t_VtxCurrentIdx += (ImDrawIdx)vtx_count;\n\t}\n}\n\nvoid ImDrawList::PathArcToFast(const ImVec2& centre, float radius, int a_min_of_12, int a_max_of_12)\n{\n\tif (radius == 0.0f || a_min_of_12 > a_max_of_12)\n\t{\n\t\t_Path.push_back(centre);\n\t\treturn;\n\t}\n\t_Path.reserve(_Path.Size + (a_max_of_12 - a_min_of_12 + 1));\n\tfor (int a = a_min_of_12; a <= a_max_of_12; a++)\n\t{\n\t\tconst ImVec2& c = _Data->CircleVtx12[a % IM_ARRAYSIZE(_Data->CircleVtx12)];\n\t\t_Path.push_back(ImVec2(centre.x + c.x * radius, centre.y + c.y * radius));\n\t}\n}\n\nvoid ImDrawList::PathArcTo(const ImVec2& centre, float radius, float a_min, float a_max, int num_segments)\n{\n\tif (radius == 0.0f)\n\t{\n\t\t_Path.push_back(centre);\n\t\treturn;\n\t}\n\t_Path.reserve(_Path.Size + (num_segments + 1));\n\tfor (int i = 0; i <= num_segments; i++)\n\t{\n\t\tconst float a = a_min + ((float)i / (float)num_segments) * (a_max - a_min);\n\t\t_Path.push_back(ImVec2(centre.x + cosf(a) * radius, centre.y + sinf(a) * radius));\n\t}\n}\n\nstatic void PathBezierToCasteljau(ImVector<ImVec2>* path, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, float tess_tol, int level)\n{\n\tfloat dx = x4 - x1;\n\tfloat dy = y4 - y1;\n\tfloat d2 = ((x2 - x4) * dy - (y2 - y4) * dx);\n\tfloat d3 = ((x3 - x4) * dy - (y3 - y4) * dx);\n\td2 = (d2 >= 0) ? d2 : -d2;\n\td3 = (d3 >= 0) ? d3 : -d3;\n\tif ((d2 + d3) * (d2 + d3) < tess_tol * (dx*dx + dy*dy))\n\t{\n\t\tpath->push_back(ImVec2(x4, y4));\n\t}\n\telse if (level < 10)\n\t{\n\t\tfloat x12 = (x1 + x2)*0.5f, y12 = (y1 + y2)*0.5f;\n\t\tfloat x23 = (x2 + x3)*0.5f, y23 = (y2 + y3)*0.5f;\n\t\tfloat x34 = (x3 + x4)*0.5f, y34 = (y3 + y4)*0.5f;\n\t\tfloat x123 = (x12 + x23)*0.5f, y123 = (y12 + y23)*0.5f;\n\t\tfloat x234 = (x23 + x34)*0.5f, y234 = (y23 + y34)*0.5f;\n\t\tfloat x1234 = (x123 + x234)*0.5f, y1234 = (y123 + y234)*0.5f;\n\n\t\tPathBezierToCasteljau(path, x1, y1, x12, y12, x123, y123, x1234, y1234, tess_tol, level + 1);\n\t\tPathBezierToCasteljau(path, x1234, y1234, x234, y234, x34, y34, x4, y4, tess_tol, level + 1);\n\t}\n}\n\nvoid ImDrawList::PathBezierCurveTo(const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, int num_segments)\n{\n\tImVec2 p1 = _Path.back();\n\tif (num_segments == 0)\n\t{\n\t\t// Auto-tessellated\n\t\tPathBezierToCasteljau(&_Path, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y, _Data->CurveTessellationTol, 0);\n\t}\n\telse\n\t{\n\t\tfloat t_step = 1.0f / (float)num_segments;\n\t\tfor (int i_step = 1; i_step <= num_segments; i_step++)\n\t\t{\n\t\t\tfloat t = t_step * i_step;\n\t\t\tfloat u = 1.0f - t;\n\t\t\tfloat w1 = u*u*u;\n\t\t\tfloat w2 = 3 * u*u*t;\n\t\t\tfloat w3 = 3 * u*t*t;\n\t\t\tfloat w4 = t*t*t;\n\t\t\t_Path.push_back(ImVec2(w1*p1.x + w2*p2.x + w3*p3.x + w4*p4.x, w1*p1.y + w2*p2.y + w3*p3.y + w4*p4.y));\n\t\t}\n\t}\n}\n\nvoid ImDrawList::PathRect(const ImVec2& a, const ImVec2& b, float rounding, int rounding_corners)\n{\n\trounding = ImMin(rounding, fabsf(b.x - a.x) * (((rounding_corners & ImDrawCornerFlags_Top) == ImDrawCornerFlags_Top) || ((rounding_corners & ImDrawCornerFlags_Bot) == ImDrawCornerFlags_Bot) ? 0.5f : 1.0f) - 1.0f);\n\trounding = ImMin(rounding, fabsf(b.y - a.y) * (((rounding_corners & ImDrawCornerFlags_Left) == ImDrawCornerFlags_Left) || ((rounding_corners & ImDrawCornerFlags_Right) == ImDrawCornerFlags_Right) ? 0.5f : 1.0f) - 1.0f);\n\n\tif (rounding <= 0.0f || rounding_corners == 0)\n\t{\n\t\tPathLineTo(a);\n\t\tPathLineTo(ImVec2(b.x, a.y));\n\t\tPathLineTo(b);\n\t\tPathLineTo(ImVec2(a.x, b.y));\n\t}\n\telse\n\t{\n\t\tconst float rounding_tl = (rounding_corners & ImDrawCornerFlags_TopLeft) ? rounding : 0.0f;\n\t\tconst float rounding_tr = (rounding_corners & ImDrawCornerFlags_TopRight) ? rounding : 0.0f;\n\t\tconst float rounding_br = (rounding_corners & ImDrawCornerFlags_BotRight) ? rounding : 0.0f;\n\t\tconst float rounding_bl = (rounding_corners & ImDrawCornerFlags_BotLeft) ? rounding : 0.0f;\n\t\tPathArcToFast(ImVec2(a.x + rounding_tl, a.y + rounding_tl), rounding_tl, 6, 9);\n\t\tPathArcToFast(ImVec2(b.x - rounding_tr, a.y + rounding_tr), rounding_tr, 9, 12);\n\t\tPathArcToFast(ImVec2(b.x - rounding_br, b.y - rounding_br), rounding_br, 0, 3);\n\t\tPathArcToFast(ImVec2(a.x + rounding_bl, b.y - rounding_bl), rounding_bl, 3, 6);\n\t}\n}\n\nvoid ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\tPathLineTo(a + ImVec2(0.5f, 0.5f));\n\tPathLineTo(b + ImVec2(0.5f, 0.5f));\n\tPathStroke(col, false, thickness);\n}\n\n// a: upper-left, b: lower-right. we don't render 1 px sized rectangles properly.\nvoid ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners_flags, float thickness)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\tPathRect(a + ImVec2(0.5f, 0.5f), b - ImVec2(0.5f, 0.5f), rounding, rounding_corners_flags);\n\tPathStroke(col, true, thickness);\n}\n\nvoid ImDrawList::AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners_flags)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\tif (rounding > 0.0f)\n\t{\n\t\tPathRect(a, b, rounding, rounding_corners_flags);\n\t\tPathFillConvex(col);\n\t}\n\telse\n\t{\n\t\tPrimReserve(6, 4);\n\t\tPrimRect(a, b, col);\n\t}\n}\n\nvoid ImDrawList::AddRectFilledMultiColor(const ImVec2& a, const ImVec2& c, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left)\n{\n\tif (((col_upr_left | col_upr_right | col_bot_right | col_bot_left) & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tconst ImVec2 uv = _Data->TexUvWhitePixel;\n\tPrimReserve(6, 4);\n\tPrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 1)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 2));\n\tPrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 2)); PrimWriteIdx((ImDrawIdx)(_VtxCurrentIdx + 3));\n\tPrimWriteVtx(a, uv, col_upr_left);\n\tPrimWriteVtx(ImVec2(c.x, a.y), uv, col_upr_right);\n\tPrimWriteVtx(c, uv, col_bot_right);\n\tPrimWriteVtx(ImVec2(a.x, c.y), uv, col_bot_left);\n}\n\nvoid ImDrawList::AddQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col, float thickness)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tPathLineTo(a);\n\tPathLineTo(b);\n\tPathLineTo(c);\n\tPathLineTo(d);\n\tPathStroke(col, true, thickness);\n}\n\nvoid ImDrawList::AddQuadFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tPathLineTo(a);\n\tPathLineTo(b);\n\tPathLineTo(c);\n\tPathLineTo(d);\n\tPathFillConvex(col);\n}\n\nvoid ImDrawList::AddTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col, float thickness)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tPathLineTo(a);\n\tPathLineTo(b);\n\tPathLineTo(c);\n\tPathStroke(col, true, thickness);\n}\n\nvoid ImDrawList::AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tPathLineTo(a);\n\tPathLineTo(b);\n\tPathLineTo(c);\n\tPathFillConvex(col);\n}\n\nvoid ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments, float thickness)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tconst float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;\n\tPathArcTo(centre, radius - 0.5f, 0.0f, a_max, num_segments);\n\tPathStroke(col, true, thickness);\n}\n\nvoid ImDrawList::AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tconst float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;\n\tPathArcTo(centre, radius, 0.0f, a_max, num_segments);\n\tPathFillConvex(col);\n}\n\nvoid ImDrawList::AddBezierCurve(const ImVec2& pos0, const ImVec2& cp0, const ImVec2& cp1, const ImVec2& pos1, ImU32 col, float thickness, int num_segments)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tPathLineTo(pos0);\n\tPathBezierCurveTo(cp0, cp1, pos1, num_segments);\n\tPathStroke(col, false, thickness);\n}\n\nvoid ImDrawList::AddText(const ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width, const ImVec4* cpu_fine_clip_rect)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tif (text_end == NULL)\n\t\ttext_end = text_begin + strlen(text_begin);\n\tif (text_begin == text_end)\n\t\treturn;\n\n\t// Pull default font/size from the shared ImDrawListSharedData instance\n\tif (font == NULL)\n\t\tfont = _Data->Font;\n\tif (font_size == 0.0f)\n\t\tfont_size = _Data->FontSize;\n\n\tIM_ASSERT(font->ContainerAtlas->TexID == _TextureIdStack.back());  // Use high-level ImGui::PushFont() or low-level ImDrawList::PushTextureId() to change font.\n\n\tImVec4 clip_rect = _ClipRectStack.back();\n\tif (cpu_fine_clip_rect)\n\t{\n\t\tclip_rect.x = ImMax(clip_rect.x, cpu_fine_clip_rect->x);\n\t\tclip_rect.y = ImMax(clip_rect.y, cpu_fine_clip_rect->y);\n\t\tclip_rect.z = ImMin(clip_rect.z, cpu_fine_clip_rect->z);\n\t\tclip_rect.w = ImMin(clip_rect.w, cpu_fine_clip_rect->w);\n\t}\n\tfont->RenderText(this, font_size, pos, col, clip_rect, text_begin, text_end, wrap_width, cpu_fine_clip_rect != NULL);\n}\n\nvoid ImDrawList::AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end)\n{\n\tAddText(NULL, 0.0f, pos, col, text_begin, text_end);\n}\n\nvoid ImDrawList::AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tconst bool push_texture_id = _TextureIdStack.empty() || user_texture_id != _TextureIdStack.back();\n\tif (push_texture_id)\n\t\tPushTextureID(user_texture_id);\n\n\tPrimReserve(6, 4);\n\tPrimRectUV(a, b, uv_a, uv_b, col);\n\n\tif (push_texture_id)\n\t\tPopTextureID();\n}\n\nvoid ImDrawList::AddImageQuad(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, const ImVec2& uv_a, const ImVec2& uv_b, const ImVec2& uv_c, const ImVec2& uv_d, ImU32 col)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tconst bool push_texture_id = _TextureIdStack.empty() || user_texture_id != _TextureIdStack.back();\n\tif (push_texture_id)\n\t\tPushTextureID(user_texture_id);\n\n\tPrimReserve(6, 4);\n\tPrimQuadUV(a, b, c, d, uv_a, uv_b, uv_c, uv_d, col);\n\n\tif (push_texture_id)\n\t\tPopTextureID();\n}\n\nvoid ImDrawList::AddImageRounded(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col, float rounding, int rounding_corners)\n{\n\tif ((col & IM_COL32_A_MASK) == 0)\n\t\treturn;\n\n\tif (rounding <= 0.0f || (rounding_corners & ImDrawCornerFlags_All) == 0)\n\t{\n\t\tAddImage(user_texture_id, a, b, uv_a, uv_b, col);\n\t\treturn;\n\t}\n\n\tconst bool push_texture_id = _TextureIdStack.empty() || user_texture_id != _TextureIdStack.back();\n\tif (push_texture_id)\n\t\tPushTextureID(user_texture_id);\n\n\tint vert_start_idx = VtxBuffer.Size;\n\tPathRect(a, b, rounding, rounding_corners);\n\tPathFillConvex(col);\n\tint vert_end_idx = VtxBuffer.Size;\n\tImGui::ShadeVertsLinearUV(VtxBuffer.Data + vert_start_idx, VtxBuffer.Data + vert_end_idx, a, b, uv_a, uv_b, true);\n\n\tif (push_texture_id)\n\t\tPopTextureID();\n}\n\n//-----------------------------------------------------------------------------\n// ImDrawData\n//-----------------------------------------------------------------------------\n\n// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!\nvoid ImDrawData::DeIndexAllBuffers()\n{\n\tImVector<ImDrawVert> new_vtx_buffer;\n\tTotalVtxCount = TotalIdxCount = 0;\n\tfor (int i = 0; i < CmdListsCount; i++)\n\t{\n\t\tImDrawList* cmd_list = CmdLists[i];\n\t\tif (cmd_list->IdxBuffer.empty())\n\t\t\tcontinue;\n\t\tnew_vtx_buffer.resize(cmd_list->IdxBuffer.Size);\n\t\tfor (int j = 0; j < cmd_list->IdxBuffer.Size; j++)\n\t\t\tnew_vtx_buffer[j] = cmd_list->VtxBuffer[cmd_list->IdxBuffer[j]];\n\t\tcmd_list->VtxBuffer.swap(new_vtx_buffer);\n\t\tcmd_list->IdxBuffer.resize(0);\n\t\tTotalVtxCount += cmd_list->VtxBuffer.Size;\n\t}\n}\n\n// Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.\nvoid ImDrawData::ScaleClipRects(const ImVec2& scale)\n{\n\tfor (int i = 0; i < CmdListsCount; i++)\n\t{\n\t\tImDrawList* cmd_list = CmdLists[i];\n\t\tfor (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)\n\t\t{\n\t\t\tImDrawCmd* cmd = &cmd_list->CmdBuffer[cmd_i];\n\t\t\tcmd->ClipRect = ImVec4(cmd->ClipRect.x * scale.x, cmd->ClipRect.y * scale.y, cmd->ClipRect.z * scale.x, cmd->ClipRect.w * scale.y);\n\t\t}\n\t}\n}\n\n//-----------------------------------------------------------------------------\n// Shade functions\n//-----------------------------------------------------------------------------\n\n// Generic linear color gradient, write to RGB fields, leave A untouched.\nvoid ImGui::ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDrawVert* vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1)\n{\n\tImVec2 gradient_extent = gradient_p1 - gradient_p0;\n\tfloat gradient_inv_length2 = 1.0f / ImLengthSqr(gradient_extent);\n\tfor (ImDrawVert* vert = vert_start; vert < vert_end; vert++)\n\t{\n\t\tfloat d = ImDot(vert->pos - gradient_p0, gradient_extent);\n\t\tfloat t = ImClamp(d * gradient_inv_length2, 0.0f, 1.0f);\n\t\tint r = ImLerp((int)(col0 >> IM_COL32_R_SHIFT) & 0xFF, (int)(col1 >> IM_COL32_R_SHIFT) & 0xFF, t);\n\t\tint g = ImLerp((int)(col0 >> IM_COL32_G_SHIFT) & 0xFF, (int)(col1 >> IM_COL32_G_SHIFT) & 0xFF, t);\n\t\tint b = ImLerp((int)(col0 >> IM_COL32_B_SHIFT) & 0xFF, (int)(col1 >> IM_COL32_B_SHIFT) & 0xFF, t);\n\t\tvert->col = (r << IM_COL32_R_SHIFT) | (g << IM_COL32_G_SHIFT) | (b << IM_COL32_B_SHIFT) | (vert->col & IM_COL32_A_MASK);\n\t}\n}\n\n// Scan and shade backward from the end of given vertices. Assume vertices are text only (= vert_start..vert_end going left to right) so we can break as soon as we are out the gradient bounds.\nvoid ImGui::ShadeVertsLinearAlphaGradientForLeftToRightText(ImDrawVert* vert_start, ImDrawVert* vert_end, float gradient_p0_x, float gradient_p1_x)\n{\n\tfloat gradient_extent_x = gradient_p1_x - gradient_p0_x;\n\tfloat gradient_inv_length2 = 1.0f / (gradient_extent_x * gradient_extent_x);\n\tint full_alpha_count = 0;\n\tfor (ImDrawVert* vert = vert_end - 1; vert >= vert_start; vert--)\n\t{\n\t\tfloat d = (vert->pos.x - gradient_p0_x) * (gradient_extent_x);\n\t\tfloat alpha_mul = 1.0f - ImClamp(d * gradient_inv_length2, 0.0f, 1.0f);\n\t\tif (alpha_mul >= 1.0f && ++full_alpha_count > 2)\n\t\t\treturn; // Early out\n\t\tint a = (int)(((vert->col >> IM_COL32_A_SHIFT) & 0xFF) * alpha_mul);\n\t\tvert->col = (vert->col & ~IM_COL32_A_MASK) | (a << IM_COL32_A_SHIFT);\n\t}\n}\n\n// Distribute UV over (a, b) rectangle\nvoid ImGui::ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp)\n{\n\tconst ImVec2 size = b - a;\n\tconst ImVec2 uv_size = uv_b - uv_a;\n\tconst ImVec2 scale = ImVec2(\n\t\tsize.x != 0.0f ? (uv_size.x / size.x) : 0.0f,\n\t\tsize.y != 0.0f ? (uv_size.y / size.y) : 0.0f);\n\n\tif (clamp)\n\t{\n\t\tconst ImVec2 min = ImMin(uv_a, uv_b);\n\t\tconst ImVec2 max = ImMax(uv_a, uv_b);\n\n\t\tfor (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex)\n\t\t\tvertex->uv = ImClamp(uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale), min, max);\n\t}\n\telse\n\t{\n\t\tfor (ImDrawVert* vertex = vert_start; vertex < vert_end; ++vertex)\n\t\t\tvertex->uv = uv_a + ImMul(ImVec2(vertex->pos.x, vertex->pos.y) - a, scale);\n\t}\n}\n\n//-----------------------------------------------------------------------------\n// ImFontConfig\n//-----------------------------------------------------------------------------\n\nImFontConfig::ImFontConfig()\n{\n\tFontData = NULL;\n\tFontDataSize = 0;\n\tFontDataOwnedByAtlas = true;\n\tFontNo = 0;\n\tSizePixels = 0.0f;\n\tOversampleH = 3;\n\tOversampleV = 1;\n\tPixelSnapH = false;\n\tGlyphExtraSpacing = ImVec2(0.0f, 0.0f);\n\tGlyphOffset = ImVec2(0.0f, 0.0f);\n\tGlyphRanges = NULL;\n\tMergeMode = false;\n\tRasterizerFlags = 0x00;\n\tRasterizerMultiply = 1.0f;\n\tmemset(Name, 0, sizeof(Name));\n\tDstFont = NULL;\n}\n\n//-----------------------------------------------------------------------------\n// ImFontAtlas\n//-----------------------------------------------------------------------------\n\n// A work of art lies ahead! (. = white layer, X = black layer, others are blank)\n// The white texels on the top left are the ones we'll use everywhere in ImGui to render filled shapes.\nconst int FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF = 90;\nconst int FONT_ATLAS_DEFAULT_TEX_DATA_H = 27;\nconst unsigned int FONT_ATLAS_DEFAULT_TEX_DATA_ID = 0x80000000;\nstatic const char FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF * FONT_ATLAS_DEFAULT_TEX_DATA_H + 1] =\n{\n\t\"..-         -XXXXXXX-    X    -           X           -XXXXXXX          -          XXXXXXX\"\n\t\"..-         -X.....X-   X.X   -          X.X          -X.....X          -          X.....X\"\n\t\"---         -XXX.XXX-  X...X  -         X...X         -X....X           -           X....X\"\n\t\"X           -  X.X  - X.....X -        X.....X        -X...X            -            X...X\"\n\t\"XX          -  X.X  -X.......X-       X.......X       -X..X.X           -           X.X..X\"\n\t\"X.X         -  X.X  -XXXX.XXXX-       XXXX.XXXX       -X.X X.X          -          X.X X.X\"\n\t\"X..X        -  X.X  -   X.X   -          X.X          -XX   X.X         -         X.X   XX\"\n\t\"X...X       -  X.X  -   X.X   -    XX    X.X    XX    -      X.X        -        X.X      \"\n\t\"X....X      -  X.X  -   X.X   -   X.X    X.X    X.X   -       X.X       -       X.X       \"\n\t\"X.....X     -  X.X  -   X.X   -  X..X    X.X    X..X  -        X.X      -      X.X        \"\n\t\"X......X    -  X.X  -   X.X   - X...XXXXXX.XXXXXX...X -         X.X   XX-XX   X.X         \"\n\t\"X.......X   -  X.X  -   X.X   -X.....................X-          X.X X.X-X.X X.X          \"\n\t\"X........X  -  X.X  -   X.X   - X...XXXXXX.XXXXXX...X -           X.X..X-X..X.X           \"\n\t\"X.........X -XXX.XXX-   X.X   -  X..X    X.X    X..X  -            X...X-X...X            \"\n\t\"X..........X-X.....X-   X.X   -   X.X    X.X    X.X   -           X....X-X....X           \"\n\t\"X......XXXXX-XXXXXXX-   X.X   -    XX    X.X    XX    -          X.....X-X.....X          \"\n\t\"X...X..X    ---------   X.X   -          X.X          -          XXXXXXX-XXXXXXX          \"\n\t\"X..X X..X   -       -XXXX.XXXX-       XXXX.XXXX       ------------------------------------\"\n\t\"X.X  X..X   -       -X.......X-       X.......X       -    XX           XX    -           \"\n\t\"XX    X..X  -       - X.....X -        X.....X        -   X.X           X.X   -           \"\n\t\"      X..X          -  X...X  -         X...X         -  X..X           X..X  -           \"\n\t\"       XX           -   X.X   -          X.X          - X...XXXXXXXXXXXXX...X -           \"\n\t\"------------        -    X    -           X           -X.....................X-           \"\n\t\"                    ----------------------------------- X...XXXXXXXXXXXXX...X -           \"\n\t\"                                                      -  X..X           X..X  -           \"\n\t\"                                                      -   X.X           X.X   -           \"\n\t\"                                                      -    XX           XX    -           \"\n};\n\nstatic const ImVec2 FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[ImGuiMouseCursor_Count_][3] =\n{\n\t// Pos ........ Size ......... Offset ......\n\t{ ImVec2(0,3),  ImVec2(12,19), ImVec2(0, 0) }, // ImGuiMouseCursor_Arrow\n\t{ ImVec2(13,0), ImVec2(7,16),  ImVec2(4, 8) }, // ImGuiMouseCursor_TextInput\n\t{ ImVec2(31,0), ImVec2(23,23), ImVec2(11,11) }, // ImGuiMouseCursor_Move\n\t{ ImVec2(21,0), ImVec2(9,23), ImVec2(5,11) }, // ImGuiMouseCursor_ResizeNS\n\t{ ImVec2(55,18),ImVec2(23, 9), ImVec2(11, 5) }, // ImGuiMouseCursor_ResizeEW\n\t{ ImVec2(73,0), ImVec2(17,17), ImVec2(9, 9) }, // ImGuiMouseCursor_ResizeNESW\n\t{ ImVec2(55,0), ImVec2(17,17), ImVec2(9, 9) }, // ImGuiMouseCursor_ResizeNWSE\n};\n\n\nImFontAtlas::ImFontAtlas()\n{\n\tTexID = NULL;\n\tTexDesiredWidth = 0;\n\tTexGlyphPadding = 1;\n\tTexPixelsAlpha8 = NULL;\n\tTexPixelsRGBA32 = NULL;\n\tTexWidth = TexHeight = 0;\n\tTexUvWhitePixel = ImVec2(0, 0);\n\tfor (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++)\n\t\tCustomRectIds[n] = -1;\n}\n\nImFontAtlas::~ImFontAtlas()\n{\n\tClear();\n}\n\nvoid    ImFontAtlas::ClearInputData()\n{\n\tfor (int i = 0; i < ConfigData.Size; i++)\n\t\tif (ConfigData[i].FontData && ConfigData[i].FontDataOwnedByAtlas)\n\t\t{\n\t\t\tImGui::MemFree(ConfigData[i].FontData);\n\t\t\tConfigData[i].FontData = NULL;\n\t\t}\n\n\t// When clearing this we lose access to  the font name and other information used to build the font.\n\tfor (int i = 0; i < Fonts.Size; i++)\n\t\tif (Fonts[i]->ConfigData >= ConfigData.Data && Fonts[i]->ConfigData < ConfigData.Data + ConfigData.Size)\n\t\t{\n\t\t\tFonts[i]->ConfigData = NULL;\n\t\t\tFonts[i]->ConfigDataCount = 0;\n\t\t}\n\tConfigData.clear();\n\tCustomRects.clear();\n\tfor (int n = 0; n < IM_ARRAYSIZE(CustomRectIds); n++)\n\t\tCustomRectIds[n] = -1;\n}\n\nvoid    ImFontAtlas::ClearTexData()\n{\n\tif (TexPixelsAlpha8)\n\t\tImGui::MemFree(TexPixelsAlpha8);\n\tif (TexPixelsRGBA32)\n\t\tImGui::MemFree(TexPixelsRGBA32);\n\tTexPixelsAlpha8 = NULL;\n\tTexPixelsRGBA32 = NULL;\n}\n\nvoid    ImFontAtlas::ClearFonts()\n{\n\tfor (int i = 0; i < Fonts.Size; i++)\n\t\tIM_DELETE(Fonts[i]);\n\tFonts.clear();\n}\n\nvoid    ImFontAtlas::Clear()\n{\n\tClearInputData();\n\tClearTexData();\n\tClearFonts();\n}\n\nvoid    ImFontAtlas::GetTexDataAsAlpha8(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)\n{\n\t// Build atlas on demand\n\tif (TexPixelsAlpha8 == NULL)\n\t{\n\t\tif (ConfigData.empty())\n\t\t\tAddFontDefault();\n\t\tBuild();\n\t}\n\n\t*out_pixels = TexPixelsAlpha8;\n\tif (out_width) *out_width = TexWidth;\n\tif (out_height) *out_height = TexHeight;\n\tif (out_bytes_per_pixel) *out_bytes_per_pixel = 1;\n}\n\nvoid    ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)\n{\n\t// Convert to RGBA32 format on demand\n\t// Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp\n\tif (!TexPixelsRGBA32)\n\t{\n\t\tunsigned char* pixels = NULL;\n\t\tGetTexDataAsAlpha8(&pixels, NULL, NULL);\n\t\tif (pixels)\n\t\t{\n\t\t\tTexPixelsRGBA32 = (unsigned int*)ImGui::MemAlloc((size_t)(TexWidth * TexHeight * 4));\n\t\t\tconst unsigned char* src = pixels;\n\t\t\tunsigned int* dst = TexPixelsRGBA32;\n\t\t\tfor (int n = TexWidth * TexHeight; n > 0; n--)\n\t\t\t\t*dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++));\n\t\t}\n\t}\n\n\t*out_pixels = (unsigned char*)TexPixelsRGBA32;\n\tif (out_width) *out_width = TexWidth;\n\tif (out_height) *out_height = TexHeight;\n\tif (out_bytes_per_pixel) *out_bytes_per_pixel = 4;\n}\n\nImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)\n{\n\tIM_ASSERT(font_cfg->FontData != NULL && font_cfg->FontDataSize > 0);\n\tIM_ASSERT(font_cfg->SizePixels > 0.0f);\n\n\t// Create new font\n\tif (!font_cfg->MergeMode)\n\t\tFonts.push_back(IM_NEW(ImFont));\n\telse\n\t\tIM_ASSERT(!Fonts.empty()); // When using MergeMode make sure that a font has already been added before. You can use ImGui::GetIO().Fonts->AddFontDefault() to add the default imgui font.\n\n\tConfigData.push_back(*font_cfg);\n\tImFontConfig& new_font_cfg = ConfigData.back();\n\tif (!new_font_cfg.DstFont)\n\t\tnew_font_cfg.DstFont = Fonts.back();\n\tif (!new_font_cfg.FontDataOwnedByAtlas)\n\t{\n\t\tnew_font_cfg.FontData = ImGui::MemAlloc(new_font_cfg.FontDataSize);\n\t\tnew_font_cfg.FontDataOwnedByAtlas = true;\n\t\tmemcpy(new_font_cfg.FontData, font_cfg->FontData, (size_t)new_font_cfg.FontDataSize);\n\t}\n\n\t// Invalidate texture\n\tClearTexData();\n\treturn new_font_cfg.DstFont;\n}\n\n// Default font TTF is compressed with stb_compress then base85 encoded (see extra_fonts/binary_to_compressed_c.cpp for encoder)\nstatic unsigned int stb_decompress_length(unsigned char *input);\nstatic unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length);\nstatic const char*  GetDefaultCompressedFontDataTTFBase85();\nstatic unsigned int Decode85Byte(char c) { return c >= '\\\\' ? c - 36 : c - 35; }\nstatic void         Decode85(const unsigned char* src, unsigned char* dst)\n{\n\twhile (*src)\n\t{\n\t\tunsigned int tmp = Decode85Byte(src[0]) + 85 * (Decode85Byte(src[1]) + 85 * (Decode85Byte(src[2]) + 85 * (Decode85Byte(src[3]) + 85 * Decode85Byte(src[4]))));\n\t\tdst[0] = ((tmp >> 0) & 0xFF); dst[1] = ((tmp >> 8) & 0xFF); dst[2] = ((tmp >> 16) & 0xFF); dst[3] = ((tmp >> 24) & 0xFF);   // We can't assume little-endianness.\n\t\tsrc += 5;\n\t\tdst += 4;\n\t}\n}\n\n// Load embedded ProggyClean.ttf at size 13, disable oversampling\nImFont* ImFontAtlas::AddFontDefault(const ImFontConfig* font_cfg_template)\n{\n\tImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n\tif (!font_cfg_template)\n\t{\n\t\tfont_cfg.OversampleH = font_cfg.OversampleV = 1;\n\t\tfont_cfg.PixelSnapH = true;\n\t}\n\tif (font_cfg.Name[0] == '\\0') strcpy(font_cfg.Name, \"ProggyClean.ttf, 13px\");\n\tif (font_cfg.SizePixels <= 0.0f) font_cfg.SizePixels = 13.0f;\n\n\tconst char* ttf_compressed_base85 = GetDefaultCompressedFontDataTTFBase85();\n\tImFont* font = AddFontFromMemoryCompressedBase85TTF(ttf_compressed_base85, font_cfg.SizePixels, &font_cfg, GetGlyphRangesDefault());\n\treturn font;\n}\n\nImFont* ImFontAtlas::AddFontFromFileTTF(const char* filename, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)\n{\n\tint data_size = 0;\n\tvoid* data = ImFileLoadToMemory(filename, \"rb\", &data_size, 0);\n\tif (!data)\n\t{\n\t\tIM_ASSERT(0); // Could not load file.\n\t\treturn NULL;\n\t}\n\tImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n\tif (font_cfg.Name[0] == '\\0')\n\t{\n\t\t// Store a short copy of filename into into the font name for convenience\n\t\tconst char* p;\n\t\tfor (p = filename + strlen(filename); p > filename && p[-1] != '/' && p[-1] != '\\\\'; p--) {}\n\t\tsnprintf(font_cfg.Name, IM_ARRAYSIZE(font_cfg.Name), \"%s, %.0fpx\", p, size_pixels);\n\t}\n\treturn AddFontFromMemoryTTF(data, data_size, size_pixels, &font_cfg, glyph_ranges);\n}\n\n// NB: Transfer ownership of 'ttf_data' to ImFontAtlas, unless font_cfg_template->FontDataOwnedByAtlas == false. Owned TTF buffer will be deleted after Build().\nImFont* ImFontAtlas::AddFontFromMemoryTTF(void* ttf_data, int ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)\n{\n\tImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n\tIM_ASSERT(font_cfg.FontData == NULL);\n\tfont_cfg.FontData = ttf_data;\n\tfont_cfg.FontDataSize = ttf_size;\n\tfont_cfg.SizePixels = size_pixels;\n\tif (glyph_ranges)\n\t\tfont_cfg.GlyphRanges = glyph_ranges;\n\treturn AddFont(&font_cfg);\n}\n\nImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_data, int compressed_ttf_size, float size_pixels, const ImFontConfig* font_cfg_template, const ImWchar* glyph_ranges)\n{\n\tconst unsigned int buf_decompressed_size = stb_decompress_length((unsigned char*)compressed_ttf_data);\n\tunsigned char* buf_decompressed_data = (unsigned char *)ImGui::MemAlloc(buf_decompressed_size);\n\tstb_decompress(buf_decompressed_data, (unsigned char*)compressed_ttf_data, (unsigned int)compressed_ttf_size);\n\n\tImFontConfig font_cfg = font_cfg_template ? *font_cfg_template : ImFontConfig();\n\tIM_ASSERT(font_cfg.FontData == NULL);\n\tfont_cfg.FontDataOwnedByAtlas = true;\n\treturn AddFontFromMemoryTTF(buf_decompressed_data, (int)buf_decompressed_size, size_pixels, &font_cfg, glyph_ranges);\n}\n\nImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)\n{\n\tint compressed_ttf_size = (((int)strlen(compressed_ttf_data_base85) + 4) / 5) * 4;\n\tvoid* compressed_ttf = ImGui::MemAlloc((size_t)compressed_ttf_size);\n\tDecode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf);\n\tImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);\n\tImGui::MemFree(compressed_ttf);\n\treturn font;\n}\n\nint ImFontAtlas::AddCustomRectRegular(unsigned int id, int width, int height)\n{\n\tIM_ASSERT(id >= 0x10000);\n\tIM_ASSERT(width > 0 && width <= 0xFFFF);\n\tIM_ASSERT(height > 0 && height <= 0xFFFF);\n\tCustomRect r;\n\tr.ID = id;\n\tr.Width = (unsigned short)width;\n\tr.Height = (unsigned short)height;\n\tCustomRects.push_back(r);\n\treturn CustomRects.Size - 1; // Return index\n}\n\nint ImFontAtlas::AddCustomRectFontGlyph(ImFont* font, ImWchar id, int width, int height, float advance_x, const ImVec2& offset)\n{\n\tIM_ASSERT(font != NULL);\n\tIM_ASSERT(width > 0 && width <= 0xFFFF);\n\tIM_ASSERT(height > 0 && height <= 0xFFFF);\n\tCustomRect r;\n\tr.ID = id;\n\tr.Width = (unsigned short)width;\n\tr.Height = (unsigned short)height;\n\tr.GlyphAdvanceX = advance_x;\n\tr.GlyphOffset = offset;\n\tr.Font = font;\n\tCustomRects.push_back(r);\n\treturn CustomRects.Size - 1; // Return index\n}\n\nvoid ImFontAtlas::CalcCustomRectUV(const CustomRect* rect, ImVec2* out_uv_min, ImVec2* out_uv_max)\n{\n\tIM_ASSERT(TexWidth > 0 && TexHeight > 0);   // Font atlas needs to be built before we can calculate UV coordinates\n\tIM_ASSERT(rect->IsPacked());                // Make sure the rectangle has been packed\n\t*out_uv_min = ImVec2((float)rect->X / TexWidth, (float)rect->Y / TexHeight);\n\t*out_uv_max = ImVec2((float)(rect->X + rect->Width) / TexWidth, (float)(rect->Y + rect->Height) / TexHeight);\n}\n\nbool    ImFontAtlas::Build()\n{\n\treturn ImFontAtlasBuildWithStbTruetype(this);\n}\n\nvoid    ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_brighten_factor)\n{\n\tfor (unsigned int i = 0; i < 256; i++)\n\t{\n\t\tunsigned int value = (unsigned int)(i * in_brighten_factor);\n\t\tout_table[i] = value > 255 ? 255 : (value & 0xFF);\n\t}\n}\n\nvoid    ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride)\n{\n\tunsigned char* data = pixels + x + y * stride;\n\tfor (int j = h; j > 0; j--, data += stride)\n\t\tfor (int i = 0; i < w; i++)\n\t\t\tdata[i] = table[data[i]];\n}\n\nbool    ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas)\n{\n\tIM_ASSERT(atlas->ConfigData.Size > 0);\n\n\tImFontAtlasBuildRegisterDefaultCustomRects(atlas);\n\n\tatlas->TexID = NULL;\n\tatlas->TexWidth = atlas->TexHeight = 0;\n\tatlas->TexUvWhitePixel = ImVec2(0, 0);\n\tatlas->ClearTexData();\n\n\t// Count glyphs/ranges\n\tint total_glyphs_count = 0;\n\tint total_ranges_count = 0;\n\tfor (int input_i = 0; input_i < atlas->ConfigData.Size; input_i++)\n\t{\n\t\tImFontConfig& cfg = atlas->ConfigData[input_i];\n\t\tif (!cfg.GlyphRanges)\n\t\t\tcfg.GlyphRanges = atlas->GetGlyphRangesDefault();\n\t\tfor (const ImWchar* in_range = cfg.GlyphRanges; in_range[0] && in_range[1]; in_range += 2, total_ranges_count++)\n\t\t\ttotal_glyphs_count += (in_range[1] - in_range[0]) + 1;\n\t}\n\n\t// We need a width for the skyline algorithm. Using a dumb heuristic here to decide of width. User can override TexDesiredWidth and TexGlyphPadding if they wish.\n\t// Width doesn't really matter much, but some API/GPU have texture size limitations and increasing width can decrease height.\n\tatlas->TexWidth = (atlas->TexDesiredWidth > 0) ? atlas->TexDesiredWidth : (total_glyphs_count > 4000) ? 4096 : (total_glyphs_count > 2000) ? 2048 : (total_glyphs_count > 1000) ? 1024 : 512;\n\tatlas->TexHeight = 0;\n\n\t// Start packing\n\tconst int max_tex_height = 1024 * 32;\n\tstbtt_pack_context spc = {};\n\tstbtt_PackBegin(&spc, NULL, atlas->TexWidth, max_tex_height, 0, atlas->TexGlyphPadding, NULL);\n\tstbtt_PackSetOversampling(&spc, 1, 1);\n\n\t// Pack our extra data rectangles first, so it will be on the upper-left corner of our texture (UV will have small values).\n\tImFontAtlasBuildPackCustomRects(atlas, spc.pack_info);\n\n\t// Initialize font information (so we can error without any cleanup)\n\tstruct ImFontTempBuildData\n\t{\n\t\tstbtt_fontinfo      FontInfo;\n\t\tstbrp_rect*         Rects;\n\t\tint                 RectsCount;\n\t\tstbtt_pack_range*   Ranges;\n\t\tint                 RangesCount;\n\t};\n\tImFontTempBuildData* tmp_array = (ImFontTempBuildData*)ImGui::MemAlloc((size_t)atlas->ConfigData.Size * sizeof(ImFontTempBuildData));\n\tfor (int input_i = 0; input_i < atlas->ConfigData.Size; input_i++)\n\t{\n\t\tImFontConfig& cfg = atlas->ConfigData[input_i];\n\t\tImFontTempBuildData& tmp = tmp_array[input_i];\n\t\tIM_ASSERT(cfg.DstFont && (!cfg.DstFont->IsLoaded() || cfg.DstFont->ContainerAtlas == atlas));\n\n\t\tconst int font_offset = stbtt_GetFontOffsetForIndex((unsigned char*)cfg.FontData, cfg.FontNo);\n\t\tIM_ASSERT(font_offset >= 0);\n\t\tif (!stbtt_InitFont(&tmp.FontInfo, (unsigned char*)cfg.FontData, font_offset))\n\t\t{\n\t\t\tatlas->TexWidth = atlas->TexHeight = 0; // Reset output on failure\n\t\t\tImGui::MemFree(tmp_array);\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// Allocate packing character data and flag packed characters buffer as non-packed (x0=y0=x1=y1=0)\n\tint buf_packedchars_n = 0, buf_rects_n = 0, buf_ranges_n = 0;\n\tstbtt_packedchar* buf_packedchars = (stbtt_packedchar*)ImGui::MemAlloc(total_glyphs_count * sizeof(stbtt_packedchar));\n\tstbrp_rect* buf_rects = (stbrp_rect*)ImGui::MemAlloc(total_glyphs_count * sizeof(stbrp_rect));\n\tstbtt_pack_range* buf_ranges = (stbtt_pack_range*)ImGui::MemAlloc(total_ranges_count * sizeof(stbtt_pack_range));\n\tmemset(buf_packedchars, 0, total_glyphs_count * sizeof(stbtt_packedchar));\n\tmemset(buf_rects, 0, total_glyphs_count * sizeof(stbrp_rect));              // Unnecessary but let's clear this for the sake of sanity.\n\tmemset(buf_ranges, 0, total_ranges_count * sizeof(stbtt_pack_range));\n\n\t// First font pass: pack all glyphs (no rendering at this point, we are working with rectangles in an infinitely tall texture at this point)\n\tfor (int input_i = 0; input_i < atlas->ConfigData.Size; input_i++)\n\t{\n\t\tImFontConfig& cfg = atlas->ConfigData[input_i];\n\t\tImFontTempBuildData& tmp = tmp_array[input_i];\n\n\t\t// Setup ranges\n\t\tint font_glyphs_count = 0;\n\t\tint font_ranges_count = 0;\n\t\tfor (const ImWchar* in_range = cfg.GlyphRanges; in_range[0] && in_range[1]; in_range += 2, font_ranges_count++)\n\t\t\tfont_glyphs_count += (in_range[1] - in_range[0]) + 1;\n\t\ttmp.Ranges = buf_ranges + buf_ranges_n;\n\t\ttmp.RangesCount = font_ranges_count;\n\t\tbuf_ranges_n += font_ranges_count;\n\t\tfor (int i = 0; i < font_ranges_count; i++)\n\t\t{\n\t\t\tconst ImWchar* in_range = &cfg.GlyphRanges[i * 2];\n\t\t\tstbtt_pack_range& range = tmp.Ranges[i];\n\t\t\trange.font_size = cfg.SizePixels;\n\t\t\trange.first_unicode_codepoint_in_range = in_range[0];\n\t\t\trange.num_chars = (in_range[1] - in_range[0]) + 1;\n\t\t\trange.chardata_for_range = buf_packedchars + buf_packedchars_n;\n\t\t\tbuf_packedchars_n += range.num_chars;\n\t\t}\n\n\t\t// Pack\n\t\ttmp.Rects = buf_rects + buf_rects_n;\n\t\ttmp.RectsCount = font_glyphs_count;\n\t\tbuf_rects_n += font_glyphs_count;\n\t\tstbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV);\n\t\tint n = stbtt_PackFontRangesGatherRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects);\n\t\tIM_ASSERT(n == font_glyphs_count);\n\t\tstbrp_pack_rects((stbrp_context*)spc.pack_info, tmp.Rects, n);\n\n\t\t// Extend texture height\n\t\tfor (int i = 0; i < n; i++)\n\t\t\tif (tmp.Rects[i].was_packed)\n\t\t\t\tatlas->TexHeight = ImMax(atlas->TexHeight, tmp.Rects[i].y + tmp.Rects[i].h);\n\t}\n\tIM_ASSERT(buf_rects_n == total_glyphs_count);\n\tIM_ASSERT(buf_packedchars_n == total_glyphs_count);\n\tIM_ASSERT(buf_ranges_n == total_ranges_count);\n\n\t// Create texture\n\tatlas->TexHeight = ImUpperPowerOfTwo(atlas->TexHeight);\n\tatlas->TexPixelsAlpha8 = (unsigned char*)ImGui::MemAlloc(atlas->TexWidth * atlas->TexHeight);\n\tmemset(atlas->TexPixelsAlpha8, 0, atlas->TexWidth * atlas->TexHeight);\n\tspc.pixels = atlas->TexPixelsAlpha8;\n\tspc.height = atlas->TexHeight;\n\n\t// Second pass: render font characters\n\tfor (int input_i = 0; input_i < atlas->ConfigData.Size; input_i++)\n\t{\n\t\tImFontConfig& cfg = atlas->ConfigData[input_i];\n\t\tImFontTempBuildData& tmp = tmp_array[input_i];\n\t\tstbtt_PackSetOversampling(&spc, cfg.OversampleH, cfg.OversampleV);\n\t\tstbtt_PackFontRangesRenderIntoRects(&spc, &tmp.FontInfo, tmp.Ranges, tmp.RangesCount, tmp.Rects);\n\t\tif (cfg.RasterizerMultiply != 1.0f)\n\t\t{\n\t\t\tunsigned char multiply_table[256];\n\t\t\tImFontAtlasBuildMultiplyCalcLookupTable(multiply_table, cfg.RasterizerMultiply);\n\t\t\tfor (const stbrp_rect* r = tmp.Rects; r != tmp.Rects + tmp.RectsCount; r++)\n\t\t\t\tif (r->was_packed)\n\t\t\t\t\tImFontAtlasBuildMultiplyRectAlpha8(multiply_table, spc.pixels, r->x, r->y, r->w, r->h, spc.stride_in_bytes);\n\t\t}\n\t\ttmp.Rects = NULL;\n\t}\n\n\t// End packing\n\tstbtt_PackEnd(&spc);\n\tImGui::MemFree(buf_rects);\n\tbuf_rects = NULL;\n\n\t// Third pass: setup ImFont and glyphs for runtime\n\tfor (int input_i = 0; input_i < atlas->ConfigData.Size; input_i++)\n\t{\n\t\tImFontConfig& cfg = atlas->ConfigData[input_i];\n\t\tImFontTempBuildData& tmp = tmp_array[input_i];\n\t\tImFont* dst_font = cfg.DstFont; // We can have multiple input fonts writing into a same destination font (when using MergeMode=true)\n\n\t\tconst float font_scale = stbtt_ScaleForPixelHeight(&tmp.FontInfo, cfg.SizePixels);\n\t\tint unscaled_ascent, unscaled_descent, unscaled_line_gap;\n\t\tstbtt_GetFontVMetrics(&tmp.FontInfo, &unscaled_ascent, &unscaled_descent, &unscaled_line_gap);\n\n\t\tconst float ascent = unscaled_ascent * font_scale;\n\t\tconst float descent = unscaled_descent * font_scale;\n\t\tImFontAtlasBuildSetupFont(atlas, dst_font, &cfg, ascent, descent);\n\t\tconst float off_x = cfg.GlyphOffset.x;\n\t\tconst float off_y = cfg.GlyphOffset.y + (float)(int)(dst_font->Ascent + 0.5f);\n\n\t\tfor (int i = 0; i < tmp.RangesCount; i++)\n\t\t{\n\t\t\tstbtt_pack_range& range = tmp.Ranges[i];\n\t\t\tfor (int char_idx = 0; char_idx < range.num_chars; char_idx += 1)\n\t\t\t{\n\t\t\t\tconst stbtt_packedchar& pc = range.chardata_for_range[char_idx];\n\t\t\t\tif (!pc.x0 && !pc.x1 && !pc.y0 && !pc.y1)\n\t\t\t\t\tcontinue;\n\n\t\t\t\tconst int codepoint = range.first_unicode_codepoint_in_range + char_idx;\n\t\t\t\tif (cfg.MergeMode && dst_font->FindGlyph((unsigned short)codepoint))\n\t\t\t\t\tcontinue;\n\n\t\t\t\tstbtt_aligned_quad q;\n\t\t\t\tfloat dummy_x = 0.0f, dummy_y = 0.0f;\n\t\t\t\tstbtt_GetPackedQuad(range.chardata_for_range, atlas->TexWidth, atlas->TexHeight, char_idx, &dummy_x, &dummy_y, &q, 0);\n\t\t\t\tdst_font->AddGlyph((ImWchar)codepoint, q.x0 + off_x, q.y0 + off_y, q.x1 + off_x, q.y1 + off_y, q.s0, q.t0, q.s1, q.t1, pc.xadvance);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Cleanup temporaries\n\tImGui::MemFree(buf_packedchars);\n\tImGui::MemFree(buf_ranges);\n\tImGui::MemFree(tmp_array);\n\n\tImFontAtlasBuildFinish(atlas);\n\n\treturn true;\n}\n\nvoid ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas)\n{\n\tif (atlas->CustomRectIds[0] < 0)\n\t\tatlas->CustomRectIds[0] = atlas->AddCustomRectRegular(FONT_ATLAS_DEFAULT_TEX_DATA_ID, FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF * 2 + 1, FONT_ATLAS_DEFAULT_TEX_DATA_H);\n}\n\nvoid ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent)\n{\n\tif (!font_config->MergeMode)\n\t{\n\t\tfont->ClearOutputData();\n\t\tfont->FontSize = font_config->SizePixels;\n\t\tfont->ConfigData = font_config;\n\t\tfont->ContainerAtlas = atlas;\n\t\tfont->Ascent = ascent;\n\t\tfont->Descent = descent;\n\t}\n\tfont->ConfigDataCount++;\n}\n\nvoid ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* pack_context_opaque)\n{\n\tstbrp_context* pack_context = (stbrp_context*)pack_context_opaque;\n\n\tImVector<ImFontAtlas::CustomRect>& user_rects = atlas->CustomRects;\n\tIM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.\n\n\tImVector<stbrp_rect> pack_rects;\n\tpack_rects.resize(user_rects.Size);\n\tmemset(pack_rects.Data, 0, sizeof(stbrp_rect) * user_rects.Size);\n\tfor (int i = 0; i < user_rects.Size; i++)\n\t{\n\t\tpack_rects[i].w = user_rects[i].Width;\n\t\tpack_rects[i].h = user_rects[i].Height;\n\t}\n\tstbrp_pack_rects(pack_context, &pack_rects[0], pack_rects.Size);\n\tfor (int i = 0; i < pack_rects.Size; i++)\n\t\tif (pack_rects[i].was_packed)\n\t\t{\n\t\t\tuser_rects[i].X = pack_rects[i].x;\n\t\t\tuser_rects[i].Y = pack_rects[i].y;\n\t\t\tIM_ASSERT(pack_rects[i].w == user_rects[i].Width && pack_rects[i].h == user_rects[i].Height);\n\t\t\tatlas->TexHeight = ImMax(atlas->TexHeight, pack_rects[i].y + pack_rects[i].h);\n\t\t}\n}\n\nstatic void ImFontAtlasBuildRenderDefaultTexData(ImFontAtlas* atlas)\n{\n\tIM_ASSERT(atlas->CustomRectIds[0] >= 0);\n\tImFontAtlas::CustomRect& r = atlas->CustomRects[atlas->CustomRectIds[0]];\n\tIM_ASSERT(r.ID == FONT_ATLAS_DEFAULT_TEX_DATA_ID);\n\tIM_ASSERT(r.Width == FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF * 2 + 1);\n\tIM_ASSERT(r.Height == FONT_ATLAS_DEFAULT_TEX_DATA_H);\n\tIM_ASSERT(r.IsPacked());\n\tIM_ASSERT(atlas->TexPixelsAlpha8 != NULL);\n\n\t// Render/copy pixels\n\tfor (int y = 0, n = 0; y < FONT_ATLAS_DEFAULT_TEX_DATA_H; y++)\n\t\tfor (int x = 0; x < FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF; x++, n++)\n\t\t{\n\t\t\tconst int offset0 = (int)(r.X + x) + (int)(r.Y + y) * atlas->TexWidth;\n\t\t\tconst int offset1 = offset0 + FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1;\n\t\t\tatlas->TexPixelsAlpha8[offset0] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == '.' ? 0xFF : 0x00;\n\t\t\tatlas->TexPixelsAlpha8[offset1] = FONT_ATLAS_DEFAULT_TEX_DATA_PIXELS[n] == 'X' ? 0xFF : 0x00;\n\t\t}\n\tconst ImVec2 tex_uv_scale(1.0f / atlas->TexWidth, 1.0f / atlas->TexHeight);\n\tatlas->TexUvWhitePixel = ImVec2((r.X + 0.5f) * tex_uv_scale.x, (r.Y + 0.5f) * tex_uv_scale.y);\n\n\t// Setup mouse cursors\n\tfor (int type = 0; type < ImGuiMouseCursor_Count_; type++)\n\t{\n\t\tImGuiMouseCursorData& cursor_data = GImGui->MouseCursorData[type];\n\t\tImVec2 pos = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][0] + ImVec2((float)r.X, (float)r.Y);\n\t\tconst ImVec2 size = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][1];\n\t\tcursor_data.Type = type;\n\t\tcursor_data.Size = size;\n\t\tcursor_data.HotOffset = FONT_ATLAS_DEFAULT_TEX_CURSOR_DATA[type][2];\n\t\tcursor_data.TexUvMin[0] = (pos)* tex_uv_scale;\n\t\tcursor_data.TexUvMax[0] = (pos + size) * tex_uv_scale;\n\t\tpos.x += FONT_ATLAS_DEFAULT_TEX_DATA_W_HALF + 1;\n\t\tcursor_data.TexUvMin[1] = (pos)* tex_uv_scale;\n\t\tcursor_data.TexUvMax[1] = (pos + size) * tex_uv_scale;\n\t}\n}\n\nvoid ImFontAtlasBuildFinish(ImFontAtlas* atlas)\n{\n\t// Render into our custom data block\n\tImFontAtlasBuildRenderDefaultTexData(atlas);\n\n\t// Register custom rectangle glyphs\n\tfor (int i = 0; i < atlas->CustomRects.Size; i++)\n\t{\n\t\tconst ImFontAtlas::CustomRect& r = atlas->CustomRects[i];\n\t\tif (r.Font == NULL || r.ID > 0x10000)\n\t\t\tcontinue;\n\n\t\tIM_ASSERT(r.Font->ContainerAtlas == atlas);\n\t\tImVec2 uv0, uv1;\n\t\tatlas->CalcCustomRectUV(&r, &uv0, &uv1);\n\t\tr.Font->AddGlyph((ImWchar)r.ID, r.GlyphOffset.x, r.GlyphOffset.y, r.GlyphOffset.x + r.Width, r.GlyphOffset.y + r.Height, uv0.x, uv0.y, uv1.x, uv1.y, r.GlyphAdvanceX);\n\t}\n\n\t// Build all fonts lookup tables\n\tfor (int i = 0; i < atlas->Fonts.Size; i++)\n\t\tatlas->Fonts[i]->BuildLookupTable();\n}\n\n// Retrieve list of range (2 int per range, values are inclusive)\nconst ImWchar*   ImFontAtlas::GetGlyphRangesDefault()\n{\n\tstatic const ImWchar ranges[] =\n\t{\n\t\t0x0020, 0x00FF, // Basic Latin + Latin Supplement\n\t\t0,\n\t};\n\treturn &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesKorean()\n{\n\tstatic const ImWchar ranges[] =\n\t{\n\t\t0x0020, 0x00FF, // Basic Latin + Latin Supplement\n\t\t0x3131, 0x3163, // Korean alphabets\n\t\t0xAC00, 0xD79D, // Korean characters\n\t\t0,\n\t};\n\treturn &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesChinese()\n{\n\tstatic const ImWchar ranges[] =\n\t{\n\t\t0x0020, 0x00FF, // Basic Latin + Latin Supplement\n\t\t0x3000, 0x30FF, // Punctuations, Hiragana, Katakana\n\t\t0x31F0, 0x31FF, // Katakana Phonetic Extensions\n\t\t0xFF00, 0xFFEF, // Half-width characters\n\t\t0x4e00, 0x9FAF, // CJK Ideograms\n\t\t0,\n\t};\n\treturn &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesJapanese()\n{\n\t// Store the 1946 ideograms code points as successive offsets from the initial unicode codepoint 0x4E00. Each offset has an implicit +1.\n\t// This encoding is designed to helps us reduce the source code size.\n\t// FIXME: Source a list of the revised 2136 joyo kanji list from 2010 and rebuild this.\n\t// The current list was sourced from http://theinstructionlimit.com/author/renaudbedardrenaudbedard/page/3\n\t// Note that you may use ImFontAtlas::GlyphRangesBuilder to create your own ranges, by merging existing ranges or adding new characters.\n\tstatic const short offsets_from_0x4E00[] =\n\t{\n\t\t-1,0,1,3,0,0,0,0,1,0,5,1,1,0,7,4,6,10,0,1,9,9,7,1,3,19,1,10,7,1,0,1,0,5,1,0,6,4,2,6,0,0,12,6,8,0,3,5,0,1,0,9,0,0,8,1,1,3,4,5,13,0,0,8,2,17,\n\t\t4,3,1,1,9,6,0,0,0,2,1,3,2,22,1,9,11,1,13,1,3,12,0,5,9,2,0,6,12,5,3,12,4,1,2,16,1,1,4,6,5,3,0,6,13,15,5,12,8,14,0,0,6,15,3,6,0,18,8,1,6,14,1,\n\t\t5,4,12,24,3,13,12,10,24,0,0,0,1,0,1,1,2,9,10,2,2,0,0,3,3,1,0,3,8,0,3,2,4,4,1,6,11,10,14,6,15,3,4,15,1,0,0,5,2,2,0,0,1,6,5,5,6,0,3,6,5,0,0,1,0,\n\t\t11,2,2,8,4,7,0,10,0,1,2,17,19,3,0,2,5,0,6,2,4,4,6,1,1,11,2,0,3,1,2,1,2,10,7,6,3,16,0,8,24,0,0,3,1,1,3,0,1,6,0,0,0,2,0,1,5,15,0,1,0,0,2,11,19,\n\t\t1,4,19,7,6,5,1,0,0,0,0,5,1,0,1,9,0,0,5,0,2,0,1,0,3,0,11,3,0,2,0,0,0,0,0,9,3,6,4,12,0,14,0,0,29,10,8,0,14,37,13,0,31,16,19,0,8,30,1,20,8,3,48,\n\t\t21,1,0,12,0,10,44,34,42,54,11,18,82,0,2,1,2,12,1,0,6,2,17,2,12,7,0,7,17,4,2,6,24,23,8,23,39,2,16,23,1,0,5,1,2,15,14,5,6,2,11,0,8,6,2,2,2,14,\n\t\t20,4,15,3,4,11,10,10,2,5,2,1,30,2,1,0,0,22,5,5,0,3,1,5,4,1,0,0,2,2,21,1,5,1,2,16,2,1,3,4,0,8,4,0,0,5,14,11,2,16,1,13,1,7,0,22,15,3,1,22,7,14,\n\t\t22,19,11,24,18,46,10,20,64,45,3,2,0,4,5,0,1,4,25,1,0,0,2,10,0,0,0,1,0,1,2,0,0,9,1,2,0,0,0,2,5,2,1,1,5,5,8,1,1,1,5,1,4,9,1,3,0,1,0,1,1,2,0,0,\n\t\t2,0,1,8,22,8,1,0,0,0,0,4,2,1,0,9,8,5,0,9,1,30,24,2,6,4,39,0,14,5,16,6,26,179,0,2,1,1,0,0,0,5,2,9,6,0,2,5,16,7,5,1,1,0,2,4,4,7,15,13,14,0,0,\n\t\t3,0,1,0,0,0,2,1,6,4,5,1,4,9,0,3,1,8,0,0,10,5,0,43,0,2,6,8,4,0,2,0,0,9,6,0,9,3,1,6,20,14,6,1,4,0,7,2,3,0,2,0,5,0,3,1,0,3,9,7,0,3,4,0,4,9,1,6,0,\n\t\t9,0,0,2,3,10,9,28,3,6,2,4,1,2,32,4,1,18,2,0,3,1,5,30,10,0,2,2,2,0,7,9,8,11,10,11,7,2,13,7,5,10,0,3,40,2,0,1,6,12,0,4,5,1,5,11,11,21,4,8,3,7,\n\t\t8,8,33,5,23,0,0,19,8,8,2,3,0,6,1,1,1,5,1,27,4,2,5,0,3,5,6,3,1,0,3,1,12,5,3,3,2,0,7,7,2,1,0,4,0,1,1,2,0,10,10,6,2,5,9,7,5,15,15,21,6,11,5,20,\n\t\t4,3,5,5,2,5,0,2,1,0,1,7,28,0,9,0,5,12,5,5,18,30,0,12,3,3,21,16,25,32,9,3,14,11,24,5,66,9,1,2,0,5,9,1,5,1,8,0,8,3,3,0,1,15,1,4,8,1,2,7,0,7,2,\n\t\t8,3,7,5,3,7,10,2,1,0,0,2,25,0,6,4,0,10,0,4,2,4,1,12,5,38,4,0,4,1,10,5,9,4,0,14,4,2,5,18,20,21,1,3,0,5,0,7,0,3,7,1,3,1,1,8,1,0,0,0,3,2,5,2,11,\n\t\t6,0,13,1,3,9,1,12,0,16,6,2,1,0,2,1,12,6,13,11,2,0,28,1,7,8,14,13,8,13,0,2,0,5,4,8,10,2,37,42,19,6,6,7,4,14,11,18,14,80,7,6,0,4,72,12,36,27,\n\t\t7,7,0,14,17,19,164,27,0,5,10,7,3,13,6,14,0,2,2,5,3,0,6,13,0,0,10,29,0,4,0,3,13,0,3,1,6,51,1,5,28,2,0,8,0,20,2,4,0,25,2,10,13,10,0,16,4,0,1,0,\n\t\t2,1,7,0,1,8,11,0,0,1,2,7,2,23,11,6,6,4,16,2,2,2,0,22,9,3,3,5,2,0,15,16,21,2,9,20,15,15,5,3,9,1,0,0,1,7,7,5,4,2,2,2,38,24,14,0,0,15,5,6,24,14,\n\t\t5,5,11,0,21,12,0,3,8,4,11,1,8,0,11,27,7,2,4,9,21,59,0,1,39,3,60,62,3,0,12,11,0,3,30,11,0,13,88,4,15,5,28,13,1,4,48,17,17,4,28,32,46,0,16,0,\n\t\t18,11,1,8,6,38,11,2,6,11,38,2,0,45,3,11,2,7,8,4,30,14,17,2,1,1,65,18,12,16,4,2,45,123,12,56,33,1,4,3,4,7,0,0,0,3,2,0,16,4,2,4,2,0,7,4,5,2,26,\n\t\t2,25,6,11,6,1,16,2,6,17,77,15,3,35,0,1,0,5,1,0,38,16,6,3,12,3,3,3,0,9,3,1,3,5,2,9,0,18,0,25,1,3,32,1,72,46,6,2,7,1,3,14,17,0,28,1,40,13,0,20,\n\t\t15,40,6,38,24,12,43,1,1,9,0,12,6,0,6,2,4,19,3,7,1,48,0,9,5,0,5,6,9,6,10,15,2,11,19,3,9,2,0,1,10,1,27,8,1,3,6,1,14,0,26,0,27,16,3,4,9,6,2,23,\n\t\t9,10,5,25,2,1,6,1,1,48,15,9,15,14,3,4,26,60,29,13,37,21,1,6,4,0,2,11,22,23,16,16,2,2,1,3,0,5,1,6,4,0,0,4,0,0,8,3,0,2,5,0,7,1,7,3,13,2,4,10,\n\t\t3,0,2,31,0,18,3,0,12,10,4,1,0,7,5,7,0,5,4,12,2,22,10,4,2,15,2,8,9,0,23,2,197,51,3,1,1,4,13,4,3,21,4,19,3,10,5,40,0,4,1,1,10,4,1,27,34,7,21,\n\t\t2,17,2,9,6,4,2,3,0,4,2,7,8,2,5,1,15,21,3,4,4,2,2,17,22,1,5,22,4,26,7,0,32,1,11,42,15,4,1,2,5,0,19,3,1,8,6,0,10,1,9,2,13,30,8,2,24,17,19,1,4,\n\t\t4,25,13,0,10,16,11,39,18,8,5,30,82,1,6,8,18,77,11,13,20,75,11,112,78,33,3,0,0,60,17,84,9,1,1,12,30,10,49,5,32,158,178,5,5,6,3,3,1,3,1,4,7,6,\n\t\t19,31,21,0,2,9,5,6,27,4,9,8,1,76,18,12,1,4,0,3,3,6,3,12,2,8,30,16,2,25,1,5,5,4,3,0,6,10,2,3,1,0,5,1,19,3,0,8,1,5,2,6,0,0,0,19,1,2,0,5,1,2,5,\n\t\t1,3,7,0,4,12,7,3,10,22,0,9,5,1,0,2,20,1,1,3,23,30,3,9,9,1,4,191,14,3,15,6,8,50,0,1,0,0,4,0,0,1,0,2,4,2,0,2,3,0,2,0,2,2,8,7,0,1,1,1,3,3,17,11,\n\t\t91,1,9,3,2,13,4,24,15,41,3,13,3,1,20,4,125,29,30,1,0,4,12,2,21,4,5,5,19,11,0,13,11,86,2,18,0,7,1,8,8,2,2,22,1,2,6,5,2,0,1,2,8,0,2,0,5,2,1,0,\n\t\t2,10,2,0,5,9,2,1,2,0,1,0,4,0,0,10,2,5,3,0,6,1,0,1,4,4,33,3,13,17,3,18,6,4,7,1,5,78,0,4,1,13,7,1,8,1,0,35,27,15,3,0,0,0,1,11,5,41,38,15,22,6,\n\t\t14,14,2,1,11,6,20,63,5,8,27,7,11,2,2,40,58,23,50,54,56,293,8,8,1,5,1,14,0,1,12,37,89,8,8,8,2,10,6,0,0,0,4,5,2,1,0,1,1,2,7,0,3,3,0,4,6,0,3,2,\n\t\t19,3,8,0,0,0,4,4,16,0,4,1,5,1,3,0,3,4,6,2,17,10,10,31,6,4,3,6,10,126,7,3,2,2,0,9,0,0,5,20,13,0,15,0,6,0,2,5,8,64,50,3,2,12,2,9,0,0,11,8,20,\n\t\t109,2,18,23,0,0,9,61,3,0,28,41,77,27,19,17,81,5,2,14,5,83,57,252,14,154,263,14,20,8,13,6,57,39,38,\n\t};\n\tstatic ImWchar base_ranges[] =\n\t{\n\t\t0x0020, 0x00FF, // Basic Latin + Latin Supplement\n\t\t0x3000, 0x30FF, // Punctuations, Hiragana, Katakana\n\t\t0x31F0, 0x31FF, // Katakana Phonetic Extensions\n\t\t0xFF00, 0xFFEF, // Half-width characters\n\t};\n\tstatic bool full_ranges_unpacked = false;\n\tstatic ImWchar full_ranges[IM_ARRAYSIZE(base_ranges) + IM_ARRAYSIZE(offsets_from_0x4E00) * 2 + 1];\n\tif (!full_ranges_unpacked)\n\t{\n\t\t// Unpack\n\t\tint codepoint = 0x4e00;\n\t\tmemcpy(full_ranges, base_ranges, sizeof(base_ranges));\n\t\tImWchar* dst = full_ranges + IM_ARRAYSIZE(base_ranges);;\n\t\tfor (int n = 0; n < IM_ARRAYSIZE(offsets_from_0x4E00); n++, dst += 2)\n\t\t\tdst[0] = dst[1] = (ImWchar)(codepoint += (offsets_from_0x4E00[n] + 1));\n\t\tdst[0] = 0;\n\t\tfull_ranges_unpacked = true;\n\t}\n\treturn &full_ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesCyrillic()\n{\n\tstatic const ImWchar ranges[] =\n\t{\n\t\t0x0020, 0x00FF, // Basic Latin + Latin Supplement\n\t\t0x0400, 0x052F, // Cyrillic + Cyrillic Supplement\n\t\t0x2DE0, 0x2DFF, // Cyrillic Extended-A\n\t\t0xA640, 0xA69F, // Cyrillic Extended-B\n\t\t0,\n\t};\n\treturn &ranges[0];\n}\n\nconst ImWchar*  ImFontAtlas::GetGlyphRangesThai()\n{\n\tstatic const ImWchar ranges[] =\n\t{\n\t\t0x0020, 0x00FF, // Basic Latin\n\t\t0x2010, 0x205E, // Punctuations\n\t\t0x0E00, 0x0E7F, // Thai\n\t\t0,\n\t};\n\treturn &ranges[0];\n}\n\n//-----------------------------------------------------------------------------\n// ImFontAtlas::GlyphRangesBuilder\n//-----------------------------------------------------------------------------\n\nvoid ImFontAtlas::GlyphRangesBuilder::AddText(const char* text, const char* text_end)\n{\n\twhile (text_end ? (text < text_end) : *text)\n\t{\n\t\tunsigned int c = 0;\n\t\tint c_len = ImTextCharFromUtf8(&c, text, text_end);\n\t\ttext += c_len;\n\t\tif (c_len == 0)\n\t\t\tbreak;\n\t\tif (c < 0x10000)\n\t\t\tAddChar((ImWchar)c);\n\t}\n}\n\nvoid ImFontAtlas::GlyphRangesBuilder::AddRanges(const ImWchar* ranges)\n{\n\tfor (; ranges[0]; ranges += 2)\n\t\tfor (ImWchar c = ranges[0]; c <= ranges[1]; c++)\n\t\t\tAddChar(c);\n}\n\nvoid ImFontAtlas::GlyphRangesBuilder::BuildRanges(ImVector<ImWchar>* out_ranges)\n{\n\tfor (int n = 0; n < 0x10000; n++)\n\t\tif (GetBit(n))\n\t\t{\n\t\t\tout_ranges->push_back((ImWchar)n);\n\t\t\twhile (n < 0x10000 && GetBit(n + 1))\n\t\t\t\tn++;\n\t\t\tout_ranges->push_back((ImWchar)n);\n\t\t}\n\tout_ranges->push_back(0);\n}\n\n//-----------------------------------------------------------------------------\n// ImFont\n//-----------------------------------------------------------------------------\n\nImFont::ImFont()\n{\n\tScale = 1.0f;\n\tFallbackChar = (ImWchar)'?';\n\tDisplayOffset = ImVec2(0.0f, 1.0f);\n\tClearOutputData();\n}\n\nImFont::~ImFont()\n{\n\t// Invalidate active font so that the user gets a clear crash instead of a dangling pointer.\n\t// If you want to delete fonts you need to do it between Render() and NewFrame().\n\t// FIXME-CLEANUP\n\t/*\n\tImGuiContext& g = *GImGui;\n\tif (g.Font == this)\n\tg.Font = NULL;\n\t*/\n\tClearOutputData();\n}\n\nvoid    ImFont::ClearOutputData()\n{\n\tFontSize = 0.0f;\n\tGlyphs.clear();\n\tIndexAdvanceX.clear();\n\tIndexLookup.clear();\n\tFallbackGlyph = NULL;\n\tFallbackAdvanceX = 0.0f;\n\tConfigDataCount = 0;\n\tConfigData = NULL;\n\tContainerAtlas = NULL;\n\tAscent = Descent = 0.0f;\n\tMetricsTotalSurface = 0;\n}\n\nvoid ImFont::BuildLookupTable()\n{\n\tint max_codepoint = 0;\n\tfor (int i = 0; i != Glyphs.Size; i++)\n\t\tmax_codepoint = ImMax(max_codepoint, (int)Glyphs[i].Codepoint);\n\n\tIM_ASSERT(Glyphs.Size < 0xFFFF); // -1 is reserved\n\tIndexAdvanceX.clear();\n\tIndexLookup.clear();\n\tGrowIndex(max_codepoint + 1);\n\tfor (int i = 0; i < Glyphs.Size; i++)\n\t{\n\t\tint codepoint = (int)Glyphs[i].Codepoint;\n\t\tIndexAdvanceX[codepoint] = Glyphs[i].AdvanceX;\n\t\tIndexLookup[codepoint] = (unsigned short)i;\n\t}\n\n\t// Create a glyph to handle TAB\n\t// FIXME: Needs proper TAB handling but it needs to be contextualized (or we could arbitrary say that each string starts at \"column 0\" ?)\n\tif (FindGlyph((unsigned short)' '))\n\t{\n\t\tif (Glyphs.back().Codepoint != '\\t')   // So we can call this function multiple times\n\t\t\tGlyphs.resize(Glyphs.Size + 1);\n\t\tImFontGlyph& tab_glyph = Glyphs.back();\n\t\ttab_glyph = *FindGlyph((unsigned short)' ');\n\t\ttab_glyph.Codepoint = '\\t';\n\t\ttab_glyph.AdvanceX *= 4;\n\t\tIndexAdvanceX[(int)tab_glyph.Codepoint] = (float)tab_glyph.AdvanceX;\n\t\tIndexLookup[(int)tab_glyph.Codepoint] = (unsigned short)(Glyphs.Size - 1);\n\t}\n\n\tFallbackGlyph = NULL;\n\tFallbackGlyph = FindGlyph(FallbackChar);\n\tFallbackAdvanceX = FallbackGlyph ? FallbackGlyph->AdvanceX : 0.0f;\n\tfor (int i = 0; i < max_codepoint + 1; i++)\n\t\tif (IndexAdvanceX[i] < 0.0f)\n\t\t\tIndexAdvanceX[i] = FallbackAdvanceX;\n}\n\nvoid ImFont::SetFallbackChar(ImWchar c)\n{\n\tFallbackChar = c;\n\tBuildLookupTable();\n}\n\nvoid ImFont::GrowIndex(int new_size)\n{\n\tIM_ASSERT(IndexAdvanceX.Size == IndexLookup.Size);\n\tif (new_size <= IndexLookup.Size)\n\t\treturn;\n\tIndexAdvanceX.resize(new_size, -1.0f);\n\tIndexLookup.resize(new_size, (unsigned short)-1);\n}\n\nvoid ImFont::AddGlyph(ImWchar codepoint, float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, float advance_x)\n{\n\tGlyphs.resize(Glyphs.Size + 1);\n\tImFontGlyph& glyph = Glyphs.back();\n\tglyph.Codepoint = (ImWchar)codepoint;\n\tglyph.X0 = x0;\n\tglyph.Y0 = y0;\n\tglyph.X1 = x1;\n\tglyph.Y1 = y1;\n\tglyph.U0 = u0;\n\tglyph.V0 = v0;\n\tglyph.U1 = u1;\n\tglyph.V1 = v1;\n\tglyph.AdvanceX = advance_x + ConfigData->GlyphExtraSpacing.x;  // Bake spacing into AdvanceX\n\n\tif (ConfigData->PixelSnapH)\n\t\tglyph.AdvanceX = (float)(int)(glyph.AdvanceX + 0.5f);\n\n\t// Compute rough surface usage metrics (+1 to account for average padding, +0.99 to round)\n\tMetricsTotalSurface += (int)((glyph.U1 - glyph.U0) * ContainerAtlas->TexWidth + 1.99f) * (int)((glyph.V1 - glyph.V0) * ContainerAtlas->TexHeight + 1.99f);\n}\n\nvoid ImFont::AddRemapChar(ImWchar dst, ImWchar src, bool overwrite_dst)\n{\n\tIM_ASSERT(IndexLookup.Size > 0);    // Currently this can only be called AFTER the font has been built, aka after calling ImFontAtlas::GetTexDataAs*() function.\n\tint index_size = IndexLookup.Size;\n\n\tif (dst < index_size && IndexLookup.Data[dst] == (unsigned short)-1 && !overwrite_dst) // 'dst' already exists\n\t\treturn;\n\tif (src >= index_size && dst >= index_size) // both 'dst' and 'src' don't exist -> no-op\n\t\treturn;\n\n\tGrowIndex(dst + 1);\n\tIndexLookup[dst] = (src < index_size) ? IndexLookup.Data[src] : (unsigned short)-1;\n\tIndexAdvanceX[dst] = (src < index_size) ? IndexAdvanceX.Data[src] : 1.0f;\n}\n\nconst ImFontGlyph* ImFont::FindGlyph(ImWchar c) const\n{\n\tif (c < IndexLookup.Size)\n\t{\n\t\tconst unsigned short i = IndexLookup[c];\n\t\tif (i != (unsigned short)-1)\n\t\t\treturn &Glyphs.Data[i];\n\t}\n\treturn FallbackGlyph;\n}\n\nconst char* ImFont::CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const\n{\n\t// Simple word-wrapping for English, not full-featured. Please submit failing cases!\n\t// FIXME: Much possible improvements (don't cut things like \"word !\", \"word!!!\" but cut within \"word,,,,\", more sensible support for punctuations, support for Unicode punctuations, etc.)\n\n\t// For references, possible wrap point marked with ^\n\t//  \"aaa bbb, ccc,ddd. eee   fff. ggg!\"\n\t//      ^    ^    ^   ^   ^__    ^    ^\n\n\t// List of hardcoded separators: .,;!?'\"\n\n\t// Skip extra blanks after a line returns (that includes not counting them in width computation)\n\t// e.g. \"Hello    world\" --> \"Hello\" \"World\"\n\n\t// Cut words that cannot possibly fit within one line.\n\t// e.g.: \"The tropical fish\" with ~5 characters worth of width --> \"The tr\" \"opical\" \"fish\"\n\n\tfloat line_width = 0.0f;\n\tfloat word_width = 0.0f;\n\tfloat blank_width = 0.0f;\n\twrap_width /= scale; // We work with unscaled widths to avoid scaling every characters\n\n\tconst char* word_end = text;\n\tconst char* prev_word_end = NULL;\n\tbool inside_word = true;\n\n\tconst char* s = text;\n\twhile (s < text_end)\n\t{\n\t\tunsigned int c = (unsigned int)*s;\n\t\tconst char* next_s;\n\t\tif (c < 0x80)\n\t\t\tnext_s = s + 1;\n\t\telse\n\t\t\tnext_s = s + ImTextCharFromUtf8(&c, s, text_end);\n\t\tif (c == 0)\n\t\t\tbreak;\n\n\t\tif (c < 32)\n\t\t{\n\t\t\tif (c == '\\n')\n\t\t\t{\n\t\t\t\tline_width = word_width = blank_width = 0.0f;\n\t\t\t\tinside_word = true;\n\t\t\t\ts = next_s;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (c == '\\r')\n\t\t\t{\n\t\t\t\ts = next_s;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tconst float char_width = ((int)c < IndexAdvanceX.Size ? IndexAdvanceX[(int)c] : FallbackAdvanceX);\n\t\tif (ImCharIsSpace(c))\n\t\t{\n\t\t\tif (inside_word)\n\t\t\t{\n\t\t\t\tline_width += blank_width;\n\t\t\t\tblank_width = 0.0f;\n\t\t\t\tword_end = s;\n\t\t\t}\n\t\t\tblank_width += char_width;\n\t\t\tinside_word = false;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tword_width += char_width;\n\t\t\tif (inside_word)\n\t\t\t{\n\t\t\t\tword_end = next_s;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tprev_word_end = word_end;\n\t\t\t\tline_width += word_width + blank_width;\n\t\t\t\tword_width = blank_width = 0.0f;\n\t\t\t}\n\n\t\t\t// Allow wrapping after punctuation.\n\t\t\tinside_word = !(c == '.' || c == ',' || c == ';' || c == '!' || c == '?' || c == '\\\"');\n\t\t}\n\n\t\t// We ignore blank width at the end of the line (they can be skipped)\n\t\tif (line_width + word_width >= wrap_width)\n\t\t{\n\t\t\t// Words that cannot possibly fit within an entire line will be cut anywhere.\n\t\t\tif (word_width < wrap_width)\n\t\t\t\ts = prev_word_end ? prev_word_end : word_end;\n\t\t\tbreak;\n\t\t}\n\n\t\ts = next_s;\n\t}\n\n\treturn s;\n}\n\nImVec2 ImFont::CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining) const\n{\n\tif (!text_end)\n\t\ttext_end = text_begin + strlen(text_begin); // FIXME-OPT: Need to avoid this.\n\n\tconst float line_height = size;\n\tconst float scale = size / FontSize;\n\n\tImVec2 text_size = ImVec2(0, 0);\n\tfloat line_width = 0.0f;\n\n\tconst bool word_wrap_enabled = (wrap_width > 0.0f);\n\tconst char* word_wrap_eol = NULL;\n\n\tconst char* s = text_begin;\n\twhile (s < text_end)\n\t{\n\t\tif (word_wrap_enabled)\n\t\t{\n\t\t\t// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.\n\t\t\tif (!word_wrap_eol)\n\t\t\t{\n\t\t\t\tword_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - line_width);\n\t\t\t\tif (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.\n\t\t\t\t\tword_wrap_eol++;    // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below\n\t\t\t}\n\n\t\t\tif (s >= word_wrap_eol)\n\t\t\t{\n\t\t\t\tif (text_size.x < line_width)\n\t\t\t\t\ttext_size.x = line_width;\n\t\t\t\ttext_size.y += line_height;\n\t\t\t\tline_width = 0.0f;\n\t\t\t\tword_wrap_eol = NULL;\n\n\t\t\t\t// Wrapping skips upcoming blanks\n\t\t\t\twhile (s < text_end)\n\t\t\t\t{\n\t\t\t\t\tconst char c = *s;\n\t\t\t\t\tif (ImCharIsSpace(c)) { s++; }\n\t\t\t\t\telse if (c == '\\n') { s++; break; }\n\t\t\t\t\telse { break; }\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// Decode and advance source\n\t\tconst char* prev_s = s;\n\t\tunsigned int c = (unsigned int)*s;\n\t\tif (c < 0x80)\n\t\t{\n\t\t\ts += 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts += ImTextCharFromUtf8(&c, s, text_end);\n\t\t\tif (c == 0) // Malformed UTF-8?\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (c < 32)\n\t\t{\n\t\t\tif (c == '\\n')\n\t\t\t{\n\t\t\t\ttext_size.x = ImMax(text_size.x, line_width);\n\t\t\t\ttext_size.y += line_height;\n\t\t\t\tline_width = 0.0f;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (c == '\\r')\n\t\t\t\tcontinue;\n\t\t}\n\n\t\tconst float char_width = ((int)c < IndexAdvanceX.Size ? IndexAdvanceX[(int)c] : FallbackAdvanceX) * scale;\n\t\tif (line_width + char_width >= max_width)\n\t\t{\n\t\t\ts = prev_s;\n\t\t\tbreak;\n\t\t}\n\n\t\tline_width += char_width;\n\t}\n\n\tif (text_size.x < line_width)\n\t\ttext_size.x = line_width;\n\n\tif (line_width > 0 || text_size.y == 0.0f)\n\t\ttext_size.y += line_height;\n\n\tif (remaining)\n\t\t*remaining = s;\n\n\treturn text_size;\n}\n\nvoid ImFont::RenderChar(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, unsigned short c) const\n{\n\tif (c == ' ' || c == '\\t' || c == '\\n' || c == '\\r') // Match behavior of RenderText(), those 4 codepoints are hard-coded.\n\t\treturn;\n\tif (const ImFontGlyph* glyph = FindGlyph(c))\n\t{\n\t\tfloat scale = (size >= 0.0f) ? (size / FontSize) : 1.0f;\n\t\tpos.x = (float)(int)pos.x + DisplayOffset.x;\n\t\tpos.y = (float)(int)pos.y + DisplayOffset.y;\n\t\tdraw_list->PrimReserve(6, 4);\n\t\tdraw_list->PrimRectUV(ImVec2(pos.x + glyph->X0 * scale, pos.y + glyph->Y0 * scale), ImVec2(pos.x + glyph->X1 * scale, pos.y + glyph->Y1 * scale), ImVec2(glyph->U0, glyph->V0), ImVec2(glyph->U1, glyph->V1), col);\n\t}\n}\n\nvoid ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width, bool cpu_fine_clip) const\n{\n\tif (!text_end)\n\t\ttext_end = text_begin + strlen(text_begin); // ImGui functions generally already provides a valid text_end, so this is merely to handle direct calls.\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t// Align to be pixel perfect\n\tpos.x = (float)(int)pos.x + DisplayOffset.x;\n\tpos.y = (float)(int)pos.y + DisplayOffset.y;\n\tfloat x = pos.x;\n\tfloat y = pos.y;\n\tif (y > clip_rect.w)\n\t\treturn;\n\n\tconst float scale = size / FontSize;\n\tconst float line_height = FontSize * scale;\n\tconst bool word_wrap_enabled = (wrap_width > 0.0f);\n\tconst char* word_wrap_eol = NULL;\n\n\t// Skip non-visible lines\n\tconst char* s = text_begin;\n\tif (!word_wrap_enabled && y + line_height < clip_rect.y)\n\t\twhile (s < text_end && *s != '\\n')  // Fast-forward to next line\n\t\t\ts++;\n\n\t// Reserve vertices for remaining worse case (over-reserving is useful and easily amortized)\n\tconst int vtx_count_max = (int)(text_end - s) * 4;\n\tconst int idx_count_max = (int)(text_end - s) * 6;\n\tconst int idx_expected_size = draw_list->IdxBuffer.Size + idx_count_max;\n\tdraw_list->PrimReserve(idx_count_max, vtx_count_max);\n\n\tImDrawVert* vtx_write = draw_list->_VtxWritePtr;\n\tImDrawIdx* idx_write = draw_list->_IdxWritePtr;\n\tunsigned int vtx_current_idx = draw_list->_VtxCurrentIdx;\n\n\twhile (s < text_end)\n\t{\n\t\tif (word_wrap_enabled)\n\t\t{\n\t\t\t// Calculate how far we can render. Requires two passes on the string data but keeps the code simple and not intrusive for what's essentially an uncommon feature.\n\t\t\tif (!word_wrap_eol)\n\t\t\t{\n\t\t\t\tword_wrap_eol = CalcWordWrapPositionA(scale, s, text_end, wrap_width - (x - pos.x));\n\t\t\t\tif (word_wrap_eol == s) // Wrap_width is too small to fit anything. Force displaying 1 character to minimize the height discontinuity.\n\t\t\t\t\tword_wrap_eol++;    // +1 may not be a character start point in UTF-8 but it's ok because we use s >= word_wrap_eol below\n\t\t\t}\n\n\t\t\tif (s >= word_wrap_eol)\n\t\t\t{\n\t\t\t\tx = pos.x;\n\t\t\t\ty += line_height;\n\t\t\t\tword_wrap_eol = NULL;\n\n\t\t\t\t// Wrapping skips upcoming blanks\n\t\t\t\twhile (s < text_end)\n\t\t\t\t{\n\t\t\t\t\tconst char c = *s;\n\t\t\t\t\tif (ImCharIsSpace(c)) { s++; }\n\t\t\t\t\telse if (c == '\\n') { s++; break; }\n\t\t\t\t\telse { break; }\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// Decode and advance source\n\t\tunsigned int c = (unsigned int)*s;\n\t\tif (c < 0x80)\n\t\t{\n\t\t\ts += 1;\n\t\t}\n\t\telse\n\t\t{\n\t\t\ts += ImTextCharFromUtf8(&c, s, text_end);\n\t\t\tif (c == 0) // Malformed UTF-8?\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (c < 32)\n\t\t{\n\t\t\tif (c == '\\n')\n\t\t\t{\n\t\t\t\tx = pos.x;\n\t\t\t\ty += line_height;\n\n\t\t\t\tif (y > clip_rect.w)\n\t\t\t\t\tbreak;\n\t\t\t\tif (!word_wrap_enabled && y + line_height < clip_rect.y)\n\t\t\t\t\twhile (s < text_end && *s != '\\n')  // Fast-forward to next line\n\t\t\t\t\t\ts++;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (c == '\\r')\n\t\t\t\tcontinue;\n\t\t}\n\n\t\tfloat char_width = 0.0f;\n\t\tif (const ImFontGlyph* glyph = FindGlyph((unsigned short)c))\n\t\t{\n\t\t\tchar_width = glyph->AdvanceX * scale;\n\n\t\t\t// Arbitrarily assume that both space and tabs are empty glyphs as an optimization\n\t\t\tif (c != ' ' && c != '\\t')\n\t\t\t{\n\t\t\t\t// We don't do a second finer clipping test on the Y axis as we've already skipped anything before clip_rect.y and exit once we pass clip_rect.w\n\t\t\t\tfloat x1 = x + glyph->X0 * scale;\n\t\t\t\tfloat x2 = x + glyph->X1 * scale;\n\t\t\t\tfloat y1 = y + glyph->Y0 * scale;\n\t\t\t\tfloat y2 = y + glyph->Y1 * scale;\n\t\t\t\tif (x1 <= clip_rect.z && x2 >= clip_rect.x)\n\t\t\t\t{\n\t\t\t\t\t// Render a character\n\t\t\t\t\tfloat u1 = glyph->U0;\n\t\t\t\t\tfloat v1 = glyph->V0;\n\t\t\t\t\tfloat u2 = glyph->U1;\n\t\t\t\t\tfloat v2 = glyph->V1;\n\n\t\t\t\t\t// CPU side clipping used to fit text in their frame when the frame is too small. Only does clipping for axis aligned quads.\n\t\t\t\t\tif (cpu_fine_clip)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (x1 < clip_rect.x)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tu1 = u1 + (1.0f - (x2 - clip_rect.x) / (x2 - x1)) * (u2 - u1);\n\t\t\t\t\t\t\tx1 = clip_rect.x;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (y1 < clip_rect.y)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tv1 = v1 + (1.0f - (y2 - clip_rect.y) / (y2 - y1)) * (v2 - v1);\n\t\t\t\t\t\t\ty1 = clip_rect.y;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (x2 > clip_rect.z)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tu2 = u1 + ((clip_rect.z - x1) / (x2 - x1)) * (u2 - u1);\n\t\t\t\t\t\t\tx2 = clip_rect.z;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (y2 > clip_rect.w)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tv2 = v1 + ((clip_rect.w - y1) / (y2 - y1)) * (v2 - v1);\n\t\t\t\t\t\t\ty2 = clip_rect.w;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (y1 >= y2)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tx += char_width;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// We are NOT calling PrimRectUV() here because non-inlined causes too much overhead in a debug builds. Inlined here:\n\t\t\t\t\t{\n\t\t\t\t\t\tidx_write[0] = (ImDrawIdx)(vtx_current_idx); idx_write[1] = (ImDrawIdx)(vtx_current_idx + 1); idx_write[2] = (ImDrawIdx)(vtx_current_idx + 2);\n\t\t\t\t\t\tidx_write[3] = (ImDrawIdx)(vtx_current_idx); idx_write[4] = (ImDrawIdx)(vtx_current_idx + 2); idx_write[5] = (ImDrawIdx)(vtx_current_idx + 3);\n\t\t\t\t\t\tvtx_write[0].pos.x = x1; vtx_write[0].pos.y = y1; vtx_write[0].col = col; vtx_write[0].uv.x = u1; vtx_write[0].uv.y = v1;\n\t\t\t\t\t\tvtx_write[1].pos.x = x2; vtx_write[1].pos.y = y1; vtx_write[1].col = col; vtx_write[1].uv.x = u2; vtx_write[1].uv.y = v1;\n\t\t\t\t\t\tvtx_write[2].pos.x = x2; vtx_write[2].pos.y = y2; vtx_write[2].col = col; vtx_write[2].uv.x = u2; vtx_write[2].uv.y = v2;\n\t\t\t\t\t\tvtx_write[3].pos.x = x1; vtx_write[3].pos.y = y2; vtx_write[3].col = col; vtx_write[3].uv.x = u1; vtx_write[3].uv.y = v2;\n\t\t\t\t\t\tvtx_write += 4;\n\t\t\t\t\t\tvtx_current_idx += 4;\n\t\t\t\t\t\tidx_write += 6;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tx += char_width;\n\t}\n\n\t// Give back unused vertices\n\tdraw_list->VtxBuffer.resize((int)(vtx_write - draw_list->VtxBuffer.Data));\n\tdraw_list->IdxBuffer.resize((int)(idx_write - draw_list->IdxBuffer.Data));\n\tdraw_list->CmdBuffer[draw_list->CmdBuffer.Size - 1].ElemCount -= (idx_expected_size - draw_list->IdxBuffer.Size);\n\tdraw_list->_VtxWritePtr = vtx_write;\n\tdraw_list->_IdxWritePtr = idx_write;\n\tdraw_list->_VtxCurrentIdx = (unsigned int)draw_list->VtxBuffer.Size;\n}\n\n//-----------------------------------------------------------------------------\n// Internals Drawing Helpers\n//-----------------------------------------------------------------------------\n\nstatic inline float ImAcos01(float x)\n{\n\tif (x <= 0.0f) return IM_PI * 0.5f;\n\tif (x >= 1.0f) return 0.0f;\n\treturn acosf(x);\n\t//return (-0.69813170079773212f * x * x - 0.87266462599716477f) * x + 1.5707963267948966f; // Cheap approximation, may be enough for what we do.\n}\n\n// FIXME: Cleanup and move code to ImDrawList.\nvoid ImGui::RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding)\n{\n\tif (x_end_norm == x_start_norm)\n\t\treturn;\n\tif (x_start_norm > x_end_norm)\n\t\tImSwap(x_start_norm, x_end_norm);\n\n\tImVec2 p0 = ImVec2(ImLerp(rect.Min.x, rect.Max.x, x_start_norm), rect.Min.y);\n\tImVec2 p1 = ImVec2(ImLerp(rect.Min.x, rect.Max.x, x_end_norm), rect.Max.y);\n\tif (rounding == 0.0f)\n\t{\n\t\tdraw_list->AddRectFilled(p0, p1, col, 0.0f);\n\t\treturn;\n\t}\n\n\trounding = ImClamp(ImMin((rect.Max.x - rect.Min.x) * 0.5f, (rect.Max.y - rect.Min.y) * 0.5f) - 1.0f, 0.0f, rounding);\n\tconst float inv_rounding = 1.0f / rounding;\n\tconst float arc0_b = ImAcos01(1.0f - (p0.x - rect.Min.x) * inv_rounding);\n\tconst float arc0_e = ImAcos01(1.0f - (p1.x - rect.Min.x) * inv_rounding);\n\tconst float x0 = ImMax(p0.x, rect.Min.x + rounding);\n\tif (arc0_b == arc0_e)\n\t{\n\t\tdraw_list->PathLineTo(ImVec2(x0, p1.y));\n\t\tdraw_list->PathLineTo(ImVec2(x0, p0.y));\n\t}\n\telse if (arc0_b == 0.0f && arc0_e == IM_PI*0.5f)\n\t{\n\t\tdraw_list->PathArcToFast(ImVec2(x0, p1.y - rounding), rounding, 3, 6); // BL\n\t\tdraw_list->PathArcToFast(ImVec2(x0, p0.y + rounding), rounding, 6, 9); // TR\n\t}\n\telse\n\t{\n\t\tdraw_list->PathArcTo(ImVec2(x0, p1.y - rounding), rounding, IM_PI - arc0_e, IM_PI - arc0_b, 3); // BL\n\t\tdraw_list->PathArcTo(ImVec2(x0, p0.y + rounding), rounding, IM_PI + arc0_b, IM_PI + arc0_e, 3); // TR\n\t}\n\tif (p1.x > rect.Min.x + rounding)\n\t{\n\t\tconst float arc1_b = ImAcos01(1.0f - (rect.Max.x - p1.x) * inv_rounding);\n\t\tconst float arc1_e = ImAcos01(1.0f - (rect.Max.x - p0.x) * inv_rounding);\n\t\tconst float x1 = ImMin(p1.x, rect.Max.x - rounding);\n\t\tif (arc1_b == arc1_e)\n\t\t{\n\t\t\tdraw_list->PathLineTo(ImVec2(x1, p0.y));\n\t\t\tdraw_list->PathLineTo(ImVec2(x1, p1.y));\n\t\t}\n\t\telse if (arc1_b == 0.0f && arc1_e == IM_PI*0.5f)\n\t\t{\n\t\t\tdraw_list->PathArcToFast(ImVec2(x1, p0.y + rounding), rounding, 9, 12); // TR\n\t\t\tdraw_list->PathArcToFast(ImVec2(x1, p1.y - rounding), rounding, 0, 3);  // BR\n\t\t}\n\t\telse\n\t\t{\n\t\t\tdraw_list->PathArcTo(ImVec2(x1, p0.y + rounding), rounding, -arc1_e, -arc1_b, 3); // TR\n\t\t\tdraw_list->PathArcTo(ImVec2(x1, p1.y - rounding), rounding, +arc1_b, +arc1_e, 3); // BR\n\t\t}\n\t}\n\tdraw_list->PathFillConvex(col);\n}\n\n//-----------------------------------------------------------------------------\n// DEFAULT FONT DATA\n//-----------------------------------------------------------------------------\n// Compressed with stb_compress() then converted to a C array.\n// Use the program in extra_fonts/binary_to_compressed_c.cpp to create the array from a TTF file.\n// Decompression from stb.h (public domain) by Sean Barrett https://github.com/nothings/stb/blob/master/stb.h\n//-----------------------------------------------------------------------------\n\nstatic unsigned int stb_decompress_length(unsigned char *input)\n{\n\treturn (input[8] << 24) + (input[9] << 16) + (input[10] << 8) + input[11];\n}\n\nstatic unsigned char *stb__barrier, *stb__barrier2, *stb__barrier3, *stb__barrier4;\nstatic unsigned char *stb__dout;\nstatic void stb__match(unsigned char *data, unsigned int length)\n{\n\t// INVERSE of memmove... write each byte before copying the next...\n\tIM_ASSERT(stb__dout + length <= stb__barrier);\n\tif (stb__dout + length > stb__barrier) { stb__dout += length; return; }\n\tif (data < stb__barrier4) { stb__dout = stb__barrier + 1; return; }\n\twhile (length--) *stb__dout++ = *data++;\n}\n\nstatic void stb__lit(unsigned char *data, unsigned int length)\n{\n\tIM_ASSERT(stb__dout + length <= stb__barrier);\n\tif (stb__dout + length > stb__barrier) { stb__dout += length; return; }\n\tif (data < stb__barrier2) { stb__dout = stb__barrier + 1; return; }\n\tmemcpy(stb__dout, data, length);\n\tstb__dout += length;\n}\n\n#define stb__in2(x)   ((i[x] << 8) + i[(x)+1])\n#define stb__in3(x)   ((i[x] << 16) + stb__in2((x)+1))\n#define stb__in4(x)   ((i[x] << 24) + stb__in3((x)+1))\n\nstatic unsigned char *stb_decompress_token(unsigned char *i)\n{\n\tif (*i >= 0x20) { // use fewer if's for cases that expand small\n\t\tif (*i >= 0x80)       stb__match(stb__dout - i[1] - 1, i[0] - 0x80 + 1), i += 2;\n\t\telse if (*i >= 0x40)  stb__match(stb__dout - (stb__in2(0) - 0x4000 + 1), i[2] + 1), i += 3;\n\t\telse /* *i >= 0x20 */ stb__lit(i + 1, i[0] - 0x20 + 1), i += 1 + (i[0] - 0x20 + 1);\n\t}\n\telse { // more ifs for cases that expand large, since overhead is amortized\n\t\tif (*i >= 0x18)       stb__match(stb__dout - (stb__in3(0) - 0x180000 + 1), i[3] + 1), i += 4;\n\t\telse if (*i >= 0x10)  stb__match(stb__dout - (stb__in3(0) - 0x100000 + 1), stb__in2(3) + 1), i += 5;\n\t\telse if (*i >= 0x08)  stb__lit(i + 2, stb__in2(0) - 0x0800 + 1), i += 2 + (stb__in2(0) - 0x0800 + 1);\n\t\telse if (*i == 0x07)  stb__lit(i + 3, stb__in2(1) + 1), i += 3 + (stb__in2(1) + 1);\n\t\telse if (*i == 0x06)  stb__match(stb__dout - (stb__in3(1) + 1), i[4] + 1), i += 5;\n\t\telse if (*i == 0x04)  stb__match(stb__dout - (stb__in3(1) + 1), stb__in2(4) + 1), i += 6;\n\t}\n\treturn i;\n}\n\nstatic unsigned int stb_adler32(unsigned int adler32, unsigned char *buffer, unsigned int buflen)\n{\n\tconst unsigned long ADLER_MOD = 65521;\n\tunsigned long s1 = adler32 & 0xffff, s2 = adler32 >> 16;\n\tunsigned long blocklen, i;\n\n\tblocklen = buflen % 5552;\n\twhile (buflen) {\n\t\tfor (i = 0; i + 7 < blocklen; i += 8) {\n\t\t\ts1 += buffer[0], s2 += s1;\n\t\t\ts1 += buffer[1], s2 += s1;\n\t\t\ts1 += buffer[2], s2 += s1;\n\t\t\ts1 += buffer[3], s2 += s1;\n\t\t\ts1 += buffer[4], s2 += s1;\n\t\t\ts1 += buffer[5], s2 += s1;\n\t\t\ts1 += buffer[6], s2 += s1;\n\t\t\ts1 += buffer[7], s2 += s1;\n\n\t\t\tbuffer += 8;\n\t\t}\n\n\t\tfor (; i < blocklen; ++i)\n\t\t\ts1 += *buffer++, s2 += s1;\n\n\t\ts1 %= ADLER_MOD, s2 %= ADLER_MOD;\n\t\tbuflen -= blocklen;\n\t\tblocklen = 5552;\n\t}\n\treturn (unsigned int)(s2 << 16) + (unsigned int)s1;\n}\n\nstatic unsigned int stb_decompress(unsigned char *output, unsigned char *i, unsigned int length)\n{\n\tunsigned int olen;\n\tif (stb__in4(0) != 0x57bC0000) return 0;\n\tif (stb__in4(4) != 0)          return 0; // error! stream is > 4GB\n\tolen = stb_decompress_length(i);\n\tstb__barrier2 = i;\n\tstb__barrier3 = i + length;\n\tstb__barrier = output + olen;\n\tstb__barrier4 = output;\n\ti += 16;\n\n\tstb__dout = output;\n\tfor (;;) {\n\t\tunsigned char *old_i = i;\n\t\ti = stb_decompress_token(i);\n\t\tif (i == old_i) {\n\t\t\tif (*i == 0x05 && i[1] == 0xfa) {\n\t\t\t\tIM_ASSERT(stb__dout == output + olen);\n\t\t\t\tif (stb__dout != output + olen) return 0;\n\t\t\t\tif (stb_adler32(1, output, olen) != (unsigned int)stb__in4(2))\n\t\t\t\t\treturn 0;\n\t\t\t\treturn olen;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tIM_ASSERT(0); /* NOTREACHED */\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t\tIM_ASSERT(stb__dout <= output + olen);\n\t\tif (stb__dout > output + olen)\n\t\t\treturn 0;\n\t}\n}\n\n//-----------------------------------------------------------------------------\n// ProggyClean.ttf\n// Copyright (c) 2004, 2005 Tristan Grimmer\n// MIT license (see License.txt in http://www.upperbounds.net/download/ProggyClean.ttf.zip)\n// Download and more information at http://upperbounds.net\n//-----------------------------------------------------------------------------\n// File: 'ProggyClean.ttf' (41208 bytes)\n// Exported using binary_to_compressed_c.cpp\n//-----------------------------------------------------------------------------\nstatic const char proggy_clean_ttf_compressed_data_base85[11980 + 1] =\n\"7])#######hV0qs'/###[),##/l:$#Q6>##5[n42>c-TH`->>#/e>11NNV=Bv(*:.F?uu#(gRU.o0XGH`$vhLG1hxt9?W`#,5LsCp#-i>.r$<$6pD>Lb';9Crc6tgXmKVeU2cD4Eo3R/\"\n\"2*>]b(MC;$jPfY.;h^`IWM9<Lh2TlS+f-s$o6Q<BWH`YiU.xfLq$N;$0iR/GX:U(jcW2p/W*q?-qmnUCI;jHSAiFWM.R*kU@C=GH?a9wp8f$e.-4^Qg1)Q-GL(lf(r/7GrRgwV%MS=C#\"\n\"`8ND>Qo#t'X#(v#Y9w0#1D$CIf;W'#pWUPXOuxXuU(H9M(1<q-UE31#^-V'8IRUo7Qf./L>=Ke$$'5F%)]0^#0X@U.a<r:QLtFsLcL6##lOj)#.Y5<-R&KgLwqJfLgN&;Q?gI^#DY2uL\"\n\"i@^rMl9t=cWq6##weg>$FBjVQTSDgEKnIS7EM9>ZY9w0#L;>>#Mx&4Mvt//L[MkA#W@lK.N'[0#7RL_&#w+F%HtG9M#XL`N&.,GM4Pg;-<nLENhvx>-VsM.M0rJfLH2eTM`*oJMHRC`N\"\n\"kfimM2J,W-jXS:)r0wK#@Fge$U>`w'N7G#$#fB#$E^$#:9:hk+eOe--6x)F7*E%?76%^GMHePW-Z5l'&GiF#$956:rS?dA#fiK:)Yr+`&#0j@'DbG&#^$PG.Ll+DNa<XCMKEV*N)LN/N\"\n\"*b=%Q6pia-Xg8I$<MR&,VdJe$<(7G;Ckl'&hF;;$<_=X(b.RS%%)###MPBuuE1V:v&cX&#2m#(&cV]`k9OhLMbn%s$G2,B$BfD3X*sp5#l,$R#]x_X1xKX%b5U*[r5iMfUo9U`N99hG)\"\n\"tm+/Us9pG)XPu`<0s-)WTt(gCRxIg(%6sfh=ktMKn3j)<6<b5Sk_/0(^]AaN#(p/L>&VZ>1i%h1S9u5o@YaaW$e+b<TWFn/Z:Oh(Cx2$lNEoN^e)#CFY@@I;BOQ*sRwZtZxRcU7uW6CX\"\n\"ow0i(?$Q[cjOd[P4d)]>ROPOpxTO7Stwi1::iB1q)C_=dV26J;2,]7op$]uQr@_V7$q^%lQwtuHY]=DX,n3L#0PHDO4f9>dC@O>HBuKPpP*E,N+b3L#lpR/MrTEH.IAQk.a>D[.e;mc.\"\n\"x]Ip.PH^'/aqUO/$1WxLoW0[iLA<QT;5HKD+@qQ'NQ(3_PLhE48R.qAPSwQ0/WK?Z,[x?-J;jQTWA0X@KJ(_Y8N-:/M74:/-ZpKrUss?d#dZq]DAbkU*JqkL+nwX@@47`5>w=4h(9.`G\"\n\"CRUxHPeR`5Mjol(dUWxZa(>STrPkrJiWx`5U7F#.g*jrohGg`cg:lSTvEY/EV_7H4Q9[Z%cnv;JQYZ5q.l7Zeas:HOIZOB?G<Nald$qs]@]L<J7bR*>gv:[7MI2k).'2($5FNP&EQ(,)\"\n\"U]W]+fh18.vsai00);D3@4ku5P?DP8aJt+;qUM]=+b'8@;mViBKx0DE[-auGl8:PJ&Dj+M6OC]O^((##]`0i)drT;-7X`=-H3[igUnPG-NZlo.#k@h#=Ork$m>a>$-?Tm$UV(?#P6YY#\"\n\"'/###xe7q.73rI3*pP/$1>s9)W,JrM7SN]'/4C#v$U`0#V.[0>xQsH$fEmPMgY2u7Kh(G%siIfLSoS+MK2eTM$=5,M8p`A.;_R%#u[K#$x4AG8.kK/HSB==-'Ie/QTtG?-.*^N-4B/ZM\"\n\"_3YlQC7(p7q)&](`6_c)$/*JL(L-^(]$wIM`dPtOdGA,U3:w2M-0<q-]L_?^)1vw'.,MRsqVr.L;aN&#/EgJ)PBc[-f>+WomX2u7lqM2iEumMTcsF?-aT=Z-97UEnXglEn1K-bnEO`gu\"\n\"Ft(c%=;Am_Qs@jLooI&NX;]0#j4#F14;gl8-GQpgwhrq8'=l_f-b49'UOqkLu7-##oDY2L(te+Mch&gLYtJ,MEtJfLh'x'M=$CS-ZZ%P]8bZ>#S?YY#%Q&q'3^Fw&?D)UDNrocM3A76/\"\n\"/oL?#h7gl85[qW/NDOk%16ij;+:1a'iNIdb-ou8.P*w,v5#EI$TWS>Pot-R*H'-SEpA:g)f+O$%%`kA#G=8RMmG1&O`>to8bC]T&$,n.LoO>29sp3dt-52U%VM#q7'DHpg+#Z9%H[K<L\"\n\"%a2E-grWVM3@2=-k22tL]4$##6We'8UJCKE[d_=%wI;'6X-GsLX4j^SgJ$##R*w,vP3wK#iiW&#*h^D&R?jp7+/u&#(AP##XU8c$fSYW-J95_-Dp[g9wcO&#M-h1OcJlc-*vpw0xUX&#\"\n\"OQFKNX@QI'IoPp7nb,QU//MQ&ZDkKP)X<WSVL(68uVl&#c'[0#(s1X&xm$Y%B7*K:eDA323j998GXbA#pwMs-jgD$9QISB-A_(aN4xoFM^@C58D0+Q+q3n0#3U1InDjF682-SjMXJK)(\"\n\"h$hxua_K]ul92%'BOU&#BRRh-slg8KDlr:%L71Ka:.A;%YULjDPmL<LYs8i#XwJOYaKPKc1h:'9Ke,g)b),78=I39B;xiY$bgGw-&.Zi9InXDuYa%G*f2Bq7mn9^#p1vv%#(Wi-;/Z5h\"\n\"o;#2:;%d&#x9v68C5g?ntX0X)pT`;%pB3q7mgGN)3%(P8nTd5L7GeA-GL@+%J3u2:(Yf>et`e;)f#Km8&+DC$I46>#Kr]]u-[=99tts1.qb#q72g1WJO81q+eN'03'eM>&1XxY-caEnO\"\n\"j%2n8)),?ILR5^.Ibn<-X-Mq7[a82Lq:F&#ce+S9wsCK*x`569E8ew'He]h:sI[2LM$[guka3ZRd6:t%IG:;$%YiJ:Nq=?eAw;/:nnDq0(CYcMpG)qLN4$##&J<j$UpK<Q4a1]MupW^-\"\n\"sj_$%[HK%'F####QRZJ::Y3EGl4'@%FkiAOg#p[##O`gukTfBHagL<LHw%q&OV0##F=6/:chIm0@eCP8X]:kFI%hl8hgO@RcBhS-@Qb$%+m=hPDLg*%K8ln(wcf3/'DW-$.lR?n[nCH-\"\n\"eXOONTJlh:.RYF%3'p6sq:UIMA945&^HFS87@$EP2iG<-lCO$%c`uKGD3rC$x0BL8aFn--`ke%#HMP'vh1/R&O_J9'um,.<tx[@%wsJk&bUT2`0uMv7gg#qp/ij.L56'hl;.s5CUrxjO\"\n\"M7-##.l+Au'A&O:-T72L]P`&=;ctp'XScX*rU.>-XTt,%OVU4)S1+R-#dg0/Nn?Ku1^0f$B*P:Rowwm-`0PKjYDDM'3]d39VZHEl4,.j']Pk-M.h^&:0FACm$maq-&sgw0t7/6(^xtk%\"\n\"LuH88Fj-ekm>GA#_>568x6(OFRl-IZp`&b,_P'$M<Jnq79VsJW/mWS*PUiq76;]/NM_>hLbxfc$mj`,O;&%W2m`Zh:/)Uetw:aJ%]K9h:TcF]u_-Sj9,VK3M.*'&0D[Ca]J9gp8,kAW]\"\n\"%(?A%R$f<->Zts'^kn=-^@c4%-pY6qI%J%1IGxfLU9CP8cbPlXv);C=b),<2mOvP8up,UVf3839acAWAW-W?#ao/^#%KYo8fRULNd2.>%m]UK:n%r$'sw]J;5pAoO_#2mO3n,'=H5(et\"\n\"Hg*`+RLgv>=4U8guD$I%D:W>-r5V*%j*W:Kvej.Lp$<M-SGZ':+Q_k+uvOSLiEo(<aD/K<CCc`'Lx>'?;++O'>()jLR-^u68PHm8ZFWe+ej8h:9r6L*0//c&iH&R8pRbA#Kjm%upV1g:\"\n\"a_#Ur7FuA#(tRh#.Y5K+@?3<-8m0$PEn;J:rh6?I6uG<-`wMU'ircp0LaE_OtlMb&1#6T.#FDKu#1Lw%u%+GM+X'e?YLfjM[VO0MbuFp7;>Q&#WIo)0@F%q7c#4XAXN-U&VB<HFF*qL(\"\n\"$/V,;(kXZejWO`<[5?\\?ewY(*9=%wDc;,u<'9t3W-(H1th3+G]ucQ]kLs7df($/*JL]@*t7Bu_G3_7mp7<iaQjO@.kLg;x3B0lqp7Hf,^Ze7-##@/c58Mo(3;knp0%)A7?-W+eI'o8)b<\"\n\"nKnw'Ho8C=Y>pqB>0ie&jhZ[?iLR@@_AvA-iQC(=ksRZRVp7`.=+NpBC%rh&3]R:8XDmE5^V8O(x<<aG/1N$#FX$0V5Y6x'aErI3I$7x%E`v<-BY,)%-?Psf*l?%C3.mM(=/M0:JxG'?\"\n\"7WhH%o'a<-80g0NBxoO(GH<dM]n.+%q@jH?f.UsJ2Ggs&4<-e47&Kl+f//9@`b+?.TeN_&B8Ss?v;^Trk;f#YvJkl&w$]>-+k?'(<S:68tq*WoDfZu';mM?8X[ma8W%*`-=;D.(nc7/;\"\n\")g:T1=^J$&BRV(-lTmNB6xqB[@0*o.erM*<SWF]u2=st-*(6v>^](H.aREZSi,#1:[IXaZFOm<-ui#qUq2$##Ri;u75OK#(RtaW-K-F`S+cF]uN`-KMQ%rP/Xri.LRcB##=YL3BgM/3M\"\n\"D?@f&1'BW-)Ju<L25gl8uhVm1hL$##*8###'A3/LkKW+(^rWX?5W_8g)a(m&K8P>#bmmWCMkk&#TR`C,5d>g)F;t,4:@_l8G/5h4vUd%&%950:VXD'QdWoY-F$BtUwmfe$YqL'8(PWX(\"\n\"P?^@Po3$##`MSs?DWBZ/S>+4%>fX,VWv/w'KD`LP5IbH;rTV>n3cEK8U#bX]l-/V+^lj3;vlMb&[5YQ8#pekX9JP3XUC72L,,?+Ni&co7ApnO*5NK,((W-i:$,kp'UDAO(G0Sq7MVjJs\"\n\"bIu)'Z,*[>br5fX^:FPAWr-m2KgL<LUN098kTF&#lvo58=/vjDo;.;)Ka*hLR#/k=rKbxuV`>Q_nN6'8uTG&#1T5g)uLv:873UpTLgH+#FgpH'_o1780Ph8KmxQJ8#H72L4@768@Tm&Q\"\n\"h4CB/5OvmA&,Q&QbUoi$a_%3M01H)4x7I^&KQVgtFnV+;[Pc>[m4k//,]1?#`VY[Jr*3&&slRfLiVZJ:]?=K3Sw=[$=uRB?3xk48@aeg<Z'<$#4H)6,>e0jT6'N#(q%.O=?2S]u*(m<-\"\n\"V8J'(1)G][68hW$5'q[GC&5j`TE?m'esFGNRM)j,ffZ?-qx8;->g4t*:CIP/[Qap7/9'#(1sao7w-.qNUdkJ)tCF&#B^;xGvn2r9FEPFFFcL@.iFNkTve$m%#QvQS8U@)2Z+3K:AKM5i\"\n\"sZ88+dKQ)W6>J%CL<KE>`.d*(B`-n8D9oK<Up]c$X$(,)M8Zt7/[rdkqTgl-0cuGMv'?>-XV1q['-5k'cAZ69e;D_?$ZPP&s^+7])$*$#@QYi9,5P&#9r+$%CE=68>K8r0=dSC%%(@p7\"\n\".m7jilQ02'0-VWAg<a/''3u.=4L$Y)6k/K:_[3=&jvL<L0C/2'v:^;-DIBW,B4E68:kZ;%?8(Q8BH=kO65BW?xSG&#@uU,DS*,?.+(o(#1vCS8#CHF>TlGW'b)Tq7VT9q^*^$$.:&N@@\"\n\"$&)WHtPm*5_rO0&e%K&#-30j(E4#'Zb.o/(Tpm$>K'f@[PvFl,hfINTNU6u'0pao7%XUp9]5.>%h`8_=VYbxuel.NTSsJfLacFu3B'lQSu/m6-Oqem8T+oE--$0a/k]uj9EwsG>%veR*\"\n\"hv^BFpQj:K'#SJ,sB-'#](j.Lg92rTw-*n%@/;39rrJF,l#qV%OrtBeC6/,;qB3ebNW[?,Hqj2L.1NP&GjUR=1D8QaS3Up&@*9wP?+lo7b?@%'k4`p0Z$22%K3+iCZj?XJN4Nm&+YF]u\"\n\"@-W$U%VEQ/,,>>#)D<h#`)h0:<Q6909ua+&VU%n2:cG3FJ-%@Bj-DgLr`Hw&HAKjKjseK</xKT*)B,N9X3]krc12t'pgTV(Lv-tL[xg_%=M_q7a^x?7Ubd>#%8cY#YZ?=,`Wdxu/ae&#\"\n\"w6)R89tI#6@s'(6Bf7a&?S=^ZI_kS&ai`&=tE72L_D,;^R)7[$s<Eh#c&)q.MXI%#v9ROa5FZO%sF7q7Nwb&#ptUJ:aqJe$Sl68%.D###EC><?-aF&#RNQv>o8lKN%5/$(vdfq7+ebA#\"\n\"u1p]ovUKW&Y%q]'>$1@-[xfn$7ZTp7mM,G,Ko7a&Gu%G[RMxJs[0MM%wci.LFDK)(<c`Q8N)jEIF*+?P2a8g%)$q]o2aH8C&<SibC/q,(e:v;-b#6[$NtDZ84Je2KNvB#$P5?tQ3nt(0\"\n\"d=j.LQf./Ll33+(;q3L-w=8dX$#WF&uIJ@-bfI>%:_i2B5CsR8&9Z&#=mPEnm0f`<&c)QL5uJ#%u%lJj+D-r;BoF&#4DoS97h5g)E#o:&S4weDF,9^Hoe`h*L+_a*NrLW-1pG_&2UdB8\"\n\"6e%B/:=>)N4xeW.*wft-;$'58-ESqr<b?UI(_%@[P46>#U`'6AQ]m&6/`Z>#S?YY#Vc;r7U2&326d=w&H####?TZ`*4?&.MK?LP8Vxg>$[QXc%QJv92.(Db*B)gb*BM9dM*hJMAo*c&#\"\n\"b0v=Pjer]$gG&JXDf->'StvU7505l9$AFvgYRI^&<^b68?j#q9QX4SM'RO#&sL1IM.rJfLUAj221]d##DW=m83u5;'bYx,*Sl0hL(W;;$doB&O/TQ:(Z^xBdLjL<Lni;''X.`$#8+1GD\"\n\":k$YUWsbn8ogh6rxZ2Z9]%nd+>V#*8U_72Lh+2Q8Cj0i:6hp&$C/:p(HK>T8Y[gHQ4`4)'$Ab(Nof%V'8hL&#<NEdtg(n'=S1A(Q1/I&4([%dM`,Iu'1:_hL>SfD07&6D<fp8dHM7/g+\"\n\"tlPN9J*rKaPct&?'uBCem^jn%9_K)<,C5K3s=5g&GmJb*[SYq7K;TRLGCsM-$$;S%:Y@r7AK0pprpL<Lrh,q7e/%KWK:50I^+m'vi`3?%Zp+<-d+$L-Sv:@.o19n$s0&39;kn;S%BSq*\"\n\"$3WoJSCLweV[aZ'MQIjO<7;X-X;&+dMLvu#^UsGEC9WEc[X(wI7#2.(F0jV*eZf<-Qv3J-c+J5AlrB#$p(H68LvEA'q3n0#m,[`*8Ft)FcYgEud]CWfm68,(aLA$@EFTgLXoBq/UPlp7\"\n\":d[/;r_ix=:TF`S5H-b<LI&HY(K=h#)]Lk$K14lVfm:x$H<3^Ql<M`$OhapBnkup'D#L$Pb_`N*g]2e;X/Dtg,bsj&K#2[-:iYr'_wgH)NUIR8a1n#S?Yej'h8^58UbZd+^FKD*T@;6A\"\n\"7aQC[K8d-(v6GI$x:T<&'Gp5Uf>@M.*J:;$-rv29'M]8qMv-tLp,'886iaC=Hb*YJoKJ,(j%K=H`K.v9HggqBIiZu'QvBT.#=)0ukruV&.)3=(^1`o*Pj4<-<aN((^7('#Z0wK#5GX@7\"\n\"u][`*S^43933A4rl][`*O4CgLEl]v$1Q3AeF37dbXk,.)vj#x'd`;qgbQR%FW,2(?LO=s%Sc68%NP'##Aotl8x=BE#j1UD([3$M(]UI2LX3RpKN@;/#f'f/&_mt&F)XdF<9t4)Qa.*kT\"\n\"LwQ'(TTB9.xH'>#MJ+gLq9-##@HuZPN0]u:h7.T..G:;$/Usj(T7`Q8tT72LnYl<-qx8;-HV7Q-&Xdx%1a,hC=0u+HlsV>nuIQL-5<N?)NBS)QN*_I,?&)2'IM%L3I)X((e/dl2&8'<M\"\n\":^#M*Q+[T.Xri.LYS3v%fF`68h;b-X[/En'CR.q7E)p'/kle2HM,u;^%OKC-N+Ll%F9CF<Nf'^#t2L,;27W:0O@6##U6W7:$rJfLWHj$#)woqBefIZ.PK<b*t7ed;p*_m;4ExK#h@&]>\"\n\"_>@kXQtMacfD.m-VAb8;IReM3$wf0''hra*so568'Ip&vRs849'MRYSp%:t:h5qSgwpEr$B>Q,;s(C#$)`svQuF$##-D,##,g68@2[T;.XSdN9Qe)rpt._K-#5wF)sP'##p#C0c%-Gb%\"\n\"hd+<-j'Ai*x&&HMkT]C'OSl##5RG[JXaHN;d'uA#x._U;.`PU@(Z3dt4r152@:v,'R.Sj'w#0<-;kPI)FfJ&#AYJ&#//)>-k=m=*XnK$>=)72L]0I%>.G690a:$##<,);?;72#?x9+d;\"\n\"^V'9;jY@;)br#q^YQpx:X#Te$Z^'=-=bGhLf:D6&bNwZ9-ZD#n^9HhLMr5G;']d&6'wYmTFmL<LD)F^%[tC'8;+9E#C$g%#5Y>q9wI>P(9mI[>kC-ekLC/R&CH+s'B;K-M6$EB%is00:\"\n\"+A4[7xks.LrNk0&E)wILYF@2L'0Nb$+pv<(2.768/FrY&h$^3i&@+G%JT'<-,v`3;_)I9M^AE]CN?Cl2AZg+%4iTpT3<n-&%H%b<FDj2M<hH=&Eh<2Len$b*aTX=-8QxN)k11IM1c^j%\"\n\"9s<L<NFSo)B?+<-(GxsF,^-Eh@$4dXhN$+#rxK8'je'D7k`e;)2pYwPA'_p9&@^18ml1^[@g4t*[JOa*[=Qp7(qJ_oOL^('7fB&Hq-:sf,sNj8xq^>$U4O]GKx'm9)b@p7YsvK3w^YR-\"\n\"CdQ*:Ir<($u&)#(&?L9Rg3H)4fiEp^iI9O8KnTj,]H?D*r7'M;PwZ9K0E^k&-cpI;.p/6_vwoFMV<->#%Xi.LxVnrU(4&8/P+:hLSKj$#U%]49t'I:rgMi'FL@a:0Y-uA[39',(vbma*\"\n\"hU%<-SRF`Tt:542R_VV$p@[p8DV[A,?1839FWdF<TddF<9Ah-6&9tWoDlh]&1SpGMq>Ti1O*H&#(AL8[_P%.M>v^-))qOT*F5Cq0`Ye%+$B6i:7@0IX<N+T+0MlMBPQ*Vj>SsD<U4JHY\"\n\"8kD2)2fU/M#$e.)T4,_=8hLim[&);?UkK'-x?'(:siIfL<$pFM`i<?%W(mGDHM%>iWP,##P`%/L<eXi:@Z9C.7o=@(pXdAO/NLQ8lPl+HPOQa8wD8=^GlPa8TKI1CjhsCTSLJM'/Wl>-\"\n\"S(qw%sf/@%#B6;/U7K]uZbi^Oc^2n<bhPmUkMw>%t<)'mEVE''n`WnJra$^TKvX5B>;_aSEK',(hwa0:i4G?.Bci.(X[?b*($,=-n<.Q%`(X=?+@Am*Js0&=3bh8K]mL<LoNs'6,'85`\"\n\"0?t/'_U59@]ddF<#LdF<eWdF<OuN/45rY<-L@&#+fm>69=Lb,OcZV/);TTm8VI;?%OtJ<(b4mq7M6:u?KRdF<gR@2L=FNU-<b[(9c/ML3m;Z[$oF3g)GAWqpARc=<ROu7cL5l;-[A]%/\"\n\"+fsd;l#SafT/f*W]0=O'$(Tb<[)*@e775R-:Yob%g*>l*:xP?Yb.5)%w_I?7uk5JC+FS(m#i'k.'a0i)9<7b'fs'59hq$*5Uhv##pi^8+hIEBF`nvo`;'l0.^S1<-wUK2/Coh58KKhLj\"\n\"M=SO*rfO`+qC`W-On.=AJ56>>i2@2LH6A:&5q`?9I3@@'04&p2/LVa*T-4<-i3;M9UvZd+N7>b*eIwg:CC)c<>nO&#<IGe;__.thjZl<%w(Wk2xmp4Q@I#I9,DF]u7-P=.-_:YJ]aS@V\"\n\"?6*C()dOp7:WL,b&3Rg/.cmM9&r^>$(>.Z-I&J(Q0Hd5Q%7Co-b`-c<N(6r@ip+AurK<m86QIth*#v;-OBqi+L7wDE-Ir8K['m+DDSLwK&/.?-V%U_%3:qKNu$_b*B-kp7NaD'QdWQPK\"\n\"Yq[@>P)hI;*_F]u`Rb[.j8_Q/<&>uu+VsH$sM9TA%?)(vmJ80),P7E>)tjD%2L=-t#fK[%`v=Q8<FfNkgg^oIbah*#8/Qt$F&:K*-(N/'+1vMB,u()-a.VUU*#[e%gAAO(S>WlA2);Sa\"\n\">gXm8YB`1d@K#n]76-a$U,mF<fX]idqd)<3,]J7JmW4`6]uks=4-72L(jEk+:bJ0M^q-8Dm_Z?0olP1C9Sa&H[d&c$ooQUj]Exd*3ZM@-WGW2%s',B-_M%>%Ul:#/'xoFM9QX-$.QN'>\"\n\"[%$Z$uF6pA6Ki2O5:8w*vP1<-1`[G,)-m#>0`P&#eb#.3i)rtB61(o'$?X3B</R90;eZ]%Ncq;-Tl]#F>2Qft^ae_5tKL9MUe9b*sLEQ95C&`=G?@Mj=wh*'3E>=-<)Gt*Iw)'QG:`@I\"\n\"wOf7&]1i'S01B+Ev/Nac#9S;=;YQpg_6U`*kVY39xK,[/6Aj7:'1Bm-_1EYfa1+o&o4hp7KN_Q(OlIo@S%;jVdn0'1<Vc52=u`3^o-n1'g4v58Hj&6_t7$##?M)c<$bgQ_'SY((-xkA#\"\n\"Y(,p'H9rIVY-b,'%bCPF7.J<Up^,(dU1VY*5#WkTU>h19w,WQhLI)3S#f$2(eb,jr*b;3Vw]*7NH%$c4Vs,eD9>XW8?N]o+(*pgC%/72LV-u<Hp,3@e^9UB1J+ak9-TN/mhKPg+AJYd$\"\n\"MlvAF_jCK*.O-^(63adMT->W%iewS8W6m2rtCpo'RS1R84=@paTKt)>=%&1[)*vp'u+x,VrwN;&]kuO9JDbg=pO$J*.jVe;u'm0dr9l,<*wMK*Oe=g8lV_KEBFkO'oU]^=[-792#ok,)\"\n\"i]lR8qQ2oA8wcRCZ^7w/Njh;?.stX?Q1>S1q4Bn$)K1<-rGdO'$Wr.Lc.CG)$/*JL4tNR/,SVO3,aUw'DJN:)Ss;wGn9A32ijw%FL+Z0Fn.U9;reSq)bmI32U==5ALuG&#Vf1398/pVo\"\n\"1*c-(aY168o<`JsSbk-,1N;$>0:OUas(3:8Z972LSfF8eb=c-;>SPw7.6hn3m`9^Xkn(r.qS[0;T%&Qc=+STRxX'q1BNk3&*eu2;&8q$&x>Q#Q7^Tf+6<(d%ZVmj2bDi%.3L2n+4W'$P\"\n\"iDDG)g,r%+?,$@?uou5tSe2aN_AQU*<h`e-GI7)?OK2A.d7_c)?wQ5AS@DL3r#7fSkgl6-++D:'A,uq7SvlB$pcpH'q3n0#_%dY#xCpr-l<F0NR@-##FEV6NTF6##$l84N1w?AO>'IAO\"\n\"URQ##V^Fv-XFbGM7Fl(N<3DhLGF%q.1rC$#:T__&Pi68%0xi_&[qFJ(77j_&JWoF.V735&T,[R*:xFR*K5>>#`bW-?4Ne_&6Ne_&6Ne_&n`kr-#GJcM6X;uM6X;uM(.a..^2TkL%oR(#\"\n\";u.T%fAr%4tJ8&><1=GHZ_+m9/#H1F^R#SC#*N=BA9(D?v[UiFY>>^8p,KKF.W]L29uLkLlu/+4T<XoIB&hx=T1PcDaB&;HH+-AFr?(m9HZV)FKS8JCw;SD=6[^/DZUL`EUDf]GGlG&>\"\n\"w$)F./^n3+rlo+DB;5sIYGNk+i1t-69Jg--0pao7Sm#K)pdHW&;LuDNH@H>#/X-TI(;P>#,Gc>#0Su>#4`1?#8lC?#<xU?#@.i?#D:%@#HF7@#LRI@#P_[@#Tkn@#Xw*A#]-=A#a9OA#\"\n\"d<F&#*;G##.GY##2Sl##6`($#:l:$#>xL$#B.`$#F:r$#JF.%#NR@%#R_R%#Vke%#Zww%#_-4&#3^Rh%Sflr-k'MS.o?.5/sWel/wpEM0%3'/1)K^f1-d>G21&v(35>V`39V7A4=onx4\"\n\"A1OY5EI0;6Ibgr6M$HS7Q<)58C5w,;WoA*#[%T*#`1g*#d=#+#hI5+#lUG+#pbY+#tnl+#x$),#&1;,#*=M,#.I`,#2Ur,#6b.-#;w[H#iQtA#m^0B#qjBB#uvTB##-hB#'9$C#+E6C#\"\n\"/QHC#3^ZC#7jmC#;v)D#?,<D#C8ND#GDaD#KPsD#O]/E#g1A5#KA*1#gC17#MGd;#8(02#L-d3#rWM4#Hga1#,<w0#T.j<#O#'2#CYN1#qa^:#_4m3#o@/=#eG8=#t8J5#`+78#4uI-#\"\n\"m3B2#SB[8#Q0@8#i[*9#iOn8#1Nm;#^sN9#qh<9#:=x-#P;K2#$%X9#bC+.#Rg;<#mN=.#MTF.#RZO.#2?)4#Y#(/#[)1/#b;L/#dAU/#0Sv;#lY$0#n`-0#sf60#(F24#wrH0#%/e0#\"\n\"TmD<#%JSMFove:CTBEXI:<eh2g)B,3h2^G3i;#d3jD>)4kMYD4lVu`4m`:&5niUA5@(A5BA1]PBB:xlBCC=2CDLXMCEUtiCf&0g2'tN?PGT4CPGT4CPGT4CPGT4CPGT4CPGT4CPGT4CP\"\n\"GT4CPGT4CPGT4CPGT4CPGT4CPGT4CP-qekC`.9kEg^+F$kwViFJTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5KTB&5o,^<-28ZI'O?;xp\"\n\"O?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xpO?;xp;7q-#lLYI:xvD=#\";\n\nstatic const char* GetDefaultCompressedFontDataTTFBase85()\n{\n\treturn proggy_clean_ttf_compressed_data_base85;\n}\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui_impl_dx11.cpp",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n// ImGui Win32 + DirectX11 binding\n// In this binding, ImTextureID is used to store a 'ID3D11ShaderResourceView*' texture identifier. Read the FAQ about ImTextureID in imgui.cpp.\n\n// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.\n// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().\n// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.\n// https://github.com/ocornut/imgui\n\n#include \"imgui.h\"\n#include \"imgui_impl_dx11.h\"\n#include \"imgui_internal.h\"\n\n// DirectX\n#include <d3d11.h>\n#define DIRECTINPUT_VERSION 0x0800\n#include <dinput.h>\n\n// Data\nstatic INT64                    g_Time = 0;\nstatic INT64                    g_TicksPerSecond = 0;\n\nstatic HWND                     g_hWnd = 0;\nstatic ID3D11Device*            g_pd3dDevice = NULL;\nstatic ID3D11DeviceContext*     g_pd3dDeviceContext = NULL;\nstatic ID3D11Buffer*            g_pVB = NULL;\nstatic ID3D11Buffer*            g_pIB = NULL;\nstatic ID3D11VertexShader*      g_pVertexShader = NULL;\nstatic ID3D11InputLayout*       g_pInputLayout = NULL;\nstatic ID3D11Buffer*            g_pVertexConstantBuffer = NULL;\nstatic ID3D11PixelShader*       g_pPixelShader = NULL;\nstatic ID3D11SamplerState*      g_pFontSampler = NULL;\nstatic ID3D11ShaderResourceView*g_pFontTextureView = NULL;\nstatic ID3D11RasterizerState*   g_pRasterizerState = NULL;\nstatic ID3D11BlendState*        g_pBlendState = NULL;\nstatic ID3D11DepthStencilState* g_pDepthStencilState = NULL;\nstatic int                      g_VertexBufferSize = 5000, g_IndexBufferSize = 10000;\n\nstruct VERTEX_CONSTANT_BUFFER\n{\n\tfloat        mvp[4][4];\n};\n\n// This is the main rendering function that you have to implement and provide to ImGui (via setting up 'RenderDrawListsFn' in the ImGuiIO structure)\n// If text or lines are blurry when integrating ImGui in your engine:\n// - in your Render function, try translating your projection matrix by (0.5f,0.5f) or (0.375f,0.375f)\nvoid ImGui_ImplDX11_RenderDrawLists(ImDrawData* draw_data)\n{\n\tID3D11DeviceContext* ctx = g_pd3dDeviceContext;\n\n\t// Create and grow vertex/index buffers if needed\n\tif (!g_pVB || g_VertexBufferSize < draw_data->TotalVtxCount)\n\t{\n\t\tif (g_pVB) { g_pVB->Release(); g_pVB = NULL; }\n\t\tg_VertexBufferSize = draw_data->TotalVtxCount + 5000;\n\t\tD3D11_BUFFER_DESC desc;\n\t\tmemset(&desc, 0, sizeof(D3D11_BUFFER_DESC));\n\t\tdesc.Usage = D3D11_USAGE_DYNAMIC;\n\t\tdesc.ByteWidth = g_VertexBufferSize * sizeof(ImDrawVert);\n\t\tdesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;\n\t\tdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\n\t\tdesc.MiscFlags = 0;\n\t\tif (g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pVB) < 0)\n\t\t\treturn;\n\t}\n\tif (!g_pIB || g_IndexBufferSize < draw_data->TotalIdxCount)\n\t{\n\t\tif (g_pIB) { g_pIB->Release(); g_pIB = NULL; }\n\t\tg_IndexBufferSize = draw_data->TotalIdxCount + 10000;\n\t\tD3D11_BUFFER_DESC desc;\n\t\tmemset(&desc, 0, sizeof(D3D11_BUFFER_DESC));\n\t\tdesc.Usage = D3D11_USAGE_DYNAMIC;\n\t\tdesc.ByteWidth = g_IndexBufferSize * sizeof(ImDrawIdx);\n\t\tdesc.BindFlags = D3D11_BIND_INDEX_BUFFER;\n\t\tdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\n\t\tif (g_pd3dDevice->CreateBuffer(&desc, NULL, &g_pIB) < 0)\n\t\t\treturn;\n\t}\n\n\t// Copy and convert all vertices into a single contiguous buffer\n\tD3D11_MAPPED_SUBRESOURCE vtx_resource, idx_resource;\n\tif (ctx->Map(g_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &vtx_resource) != S_OK)\n\t\treturn;\n\tif (ctx->Map(g_pIB, 0, D3D11_MAP_WRITE_DISCARD, 0, &idx_resource) != S_OK)\n\t\treturn;\n\tImDrawVert* vtx_dst = (ImDrawVert*)vtx_resource.pData;\n\tImDrawIdx* idx_dst = (ImDrawIdx*)idx_resource.pData;\n\tfor (int n = 0; n < draw_data->CmdListsCount; n++)\n\t{\n\t\tconst ImDrawList* cmd_list = draw_data->CmdLists[n];\n\t\tmemcpy(vtx_dst, cmd_list->VtxBuffer.Data, cmd_list->VtxBuffer.Size * sizeof(ImDrawVert));\n\t\tmemcpy(idx_dst, cmd_list->IdxBuffer.Data, cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx));\n\t\tvtx_dst += cmd_list->VtxBuffer.Size;\n\t\tidx_dst += cmd_list->IdxBuffer.Size;\n\t}\n\tctx->Unmap(g_pVB, 0);\n\tctx->Unmap(g_pIB, 0);\n\n\t// Setup orthographic projection matrix into our constant buffer\n\t{\n\t\tD3D11_MAPPED_SUBRESOURCE mapped_resource;\n\t\tif (ctx->Map(g_pVertexConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mapped_resource) != S_OK)\n\t\t\treturn;\n\t\tVERTEX_CONSTANT_BUFFER* constant_buffer = (VERTEX_CONSTANT_BUFFER*)mapped_resource.pData;\n\t\tfloat L = 0.0f;\n\t\tfloat R = ImGui::GetIO().DisplaySize.x;\n\t\tfloat B = ImGui::GetIO().DisplaySize.y;\n\t\tfloat T = 0.0f;\n\t\tfloat mvp[4][4] =\n\t\t{\n\t\t\t{ 2.0f / (R - L),   0.0f,           0.0f,       0.0f },\n\t\t\t{ 0.0f,         2.0f / (T - B),     0.0f,       0.0f },\n\t\t\t{ 0.0f,         0.0f,           0.5f,       0.0f },\n\t\t\t{ (R + L) / (L - R),  (T + B) / (B - T),    0.5f,       1.0f },\n\t\t};\n\t\tmemcpy(&constant_buffer->mvp, mvp, sizeof(mvp));\n\t\tctx->Unmap(g_pVertexConstantBuffer, 0);\n\t}\n\n\t// Backup DX state that will be modified to restore it afterwards (unfortunately this is very ugly looking and verbose. Close your eyes!)\n\tstruct BACKUP_DX11_STATE\n\t{\n\t\tUINT                        ScissorRectsCount, ViewportsCount;\n\t\tD3D11_RECT                  ScissorRects[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];\n\t\tD3D11_VIEWPORT              Viewports[D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE];\n\t\tID3D11RasterizerState*      RS;\n\t\tID3D11BlendState*           BlendState;\n\t\tFLOAT                       BlendFactor[4];\n\t\tUINT                        SampleMask;\n\t\tUINT                        StencilRef;\n\t\tID3D11DepthStencilState*    DepthStencilState;\n\t\tID3D11ShaderResourceView*   PSShaderResource;\n\t\tID3D11SamplerState*         PSSampler;\n\t\tID3D11PixelShader*          PS;\n\t\tID3D11VertexShader*         VS;\n\t\tUINT                        PSInstancesCount, VSInstancesCount;\n\t\tID3D11ClassInstance*        PSInstances[256], *VSInstances[256];   // 256 is max according to PSSetShader documentation\n\t\tD3D11_PRIMITIVE_TOPOLOGY    PrimitiveTopology;\n\t\tID3D11Buffer*               IndexBuffer, *VertexBuffer, *VSConstantBuffer;\n\t\tUINT                        IndexBufferOffset, VertexBufferStride, VertexBufferOffset;\n\t\tDXGI_FORMAT                 IndexBufferFormat;\n\t\tID3D11InputLayout*          InputLayout;\n\t};\n\tBACKUP_DX11_STATE old;\n\told.ScissorRectsCount = old.ViewportsCount = D3D11_VIEWPORT_AND_SCISSORRECT_OBJECT_COUNT_PER_PIPELINE;\n\tctx->RSGetScissorRects(&old.ScissorRectsCount, old.ScissorRects);\n\tctx->RSGetViewports(&old.ViewportsCount, old.Viewports);\n\tctx->RSGetState(&old.RS);\n\tctx->OMGetBlendState(&old.BlendState, old.BlendFactor, &old.SampleMask);\n\tctx->OMGetDepthStencilState(&old.DepthStencilState, &old.StencilRef);\n\tctx->PSGetShaderResources(0, 1, &old.PSShaderResource);\n\tctx->PSGetSamplers(0, 1, &old.PSSampler);\n\told.PSInstancesCount = old.VSInstancesCount = 256;\n\tctx->PSGetShader(&old.PS, old.PSInstances, &old.PSInstancesCount);\n\tctx->VSGetShader(&old.VS, old.VSInstances, &old.VSInstancesCount);\n\tctx->VSGetConstantBuffers(0, 1, &old.VSConstantBuffer);\n\tctx->IAGetPrimitiveTopology(&old.PrimitiveTopology);\n\tctx->IAGetIndexBuffer(&old.IndexBuffer, &old.IndexBufferFormat, &old.IndexBufferOffset);\n\tctx->IAGetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset);\n\tctx->IAGetInputLayout(&old.InputLayout);\n\n\t// Setup viewport\n\tD3D11_VIEWPORT vp;\n\tmemset(&vp, 0, sizeof(D3D11_VIEWPORT));\n\tvp.Width = ImGui::GetIO().DisplaySize.x;\n\tvp.Height = ImGui::GetIO().DisplaySize.y;\n\tvp.MinDepth = 0.0f;\n\tvp.MaxDepth = 1.0f;\n\tvp.TopLeftX = vp.TopLeftY = 0.0f;\n\tctx->RSSetViewports(1, &vp);\n\n\t// Bind shader and vertex buffers\n\tunsigned int stride = sizeof(ImDrawVert);\n\tunsigned int offset = 0;\n\tctx->IASetInputLayout(g_pInputLayout);\n\tctx->IASetVertexBuffers(0, 1, &g_pVB, &stride, &offset);\n\tctx->IASetIndexBuffer(g_pIB, sizeof(ImDrawIdx) == 2 ? DXGI_FORMAT_R16_UINT : DXGI_FORMAT_R32_UINT, 0);\n\tctx->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);\n\tctx->VSSetShader(g_pVertexShader, NULL, 0);\n\tctx->VSSetConstantBuffers(0, 1, &g_pVertexConstantBuffer);\n\tctx->PSSetShader(g_pPixelShader, NULL, 0);\n\tctx->PSSetSamplers(0, 1, &g_pFontSampler);\n\n\t// Setup render state\n\tconst float blend_factor[4] = { 0.f, 0.f, 0.f, 0.f };\n\tctx->OMSetBlendState(g_pBlendState, blend_factor, 0xffffffff);\n\tctx->OMSetDepthStencilState(g_pDepthStencilState, 0);\n\tctx->RSSetState(g_pRasterizerState);\n\n\t// Render command lists\n\tint vtx_offset = 0;\n\tint idx_offset = 0;\n\tfor (int n = 0; n < draw_data->CmdListsCount; n++)\n\t{\n\t\tconst ImDrawList* cmd_list = draw_data->CmdLists[n];\n\t\tfor (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)\n\t\t{\n\t\t\tconst ImDrawCmd* pcmd = &cmd_list->CmdBuffer[cmd_i];\n\t\t\tif (pcmd->UserCallback)\n\t\t\t{\n\t\t\t\tpcmd->UserCallback(cmd_list, pcmd);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tconst D3D11_RECT r = { (LONG)pcmd->ClipRect.x, (LONG)pcmd->ClipRect.y, (LONG)pcmd->ClipRect.z, (LONG)pcmd->ClipRect.w };\n\t\t\t\tctx->PSSetShaderResources(0, 1, (ID3D11ShaderResourceView**)&pcmd->TextureId);\n\t\t\t\tctx->RSSetScissorRects(1, &r);\n\t\t\t\tctx->DrawIndexed(pcmd->ElemCount, idx_offset, vtx_offset);\n\t\t\t}\n\t\t\tidx_offset += pcmd->ElemCount;\n\t\t}\n\t\tvtx_offset += cmd_list->VtxBuffer.Size;\n\t}\n\n\t// Restore modified DX state\n\tctx->RSSetScissorRects(old.ScissorRectsCount, old.ScissorRects);\n\tctx->RSSetViewports(old.ViewportsCount, old.Viewports);\n\tctx->RSSetState(old.RS); if (old.RS) old.RS->Release();\n\tctx->OMSetBlendState(old.BlendState, old.BlendFactor, old.SampleMask); if (old.BlendState) old.BlendState->Release();\n\tctx->OMSetDepthStencilState(old.DepthStencilState, old.StencilRef); if (old.DepthStencilState) old.DepthStencilState->Release();\n\tctx->PSSetShaderResources(0, 1, &old.PSShaderResource); if (old.PSShaderResource) old.PSShaderResource->Release();\n\tctx->PSSetSamplers(0, 1, &old.PSSampler); if (old.PSSampler) old.PSSampler->Release();\n\tctx->PSSetShader(old.PS, old.PSInstances, old.PSInstancesCount); if (old.PS) old.PS->Release();\n\tfor (UINT i = 0; i < old.PSInstancesCount; i++) if (old.PSInstances[i]) old.PSInstances[i]->Release();\n\tctx->VSSetShader(old.VS, old.VSInstances, old.VSInstancesCount); if (old.VS) old.VS->Release();\n\tctx->VSSetConstantBuffers(0, 1, &old.VSConstantBuffer); if (old.VSConstantBuffer) old.VSConstantBuffer->Release();\n\tfor (UINT i = 0; i < old.VSInstancesCount; i++) if (old.VSInstances[i]) old.VSInstances[i]->Release();\n\tctx->IASetPrimitiveTopology(old.PrimitiveTopology);\n\tctx->IASetIndexBuffer(old.IndexBuffer, old.IndexBufferFormat, old.IndexBufferOffset); if (old.IndexBuffer) old.IndexBuffer->Release();\n\tctx->IASetVertexBuffers(0, 1, &old.VertexBuffer, &old.VertexBufferStride, &old.VertexBufferOffset); if (old.VertexBuffer) old.VertexBuffer->Release();\n\tctx->IASetInputLayout(old.InputLayout); if (old.InputLayout) old.InputLayout->Release();\n}\n\nstatic bool IsAnyMouseButtonDown()\n{\n\tImGuiIO& io = ImGui::GetIO();\n\tfor (int n = 0; n < IM_ARRAYSIZE(io.MouseDown); n++)\n\t\tif (io.MouseDown[n])\n\t\t\treturn true;\n\treturn false;\n}\n\n// Process Win32 mouse/keyboard inputs. \n// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.\n// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application.\n// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.\n// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.\n// PS: In this Win32 handler, we use the capture API (GetCapture/SetCapture/ReleaseCapture) to be able to read mouse coordinations when dragging mouse outside of our window bounds.\n// PS: We treat DBLCLK messages as regular mouse down messages, so this code will work on windows classes that have the CS_DBLCLKS flag set. Our own example app code doesn't set this flag.\nIMGUI_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)\n{\n\tImGuiIO& io = ImGui::GetIO();\n\tswitch (msg)\n\t{\n\tcase WM_LBUTTONDOWN: case WM_LBUTTONDBLCLK:\n\tcase WM_RBUTTONDOWN: case WM_RBUTTONDBLCLK:\n\tcase WM_MBUTTONDOWN: case WM_MBUTTONDBLCLK:\n\t{\n\t\tint button = 0;\n\t\tif (msg == WM_LBUTTONDOWN || msg == WM_LBUTTONDBLCLK) button = 0;\n\t\tif (msg == WM_RBUTTONDOWN || msg == WM_RBUTTONDBLCLK) button = 1;\n\t\tif (msg == WM_MBUTTONDOWN || msg == WM_MBUTTONDBLCLK) button = 2;\n\t\tif (!IsAnyMouseButtonDown() && GetCapture() == NULL)\n\t\t\tSetCapture(hwnd);\n\t\tio.MouseDown[button] = true;\n\t\treturn 0;\n\t}\n\tcase WM_LBUTTONUP:\n\tcase WM_RBUTTONUP:\n\tcase WM_MBUTTONUP:\n\t{\n\t\tint button = 0;\n\t\tif (msg == WM_LBUTTONUP) button = 0;\n\t\tif (msg == WM_RBUTTONUP) button = 1;\n\t\tif (msg == WM_MBUTTONUP) button = 2;\n\t\tio.MouseDown[button] = false;\n\t\tif (!IsAnyMouseButtonDown() && GetCapture() == hwnd)\n\t\t\tReleaseCapture();\n\t\treturn 0;\n\t}\n\tcase WM_MOUSEWHEEL:\n\t\tio.MouseWheel += GET_WHEEL_DELTA_WPARAM(wParam) > 0 ? +1.0f : -1.0f;\n\t\treturn 0;\n\tcase WM_MOUSEMOVE:\n\t\tio.MousePos.x = (signed short)(lParam);\n\t\tio.MousePos.y = (signed short)(lParam >> 16);\n\t\treturn 0;\n\tcase WM_KEYDOWN:\n\tcase WM_SYSKEYDOWN:\n\t\tif (wParam < 256)\n\t\t\tio.KeysDown[wParam] = 1;\n\t\treturn 0;\n\tcase WM_KEYUP:\n\tcase WM_SYSKEYUP:\n\t\tif (wParam < 256)\n\t\t\tio.KeysDown[wParam] = 0;\n\t\treturn 0;\n\tcase WM_CHAR:\n\t\t// You can also use ToAscii()+GetKeyboardState() to retrieve characters.\n\t\tif (wParam > 0 && wParam < 0x10000)\n\t\t\tio.AddInputCharacter((unsigned short)wParam);\n\t\treturn 0;\n\t}\n\treturn 0;\n}\n\nstatic void ImGui_ImplDX11_CreateFontsTexture()\n{\n\t// Build texture atlas\n\tImGuiIO& io = ImGui::GetIO();\n\tunsigned char* pixels;\n\tint width, height;\n\tio.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);\n\n\t// Upload texture to graphics system\n\t{\n\t\tD3D11_TEXTURE2D_DESC desc;\n\t\tZeroMemory(&desc, sizeof(desc));\n\t\tdesc.Width = width;\n\t\tdesc.Height = height;\n\t\tdesc.MipLevels = 1;\n\t\tdesc.ArraySize = 1;\n\t\tdesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;\n\t\tdesc.SampleDesc.Count = 1;\n\t\tdesc.Usage = D3D11_USAGE_DEFAULT;\n\t\tdesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;\n\t\tdesc.CPUAccessFlags = 0;\n\n\t\tID3D11Texture2D *pTexture = NULL;\n\t\tD3D11_SUBRESOURCE_DATA subResource;\n\t\tsubResource.pSysMem = pixels;\n\t\tsubResource.SysMemPitch = desc.Width * 4;\n\t\tsubResource.SysMemSlicePitch = 0;\n\t\tg_pd3dDevice->CreateTexture2D(&desc, &subResource, &pTexture);\n\n\t\t// Create texture view\n\t\tD3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;\n\t\tZeroMemory(&srvDesc, sizeof(srvDesc));\n\t\tsrvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;\n\t\tsrvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;\n\t\tsrvDesc.Texture2D.MipLevels = desc.MipLevels;\n\t\tsrvDesc.Texture2D.MostDetailedMip = 0;\n\t\tg_pd3dDevice->CreateShaderResourceView(pTexture, &srvDesc, &g_pFontTextureView);\n\t\tpTexture->Release();\n\t}\n\n\t// Store our identifier\n\tio.Fonts->TexID = (void *)g_pFontTextureView;\n\n\t// Create texture sampler\n\t{\n\t\tD3D11_SAMPLER_DESC desc;\n\t\tZeroMemory(&desc, sizeof(desc));\n\t\tdesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;\n\t\tdesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;\n\t\tdesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;\n\t\tdesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;\n\t\tdesc.MipLODBias = 0.f;\n\t\tdesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;\n\t\tdesc.MinLOD = 0.f;\n\t\tdesc.MaxLOD = 0.f;\n\t\tg_pd3dDevice->CreateSamplerState(&desc, &g_pFontSampler);\n\t}\n}\n\nbool ImGui_ImplDX11_CreateDeviceObjects()\n{\n\tif (!g_pd3dDevice)\n\t\treturn false;\n\tif (g_pFontSampler)\n\t\tImGui_ImplDX11_InvalidateDeviceObjects();\n\n\t// By using D3DCompile() from <d3dcompiler.h> / d3dcompiler.lib, we introduce a dependency to a given version of d3dcompiler_XX.dll (see D3DCOMPILER_DLL_A)\n\t// If you would like to use this DX11 sample code but remove this dependency you can: \n\t//  1) compile once, save the compiled shader blobs into a file or source code and pass them to CreateVertexShader()/CreatePixelShader() [preferred solution]\n\t//  2) use code to detect any version of the DLL and grab a pointer to D3DCompile from the DLL. \n\t// See https://github.com/ocornut/imgui/pull/638 for sources and details.\n\n\t// Create the vertex shader\n\t{\n\t\tstatic unsigned char vertexBuffer[] = { 0x44, 0x58, 0x42, 0x43, 0xA5, 0x65, 0x6C, 0xBA, 0x38, 0x7A, 0x27, 0x51, 0xAE, 0x7C, 0xE0, 0x18, 0xED, 0xDE, 0xC0, 0xE4, 0x01, 0x00, 0x00, 0x00, 0x78, 0x03, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x10, 0x01, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0xF4, 0x01, 0x00, 0x00, 0xFC, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xD4, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFE, 0xFF, 0x00, 0x01, 0x00, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x00, 0xAB, 0xAB, 0xAB, 0x3C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x72, 0x6F, 0x6A, 0x65, 0x63, 0x74, 0x69, 0x6F, 0x6E, 0x4D, 0x61, 0x74, 0x72, 0x69, 0x78, 0x00, 0xAB, 0xAB, 0xAB, 0x03, 0x00, 0x03, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2E, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0x49, 0x53, 0x47, 0x4E, 0x68, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0x4F, 0x53, 0x47, 0x4E, 0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x0C, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00, 0x01, 0x00, 0x40, 0x00, 0x00, 0x00, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x5F, 0x00, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x67, 0x00, 0x00, 0x04, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x08, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x15, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x0A, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x8E, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0xF2, 0x20, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x1E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x05, 0x32, 0x20, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };\n\n\t\tif (g_pd3dDevice->CreateVertexShader(vertexBuffer, sizeof(vertexBuffer), NULL, &g_pVertexShader) != S_OK)\n\t\t\treturn false;\n\n\t\t// Create the input layout\n\t\tD3D11_INPUT_ELEMENT_DESC local_layout[] = {\n\t\t\t{ \"POSITION\", 0, DXGI_FORMAT_R32G32_FLOAT,   0, (size_t)(&((ImDrawVert*)0)->pos), D3D11_INPUT_PER_VERTEX_DATA, 0 },\n\t\t\t{ \"TEXCOORD\", 0, DXGI_FORMAT_R32G32_FLOAT,   0, (size_t)(&((ImDrawVert*)0)->uv),  D3D11_INPUT_PER_VERTEX_DATA, 0 },\n\t\t\t{ \"COLOR\",    0, DXGI_FORMAT_R8G8B8A8_UNORM, 0, (size_t)(&((ImDrawVert*)0)->col), D3D11_INPUT_PER_VERTEX_DATA, 0 },\n\t\t};\n\t\tif (g_pd3dDevice->CreateInputLayout(local_layout, 3, vertexBuffer, sizeof(vertexBuffer), &g_pInputLayout) != S_OK)\n\t\t\treturn false;\n\n\t\t// Create the constant buffer\n\t\t{\n\t\t\tD3D11_BUFFER_DESC desc;\n\t\t\tdesc.ByteWidth = sizeof(VERTEX_CONSTANT_BUFFER);\n\t\t\tdesc.Usage = D3D11_USAGE_DYNAMIC;\n\t\t\tdesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;\n\t\t\tdesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;\n\t\t\tdesc.MiscFlags = 0;\n\t\t\tg_pd3dDevice->CreateBuffer(&desc, NULL, &g_pVertexConstantBuffer);\n\t\t}\n\t}\n\n\t// Create the pixel shader\n\t{\n\t\tstatic unsigned char shaderBlob[] = { 0x44, 0x58, 0x42, 0x43, 0xF4, 0x37, 0x3F, 0xAD, 0x4C, 0xA5, 0xBC, 0xD8, 0x5D, 0xCA, 0xD9, 0x4F, 0xE0, 0x7A, 0xCE, 0x9A, 0x01, 0x00, 0x00, 0x00, 0xA0, 0x02, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x88, 0x01, 0x00, 0x00, 0x24, 0x02, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xA4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x04, 0xFF, 0xFF, 0x00, 0x01, 0x00, 0x00, 0x6E, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6D, 0x70, 0x6C, 0x65, 0x72, 0x30, 0x00, 0x74, 0x65, 0x78, 0x74, 0x75, 0x72, 0x65, 0x30, 0x00, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4C, 0x53, 0x4C, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6F, 0x6D, 0x70, 0x69, 0x6C, 0x65, 0x72, 0x20, 0x31, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x30, 0x30, 0x31, 0x31, 0x2E, 0x31, 0x36, 0x33, 0x38, 0x34, 0x00, 0xAB, 0xAB, 0x49, 0x53, 0x47, 0x4E, 0x6C, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x5C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x00, 0x00, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x50, 0x4F, 0x53, 0x49, 0x54, 0x49, 0x4F, 0x4E, 0x00, 0x43, 0x4F, 0x4C, 0x4F, 0x52, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4F, 0x4F, 0x52, 0x44, 0x00, 0xAB, 0x4F, 0x53, 0x47, 0x4E, 0x2C, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5F, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0xAB, 0xAB, 0x53, 0x48, 0x44, 0x52, 0x94, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, 0x5A, 0x00, 0x00, 0x03, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x18, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0xF2, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x62, 0x10, 0x00, 0x03, 0x32, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x45, 0x00, 0x00, 0x09, 0xF2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x10, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x46, 0x7E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x07, 0xF2, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x0E, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x1E, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x74, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };\n\n\t\tif (g_pd3dDevice->CreatePixelShader(shaderBlob, sizeof(shaderBlob), NULL, &g_pPixelShader) != S_OK)\n\t\t\treturn false;\n\t}\n\n\t// Create the blending setup\n\t{\n\t\tD3D11_BLEND_DESC desc;\n\t\tZeroMemory(&desc, sizeof(desc));\n\t\tdesc.AlphaToCoverageEnable = false;\n\t\tdesc.RenderTarget[0].BlendEnable = true;\n\t\tdesc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;\n\t\tdesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;\n\t\tdesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;\n\t\tdesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;\n\t\tdesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;\n\t\tdesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;\n\t\tdesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;\n\t\tg_pd3dDevice->CreateBlendState(&desc, &g_pBlendState);\n\t}\n\n\t// Create the rasterizer state\n\t{\n\t\tD3D11_RASTERIZER_DESC desc;\n\t\tZeroMemory(&desc, sizeof(desc));\n\t\tdesc.FillMode = D3D11_FILL_SOLID;\n\t\tdesc.CullMode = D3D11_CULL_NONE;\n\t\tdesc.ScissorEnable = true;\n\t\tdesc.DepthClipEnable = true;\n\t\tg_pd3dDevice->CreateRasterizerState(&desc, &g_pRasterizerState);\n\t}\n\n\t// Create depth-stencil State\n\t{\n\t\tD3D11_DEPTH_STENCIL_DESC desc;\n\t\tZeroMemory(&desc, sizeof(desc));\n\t\tdesc.DepthEnable = false;\n\t\tdesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;\n\t\tdesc.DepthFunc = D3D11_COMPARISON_ALWAYS;\n\t\tdesc.StencilEnable = false;\n\t\tdesc.FrontFace.StencilFailOp = desc.FrontFace.StencilDepthFailOp = desc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;\n\t\tdesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;\n\t\tdesc.BackFace = desc.FrontFace;\n\t\tg_pd3dDevice->CreateDepthStencilState(&desc, &g_pDepthStencilState);\n\t}\n\n\tImGui_ImplDX11_CreateFontsTexture();\n\n\treturn true;\n}\n\nvoid    ImGui_ImplDX11_InvalidateDeviceObjects()\n{\n\tif (!g_pd3dDevice)\n\t\treturn;\n\n\tif (g_pFontSampler) { g_pFontSampler->Release(); g_pFontSampler = NULL; }\n\tif (g_pFontTextureView) { g_pFontTextureView->Release(); g_pFontTextureView = NULL; ImGui::GetIO().Fonts->TexID = NULL; } // We copied g_pFontTextureView to io.Fonts->TexID so let's clear that as well.\n\tif (g_pIB) { g_pIB->Release(); g_pIB = NULL; }\n\tif (g_pVB) { g_pVB->Release(); g_pVB = NULL; }\n\n\tif (g_pBlendState) { g_pBlendState->Release(); g_pBlendState = NULL; }\n\tif (g_pDepthStencilState) { g_pDepthStencilState->Release(); g_pDepthStencilState = NULL; }\n\tif (g_pRasterizerState) { g_pRasterizerState->Release(); g_pRasterizerState = NULL; }\n\tif (g_pPixelShader) { g_pPixelShader->Release(); g_pPixelShader = NULL; }\n\tif (g_pVertexConstantBuffer) { g_pVertexConstantBuffer->Release(); g_pVertexConstantBuffer = NULL; }\n\tif (g_pInputLayout) { g_pInputLayout->Release(); g_pInputLayout = NULL; }\n\tif (g_pVertexShader) { g_pVertexShader->Release(); g_pVertexShader = NULL; }\n}\n\nbool    ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContext* device_context)\n{\n\tg_hWnd = (HWND)hwnd;\n\tg_pd3dDevice = device;\n\tg_pd3dDeviceContext = device_context;\n\n\tif (!QueryPerformanceFrequency((LARGE_INTEGER *)&g_TicksPerSecond))\n\t\treturn false;\n\tif (!QueryPerformanceCounter((LARGE_INTEGER *)&g_Time))\n\t\treturn false;\n\n\tImGuiIO& io = ImGui::GetIO();\n\tio.KeyMap[ImGuiKey_Tab] = VK_TAB;                       // Keyboard mapping. ImGui will use those indices to peek into the io.KeyDown[] array that we will update during the application lifetime.\n\tio.KeyMap[ImGuiKey_LeftArrow] = VK_LEFT;\n\tio.KeyMap[ImGuiKey_RightArrow] = VK_RIGHT;\n\tio.KeyMap[ImGuiKey_UpArrow] = VK_UP;\n\tio.KeyMap[ImGuiKey_DownArrow] = VK_DOWN;\n\tio.KeyMap[ImGuiKey_PageUp] = VK_PRIOR;\n\tio.KeyMap[ImGuiKey_PageDown] = VK_NEXT;\n\tio.KeyMap[ImGuiKey_Home] = VK_HOME;\n\tio.KeyMap[ImGuiKey_End] = VK_END;\n\tio.KeyMap[ImGuiKey_Insert] = VK_INSERT;\n\tio.KeyMap[ImGuiKey_Delete] = VK_DELETE;\n\tio.KeyMap[ImGuiKey_Backspace] = VK_BACK;\n\tio.KeyMap[ImGuiKey_Enter] = VK_RETURN;\n\tio.KeyMap[ImGuiKey_Escape] = VK_ESCAPE;\n\tio.KeyMap[ImGuiKey_A] = 'A';\n\tio.KeyMap[ImGuiKey_C] = 'C';\n\tio.KeyMap[ImGuiKey_V] = 'V';\n\tio.KeyMap[ImGuiKey_X] = 'X';\n\tio.KeyMap[ImGuiKey_Y] = 'Y';\n\tio.KeyMap[ImGuiKey_Z] = 'Z';\n\n\tio.RenderDrawListsFn = ImGui_ImplDX11_RenderDrawLists;  // Alternatively you can set this to NULL and call ImGui::GetDrawData() after ImGui::Render() to get the same ImDrawData pointer.\n\tio.ImeWindowHandle = g_hWnd;\n\n\treturn true;\n}\n\nvoid ImGui_ImplDX11_Shutdown()\n{\n\tImGui_ImplDX11_InvalidateDeviceObjects();\n\tImGui::Shutdown();\n\tg_pd3dDevice = NULL;\n\tg_pd3dDeviceContext = NULL;\n\tg_hWnd = (HWND)0;\n}\n\nvoid ImGui_ImplDX11_NewFrame()\n{\n\tif (!g_pFontSampler)\n\t\tImGui_ImplDX11_CreateDeviceObjects();\n\n\tImGuiIO& io = ImGui::GetIO();\n\n\t// Setup display size (every frame to accommodate for window resizing)\n\tRECT rect;\n\tGetClientRect(g_hWnd, &rect);\n\tio.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top));\n\n\t// Setup time step\n\tINT64 current_time;\n\tQueryPerformanceCounter((LARGE_INTEGER *)&current_time);\n\tio.DeltaTime = (float)(current_time - g_Time) / g_TicksPerSecond;\n\tg_Time = current_time;\n\n\t// Read keyboard modifiers inputs\n\tio.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;\n\tio.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;\n\tio.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0;\n\tio.KeySuper = false;\n\t// io.KeysDown : filled by WM_KEYDOWN/WM_KEYUP events\n\t// io.MousePos : filled by WM_MOUSEMOVE events\n\t// io.MouseDown : filled by WM_*BUTTON* events\n\t// io.MouseWheel : filled by WM_MOUSEWHEEL events\n\n\t// Set OS mouse position if requested last frame by io.WantMoveMouse flag (used when io.NavMovesTrue is enabled by user and using directional navigation)\n\tif (io.WantMoveMouse)\n\t{\n\t\tPOINT pos = { (int)io.MousePos.x, (int)io.MousePos.y };\n\t\tClientToScreen(g_hWnd, &pos);\n\t\tSetCursorPos(pos.x, pos.y);\n\t}\n\n\t// Hide OS mouse cursor if ImGui is drawing it\n\tif (io.MouseDrawCursor)\n\t\tSetCursor(NULL);\n\n\t// Start the frame. This call will update the io.WantCaptureMouse, io.WantCaptureKeyboard flag that you can use to dispatch inputs (or not) to your application.\n\tImGui::NewFrame();\n}\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui_impl_dx11.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n// ImGui Win32 + DirectX11 binding\n// In this binding, ImTextureID is used to store a 'ID3D11ShaderResourceView*' texture identifier. Read the FAQ about ImTextureID in imgui.cpp.\n\n// You can copy and use unmodified imgui_impl_* files in your project. See main.cpp for an example of using this.\n// If you use this binding you'll need to call 4 functions: ImGui_ImplXXXX_Init(), ImGui_ImplXXXX_NewFrame(), ImGui::Render() and ImGui_ImplXXXX_Shutdown().\n// If you are new to ImGui, see examples/README.txt and documentation at the top of imgui.cpp.\n// https://github.com/ocornut/imgui\n\nstruct ID3D11Device;\nstruct ID3D11DeviceContext;\n\nIMGUI_API bool        ImGui_ImplDX11_Init(void* hwnd, ID3D11Device* device, ID3D11DeviceContext* device_context);\nIMGUI_API void        ImGui_ImplDX11_Shutdown();\nIMGUI_API void        ImGui_ImplDX11_NewFrame();\n\n// Use if you want to reset your rendering device without losing ImGui state.\nIMGUI_API void        ImGui_ImplDX11_InvalidateDeviceObjects();\nIMGUI_API bool        ImGui_ImplDX11_CreateDeviceObjects();\n\n// Handler for Win32 messages, update mouse/keyboard data.\n// You may or not need this for your implementation, but it can serve as reference for handling inputs.\n// Commented out to avoid dragging dependencies on <windows.h> types. You can copy the extern declaration in your code.\n/*\nIMGUI_API LRESULT   ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);\n*/\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui_internal.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n\n// dear imgui, v1.54 WIP\n// (internals)\n\n// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!\n// Set:\n//   #define IMGUI_DEFINE_MATH_OPERATORS\n// To implement maths operators for ImVec2 (disabled by default to not collide with using IM_VEC2_CLASS_EXTRA along with your own math types+operators)\n\n#pragma once\n\n#ifndef IMGUI_VERSION\n////#error Must include imgui.h before imgui_internal.h\n#endif\n\n#include <stdio.h>      // FILE*\n#include <math.h>       // sqrtf, fabsf, fmodf, powf, floorf, ceilf, cosf, sinf\n\n#ifdef _MSC_VER\n#pragma warning (push)\n#pragma warning (disable: 4251) // class 'xxx' needs to have dll-interface to be used by clients of struct 'xxx' // when IMGUI_API is set to__declspec(dllexport)\n#endif\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wunused-function\"        // for stb_textedit.h\n#pragma clang diagnostic ignored \"-Wmissing-prototypes\"     // for stb_textedit.h\n#pragma clang diagnostic ignored \"-Wold-style-cast\"\n#endif\n\n//-----------------------------------------------------------------------------\n// Forward Declarations\n//-----------------------------------------------------------------------------\n\nstruct ImRect;\nstruct ImGuiColMod;\nstruct ImGuiStyleMod;\nstruct ImGuiGroupData;\nstruct ImGuiMenuColumns;\nstruct ImGuiDrawContext;\nstruct ImGuiTextEditState;\nstruct ImGuiMouseCursorData;\nstruct ImGuiPopupRef;\nstruct ImGuiWindow;\nstruct ImGuiWindowSettings;\n\ntypedef int ImGuiLayoutType;        // enum: horizontal or vertical             // enum ImGuiLayoutType_\ntypedef int ImGuiButtonFlags;       // flags: for ButtonEx(), ButtonBehavior()  // enum ImGuiButtonFlags_\ntypedef int ImGuiItemFlags;         // flags: for PushItemFlag()                // enum ImGuiItemFlags_\ntypedef int ImGuiSeparatorFlags;    // flags: for Separator() - internal        // enum ImGuiSeparatorFlags_\ntypedef int ImGuiSliderFlags;       // flags: for SliderBehavior()              // enum ImGuiSliderFlags_\n\n\t\t\t\t\t\t\t\t\t//-------------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t// STB libraries\n\t\t\t\t\t\t\t\t\t//-------------------------------------------------------------------------\n\nnamespace ImGuiStb\n{\n\n#undef STB_TEXTEDIT_STRING\n#undef STB_TEXTEDIT_CHARTYPE\n#define STB_TEXTEDIT_STRING             ImGuiTextEditState\n#define STB_TEXTEDIT_CHARTYPE           ImWchar\n#define STB_TEXTEDIT_GETWIDTH_NEWLINE   -1.0f\n#include \"stb_textedit.h\"\n\n} // namespace ImGuiStb\n\n  //-----------------------------------------------------------------------------\n  // Context\n  //-----------------------------------------------------------------------------\n\n#ifndef GImGui\nextern IMGUI_API ImGuiContext* GImGui;  // Current implicit ImGui context pointer\n#endif\n\n\t\t\t\t\t\t\t\t\t\t//-----------------------------------------------------------------------------\n\t\t\t\t\t\t\t\t\t\t// Helpers\n\t\t\t\t\t\t\t\t\t\t//-----------------------------------------------------------------------------\n\n#define IM_PI           3.14159265358979323846f\n\n\t\t\t\t\t\t\t\t\t\t// Helpers: UTF-8 <> wchar\nIMGUI_API int           ImTextStrToUtf8(char* buf, int buf_size, const ImWchar* in_text, const ImWchar* in_text_end);      // return output UTF-8 bytes count\nIMGUI_API int           ImTextCharFromUtf8(unsigned int* out_char, const char* in_text, const char* in_text_end);          // return input UTF-8 bytes count\nIMGUI_API int           ImTextStrFromUtf8(ImWchar* buf, int buf_size, const char* in_text, const char* in_text_end, const char** in_remaining = NULL);   // return input UTF-8 bytes count\nIMGUI_API int           ImTextCountCharsFromUtf8(const char* in_text, const char* in_text_end);                            // return number of UTF-8 code-points (NOT bytes count)\nIMGUI_API int           ImTextCountUtf8BytesFromStr(const ImWchar* in_text, const ImWchar* in_text_end);                   // return number of bytes to express string as UTF-8 code-points\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   // Helpers: Misc\nIMGUI_API ImU32         ImHash(const void* data, int data_size, ImU32 seed = 0);    // Pass data_size==0 for zero-terminated strings\nIMGUI_API void*         ImFileLoadToMemory(const char* filename, const char* file_open_mode, int* out_file_size = NULL, int padding_bytes = 0);\nIMGUI_API FILE*         ImFileOpen(const char* filename, const char* file_open_mode);\nstatic inline bool      ImCharIsSpace(int c) { return c == ' ' || c == '\\t' || c == 0x3000; }\nstatic inline bool      ImIsPowerOfTwo(int v) { return v != 0 && (v & (v - 1)) == 0; }\nstatic inline int       ImUpperPowerOfTwo(int v) { v--; v |= v >> 1; v |= v >> 2; v |= v >> 4; v |= v >> 8; v |= v >> 16; v++; return v; }\n\n// Helpers: Geometry\nIMGUI_API ImVec2        ImLineClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& p);\nIMGUI_API bool          ImTriangleContainsPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);\nIMGUI_API ImVec2        ImTriangleClosestPoint(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p);\nIMGUI_API void          ImTriangleBarycentricCoords(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& p, float& out_u, float& out_v, float& out_w);\n\n// Helpers: String\nIMGUI_API int           ImStricmp(const char* str1, const char* str2);\nIMGUI_API int           ImStrnicmp(const char* str1, const char* str2, size_t count);\nIMGUI_API void          ImStrncpy(char* dst, const char* src, size_t count);\nIMGUI_API char*         ImStrdup(const char* str);\nIMGUI_API char*         ImStrchrRange(const char* str_begin, const char* str_end, char c);\nIMGUI_API int           ImStrlenW(const ImWchar* str);\nIMGUI_API const ImWchar*ImStrbolW(const ImWchar* buf_mid_line, const ImWchar* buf_begin); // Find beginning-of-line\nIMGUI_API const char*   ImStristr(const char* haystack, const char* haystack_end, const char* needle, const char* needle_end);\nIMGUI_API int           ImFormatString(char* buf, size_t buf_size, const char* fmt, ...) IM_FMTARGS(3);\nIMGUI_API int           ImFormatStringV(char* buf, size_t buf_size, const char* fmt, va_list args) IM_FMTLIST(3);\n\n// Helpers: Math\n// We are keeping those not leaking to the user by default, in the case the user has implicit cast operators between ImVec2 and its own types (when IM_VEC2_CLASS_EXTRA is defined)\n#ifdef IMGUI_DEFINE_MATH_OPERATORS\nstatic inline ImVec2 operator*(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x*rhs, lhs.y*rhs); }\nstatic inline ImVec2 operator/(const ImVec2& lhs, const float rhs) { return ImVec2(lhs.x / rhs, lhs.y / rhs); }\nstatic inline ImVec2 operator+(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x + rhs.x, lhs.y + rhs.y); }\nstatic inline ImVec2 operator-(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x - rhs.x, lhs.y - rhs.y); }\nstatic inline ImVec2 operator*(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x*rhs.x, lhs.y*rhs.y); }\nstatic inline ImVec2 operator/(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x / rhs.x, lhs.y / rhs.y); }\nstatic inline ImVec2& operator+=(ImVec2& lhs, const ImVec2& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; }\nstatic inline ImVec2& operator-=(ImVec2& lhs, const ImVec2& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; }\nstatic inline ImVec2& operator*=(ImVec2& lhs, const float rhs) { lhs.x *= rhs; lhs.y *= rhs; return lhs; }\nstatic inline ImVec2& operator/=(ImVec2& lhs, const float rhs) { lhs.x /= rhs; lhs.y /= rhs; return lhs; }\nstatic inline ImVec4 operator+(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z, lhs.w + rhs.w); }\nstatic inline ImVec4 operator-(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z, lhs.w - rhs.w); }\nstatic inline ImVec4 operator*(const ImVec4& lhs, const ImVec4& rhs) { return ImVec4(lhs.x*rhs.x, lhs.y*rhs.y, lhs.z*rhs.z, lhs.w*rhs.w); }\n#endif\n\nstatic inline int    ImMin(int lhs, int rhs) { return lhs < rhs ? lhs : rhs; }\nstatic inline int    ImMax(int lhs, int rhs) { return lhs >= rhs ? lhs : rhs; }\nstatic inline float  ImMin(float lhs, float rhs) { return lhs < rhs ? lhs : rhs; }\nstatic inline float  ImMax(float lhs, float rhs) { return lhs >= rhs ? lhs : rhs; }\nstatic inline ImVec2 ImMin(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x < rhs.x ? lhs.x : rhs.x, lhs.y < rhs.y ? lhs.y : rhs.y); }\nstatic inline ImVec2 ImMax(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x >= rhs.x ? lhs.x : rhs.x, lhs.y >= rhs.y ? lhs.y : rhs.y); }\nstatic inline int    ImClamp(int v, int mn, int mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }\nstatic inline float  ImClamp(float v, float mn, float mx) { return (v < mn) ? mn : (v > mx) ? mx : v; }\nstatic inline ImVec2 ImClamp(const ImVec2& f, const ImVec2& mn, ImVec2 mx) { return ImVec2(ImClamp(f.x, mn.x, mx.x), ImClamp(f.y, mn.y, mx.y)); }\nstatic inline float  ImSaturate(float f) { return (f < 0.0f) ? 0.0f : (f > 1.0f) ? 1.0f : f; }\nstatic inline void   ImSwap(int& a, int& b) { int tmp = a; a = b; b = tmp; }\nstatic inline void   ImSwap(float& a, float& b) { float tmp = a; a = b; b = tmp; }\nstatic inline int    ImLerp(int a, int b, float t) { return (int)(a + (b - a) * t); }\nstatic inline float  ImLerp(float a, float b, float t) { return a + (b - a) * t; }\nstatic inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, float t) { return ImVec2(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t); }\nstatic inline ImVec2 ImLerp(const ImVec2& a, const ImVec2& b, const ImVec2& t) { return ImVec2(a.x + (b.x - a.x) * t.x, a.y + (b.y - a.y) * t.y); }\nstatic inline ImVec4 ImLerp(const ImVec4& a, const ImVec4& b, float t) { return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t); }\nstatic inline float  ImLengthSqr(const ImVec2& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y; }\nstatic inline float  ImLengthSqr(const ImVec4& lhs) { return lhs.x*lhs.x + lhs.y*lhs.y + lhs.z*lhs.z + lhs.w*lhs.w; }\nstatic inline float  ImInvLength(const ImVec2& lhs, float fail_value) { float d = lhs.x*lhs.x + lhs.y*lhs.y; if (d > 0.0f) return 1.0f / sqrtf(d); return fail_value; }\nstatic inline float  ImFloor(float f) { return (float)(int)f; }\nstatic inline ImVec2 ImFloor(const ImVec2& v) { return ImVec2((float)(int)v.x, (float)(int)v.y); }\nstatic inline float  ImDot(const ImVec2& a, const ImVec2& b) { return a.x * b.x + a.y * b.y; }\nstatic inline ImVec2 ImRotate(const ImVec2& v, float cos_a, float sin_a) { return ImVec2(v.x * cos_a - v.y * sin_a, v.x * sin_a + v.y * cos_a); }\nstatic inline float  ImLinearSweep(float current, float target, float speed) { if (current < target) return ImMin(current + speed, target); if (current > target) return ImMax(current - speed, target); return current; }\nstatic inline ImVec2 ImMul(const ImVec2& lhs, const ImVec2& rhs) { return ImVec2(lhs.x * rhs.x, lhs.y * rhs.y); }\n\n// We call C++ constructor on own allocated memory via the placement \"new(ptr) Type()\" syntax.\n// Defining a custom placement new() with a dummy parameter allows us to bypass including <new> which on some platforms complains when user has disabled exceptions.\nstruct ImNewPlacementDummy {};\ninline void* operator   new(size_t, ImNewPlacementDummy, void* ptr) { return ptr; }\ninline void  operator   delete(void*, ImNewPlacementDummy, void*) {} // This is only required so we can use the symetrical new()\n#define IM_PLACEMENT_NEW(_PTR)              new(ImNewPlacementDummy(), _PTR)\n#define IM_NEW(_TYPE)                       new(ImNewPlacementDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE\ntemplate <typename T> void IM_DELETE(T*& p) { if (p) { p->~T(); ImGui::MemFree(p); p = NULL; } }\n\n//-----------------------------------------------------------------------------\n// Types\n//-----------------------------------------------------------------------------\n\nenum ImGuiButtonFlags_\n{\n\tImGuiButtonFlags_Repeat = 1 << 0,   // hold to repeat\n\tImGuiButtonFlags_PressedOnClickRelease = 1 << 1,   // return true on click + release on same item [DEFAULT if no PressedOn* flag is set]\n\tImGuiButtonFlags_PressedOnClick = 1 << 2,   // return true on click (default requires click+release)\n\tImGuiButtonFlags_PressedOnRelease = 1 << 3,   // return true on release (default requires click+release)\n\tImGuiButtonFlags_PressedOnDoubleClick = 1 << 4,   // return true on double-click (default requires click+release)\n\tImGuiButtonFlags_FlattenChildren = 1 << 5,   // allow interactions even if a child window is overlapping\n\tImGuiButtonFlags_AllowItemOverlap = 1 << 6,   // require previous frame HoveredId to either match id or be null before being usable, use along with SetItemAllowOverlap()\n\tImGuiButtonFlags_DontClosePopups = 1 << 7,   // disable automatically closing parent popup on press // [UNUSED]\n\tImGuiButtonFlags_Disabled = 1 << 8,   // disable interactions\n\tImGuiButtonFlags_AlignTextBaseLine = 1 << 9,   // vertically align button to match text baseline - ButtonEx() only // FIXME: Should be removed and handled by SmallButton(), not possible currently because of DC.CursorPosPrevLine\n\tImGuiButtonFlags_NoKeyModifiers = 1 << 10,  // disable interaction if a key modifier is held\n\tImGuiButtonFlags_NoHoldingActiveID = 1 << 11,  // don't set ActiveId while holding the mouse (ImGuiButtonFlags_PressedOnClick only)\n\tImGuiButtonFlags_PressedOnDragDropHold = 1 << 12   // press when held into while we are drag and dropping another item (used by e.g. tree nodes, collapsing headers)\n};\n\nenum ImGuiSliderFlags_\n{\n\tImGuiSliderFlags_Vertical = 1 << 0\n};\n\nenum ImGuiColumnsFlags_\n{\n\t// Default: 0\n\tImGuiColumnsFlags_NoBorder = 1 << 0,   // Disable column dividers\n\tImGuiColumnsFlags_NoResize = 1 << 1,   // Disable resizing columns when clicking on the dividers\n\tImGuiColumnsFlags_NoPreserveWidths = 1 << 2,   // Disable column width preservation when adjusting columns\n\tImGuiColumnsFlags_NoForceWithinWindow = 1 << 3,   // Disable forcing columns to fit within window\n\tImGuiColumnsFlags_GrowParentContentsSize = 1 << 4    // (WIP) Restore pre-1.51 behavior of extending the parent window contents size but _without affecting the columns width at all_. Will eventually remove.\n};\n\nenum ImGuiSelectableFlagsPrivate_\n{\n\t// NB: need to be in sync with last value of ImGuiSelectableFlags_\n\tImGuiSelectableFlags_Menu = 1 << 3,   // -> PressedOnClick\n\tImGuiSelectableFlags_MenuItem = 1 << 4,   // -> PressedOnRelease\n\tImGuiSelectableFlags_Disabled = 1 << 5,\n\tImGuiSelectableFlags_DrawFillAvailWidth = 1 << 6\n};\n\nenum ImGuiSeparatorFlags_\n{\n\tImGuiSeparatorFlags_Horizontal = 1 << 0,   // Axis default to current layout type, so generally Horizontal unless e.g. in a menu bar\n\tImGuiSeparatorFlags_Vertical = 1 << 1\n};\n\n// FIXME: this is in development, not exposed/functional as a generic feature yet.\nenum ImGuiLayoutType_\n{\n\tImGuiLayoutType_Vertical,\n\tImGuiLayoutType_Horizontal\n};\n\nenum ImGuiAxis\n{\n\tImGuiAxis_None = -1,\n\tImGuiAxis_X = 0,\n\tImGuiAxis_Y = 1\n};\n\nenum ImGuiPlotType\n{\n\tImGuiPlotType_Lines,\n\tImGuiPlotType_Histogram\n};\n\nenum ImGuiDataType\n{\n\tImGuiDataType_Int,\n\tImGuiDataType_Float,\n\tImGuiDataType_Float2\n};\n\nenum ImGuiDir\n{\n\tImGuiDir_None = -1,\n\tImGuiDir_Left = 0,\n\tImGuiDir_Right = 1,\n\tImGuiDir_Up = 2,\n\tImGuiDir_Down = 3,\n\tImGuiDir_Count_\n};\n\n// 2D axis aligned bounding-box\n// NB: we can't rely on ImVec2 math operators being available here\nstruct IMGUI_API ImRect\n{\n\tImVec2      Min;    // Upper-left\n\tImVec2      Max;    // Lower-right\n\n\tImRect() : Min(FLT_MAX, FLT_MAX), Max(-FLT_MAX, -FLT_MAX) {}\n\tImRect(const ImVec2& min, const ImVec2& max) : Min(min), Max(max) {}\n\tImRect(const ImVec4& v) : Min(v.x, v.y), Max(v.z, v.w) {}\n\tImRect(float x1, float y1, float x2, float y2) : Min(x1, y1), Max(x2, y2) {}\n\n\tImVec2      GetCenter() const { return ImVec2((Min.x + Max.x) * 0.5f, (Min.y + Max.y) * 0.5f); }\n\tImVec2      GetSize() const { return ImVec2(Max.x - Min.x, Max.y - Min.y); }\n\tfloat       GetWidth() const { return Max.x - Min.x; }\n\tfloat       GetHeight() const { return Max.y - Min.y; }\n\tImVec2      GetTL() const { return Min; }                   // Top-left\n\tImVec2      GetTR() const { return ImVec2(Max.x, Min.y); }  // Top-right\n\tImVec2      GetBL() const { return ImVec2(Min.x, Max.y); }  // Bottom-left\n\tImVec2      GetBR() const { return Max; }                   // Bottom-right\n\tbool        Contains(const ImVec2& p) const { return p.x >= Min.x && p.y >= Min.y && p.x     < Max.x && p.y     < Max.y; }\n\tbool        Contains(const ImRect& r) const { return r.Min.x >= Min.x && r.Min.y >= Min.y && r.Max.x < Max.x && r.Max.y < Max.y; }\n\tbool        Overlaps(const ImRect& r) const { return r.Min.y <  Max.y && r.Max.y >  Min.y && r.Min.x < Max.x && r.Max.x > Min.x; }\n\tvoid        Add(const ImVec2& p) { if (Min.x > p.x)     Min.x = p.x;     if (Min.y > p.y)     Min.y = p.y;     if (Max.x < p.x)     Max.x = p.x;     if (Max.y < p.y)     Max.y = p.y; }\n\tvoid        Add(const ImRect& r) { if (Min.x > r.Min.x) Min.x = r.Min.x; if (Min.y > r.Min.y) Min.y = r.Min.y; if (Max.x < r.Max.x) Max.x = r.Max.x; if (Max.y < r.Max.y) Max.y = r.Max.y; }\n\tvoid        Expand(const float amount) { Min.x -= amount;   Min.y -= amount;   Max.x += amount;   Max.y += amount; }\n\tvoid        Expand(const ImVec2& amount) { Min.x -= amount.x; Min.y -= amount.y; Max.x += amount.x; Max.y += amount.y; }\n\tvoid        Translate(const ImVec2& v) { Min.x += v.x; Min.y += v.y; Max.x += v.x; Max.y += v.y; }\n\tvoid        ClipWith(const ImRect& r) { Min = ImMax(Min, r.Min); Max = ImMin(Max, r.Max); }                   // Simple version, may lead to an inverted rectangle, which is fine for Contains/Overlaps test but not for display.\n\tvoid        ClipWithFull(const ImRect& r) { Min = ImClamp(Min, r.Min, r.Max); Max = ImClamp(Max, r.Min, r.Max); } // Full version, ensure both points are fully clipped.\n\tvoid        Floor() { Min.x = (float)(int)Min.x; Min.y = (float)(int)Min.y; Max.x = (float)(int)Max.x; Max.y = (float)(int)Max.y; }\n\tvoid        FixInverted() { if (Min.x > Max.x) ImSwap(Min.x, Max.x); if (Min.y > Max.y) ImSwap(Min.y, Max.y); }\n\tbool        IsFinite() const { return Min.x != FLT_MAX; }\n};\n\n// Stacked color modifier, backup of modified data so we can restore it\nstruct ImGuiColMod\n{\n\tImGuiCol    Col;\n\tImVec4      BackupValue;\n};\n\n// Stacked style modifier, backup of modified data so we can restore it. Data type inferred from the variable.\nstruct ImGuiStyleMod\n{\n\tImGuiStyleVar   VarIdx;\n\tunion { int BackupInt[2]; float BackupFloat[2]; };\n\tImGuiStyleMod(ImGuiStyleVar idx, int v) { VarIdx = idx; BackupInt[0] = v; }\n\tImGuiStyleMod(ImGuiStyleVar idx, float v) { VarIdx = idx; BackupFloat[0] = v; }\n\tImGuiStyleMod(ImGuiStyleVar idx, ImVec2 v) { VarIdx = idx; BackupFloat[0] = v.x; BackupFloat[1] = v.y; }\n};\n\n// Stacked data for BeginGroup()/EndGroup()\nstruct ImGuiGroupData\n{\n\tImVec2      BackupCursorPos;\n\tImVec2      BackupCursorMaxPos;\n\tfloat       BackupIndentX;\n\tfloat       BackupGroupOffsetX;\n\tfloat       BackupCurrentLineHeight;\n\tfloat       BackupCurrentLineTextBaseOffset;\n\tfloat       BackupLogLinePosY;\n\tbool        BackupActiveIdIsAlive;\n\tbool        AdvanceCursor;\n};\n\n// Simple column measurement currently used for MenuItem() only. This is very short-sighted/throw-away code and NOT a generic helper.\nstruct IMGUI_API ImGuiMenuColumns\n{\n\tint         Count;\n\tfloat       Spacing;\n\tfloat       Width, NextWidth;\n\tfloat       Pos[4], NextWidths[4];\n\n\tImGuiMenuColumns();\n\tvoid        Update(int count, float spacing, bool clear);\n\tfloat       DeclColumns(float w0, float w1, float w2);\n\tfloat       CalcExtraSpace(float avail_w);\n};\n\n// Internal state of the currently focused/edited text input box\nstruct IMGUI_API ImGuiTextEditState\n{\n\tImGuiID             Id;                         // widget id owning the text state\n\tImVector<ImWchar>   Text;                       // edit buffer, we need to persist but can't guarantee the persistence of the user-provided buffer. so we copy into own buffer.\n\tImVector<char>      InitialText;                // backup of end-user buffer at the time of focus (in UTF-8, unaltered)\n\tImVector<char>      TempTextBuffer;\n\tint                 CurLenA, CurLenW;           // we need to maintain our buffer length in both UTF-8 and wchar format.\n\tint                 BufSizeA;                   // end-user buffer size\n\tfloat               ScrollX;\n\tImGuiStb::STB_TexteditState   StbState;\n\tfloat               CursorAnim;\n\tbool                CursorFollow;\n\tbool                SelectedAllMouseLock;\n\n\tImGuiTextEditState() { memset(this, 0, sizeof(*this)); }\n\tvoid                CursorAnimReset() { CursorAnim = -0.30f; }                                   // After a user-input the cursor stays on for a while without blinking\n\tvoid                CursorClamp() { StbState.cursor = ImMin(StbState.cursor, CurLenW); StbState.select_start = ImMin(StbState.select_start, CurLenW); StbState.select_end = ImMin(StbState.select_end, CurLenW); }\n\tbool                HasSelection() const { return StbState.select_start != StbState.select_end; }\n\tvoid                ClearSelection() { StbState.select_start = StbState.select_end = StbState.cursor; }\n\tvoid                SelectAll() { StbState.select_start = 0; StbState.cursor = StbState.select_end = CurLenW; StbState.has_preferred_x = false; }\n\tvoid                OnKeyPressed(int key);\n};\n\n// Data saved in imgui.ini file\nstruct ImGuiWindowSettings\n{\n\tchar*       Name;\n\tImGuiID     Id;\n\tImVec2      Pos;\n\tImVec2      Size;\n\tbool        Collapsed;\n\n\tImGuiWindowSettings() { Name = NULL; Id = 0; Pos = Size = ImVec2(0, 0); Collapsed = false; }\n};\n\nstruct ImGuiSettingsHandler\n{\n\tconst char* TypeName;   // Short description stored in .ini file. Disallowed characters: '[' ']'  \n\tImGuiID     TypeHash;   // == ImHash(TypeName, 0, 0)\n\tvoid*       (*ReadOpenFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name);\n\tvoid(*ReadLineFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line);\n\tvoid(*WriteAllFn)(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf);\n\tvoid*       UserData;\n\n\tImGuiSettingsHandler() { memset(this, 0, sizeof(*this)); }\n};\n\n// Mouse cursor data (used when io.MouseDrawCursor is set)\nstruct ImGuiMouseCursorData\n{\n\tImGuiMouseCursor    Type;\n\tImVec2              HotOffset;\n\tImVec2              Size;\n\tImVec2              TexUvMin[2];\n\tImVec2              TexUvMax[2];\n};\n\n// Storage for current popup stack\nstruct ImGuiPopupRef\n{\n\tImGuiID             PopupId;        // Set on OpenPopup()\n\tImGuiWindow*        Window;         // Resolved on BeginPopup() - may stay unresolved if user never calls OpenPopup()\n\tImGuiWindow*        ParentWindow;   // Set on OpenPopup()\n\tint                 OpenFrameCount; // Set on OpenPopup()\n\tImGuiID             OpenParentId;   // Set on OpenPopup(), we need this to differenciate multiple menu sets from each others (e.g. inside menu bar vs loose menu items)\n\tImVec2              OpenPopupPos;   // Set on OpenPopup(), preferred popup position (typically == OpenMousePos when using mouse)\n\tImVec2              OpenMousePos;   // Set on OpenPopup(), copy of mouse position at the time of opening popup\n};\n\nstruct ImGuiColumnData\n{\n\tfloat               OffsetNorm;         // Column start offset, normalized 0.0 (far left) -> 1.0 (far right)\n\tfloat               OffsetNormBeforeResize;\n\tImGuiColumnsFlags   Flags;              // Not exposed\n\tImRect              ClipRect;\n\n\tImGuiColumnData() { OffsetNorm = OffsetNormBeforeResize = 0.0f; Flags = 0; }\n};\n\nstruct ImGuiColumnsSet\n{\n\tImGuiID             ID;\n\tImGuiColumnsFlags   Flags;\n\tbool                IsFirstFrame;\n\tbool                IsBeingResized;\n\tint                 Current;\n\tint                 Count;\n\tfloat               MinX, MaxX;\n\tfloat               StartPosY;\n\tfloat               StartMaxPosX;       // Backup of CursorMaxPos\n\tfloat               CellMinY, CellMaxY;\n\tImVector<ImGuiColumnData> Columns;\n\n\tImGuiColumnsSet() { Clear(); }\n\tvoid Clear()\n\t{\n\t\tID = 0;\n\t\tFlags = 0;\n\t\tIsFirstFrame = false;\n\t\tIsBeingResized = false;\n\t\tCurrent = 0;\n\t\tCount = 1;\n\t\tMinX = MaxX = 0.0f;\n\t\tStartPosY = 0.0f;\n\t\tStartMaxPosX = 0.0f;\n\t\tCellMinY = CellMaxY = 0.0f;\n\t\tColumns.clear();\n\t}\n};\n\nstruct IMGUI_API ImDrawListSharedData\n{\n\tImVec2          TexUvWhitePixel;            // UV of white pixel in the atlas\n\tImFont*         Font;                       // Current/default font (optional, for simplified AddText overload)\n\tfloat           FontSize;                   // Current/default font size (optional, for simplified AddText overload)\n\tfloat           CurveTessellationTol;\n\tImVec4          ClipRectFullscreen;         // Value for PushClipRectFullscreen()\n\n\t\t\t\t\t\t\t\t\t\t\t\t// Const data\n\t\t\t\t\t\t\t\t\t\t\t\t// FIXME: Bake rounded corners fill/borders in atlas\n\tImVec2          CircleVtx12[12];\n\n\tImDrawListSharedData();\n};\n\nstruct ImDrawDataBuilder\n{\n\tImVector<ImDrawList*>   Layers[2];           // Global layers for: regular, tooltip\n\n\tvoid Clear() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].resize(0); }\n\tvoid ClearFreeMemory() { for (int n = 0; n < IM_ARRAYSIZE(Layers); n++) Layers[n].clear(); }\n\tIMGUI_API void FlattenIntoSingleLayer();\n};\n\n// Storage for SetNexWindow** functions\nstruct ImGuiNextWindowData\n{\n\tImGuiCond               PosCond;\n\tImGuiCond               SizeCond;\n\tImGuiCond               ContentSizeCond;\n\tImGuiCond               CollapsedCond;\n\tImGuiCond               SizeConstraintCond;\n\tImGuiCond               FocusCond;\n\tImVec2                  PosVal;\n\tImVec2                  PosPivotVal;\n\tImVec2                  SizeVal;\n\tImVec2                  ContentSizeVal;\n\tbool                    CollapsedVal;\n\tImRect                  SizeConstraintRect;                 // Valid if 'SetNextWindowSizeConstraint' is true\n\tImGuiSizeCallback       SizeCallback;\n\tvoid*                   SizeCallbackUserData;\n\n\tImGuiNextWindowData()\n\t{\n\t\tPosCond = SizeCond = ContentSizeCond = CollapsedCond = SizeConstraintCond = FocusCond = 0;\n\t\tPosVal = PosPivotVal = SizeVal = ImVec2(0.0f, 0.0f);\n\t\tContentSizeVal = ImVec2(0.0f, 0.0f);\n\t\tCollapsedVal = false;\n\t\tSizeConstraintRect = ImRect();\n\t\tSizeCallback = NULL;\n\t\tSizeCallbackUserData = NULL;\n\t}\n\n\tvoid    Clear()\n\t{\n\t\tPosCond = SizeCond = ContentSizeCond = CollapsedCond = SizeConstraintCond = FocusCond = 0;\n\t}\n};\n\n// Main state for ImGui\nstruct ImGuiContext\n{\n\tbool                    Initialized;\n\tImGuiIO                 IO;\n\tImGuiStyle              Style;\n\tImFont*                 Font;                               // (Shortcut) == FontStack.empty() ? IO.Font : FontStack.back()\n\tfloat                   FontSize;                           // (Shortcut) == FontBaseSize * g.CurrentWindow->FontWindowScale == window->FontSize(). Text height for current window.\n\tfloat                   FontBaseSize;                       // (Shortcut) == IO.FontGlobalScale * Font->Scale * Font->FontSize. Base text height.\n\tImDrawListSharedData    DrawListSharedData;\n\n\tfloat                   Time;\n\tint                     FrameCount;\n\tint                     FrameCountEnded;\n\tint                     FrameCountRendered;\n\tImVector<ImGuiWindow*>  Windows;\n\tImVector<ImGuiWindow*>  WindowsSortBuffer;\n\tImVector<ImGuiWindow*>  CurrentWindowStack;\n\tImGuiStorage            WindowsById;\n\tint                     WindowsActiveCount;\n\tImGuiWindow*            CurrentWindow;                      // Being drawn into\n\tImGuiWindow*            NavWindow;                          // Nav/focused window for navigation\n\tImGuiWindow*            HoveredWindow;                      // Will catch mouse inputs\n\tImGuiWindow*            HoveredRootWindow;                  // Will catch mouse inputs (for focus/move only)\n\tImGuiID                 HoveredId;                          // Hovered widget\n\tbool                    HoveredIdAllowOverlap;\n\tImGuiID                 HoveredIdPreviousFrame;\n\tfloat                   HoveredIdTimer;\n\tImGuiID                 ActiveId;                           // Active widget\n\tImGuiID                 ActiveIdPreviousFrame;\n\tfloat                   ActiveIdTimer;\n\tbool                    ActiveIdIsAlive;                    // Active widget has been seen this frame\n\tbool                    ActiveIdIsJustActivated;            // Set at the time of activation for one frame\n\tbool                    ActiveIdAllowOverlap;               // Active widget allows another widget to steal active id (generally for overlapping widgets, but not always)\n\tImVec2                  ActiveIdClickOffset;                // Clicked offset from upper-left corner, if applicable (currently only set by ButtonBehavior)\n\tImGuiWindow*            ActiveIdWindow;\n\tImGuiWindow*            MovingWindow;                       // Track the window we clicked on (in order to preserve focus). The actually window that is moved is generally MovingWindow->RootWindow.\n\tImGuiID                 MovingWindowMoveId;                 // == MovingWindow->MoveId\n\tImVector<ImGuiColMod>   ColorModifiers;                     // Stack for PushStyleColor()/PopStyleColor()\n\tImVector<ImGuiStyleMod> StyleModifiers;                     // Stack for PushStyleVar()/PopStyleVar()\n\tImVector<ImFont*>       FontStack;                          // Stack for PushFont()/PopFont()\n\tImVector<ImGuiPopupRef> OpenPopupStack;                     // Which popups are open (persistent)\n\tImVector<ImGuiPopupRef> CurrentPopupStack;                  // Which level of BeginPopup() we are in (reset every frame)\n\tImGuiNextWindowData     NextWindowData;                     // Storage for SetNextWindow** functions\n\tbool                    NextTreeNodeOpenVal;                // Storage for SetNextTreeNode** functions\n\tImGuiCond               NextTreeNodeOpenCond;\n\tImGuiID                 LastActiveId;\n\tfloat                   LastActiveIdTimer;\n\n\t// Render\n\tImDrawData              DrawData;                           // Main ImDrawData instance to pass render information to the user\n\tImDrawDataBuilder       DrawDataBuilder;\n\tfloat                   ModalWindowDarkeningRatio;\n\tImDrawList              OverlayDrawList;                    // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays\n\tImGuiMouseCursor        MouseCursor;\n\tImGuiMouseCursorData    MouseCursorData[ImGuiMouseCursor_Count_];\n\n\t// Drag and Drop\n\tbool                    DragDropActive;\n\tImGuiDragDropFlags      DragDropSourceFlags;\n\tint                     DragDropMouseButton;\n\tImGuiPayload            DragDropPayload;\n\tImRect                  DragDropTargetRect;\n\tImGuiID                 DragDropTargetId;\n\tfloat                   DragDropAcceptIdCurrRectSurface;\n\tImGuiID                 DragDropAcceptIdCurr;               // Target item id (set at the time of accepting the payload)\n\tImGuiID                 DragDropAcceptIdPrev;               // Target item id from previous frame (we need to store this to allow for overlapping drag and drop targets)\n\tint                     DragDropAcceptFrameCount;           // Last time a target expressed a desire to accept the source\n\tImVector<unsigned char> DragDropPayloadBufHeap;             // We don't expose the ImVector<> directly\n\tunsigned char           DragDropPayloadBufLocal[8];\n\n\t// Widget state\n\tImGuiTextEditState      InputTextState;\n\tImFont                  InputTextPasswordFont;\n\tImGuiID                 ScalarAsInputTextId;                // Temporary text input when CTRL+clicking on a slider, etc.\n\tImGuiColorEditFlags     ColorEditOptions;                   // Store user options for color edit widgets\n\tImVec4                  ColorPickerRef;\n\tfloat                   DragCurrentValue;                   // Currently dragged value, always float, not rounded by end-user precision settings\n\tImVec2                  DragLastMouseDelta;\n\tfloat                   DragSpeedDefaultRatio;              // If speed == 0.0f, uses (max-min) * DragSpeedDefaultRatio\n\tfloat                   DragSpeedScaleSlow;\n\tfloat                   DragSpeedScaleFast;\n\tImVec2                  ScrollbarClickDeltaToGrabCenter;    // Distance between mouse and center of grab box, normalized in parent space. Use storage?\n\tint                     TooltipOverrideCount;\n\tImVector<char>          PrivateClipboard;                   // If no custom clipboard handler is defined\n\tImVec2                  OsImePosRequest, OsImePosSet;       // Cursor position request & last passed to the OS Input Method Editor\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Settings\n\tfloat                          SettingsDirtyTimer;          // Save .ini Settings on disk when time reaches zero\n\tImVector<ImGuiWindowSettings>  SettingsWindows;             // .ini settings for ImGuiWindow\n\tImVector<ImGuiSettingsHandler> SettingsHandlers;            // List of .ini settings handlers\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Logging\n\tbool                    LogEnabled;\n\tFILE*                   LogFile;                            // If != NULL log to stdout/ file\n\tImGuiTextBuffer*        LogClipboard;                       // Else log to clipboard. This is pointer so our GImGui static constructor doesn't call heap allocators.\n\tint                     LogStartDepth;\n\tint                     LogAutoExpandMaxDepth;\n\n\t// Misc\n\tfloat                   FramerateSecPerFrame[120];          // calculate estimate of framerate for user\n\tint                     FramerateSecPerFrameIdx;\n\tfloat                   FramerateSecPerFrameAccum;\n\tint                     WantCaptureMouseNextFrame;          // explicit capture via CaptureInputs() sets those flags\n\tint                     WantCaptureKeyboardNextFrame;\n\tint                     WantTextInputNextFrame;\n\tchar                    TempBuffer[1024 * 3 + 1];               // temporary text buffer\n\n\tImGuiContext() : OverlayDrawList(NULL)\n\t{\n\t\tInitialized = false;\n\t\tFont = NULL;\n\t\tFontSize = FontBaseSize = 0.0f;\n\n\t\tTime = 0.0f;\n\t\tFrameCount = 0;\n\t\tFrameCountEnded = FrameCountRendered = -1;\n\t\tWindowsActiveCount = 0;\n\t\tCurrentWindow = NULL;\n\t\tNavWindow = NULL;\n\t\tHoveredWindow = NULL;\n\t\tHoveredRootWindow = NULL;\n\t\tHoveredId = 0;\n\t\tHoveredIdAllowOverlap = false;\n\t\tHoveredIdPreviousFrame = 0;\n\t\tHoveredIdTimer = 0.0f;\n\t\tActiveId = 0;\n\t\tActiveIdPreviousFrame = 0;\n\t\tActiveIdTimer = 0.0f;\n\t\tActiveIdIsAlive = false;\n\t\tActiveIdIsJustActivated = false;\n\t\tActiveIdAllowOverlap = false;\n\t\tActiveIdClickOffset = ImVec2(-1, -1);\n\t\tActiveIdWindow = NULL;\n\t\tMovingWindow = NULL;\n\t\tMovingWindowMoveId = 0;\n\t\tNextTreeNodeOpenVal = false;\n\t\tNextTreeNodeOpenCond = 0;\n\t\tLastActiveId = 0;\n\t\tLastActiveIdTimer = 0.0f;\n\n\t\tModalWindowDarkeningRatio = 0.0f;\n\t\tOverlayDrawList._Data = &DrawListSharedData;\n\t\tOverlayDrawList._OwnerName = \"##Overlay\"; // Give it a name for debugging\n\t\tMouseCursor = ImGuiMouseCursor_Arrow;\n\t\tmemset(MouseCursorData, 0, sizeof(MouseCursorData));\n\n\t\tDragDropActive = false;\n\t\tDragDropSourceFlags = 0;\n\t\tDragDropMouseButton = -1;\n\t\tDragDropTargetId = 0;\n\t\tDragDropAcceptIdCurrRectSurface = 0.0f;\n\t\tDragDropAcceptIdPrev = DragDropAcceptIdCurr = 0;\n\t\tDragDropAcceptFrameCount = -1;\n\t\tmemset(DragDropPayloadBufLocal, 0, sizeof(DragDropPayloadBufLocal));\n\n\t\tScalarAsInputTextId = 0;\n\t\tColorEditOptions = ImGuiColorEditFlags__OptionsDefault;\n\t\tDragCurrentValue = 0.0f;\n\t\tDragLastMouseDelta = ImVec2(0.0f, 0.0f);\n\t\tDragSpeedDefaultRatio = 1.0f / 100.0f;\n\t\tDragSpeedScaleSlow = 1.0f / 100.0f;\n\t\tDragSpeedScaleFast = 10.0f;\n\t\tScrollbarClickDeltaToGrabCenter = ImVec2(0.0f, 0.0f);\n\t\tTooltipOverrideCount = 0;\n\t\tOsImePosRequest = OsImePosSet = ImVec2(-1.0f, -1.0f);\n\n\t\tSettingsDirtyTimer = 0.0f;\n\n\t\tLogEnabled = false;\n\t\tLogFile = NULL;\n\t\tLogClipboard = NULL;\n\t\tLogStartDepth = 0;\n\t\tLogAutoExpandMaxDepth = 2;\n\n\t\tmemset(FramerateSecPerFrame, 0, sizeof(FramerateSecPerFrame));\n\t\tFramerateSecPerFrameIdx = 0;\n\t\tFramerateSecPerFrameAccum = 0.0f;\n\t\tWantCaptureMouseNextFrame = WantCaptureKeyboardNextFrame = WantTextInputNextFrame = -1;\n\t\tmemset(TempBuffer, 0, sizeof(TempBuffer));\n\t}\n};\n\n// Transient per-window flags, reset at the beginning of the frame. For child window, inherited from parent on first Begin().\nenum ImGuiItemFlags_\n{\n\tImGuiItemFlags_AllowKeyboardFocus = 1 << 0,  // true\n\tImGuiItemFlags_ButtonRepeat = 1 << 1,  // false    // Button() will return true multiple times based on io.KeyRepeatDelay and io.KeyRepeatRate settings.\n\tImGuiItemFlags_Disabled = 1 << 2,  // false    // FIXME-WIP: Disable interactions but doesn't affect visuals. Should be: grey out and disable interactions with widgets that affect data + view widgets (WIP) \n\t\t\t\t\t\t\t\t\t   //ImGuiItemFlags_NoNav                      = 1 << 3,  // false\n\t\t\t\t\t\t\t\t\t   //ImGuiItemFlags_NoNavDefaultFocus          = 1 << 4,  // false\n\t\t\t\t\t\t\t\t\t   ImGuiItemFlags_SelectableDontClosePopup = 1 << 5,  // false    // MenuItem/Selectable() automatically closes current Popup window\n\t\t\t\t\t\t\t\t\t   ImGuiItemFlags_Default_ = ImGuiItemFlags_AllowKeyboardFocus\n};\n\n// Transient per-window data, reset at the beginning of the frame\n// FIXME: That's theory, in practice the delimitation between ImGuiWindow and ImGuiDrawContext is quite tenuous and could be reconsidered.\nstruct IMGUI_API ImGuiDrawContext\n{\n\tImVec2                  CursorPos;\n\tImVec2                  CursorPosPrevLine;\n\tImVec2                  CursorStartPos;\n\tImVec2                  CursorMaxPos;           // Used to implicitly calculate the size of our contents, always growing during the frame. Turned into window->SizeContents at the beginning of next frame\n\tfloat                   CurrentLineHeight;\n\tfloat                   CurrentLineTextBaseOffset;\n\tfloat                   PrevLineHeight;\n\tfloat                   PrevLineTextBaseOffset;\n\tfloat                   LogLinePosY;\n\tint                     TreeDepth;\n\tImGuiID                 LastItemId;\n\tImRect                  LastItemRect;\n\tbool                    LastItemRectHoveredRect;\n\tbool                    MenuBarAppending;\n\tfloat                   MenuBarOffsetX;\n\tImVector<ImGuiWindow*>  ChildWindows;\n\tImGuiStorage*           StateStorage;\n\tImGuiLayoutType         LayoutType;\n\n\t// We store the current settings outside of the vectors to increase memory locality (reduce cache misses). The vectors are rarely modified. Also it allows us to not heap allocate for short-lived windows which are not using those settings.\n\tImGuiItemFlags          ItemFlags;              // == ItemFlagsStack.back() [empty == ImGuiItemFlags_Default]\n\tfloat                   ItemWidth;              // == ItemWidthStack.back(). 0.0: default, >0.0: width in pixels, <0.0: align xx pixels to the right of window\n\tfloat                   TextWrapPos;            // == TextWrapPosStack.back() [empty == -1.0f]\n\tImVector<ImGuiItemFlags>ItemFlagsStack;\n\tImVector<float>         ItemWidthStack;\n\tImVector<float>         TextWrapPosStack;\n\tImVector<ImGuiGroupData>GroupStack;\n\tint                     StackSizesBackup[6];    // Store size of various stacks for asserting\n\n\tfloat                   IndentX;                // Indentation / start position from left of window (increased by TreePush/TreePop, etc.)\n\tfloat                   GroupOffsetX;\n\tfloat                   ColumnsOffsetX;         // Offset to the current column (if ColumnsCurrent > 0). FIXME: This and the above should be a stack to allow use cases like Tree->Column->Tree. Need revamp columns API.\n\tImGuiColumnsSet*        ColumnsSet;             // Current columns set\n\n\tImGuiDrawContext()\n\t{\n\t\tCursorPos = CursorPosPrevLine = CursorStartPos = CursorMaxPos = ImVec2(0.0f, 0.0f);\n\t\tCurrentLineHeight = PrevLineHeight = 0.0f;\n\t\tCurrentLineTextBaseOffset = PrevLineTextBaseOffset = 0.0f;\n\t\tLogLinePosY = -1.0f;\n\t\tTreeDepth = 0;\n\t\tLastItemId = 0;\n\t\tLastItemRect = ImRect();\n\t\tLastItemRectHoveredRect = false;\n\t\tMenuBarAppending = false;\n\t\tMenuBarOffsetX = 0.0f;\n\t\tStateStorage = NULL;\n\t\tLayoutType = ImGuiLayoutType_Vertical;\n\t\tItemWidth = 0.0f;\n\t\tItemFlags = ImGuiItemFlags_Default_;\n\t\tTextWrapPos = -1.0f;\n\t\tmemset(StackSizesBackup, 0, sizeof(StackSizesBackup));\n\n\t\tIndentX = 0.0f;\n\t\tGroupOffsetX = 0.0f;\n\t\tColumnsOffsetX = 0.0f;\n\t\tColumnsSet = NULL;\n\t}\n};\n\n// Windows data\nstruct IMGUI_API ImGuiWindow\n{\n\tchar*                   Name;\n\tImGuiID                 ID;                                 // == ImHash(Name)\n\tImGuiWindowFlags        Flags;                              // See enum ImGuiWindowFlags_\n\tImVec2                  PosFloat;\n\tImVec2                  Pos;                                // Position rounded-up to nearest pixel\n\tImVec2                  Size;                               // Current size (==SizeFull or collapsed title bar size)\n\tImVec2                  SizeFull;                           // Size when non collapsed\n\tImVec2                  SizeFullAtLastBegin;                // Copy of SizeFull at the end of Begin. This is the reference value we'll use on the next frame to decide if we need scrollbars.\n\tImVec2                  SizeContents;                       // Size of contents (== extents reach of the drawing cursor) from previous frame. Include decoration, window title, border, menu, etc.\n\tImVec2                  SizeContentsExplicit;               // Size of contents explicitly set by the user via SetNextWindowContentSize()\n\tImRect                  ContentsRegionRect;                 // Maximum visible content position in window coordinates. ~~ (SizeContentsExplicit ? SizeContentsExplicit : Size - ScrollbarSizes) - CursorStartPos, per axis\n\tImVec2                  WindowPadding;                      // Window padding at the time of begin.\n\tfloat                   WindowRounding;                     // Window rounding at the time of begin.\n\tfloat                   WindowBorderSize;                   // Window border size at the time of begin.\n\tImGuiID                 MoveId;                             // == window->GetID(\"#MOVE\")\n\tImVec2                  Scroll;\n\tImVec2                  ScrollTarget;                       // target scroll position. stored as cursor position with scrolling canceled out, so the highest point is always 0.0f. (FLT_MAX for no change)\n\tImVec2                  ScrollTargetCenterRatio;            // 0.0f = scroll so that target position is at top, 0.5f = scroll so that target position is centered\n\tbool                    ScrollbarX, ScrollbarY;\n\tImVec2                  ScrollbarSizes;\n\tbool                    Active;                             // Set to true on Begin(), unless Collapsed\n\tbool                    WasActive;\n\tbool                    WriteAccessed;                      // Set to true when any widget access the current window\n\tbool                    Collapsed;                          // Set when collapsing window to become only title-bar\n\tbool                    SkipItems;                          // Set when items can safely be all clipped (e.g. window not visible or collapsed)\n\tbool                    Appearing;                          // Set during the frame where the window is appearing (or re-appearing)\n\tbool                    CloseButton;                        // Set when the window has a close button (p_open != NULL)\n\tint                     BeginOrderWithinParent;             // Order within immediate parent window, if we are a child window. Otherwise 0.\n\tint                     BeginOrderWithinContext;            // Order within entire imgui context. This is mostly used for debugging submission order related issues.\n\tint                     BeginCount;                         // Number of Begin() during the current frame (generally 0 or 1, 1+ if appending via multiple Begin/End pairs)\n\tImGuiID                 PopupId;                            // ID in the popup stack when this window is used as a popup/menu (because we use generic Name/ID for recycling)\n\tint                     AutoFitFramesX, AutoFitFramesY;\n\tbool                    AutoFitOnlyGrows;\n\tint                     AutoFitChildAxises;\n\tImGuiDir                AutoPosLastDirection;\n\tint                     HiddenFrames;\n\tImGuiCond               SetWindowPosAllowFlags;             // store condition flags for next SetWindowPos() call.\n\tImGuiCond               SetWindowSizeAllowFlags;            // store condition flags for next SetWindowSize() call.\n\tImGuiCond               SetWindowCollapsedAllowFlags;       // store condition flags for next SetWindowCollapsed() call.\n\tImVec2                  SetWindowPosVal;                    // store window position when using a non-zero Pivot (position set needs to be processed when we know the window size)\n\tImVec2                  SetWindowPosPivot;                  // store window pivot for positioning. ImVec2(0,0) when positioning from top-left corner; ImVec2(0.5f,0.5f) for centering; ImVec2(1,1) for bottom right.\n\n\tImGuiDrawContext        DC;                                 // Temporary per-window data, reset at the beginning of the frame\n\tImVector<ImGuiID>       IDStack;                            // ID stack. ID are hashes seeded with the value at the top of the stack\n\tImRect                  ClipRect;                           // = DrawList->clip_rect_stack.back(). Scissoring / clipping rectangle. x1, y1, x2, y2.\n\tImRect                  WindowRectClipped;                  // = WindowRect just after setup in Begin(). == window->Rect() for root window.\n\tImRect                  InnerRect;\n\tint                     LastFrameActive;\n\tfloat                   ItemWidthDefault;\n\tImGuiMenuColumns        MenuColumns;                        // Simplified columns storage for menu items\n\tImGuiStorage            StateStorage;\n\tImVector<ImGuiColumnsSet> ColumnsStorage;\n\tfloat                   FontWindowScale;                    // Scale multiplier per-window\n\tImDrawList*             DrawList;\n\tImGuiWindow*            ParentWindow;                       // If we are a child _or_ popup window, this is pointing to our parent. Otherwise NULL.\n\tImGuiWindow*            RootWindow;                         // Generally point to ourself. If we are a child window, this is pointing to the first non-child parent window.\n\tImGuiWindow*            RootNonPopupWindow;                 // Generally point to ourself. Used to display TitleBgActive color and for selecting which window to use for NavWindowing\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Navigation / Focus\n\tint                     FocusIdxAllCounter;                 // Start at -1 and increase as assigned via FocusItemRegister()\n\tint                     FocusIdxTabCounter;                 // (same, but only count widgets which you can Tab through)\n\tint                     FocusIdxAllRequestCurrent;          // Item being requested for focus\n\tint                     FocusIdxTabRequestCurrent;          // Tab-able item being requested for focus\n\tint                     FocusIdxAllRequestNext;             // Item being requested for focus, for next update (relies on layout to be stable between the frame pressing TAB and the next frame)\n\tint                     FocusIdxTabRequestNext;             // \"\n\npublic:\n\tImGuiWindow(ImGuiContext* context, const char* name);\n\t~ImGuiWindow();\n\n\tImGuiID     GetID(const char* str, const char* str_end = NULL);\n\tImGuiID     GetID(const void* ptr);\n\tImGuiID     GetIDNoKeepAlive(const char* str, const char* str_end = NULL);\n\tImGuiID     GetIDFromRectangle(const ImRect& r_abs);\n\n\t// We don't use g.FontSize because the window may be != g.CurrentWidow.\n\tImRect      Rect() const { return ImRect(Pos.x, Pos.y, Pos.x + Size.x, Pos.y + Size.y); }\n\tfloat       CalcFontSize() const { return GImGui->FontBaseSize * FontWindowScale; }\n\tfloat       TitleBarHeight() const { return (Flags & ImGuiWindowFlags_NoTitleBar) ? 0.0f : CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f; }\n\tImRect      TitleBarRect() const { return ImRect(Pos, ImVec2(Pos.x + SizeFull.x, Pos.y + TitleBarHeight())); }\n\tfloat       MenuBarHeight() const { return (Flags & ImGuiWindowFlags_MenuBar) ? CalcFontSize() + GImGui->Style.FramePadding.y * 2.0f : 0.0f; }\n\tImRect      MenuBarRect() const { float y1 = Pos.y + TitleBarHeight(); return ImRect(Pos.x, y1, Pos.x + SizeFull.x, y1 + MenuBarHeight()); }\n};\n\n// Backup and restore just enough data to be able to use IsItemHovered() on item A after another B in the same window has overwritten the data.  \nstruct ImGuiItemHoveredDataBackup\n{\n\tImGuiID     LastItemId;\n\tImRect      LastItemRect;\n\tbool        LastItemRectHoveredRect;\n\n\tImGuiItemHoveredDataBackup() { Backup(); }\n\tvoid Backup() { ImGuiWindow* window = GImGui->CurrentWindow; LastItemId = window->DC.LastItemId; LastItemRect = window->DC.LastItemRect; LastItemRectHoveredRect = window->DC.LastItemRectHoveredRect; }\n\tvoid Restore() const { ImGuiWindow* window = GImGui->CurrentWindow; window->DC.LastItemId = LastItemId; window->DC.LastItemRect = LastItemRect; window->DC.LastItemRectHoveredRect = LastItemRectHoveredRect; }\n};\n\n//-----------------------------------------------------------------------------\n// Internal API\n// No guarantee of forward compatibility here.\n//-----------------------------------------------------------------------------\n\nnamespace ImGui\n{\n\t// We should always have a CurrentWindow in the stack (there is an implicit \"Debug\" window)\n\t// If this ever crash because g.CurrentWindow is NULL it means that either\n\t// - ImGui::NewFrame() has never been called, which is illegal.\n\t// - You are calling ImGui functions after ImGui::Render() and before the next ImGui::NewFrame(), which is also illegal.\n\tinline    ImGuiWindow*  GetCurrentWindowRead() { ImGuiContext& g = *GImGui; return g.CurrentWindow; }\n\tinline    ImGuiWindow*  GetCurrentWindow() { ImGuiContext& g = *GImGui; g.CurrentWindow->WriteAccessed = true; return g.CurrentWindow; }\n\tIMGUI_API ImGuiWindow*  FindWindowByName(const char* name);\n\tIMGUI_API void          FocusWindow(ImGuiWindow* window);\n\tIMGUI_API void          BringWindowToFront(ImGuiWindow* window);\n\tIMGUI_API void          BringWindowToBack(ImGuiWindow* window);\n\tIMGUI_API bool          IsWindowChildOf(ImGuiWindow* window, ImGuiWindow* potential_parent);\n\n\tIMGUI_API void          Initialize();\n\n\tIMGUI_API void                  MarkIniSettingsDirty();\n\tIMGUI_API ImGuiSettingsHandler* FindSettingsHandler(const char* type_name);\n\tIMGUI_API ImGuiWindowSettings*  FindWindowSettings(ImGuiID id);\n\n\tIMGUI_API void          SetActiveID(ImGuiID id, ImGuiWindow* window);\n\tIMGUI_API void          ClearActiveID();\n\tIMGUI_API void          SetHoveredID(ImGuiID id);\n\tIMGUI_API ImGuiID       GetHoveredID();\n\tIMGUI_API void          KeepAliveID(ImGuiID id);\n\n\tIMGUI_API void          ItemSize(const ImVec2& size, float text_offset_y = 0.0f);\n\tIMGUI_API void          ItemSize(const ImRect& bb, float text_offset_y = 0.0f);\n\tIMGUI_API bool          ItemAdd(const ImRect& bb, ImGuiID id);\n\tIMGUI_API bool          ItemHoverable(const ImRect& bb, ImGuiID id);\n\tIMGUI_API bool          IsClippedEx(const ImRect& bb, ImGuiID id, bool clip_even_when_logged);\n\tIMGUI_API bool          FocusableItemRegister(ImGuiWindow* window, ImGuiID id, bool tab_stop = true);      // Return true if focus is requested\n\tIMGUI_API void          FocusableItemUnregister(ImGuiWindow* window);\n\tIMGUI_API ImVec2        CalcItemSize(ImVec2 size, float default_x, float default_y);\n\tIMGUI_API float         CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x);\n\tIMGUI_API void          PushMultiItemsWidths(int components, float width_full = 0.0f);\n\tIMGUI_API void          PushItemFlag(ImGuiItemFlags option, bool enabled);\n\tIMGUI_API void          PopItemFlag();\n\n\tIMGUI_API void          OpenPopupEx(ImGuiID id);\n\tIMGUI_API void          ClosePopup(ImGuiID id);\n\tIMGUI_API bool          IsPopupOpen(ImGuiID id);\n\tIMGUI_API bool          BeginPopupEx(ImGuiID id, ImGuiWindowFlags extra_flags);\n\tIMGUI_API void          BeginTooltipEx(ImGuiWindowFlags extra_flags, bool override_previous_tooltip = true);\n\n\tIMGUI_API int           CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);\n\n\tIMGUI_API void          Scrollbar(ImGuiLayoutType direction);\n\tIMGUI_API void          VerticalSeparator();        // Vertical separator, for menu bars (use current line height). not exposed because it is misleading what it doesn't have an effect on regular layout.\n\tIMGUI_API bool          SplitterBehavior(ImGuiID id, const ImRect& bb, ImGuiAxis axis, float* size1, float* size2, float min_size1, float min_size2, float hover_extend = 0.0f);\n\n\tIMGUI_API bool          BeginDragDropTargetCustom(const ImRect& bb, ImGuiID id);\n\tIMGUI_API void          ClearDragDrop();\n\tIMGUI_API bool          IsDragDropPayloadBeingAccepted();\n\n\t// FIXME-WIP: New Columns API\n\tIMGUI_API void          BeginColumns(const char* str_id, int count, ImGuiColumnsFlags flags = 0); // setup number of columns. use an identifier to distinguish multiple column sets. close with EndColumns().\n\tIMGUI_API void          EndColumns();                                                             // close columns\n\tIMGUI_API void          PushColumnClipRect(int column_index = -1);\n\n\t// NB: All position are in absolute pixels coordinates (never using window coordinates internally)\n\t// AVOID USING OUTSIDE OF IMGUI.CPP! NOT FOR PUBLIC CONSUMPTION. THOSE FUNCTIONS ARE A MESS. THEIR SIGNATURE AND BEHAVIOR WILL CHANGE, THEY NEED TO BE REFACTORED INTO SOMETHING DECENT.\n\tIMGUI_API void          RenderText(ImVec2 pos, const char* text, const char* text_end = NULL, bool hide_text_after_hash = true);\n\tIMGUI_API void          RenderTextWrapped(ImVec2 pos, const char* text, const char* text_end, float wrap_width);\n\tIMGUI_API void          RenderTextClipped(const ImVec2& pos_min, const ImVec2& pos_max, const char* text, const char* text_end, const ImVec2* text_size_if_known, const ImVec2& align = ImVec2(0, 0), const ImRect* clip_rect = NULL);\n\tIMGUI_API void          RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border = true, float rounding = 0.0f);\n\tIMGUI_API void          RenderFrameBorder(ImVec2 p_min, ImVec2 p_max, float rounding = 0.0f);\n\tIMGUI_API void          RenderColorRectWithAlphaCheckerboard(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, float grid_step, ImVec2 grid_off, float rounding = 0.0f, int rounding_corners_flags = ~0);\n\tIMGUI_API void          RenderTriangle(ImVec2 pos, ImGuiDir dir, float scale = 1.0f);\n\tIMGUI_API void          RenderBullet(ImVec2 pos);\n\tIMGUI_API void          RenderCheckMark(ImVec2 pos, ImU32 col, float sz);\n\tIMGUI_API void          RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);\n\tIMGUI_API const char*   FindRenderedTextEnd(const char* text, const char* text_end = NULL); // Find the optional ## from which we stop displaying text.\n\n\tIMGUI_API bool          ButtonBehavior(const ImRect& bb, ImGuiID id, bool* out_hovered, bool* out_held, ImGuiButtonFlags flags = 0);\n\tIMGUI_API bool          ButtonEx(const char* label, const ImVec2& size_arg = ImVec2(0, 0), ImGuiButtonFlags flags = 0);\n\tIMGUI_API bool          CloseButton(ImGuiID id, const ImVec2& pos, float radius);\n\tIMGUI_API bool          ArrowButton(ImGuiID id, ImGuiDir dir, ImVec2 padding, ImGuiButtonFlags flags = 0);\n\n\tIMGUI_API bool          SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_min, float v_max, float power, int decimal_precision, ImGuiSliderFlags flags = 0);\n\tIMGUI_API bool          SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power);\n\tIMGUI_API bool          SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format);\n\n\tIMGUI_API bool          DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power);\n\tIMGUI_API bool          DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power);\n\tIMGUI_API bool          DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format);\n\n\tIMGUI_API bool          InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);\n\tIMGUI_API bool          InputFloatN(const char* label, float* v, int components, int decimal_precision, ImGuiInputTextFlags extra_flags);\n\tIMGUI_API bool          InputIntN(const char* label, int* v, int components, ImGuiInputTextFlags extra_flags);\n\tIMGUI_API bool          InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags);\n\tIMGUI_API bool          InputScalarAsWidgetReplacement(const ImRect& aabb, const char* label, ImGuiDataType data_type, void* data_ptr, ImGuiID id, int decimal_precision);\n\n\tIMGUI_API void          ColorTooltip(const char* text, const float* col, ImGuiColorEditFlags flags);\n\tIMGUI_API void          ColorEditOptionsPopup(const float* col, ImGuiColorEditFlags flags);\n\n\tIMGUI_API bool          TreeNodeBehavior(ImGuiID id, ImGuiTreeNodeFlags flags, const char* label, const char* label_end = NULL);\n\tIMGUI_API bool          TreeNodeBehaviorIsOpen(ImGuiID id, ImGuiTreeNodeFlags flags = 0);                     // Consume previous SetNextTreeNodeOpened() data, if any. May return true when logging\n\tIMGUI_API void          TreePushRawID(ImGuiID id);\n\n\tIMGUI_API void          PlotEx(ImGuiPlotType plot_type, const char* label, float(*values_getter)(void* data, int idx), void* data, int values_count, int values_offset, const char* overlay_text, float scale_min, float scale_max, ImVec2 graph_size);\n\n\tIMGUI_API int           ParseFormatPrecision(const char* fmt, int default_value);\n\tIMGUI_API float         RoundScalar(float value, int decimal_precision);\n\n\t// Shade functions\n\tIMGUI_API void          ShadeVertsLinearColorGradientKeepAlpha(ImDrawVert* vert_start, ImDrawVert* vert_end, ImVec2 gradient_p0, ImVec2 gradient_p1, ImU32 col0, ImU32 col1);\n\tIMGUI_API void          ShadeVertsLinearAlphaGradientForLeftToRightText(ImDrawVert* vert_start, ImDrawVert* vert_end, float gradient_p0_x, float gradient_p1_x);\n\tIMGUI_API void          ShadeVertsLinearUV(ImDrawVert* vert_start, ImDrawVert* vert_end, const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, bool clamp);\n\n} // namespace ImGui\n\n  // ImFontAtlas internals\nIMGUI_API bool              ImFontAtlasBuildWithStbTruetype(ImFontAtlas* atlas);\nIMGUI_API void              ImFontAtlasBuildRegisterDefaultCustomRects(ImFontAtlas* atlas);\nIMGUI_API void              ImFontAtlasBuildSetupFont(ImFontAtlas* atlas, ImFont* font, ImFontConfig* font_config, float ascent, float descent);\nIMGUI_API void              ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* spc);\nIMGUI_API void              ImFontAtlasBuildFinish(ImFontAtlas* atlas);\nIMGUI_API void              ImFontAtlasBuildMultiplyCalcLookupTable(unsigned char out_table[256], float in_multiply_factor);\nIMGUI_API void              ImFontAtlasBuildMultiplyRectAlpha8(const unsigned char table[256], unsigned char* pixels, int x, int y, int w, int h, int stride);\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n#ifdef _MSC_VER\n#pragma warning (pop)\n#endif\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/imgui_xorstr.h",
    "content": "#pragma once\n/*\n * Copyright 2017 - 2018 Justas Masiulis\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#ifndef JM_XORSTR_HPP\n#define JM_XORSTR_HPP\n\n#include <immintrin.h>\n#include <cstdint>\n#include <cstddef>\n#include <utility>\n\n#define JM_XORSTR_DISABLE_AVX_INTRINSICS\n\n#define xorstr_(str)                                             \\\n    ::jm::make_xorstr(                                           \\\n        []() { return str; },                                    \\\n        std::make_index_sequence<sizeof(str) / sizeof(*str)>{},  \\\n        std::make_index_sequence<::jm::detail::_buffer_size<sizeof(str)>()>{})\n#define xorstr(str) xorstr_(str).crypt_get()\n\n#ifdef _MSC_VER\n#define XORSTR_FORCEINLINE __forceinline\n#else\n#define XORSTR_FORCEINLINE __attribute__((always_inline))\n#endif\n\n // you can define this macro to get possibly faster code on gcc/clang\n // at the expense of constants being put into data section.\n#if !defined(XORSTR_ALLOW_DATA)\n// MSVC - no volatile\n// GCC and clang - volatile everywhere\n#if defined(__clang__) || defined(__GNUC__)\n#define XORSTR_VOLATILE volatile\n#endif\n\n#endif\n#ifndef XORSTR_VOLATILE\n#define XORSTR_VOLATILE\n#endif\n\nnamespace jm {\n\n    namespace detail {\n\n        template<std::size_t S>\n        struct unsigned_;\n\n        template<>\n        struct unsigned_<1> {\n            using type = std::uint8_t;\n        };\n        template<>\n        struct unsigned_<2> {\n            using type = std::uint16_t;\n        };\n        template<>\n        struct unsigned_<4> {\n            using type = std::uint32_t;\n        };\n\n        template<auto C, auto...>\n        struct pack_value_type {\n            using type = decltype(C);\n        };\n\n        template<std::size_t Size>\n        constexpr std::size_t _buffer_size() {\n            return ((Size / 16) + (Size % 16 != 0)) * 2;\n        }\n\n        template<auto... Cs>\n        struct tstring_ {\n            using value_type = typename pack_value_type<Cs...>::type;\n            constexpr static std::size_t size = sizeof...(Cs);\n            constexpr static value_type  str[size] = { Cs... };\n\n            constexpr static std::size_t buffer_size = _buffer_size<sizeof(str)>();\n            constexpr static std::size_t buffer_align =\n#ifndef JM_XORSTR_DISABLE_AVX_INTRINSICS\n            ((sizeof(str) > 16) ? 32 : 16);\n#else\n                16;\n#endif\n        };\n\n        template<std::size_t I, std::uint64_t K>\n        struct _ki {\n            constexpr static std::size_t   idx = I;\n            constexpr static std::uint64_t key = K;\n        };\n\n        template<std::uint32_t Seed>\n        constexpr std::uint32_t key4() noexcept {\n            std::uint32_t value = Seed;\n            for (char c : __TIME__)\n                value = static_cast<std::uint32_t>((value ^ c) * 16777619ull);\n            return value;\n        }\n\n        template<std::size_t S>\n        constexpr std::uint64_t key8() {\n            constexpr auto first_part = key4<2166136261 + S>();\n            constexpr auto second_part = key4<first_part>();\n            return (static_cast<std::uint64_t>(first_part) << 32) | second_part;\n        }\n\n        // clang and gcc try really hard to place the constants in data\n        // sections. to counter that there was a need to create an intermediate\n        // constexpr string and then copy it into a non constexpr container with\n        // volatile storage so that the constants would be placed directly into\n        // code.\n        template<class T, std::uint64_t... Keys>\n        struct string_storage {\n            std::uint64_t storage[T::buffer_size];\n\n            XORSTR_FORCEINLINE constexpr string_storage() noexcept : storage{ Keys... } {\n                using cast_type =\n                    typename unsigned_<sizeof(typename T::value_type)>::type;\n                constexpr auto value_size = sizeof(typename T::value_type);\n                // puts the string into 64 bit integer blocks in a constexpr\n                // fashion\n                for (std::size_t i = 0; i < T::size; ++i)\n                    storage[i / (8 / value_size)] ^=\n                    (std::uint64_t{ static_cast<cast_type>(T::str[i]) }\n                << ((i % (8 / value_size)) * 8 * value_size));\n            }\n        };\n\n    } // namespace detail\n\n    template<class T, class... Keys>\n    class xor_string {\n        alignas(T::buffer_align) std::uint64_t _storage[T::buffer_size];\n\n        // _single functions needed because MSVC crashes without them\n        XORSTR_FORCEINLINE void _crypt_256_single(const std::uint64_t* keys,\n            std::uint64_t* storage) noexcept\n\n        {\n            _mm256_store_si256(\n                reinterpret_cast<__m256i*>(storage),\n                _mm256_xor_si256(\n                    _mm256_load_si256(reinterpret_cast<const __m256i*>(storage)),\n                    _mm256_load_si256(reinterpret_cast<const __m256i*>(keys))));\n        }\n\n        template<std::size_t... Idxs>\n        XORSTR_FORCEINLINE void _crypt_256(const std::uint64_t* keys,\n            std::index_sequence<Idxs...>) noexcept {\n            (_crypt_256_single(keys + Idxs * 4, _storage + Idxs * 4), ...);\n        }\n\n        XORSTR_FORCEINLINE void _crypt_128_single(const std::uint64_t* keys,\n            std::uint64_t* storage) noexcept {\n            _mm_store_si128(\n                reinterpret_cast<__m128i*>(storage),\n                _mm_xor_si128(_mm_load_si128(reinterpret_cast<const __m128i*>(storage)),\n                    _mm_load_si128(reinterpret_cast<const __m128i*>(keys))));\n        }\n\n        template<std::size_t... Idxs>\n        XORSTR_FORCEINLINE void _crypt_128(const std::uint64_t* keys,\n            std::index_sequence<Idxs...>) noexcept {\n            (_crypt_128_single(keys + Idxs * 2, _storage + Idxs * 2), ...);\n        }\n\n        // loop generates vectorized code which places constants in data dir\n        XORSTR_FORCEINLINE constexpr void _copy() noexcept {\n            constexpr detail::string_storage<T, Keys::key...> storage;\n            static_cast<void>(std::initializer_list<std::uint64_t>{\n                (const_cast<XORSTR_VOLATILE std::uint64_t*>(_storage))[Keys::idx] =\n                    storage.storage[Keys::idx]... });\n        }\n\n    public:\n        using value_type = typename T::value_type;\n        using size_type = std::size_t;\n        using pointer = value_type*;\n        using const_pointer = const pointer;\n\n        XORSTR_FORCEINLINE xor_string() noexcept { _copy(); }\n\n        XORSTR_FORCEINLINE constexpr size_type size() const noexcept {\n            return T::size - 1;\n        }\n\n        XORSTR_FORCEINLINE void crypt() noexcept {\n            alignas(T::buffer_align) std::uint64_t keys[T::buffer_size];\n            static_cast<void>(std::initializer_list<std::uint64_t>{\n                (const_cast<XORSTR_VOLATILE std::uint64_t*>(keys))[Keys::idx] =\n                    Keys::key... });\n\n            _copy();\n\n#ifndef JM_XORSTR_DISABLE_AVX_INTRINSICS\n            _crypt_256(keys, std::make_index_sequence<T::buffer_size / 4>{});\n            if constexpr (T::buffer_size % 4 != 0)\n                _crypt_128(keys, std::index_sequence<T::buffer_size / 2 - 1>{});\n#else\n            _crypt_128(keys, std::make_index_sequence<T::buffer_size / 2>{});\n#endif\n        }\n\n        XORSTR_FORCEINLINE const_pointer get() const noexcept {\n            return reinterpret_cast<const_pointer>(_storage);\n        }\n\n        XORSTR_FORCEINLINE const_pointer crypt_get() noexcept {\n            crypt();\n            return reinterpret_cast<const_pointer>(_storage);\n        }\n    };\n\n    template<class Tstr, std::size_t... StringIndices, std::size_t... KeyIndices>\n    XORSTR_FORCEINLINE constexpr auto\n        make_xorstr(Tstr str_lambda,\n            std::index_sequence<StringIndices...>,\n            std::index_sequence<KeyIndices...>) noexcept {\n        return xor_string<detail::tstring_<str_lambda()[StringIndices]...>,\n            detail::_ki<KeyIndices, detail::key8<KeyIndices>()>...>{};\n    }\n\n} // namespace jm\n\n#endif // include guard\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/stb_rect_pack.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n// stb_rect_pack.h - v0.10 - public domain - rectangle packing\n// Sean Barrett 2014\n//\n// Useful for e.g. packing rectangular textures into an atlas.\n// Does not do rotation.\n//\n// Not necessarily the awesomest packing method, but better than\n// the totally naive one in stb_truetype (which is primarily what\n// this is meant to replace).\n//\n// Has only had a few tests run, may have issues.\n//\n// More docs to come.\n//\n// No memory allocations; uses qsort() and assert() from stdlib.\n// Can override those by defining STBRP_SORT and STBRP_ASSERT.\n//\n// This library currently uses the Skyline Bottom-Left algorithm.\n//\n// Please note: better rectangle packers are welcome! Please\n// implement them to the same API, but with a different init\n// function.\n//\n// Credits\n//\n//  Library\n//    Sean Barrett\n//  Minor features\n//    Martins Mozeiko\n//  Bugfixes / warning fixes\n//    Jeremy Jaussaud\n//\n// Version history:\n//\n//     0.10  (2016-10-25)  remove cast-away-const to avoid warnings\n//     0.09  (2016-08-27)  fix compiler warnings\n//     0.08  (2015-09-13)  really fix bug with empty rects (w=0 or h=0)\n//     0.07  (2015-09-13)  fix bug with empty rects (w=0 or h=0)\n//     0.06  (2015-04-15)  added STBRP_SORT to allow replacing qsort\n//     0.05:  added STBRP_ASSERT to allow replacing assert\n//     0.04:  fixed minor bug in STBRP_LARGE_RECTS support\n//     0.01:  initial release\n//\n// LICENSE\n//\n//   This software is dual-licensed to the public domain and under the following\n//   license: you are granted a perpetual, irrevocable license to copy, modify,\n//   publish, and distribute this file as you see fit.\n\n//////////////////////////////////////////////////////////////////////////////\n//\n//       INCLUDE SECTION\n//\n\n#ifndef STB_INCLUDE_STB_RECT_PACK_H\n#define STB_INCLUDE_STB_RECT_PACK_H\n\n#define STB_RECT_PACK_VERSION  1\n\n#ifdef STBRP_STATIC\n#define STBRP_DEF static\n#else\n#define STBRP_DEF extern\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\ttypedef struct stbrp_context stbrp_context;\n\ttypedef struct stbrp_node    stbrp_node;\n\ttypedef struct stbrp_rect    stbrp_rect;\n\n#ifdef STBRP_LARGE_RECTS\n\ttypedef int            stbrp_coord;\n#else\n\ttypedef unsigned short stbrp_coord;\n#endif\n\n\tSTBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects);\n\t// Assign packed locations to rectangles. The rectangles are of type\n\t// 'stbrp_rect' defined below, stored in the array 'rects', and there\n\t// are 'num_rects' many of them.\n\t//\n\t// Rectangles which are successfully packed have the 'was_packed' flag\n\t// set to a non-zero value and 'x' and 'y' store the minimum location\n\t// on each axis (i.e. bottom-left in cartesian coordinates, top-left\n\t// if you imagine y increasing downwards). Rectangles which do not fit\n\t// have the 'was_packed' flag set to 0.\n\t//\n\t// You should not try to access the 'rects' array from another thread\n\t// while this function is running, as the function temporarily reorders\n\t// the array while it executes.\n\t//\n\t// To pack into another rectangle, you need to call stbrp_init_target\n\t// again. To continue packing into the same rectangle, you can call\n\t// this function again. Calling this multiple times with multiple rect\n\t// arrays will probably produce worse packing results than calling it\n\t// a single time with the full rectangle array, but the option is\n\t// available.\n\n\tstruct stbrp_rect\n\t{\n\t\t// reserved for your use:\n\t\tint            id;\n\n\t\t// input:\n\t\tstbrp_coord    w, h;\n\n\t\t// output:\n\t\tstbrp_coord    x, y;\n\t\tint            was_packed;  // non-zero if valid packing\n\n\t}; // 16 bytes, nominally\n\n\n\tSTBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes);\n\t// Initialize a rectangle packer to:\n\t//    pack a rectangle that is 'width' by 'height' in dimensions\n\t//    using temporary storage provided by the array 'nodes', which is 'num_nodes' long\n\t//\n\t// You must call this function every time you start packing into a new target.\n\t//\n\t// There is no \"shutdown\" function. The 'nodes' memory must stay valid for\n\t// the following stbrp_pack_rects() call (or calls), but can be freed after\n\t// the call (or calls) finish.\n\t//\n\t// Note: to guarantee best results, either:\n\t//       1. make sure 'num_nodes' >= 'width'\n\t//   or  2. call stbrp_allow_out_of_mem() defined below with 'allow_out_of_mem = 1'\n\t//\n\t// If you don't do either of the above things, widths will be quantized to multiples\n\t// of small integers to guarantee the algorithm doesn't run out of temporary storage.\n\t//\n\t// If you do #2, then the non-quantized algorithm will be used, but the algorithm\n\t// may run out of temporary storage and be unable to pack some rectangles.\n\n\tSTBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem);\n\t// Optionally call this function after init but before doing any packing to\n\t// change the handling of the out-of-temp-memory scenario, described above.\n\t// If you call init again, this will be reset to the default (false).\n\n\n\tSTBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic);\n\t// Optionally select which packing heuristic the library should use. Different\n\t// heuristics will produce better/worse results for different data sets.\n\t// If you call init again, this will be reset to the default.\n\n\tenum\n\t{\n\t\tSTBRP_HEURISTIC_Skyline_default = 0,\n\t\tSTBRP_HEURISTIC_Skyline_BL_sortHeight = STBRP_HEURISTIC_Skyline_default,\n\t\tSTBRP_HEURISTIC_Skyline_BF_sortHeight\n\t};\n\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// the details of the following structures don't matter to you, but they must\n\t// be visible so you can handle the memory allocations for them\n\n\tstruct stbrp_node\n\t{\n\t\tstbrp_coord  x, y;\n\t\tstbrp_node  *next;\n\t};\n\n\tstruct stbrp_context\n\t{\n\t\tint width;\n\t\tint height;\n\t\tint align;\n\t\tint init_mode;\n\t\tint heuristic;\n\t\tint num_nodes;\n\t\tstbrp_node *active_head;\n\t\tstbrp_node *free_head;\n\t\tstbrp_node extra[2]; // we allocate two extra nodes so optimal user-node-count is 'width' not 'width+2'\n\t};\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n//     IMPLEMENTATION SECTION\n//\n\n#ifdef STB_RECT_PACK_IMPLEMENTATION\n#ifndef STBRP_SORT\n#include <stdlib.h>\n#define STBRP_SORT qsort\n#endif\n\n#ifndef STBRP_ASSERT\n#include <assert.h>\n#define STBRP_ASSERT assert\n#endif\n\n#ifdef _MSC_VER\n#define STBRP__NOTUSED(v)  (void)(v)\n#else\n#define STBRP__NOTUSED(v)  (void)sizeof(v)\n#endif\n\nenum\n{\n\tSTBRP__INIT_skyline = 1\n};\n\nSTBRP_DEF void stbrp_setup_heuristic(stbrp_context *context, int heuristic)\n{\n\tswitch (context->init_mode) {\n\tcase STBRP__INIT_skyline:\n\t\tSTBRP_ASSERT(heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight || heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight);\n\t\tcontext->heuristic = heuristic;\n\t\tbreak;\n\tdefault:\n\t\tSTBRP_ASSERT(0);\n\t}\n}\n\nSTBRP_DEF void stbrp_setup_allow_out_of_mem(stbrp_context *context, int allow_out_of_mem)\n{\n\tif (allow_out_of_mem)\n\t\t// if it's ok to run out of memory, then don't bother aligning them;\n\t\t// this gives better packing, but may fail due to OOM (even though\n\t\t// the rectangles easily fit). @TODO a smarter approach would be to only\n\t\t// quantize once we've hit OOM, then we could get rid of this parameter.\n\t\tcontext->align = 1;\n\telse {\n\t\t// if it's not ok to run out of memory, then quantize the widths\n\t\t// so that num_nodes is always enough nodes.\n\t\t//\n\t\t// I.e. num_nodes * align >= width\n\t\t//                  align >= width / num_nodes\n\t\t//                  align = ceil(width/num_nodes)\n\n\t\tcontext->align = (context->width + context->num_nodes - 1) / context->num_nodes;\n\t}\n}\n\nSTBRP_DEF void stbrp_init_target(stbrp_context *context, int width, int height, stbrp_node *nodes, int num_nodes)\n{\n\tint i;\n#ifndef STBRP_LARGE_RECTS\n\tSTBRP_ASSERT(width <= 0xffff && height <= 0xffff);\n#endif\n\n\tfor (i = 0; i < num_nodes - 1; ++i)\n\t\tnodes[i].next = &nodes[i + 1];\n\tnodes[i].next = NULL;\n\tcontext->init_mode = STBRP__INIT_skyline;\n\tcontext->heuristic = STBRP_HEURISTIC_Skyline_default;\n\tcontext->free_head = &nodes[0];\n\tcontext->active_head = &context->extra[0];\n\tcontext->width = width;\n\tcontext->height = height;\n\tcontext->num_nodes = num_nodes;\n\tstbrp_setup_allow_out_of_mem(context, 0);\n\n\t// node 0 is the full width, node 1 is the sentinel (lets us not store width explicitly)\n\tcontext->extra[0].x = 0;\n\tcontext->extra[0].y = 0;\n\tcontext->extra[0].next = &context->extra[1];\n\tcontext->extra[1].x = (stbrp_coord)width;\n#ifdef STBRP_LARGE_RECTS\n\tcontext->extra[1].y = (1 << 30);\n#else\n\tcontext->extra[1].y = 65535;\n#endif\n\tcontext->extra[1].next = NULL;\n}\n\n// find minimum y position if it starts at x1\nstatic int stbrp__skyline_find_min_y(stbrp_context *c, stbrp_node *first, int x0, int width, int *pwaste)\n{\n\tstbrp_node *node = first;\n\tint x1 = x0 + width;\n\tint min_y, visited_width, waste_area;\n\n\tSTBRP__NOTUSED(c);\n\n\tSTBRP_ASSERT(first->x <= x0);\n\n#if 0\n\t// skip in case we're past the node\n\twhile (node->next->x <= x0)\n\t\t++node;\n#else\n\tSTBRP_ASSERT(node->next->x > x0); // we ended up handling this in the caller for efficiency\n#endif\n\n\tSTBRP_ASSERT(node->x <= x0);\n\n\tmin_y = 0;\n\twaste_area = 0;\n\tvisited_width = 0;\n\twhile (node->x < x1) {\n\t\tif (node->y > min_y) {\n\t\t\t// raise min_y higher.\n\t\t\t// we've accounted for all waste up to min_y,\n\t\t\t// but we'll now add more waste for everything we've visted\n\t\t\twaste_area += visited_width * (node->y - min_y);\n\t\t\tmin_y = node->y;\n\t\t\t// the first time through, visited_width might be reduced\n\t\t\tif (node->x < x0)\n\t\t\t\tvisited_width += node->next->x - x0;\n\t\t\telse\n\t\t\t\tvisited_width += node->next->x - node->x;\n\t\t}\n\t\telse {\n\t\t\t// add waste area\n\t\t\tint under_width = node->next->x - node->x;\n\t\t\tif (under_width + visited_width > width)\n\t\t\t\tunder_width = width - visited_width;\n\t\t\twaste_area += under_width * (min_y - node->y);\n\t\t\tvisited_width += under_width;\n\t\t}\n\t\tnode = node->next;\n\t}\n\n\t*pwaste = waste_area;\n\treturn min_y;\n}\n\ntypedef struct\n{\n\tint x, y;\n\tstbrp_node **prev_link;\n} stbrp__findresult;\n\nstatic stbrp__findresult stbrp__skyline_find_best_pos(stbrp_context *c, int width, int height)\n{\n\tint best_waste = (1 << 30), best_x, best_y = (1 << 30);\n\tstbrp__findresult fr;\n\tstbrp_node **prev, *node, *tail, **best = NULL;\n\n\t// align to multiple of c->align\n\twidth = (width + c->align - 1);\n\twidth -= width % c->align;\n\tSTBRP_ASSERT(width % c->align == 0);\n\n\tnode = c->active_head;\n\tprev = &c->active_head;\n\twhile (node->x + width <= c->width) {\n\t\tint y, waste;\n\t\ty = stbrp__skyline_find_min_y(c, node, node->x, width, &waste);\n\t\tif (c->heuristic == STBRP_HEURISTIC_Skyline_BL_sortHeight) { // actually just want to test BL\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // bottom left\n\t\t\tif (y < best_y) {\n\t\t\t\tbest_y = y;\n\t\t\t\tbest = prev;\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\t// best-fit\n\t\t\tif (y + height <= c->height) {\n\t\t\t\t// can only use it if it first vertically\n\t\t\t\tif (y < best_y || (y == best_y && waste < best_waste)) {\n\t\t\t\t\tbest_y = y;\n\t\t\t\t\tbest_waste = waste;\n\t\t\t\t\tbest = prev;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tprev = &node->next;\n\t\tnode = node->next;\n\t}\n\n\tbest_x = (best == NULL) ? 0 : (*best)->x;\n\n\t// if doing best-fit (BF), we also have to try aligning right edge to each node position\n\t//\n\t// e.g, if fitting\n\t//\n\t//     ____________________\n\t//    |____________________|\n\t//\n\t//            into\n\t//\n\t//   |                         |\n\t//   |             ____________|\n\t//   |____________|\n\t//\n\t// then right-aligned reduces waste, but bottom-left BL is always chooses left-aligned\n\t//\n\t// This makes BF take about 2x the time\n\n\tif (c->heuristic == STBRP_HEURISTIC_Skyline_BF_sortHeight) {\n\t\ttail = c->active_head;\n\t\tnode = c->active_head;\n\t\tprev = &c->active_head;\n\t\t// find first node that's admissible\n\t\twhile (tail->x < width)\n\t\t\ttail = tail->next;\n\t\twhile (tail) {\n\t\t\tint xpos = tail->x - width;\n\t\t\tint y, waste;\n\t\t\tSTBRP_ASSERT(xpos >= 0);\n\t\t\t// find the left position that matches this\n\t\t\twhile (node->next->x <= xpos) {\n\t\t\t\tprev = &node->next;\n\t\t\t\tnode = node->next;\n\t\t\t}\n\t\t\tSTBRP_ASSERT(node->next->x > xpos && node->x <= xpos);\n\t\t\ty = stbrp__skyline_find_min_y(c, node, xpos, width, &waste);\n\t\t\tif (y + height < c->height) {\n\t\t\t\tif (y <= best_y) {\n\t\t\t\t\tif (y < best_y || waste < best_waste || (waste == best_waste && xpos < best_x)) {\n\t\t\t\t\t\tbest_x = xpos;\n\t\t\t\t\t\tSTBRP_ASSERT(y <= best_y);\n\t\t\t\t\t\tbest_y = y;\n\t\t\t\t\t\tbest_waste = waste;\n\t\t\t\t\t\tbest = prev;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\ttail = tail->next;\n\t\t}\n\t}\n\n\tfr.prev_link = best;\n\tfr.x = best_x;\n\tfr.y = best_y;\n\treturn fr;\n}\n\nstatic stbrp__findresult stbrp__skyline_pack_rectangle(stbrp_context *context, int width, int height)\n{\n\t// find best position according to heuristic\n\tstbrp__findresult res = stbrp__skyline_find_best_pos(context, width, height);\n\tstbrp_node *node, *cur;\n\n\t// bail if:\n\t//    1. it failed\n\t//    2. the best node doesn't fit (we don't always check this)\n\t//    3. we're out of memory\n\tif (res.prev_link == NULL || res.y + height > context->height || context->free_head == NULL) {\n\t\tres.prev_link = NULL;\n\t\treturn res;\n\t}\n\n\t// on success, create new node\n\tnode = context->free_head;\n\tnode->x = (stbrp_coord)res.x;\n\tnode->y = (stbrp_coord)(res.y + height);\n\n\tcontext->free_head = node->next;\n\n\t// insert the new node into the right starting point, and\n\t// let 'cur' point to the remaining nodes needing to be\n\t// stiched back in\n\n\tcur = *res.prev_link;\n\tif (cur->x < res.x) {\n\t\t// preserve the existing one, so start testing with the next one\n\t\tstbrp_node *next = cur->next;\n\t\tcur->next = node;\n\t\tcur = next;\n\t}\n\telse {\n\t\t*res.prev_link = node;\n\t}\n\n\t// from here, traverse cur and free the nodes, until we get to one\n\t// that shouldn't be freed\n\twhile (cur->next && cur->next->x <= res.x + width) {\n\t\tstbrp_node *next = cur->next;\n\t\t// move the current node to the free list\n\t\tcur->next = context->free_head;\n\t\tcontext->free_head = cur;\n\t\tcur = next;\n\t}\n\n\t// stitch the list back in\n\tnode->next = cur;\n\n\tif (cur->x < res.x + width)\n\t\tcur->x = (stbrp_coord)(res.x + width);\n\n#ifdef _DEBUG\n\tcur = context->active_head;\n\twhile (cur->x < context->width) {\n\t\tSTBRP_ASSERT(cur->x < cur->next->x);\n\t\tcur = cur->next;\n\t}\n\tSTBRP_ASSERT(cur->next == NULL);\n\n\t{\n\t\tstbrp_node *L1 = NULL, *L2 = NULL;\n\t\tint count = 0;\n\t\tcur = context->active_head;\n\t\twhile (cur) {\n\t\t\tL1 = cur;\n\t\t\tcur = cur->next;\n\t\t\t++count;\n\t\t}\n\t\tcur = context->free_head;\n\t\twhile (cur) {\n\t\t\tL2 = cur;\n\t\t\tcur = cur->next;\n\t\t\t++count;\n\t\t}\n\t\tSTBRP_ASSERT(count == context->num_nodes + 2);\n\t}\n#endif\n\n\treturn res;\n}\n\nstatic int rect_height_compare(const void *a, const void *b)\n{\n\tconst stbrp_rect *p = (const stbrp_rect *)a;\n\tconst stbrp_rect *q = (const stbrp_rect *)b;\n\tif (p->h > q->h)\n\t\treturn -1;\n\tif (p->h < q->h)\n\t\treturn  1;\n\treturn (p->w > q->w) ? -1 : (p->w < q->w);\n}\n\nstatic int rect_width_compare(const void *a, const void *b)\n{\n\tconst stbrp_rect *p = (const stbrp_rect *)a;\n\tconst stbrp_rect *q = (const stbrp_rect *)b;\n\tif (p->w > q->w)\n\t\treturn -1;\n\tif (p->w < q->w)\n\t\treturn  1;\n\treturn (p->h > q->h) ? -1 : (p->h < q->h);\n}\n\nstatic int rect_original_order(const void *a, const void *b)\n{\n\tconst stbrp_rect *p = (const stbrp_rect *)a;\n\tconst stbrp_rect *q = (const stbrp_rect *)b;\n\treturn (p->was_packed < q->was_packed) ? -1 : (p->was_packed > q->was_packed);\n}\n\n#ifdef STBRP_LARGE_RECTS\n#define STBRP__MAXVAL  0xffffffff\n#else\n#define STBRP__MAXVAL  0xffff\n#endif\n\nSTBRP_DEF void stbrp_pack_rects(stbrp_context *context, stbrp_rect *rects, int num_rects)\n{\n\tint i;\n\n\t// we use the 'was_packed' field internally to allow sorting/unsorting\n\tfor (i = 0; i < num_rects; ++i) {\n\t\trects[i].was_packed = i;\n#ifndef STBRP_LARGE_RECTS\n\t\tSTBRP_ASSERT(rects[i].w <= 0xffff && rects[i].h <= 0xffff);\n#endif\n\t}\n\n\t// sort according to heuristic\n\tSTBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_height_compare);\n\n\tfor (i = 0; i < num_rects; ++i) {\n\t\tif (rects[i].w == 0 || rects[i].h == 0) {\n\t\t\trects[i].x = rects[i].y = 0;  // empty rect needs no space\n\t\t}\n\t\telse {\n\t\t\tstbrp__findresult fr = stbrp__skyline_pack_rectangle(context, rects[i].w, rects[i].h);\n\t\t\tif (fr.prev_link) {\n\t\t\t\trects[i].x = (stbrp_coord)fr.x;\n\t\t\t\trects[i].y = (stbrp_coord)fr.y;\n\t\t\t}\n\t\t\telse {\n\t\t\t\trects[i].x = rects[i].y = STBRP__MAXVAL;\n\t\t\t}\n\t\t}\n\t}\n\n\t// unsort\n\tSTBRP_SORT(rects, num_rects, sizeof(rects[0]), rect_original_order);\n\n\t// set was_packed flags\n\tfor (i = 0; i < num_rects; ++i)\n\t\trects[i].was_packed = !(rects[i].x == STBRP__MAXVAL && rects[i].y == STBRP__MAXVAL);\n}\n#endif\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/stb_textedit.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n// [ImGui] this is a slightly modified version of stb_truetype.h 1.9. Those changes would need to be pushed into nothings/sb\n// [ImGui] - fixed linestart handler when over last character of multi-line buffer + simplified existing code (#588, #815)\n// [ImGui] - fixed a state corruption/crash bug in stb_text_redo and stb_textedit_discard_redo (#715)\n// [ImGui] - fixed a crash bug in stb_textedit_discard_redo (#681)\n// [ImGui] - fixed some minor warnings\n\n// stb_textedit.h - v1.9  - public domain - Sean Barrett\n// Development of this library was sponsored by RAD Game Tools\n//\n// This C header file implements the guts of a multi-line text-editing\n// widget; you implement display, word-wrapping, and low-level string\n// insertion/deletion, and stb_textedit will map user inputs into\n// insertions & deletions, plus updates to the cursor position,\n// selection state, and undo state.\n//\n// It is intended for use in games and other systems that need to build\n// their own custom widgets and which do not have heavy text-editing\n// requirements (this library is not recommended for use for editing large\n// texts, as its performance does not scale and it has limited undo).\n//\n// Non-trivial behaviors are modelled after Windows text controls.\n// \n//\n// LICENSE\n//\n//   This software is dual-licensed to the public domain and under the following\n//   license: you are granted a perpetual, irrevocable license to copy, modify,\n//   publish, and distribute this file as you see fit.\n//\n//\n// DEPENDENCIES\n//\n// Uses the C runtime function 'memmove', which you can override\n// by defining STB_TEXTEDIT_memmove before the implementation.\n// Uses no other functions. Performs no runtime allocations.\n//\n//\n// VERSION HISTORY\n//\n//   1.9  (2016-08-27) customizable move-by-word\n//   1.8  (2016-04-02) better keyboard handling when mouse button is down\n//   1.7  (2015-09-13) change y range handling in case baseline is non-0\n//   1.6  (2015-04-15) allow STB_TEXTEDIT_memmove\n//   1.5  (2014-09-10) add support for secondary keys for OS X\n//   1.4  (2014-08-17) fix signed/unsigned warnings\n//   1.3  (2014-06-19) fix mouse clicking to round to nearest char boundary\n//   1.2  (2014-05-27) fix some RAD types that had crept into the new code\n//   1.1  (2013-12-15) move-by-word (requires STB_TEXTEDIT_IS_SPACE )\n//   1.0  (2012-07-26) improve documentation, initial public release\n//   0.3  (2012-02-24) bugfixes, single-line mode; insert mode\n//   0.2  (2011-11-28) fixes to undo/redo\n//   0.1  (2010-07-08) initial version\n//\n// ADDITIONAL CONTRIBUTORS\n//\n//   Ulf Winklemann: move-by-word in 1.1\n//   Fabian Giesen: secondary key inputs in 1.5\n//   Martins Mozeiko: STB_TEXTEDIT_memmove\n//\n//   Bugfixes:\n//      Scott Graham\n//      Daniel Keller\n//      Omar Cornut\n//\n// USAGE\n//\n// This file behaves differently depending on what symbols you define\n// before including it.\n//\n//\n// Header-file mode:\n//\n//   If you do not define STB_TEXTEDIT_IMPLEMENTATION before including this,\n//   it will operate in \"header file\" mode. In this mode, it declares a\n//   single public symbol, STB_TexteditState, which encapsulates the current\n//   state of a text widget (except for the string, which you will store\n//   separately).\n//\n//   To compile in this mode, you must define STB_TEXTEDIT_CHARTYPE to a\n//   primitive type that defines a single character (e.g. char, wchar_t, etc).\n//\n//   To save space or increase undo-ability, you can optionally define the\n//   following things that are used by the undo system:\n//\n//      STB_TEXTEDIT_POSITIONTYPE         small int type encoding a valid cursor position\n//      STB_TEXTEDIT_UNDOSTATECOUNT       the number of undo states to allow\n//      STB_TEXTEDIT_UNDOCHARCOUNT        the number of characters to store in the undo buffer\n//\n//   If you don't define these, they are set to permissive types and\n//   moderate sizes. The undo system does no memory allocations, so\n//   it grows STB_TexteditState by the worst-case storage which is (in bytes):\n//\n//        [4 + sizeof(STB_TEXTEDIT_POSITIONTYPE)] * STB_TEXTEDIT_UNDOSTATE_COUNT\n//      +      sizeof(STB_TEXTEDIT_CHARTYPE)      * STB_TEXTEDIT_UNDOCHAR_COUNT\n//\n//\n// Implementation mode:\n//\n//   If you define STB_TEXTEDIT_IMPLEMENTATION before including this, it\n//   will compile the implementation of the text edit widget, depending\n//   on a large number of symbols which must be defined before the include.\n//\n//   The implementation is defined only as static functions. You will then\n//   need to provide your own APIs in the same file which will access the\n//   static functions.\n//\n//   The basic concept is that you provide a \"string\" object which\n//   behaves like an array of characters. stb_textedit uses indices to\n//   refer to positions in the string, implicitly representing positions\n//   in the displayed textedit. This is true for both plain text and\n//   rich text; even with rich text stb_truetype interacts with your\n//   code as if there was an array of all the displayed characters.\n//\n// Symbols that must be the same in header-file and implementation mode:\n//\n//     STB_TEXTEDIT_CHARTYPE             the character type\n//     STB_TEXTEDIT_POSITIONTYPE         small type that a valid cursor position\n//     STB_TEXTEDIT_UNDOSTATECOUNT       the number of undo states to allow\n//     STB_TEXTEDIT_UNDOCHARCOUNT        the number of characters to store in the undo buffer\n//\n// Symbols you must define for implementation mode:\n//\n//    STB_TEXTEDIT_STRING               the type of object representing a string being edited,\n//                                      typically this is a wrapper object with other data you need\n//\n//    STB_TEXTEDIT_STRINGLEN(obj)       the length of the string (ideally O(1))\n//    STB_TEXTEDIT_LAYOUTROW(&r,obj,n)  returns the results of laying out a line of characters\n//                                        starting from character #n (see discussion below)\n//    STB_TEXTEDIT_GETWIDTH(obj,n,i)    returns the pixel delta from the xpos of the i'th character\n//                                        to the xpos of the i+1'th char for a line of characters\n//                                        starting at character #n (i.e. accounts for kerning\n//                                        with previous char)\n//    STB_TEXTEDIT_KEYTOTEXT(k)         maps a keyboard input to an insertable character\n//                                        (return type is int, -1 means not valid to insert)\n//    STB_TEXTEDIT_GETCHAR(obj,i)       returns the i'th character of obj, 0-based\n//    STB_TEXTEDIT_NEWLINE              the character returned by _GETCHAR() we recognize\n//                                        as manually wordwrapping for end-of-line positioning\n//\n//    STB_TEXTEDIT_DELETECHARS(obj,i,n)      delete n characters starting at i\n//    STB_TEXTEDIT_INSERTCHARS(obj,i,c*,n)   insert n characters at i (pointed to by STB_TEXTEDIT_CHARTYPE*)\n//\n//    STB_TEXTEDIT_K_SHIFT       a power of two that is or'd in to a keyboard input to represent the shift key\n//\n//    STB_TEXTEDIT_K_LEFT        keyboard input to move cursor left\n//    STB_TEXTEDIT_K_RIGHT       keyboard input to move cursor right\n//    STB_TEXTEDIT_K_UP          keyboard input to move cursor up\n//    STB_TEXTEDIT_K_DOWN        keyboard input to move cursor down\n//    STB_TEXTEDIT_K_LINESTART   keyboard input to move cursor to start of line  // e.g. HOME\n//    STB_TEXTEDIT_K_LINEEND     keyboard input to move cursor to end of line    // e.g. END\n//    STB_TEXTEDIT_K_TEXTSTART   keyboard input to move cursor to start of text  // e.g. ctrl-HOME\n//    STB_TEXTEDIT_K_TEXTEND     keyboard input to move cursor to end of text    // e.g. ctrl-END\n//    STB_TEXTEDIT_K_DELETE      keyboard input to delete selection or character under cursor\n//    STB_TEXTEDIT_K_BACKSPACE   keyboard input to delete selection or character left of cursor\n//    STB_TEXTEDIT_K_UNDO        keyboard input to perform undo\n//    STB_TEXTEDIT_K_REDO        keyboard input to perform redo\n//\n// Optional:\n//    STB_TEXTEDIT_K_INSERT              keyboard input to toggle insert mode\n//    STB_TEXTEDIT_IS_SPACE(ch)          true if character is whitespace (e.g. 'isspace'),\n//                                          required for default WORDLEFT/WORDRIGHT handlers\n//    STB_TEXTEDIT_MOVEWORDLEFT(obj,i)   custom handler for WORDLEFT, returns index to move cursor to\n//    STB_TEXTEDIT_MOVEWORDRIGHT(obj,i)  custom handler for WORDRIGHT, returns index to move cursor to\n//    STB_TEXTEDIT_K_WORDLEFT            keyboard input to move cursor left one word // e.g. ctrl-LEFT\n//    STB_TEXTEDIT_K_WORDRIGHT           keyboard input to move cursor right one word // e.g. ctrl-RIGHT\n//    STB_TEXTEDIT_K_LINESTART2          secondary keyboard input to move cursor to start of line\n//    STB_TEXTEDIT_K_LINEEND2            secondary keyboard input to move cursor to end of line\n//    STB_TEXTEDIT_K_TEXTSTART2          secondary keyboard input to move cursor to start of text\n//    STB_TEXTEDIT_K_TEXTEND2            secondary keyboard input to move cursor to end of text\n//\n// Todo:\n//    STB_TEXTEDIT_K_PGUP        keyboard input to move cursor up a page\n//    STB_TEXTEDIT_K_PGDOWN      keyboard input to move cursor down a page\n//\n// Keyboard input must be encoded as a single integer value; e.g. a character code\n// and some bitflags that represent shift states. to simplify the interface, SHIFT must\n// be a bitflag, so we can test the shifted state of cursor movements to allow selection,\n// i.e. (STB_TEXTED_K_RIGHT|STB_TEXTEDIT_K_SHIFT) should be shifted right-arrow.\n//\n// You can encode other things, such as CONTROL or ALT, in additional bits, and\n// then test for their presence in e.g. STB_TEXTEDIT_K_WORDLEFT. For example,\n// my Windows implementations add an additional CONTROL bit, and an additional KEYDOWN\n// bit. Then all of the STB_TEXTEDIT_K_ values bitwise-or in the KEYDOWN bit,\n// and I pass both WM_KEYDOWN and WM_CHAR events to the \"key\" function in the\n// API below. The control keys will only match WM_KEYDOWN events because of the\n// keydown bit I add, and STB_TEXTEDIT_KEYTOTEXT only tests for the KEYDOWN\n// bit so it only decodes WM_CHAR events.\n//\n// STB_TEXTEDIT_LAYOUTROW returns information about the shape of one displayed\n// row of characters assuming they start on the i'th character--the width and\n// the height and the number of characters consumed. This allows this library\n// to traverse the entire layout incrementally. You need to compute word-wrapping\n// here.\n//\n// Each textfield keeps its own insert mode state, which is not how normal\n// applications work. To keep an app-wide insert mode, update/copy the\n// \"insert_mode\" field of STB_TexteditState before/after calling API functions.\n//\n// API\n//\n//    void stb_textedit_initialize_state(STB_TexteditState *state, int is_single_line)\n//\n//    void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n//    void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n//    int  stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n//    int  stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE *text, int len)\n//    void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int key)\n//\n//    Each of these functions potentially updates the string and updates the\n//    state.\n//\n//      initialize_state:\n//          set the textedit state to a known good default state when initially\n//          constructing the textedit.\n//\n//      click:\n//          call this with the mouse x,y on a mouse down; it will update the cursor\n//          and reset the selection start/end to the cursor point. the x,y must\n//          be relative to the text widget, with (0,0) being the top left.\n//     \n//      drag:\n//          call this with the mouse x,y on a mouse drag/up; it will update the\n//          cursor and the selection end point\n//     \n//      cut:\n//          call this to delete the current selection; returns true if there was\n//          one. you should FIRST copy the current selection to the system paste buffer.\n//          (To copy, just copy the current selection out of the string yourself.)\n//     \n//      paste:\n//          call this to paste text at the current cursor point or over the current\n//          selection if there is one.\n//     \n//      key:\n//          call this for keyboard inputs sent to the textfield. you can use it\n//          for \"key down\" events or for \"translated\" key events. if you need to\n//          do both (as in Win32), or distinguish Unicode characters from control\n//          inputs, set a high bit to distinguish the two; then you can define the\n//          various definitions like STB_TEXTEDIT_K_LEFT have the is-key-event bit\n//          set, and make STB_TEXTEDIT_KEYTOCHAR check that the is-key-event bit is\n//          clear.\n//     \n//   When rendering, you can read the cursor position and selection state from\n//   the STB_TexteditState.\n//\n//\n// Notes:\n//\n// This is designed to be usable in IMGUI, so it allows for the possibility of\n// running in an IMGUI that has NOT cached the multi-line layout. For this\n// reason, it provides an interface that is compatible with computing the\n// layout incrementally--we try to make sure we make as few passes through\n// as possible. (For example, to locate the mouse pointer in the text, we\n// could define functions that return the X and Y positions of characters\n// and binary search Y and then X, but if we're doing dynamic layout this\n// will run the layout algorithm many times, so instead we manually search\n// forward in one pass. Similar logic applies to e.g. up-arrow and\n// down-arrow movement.)\n//\n// If it's run in a widget that *has* cached the layout, then this is less\n// efficient, but it's not horrible on modern computers. But you wouldn't\n// want to edit million-line files with it.\n\n\n////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////\n////\n////   Header-file mode\n////\n////\n\n#ifndef INCLUDE_STB_TEXTEDIT_H\n#define INCLUDE_STB_TEXTEDIT_H\n\n////////////////////////////////////////////////////////////////////////\n//\n//     STB_TexteditState\n//\n// Definition of STB_TexteditState which you should store\n// per-textfield; it includes cursor position, selection state,\n// and undo state.\n//\n\n#ifndef STB_TEXTEDIT_UNDOSTATECOUNT\n#define STB_TEXTEDIT_UNDOSTATECOUNT   99\n#endif\n#ifndef STB_TEXTEDIT_UNDOCHARCOUNT\n#define STB_TEXTEDIT_UNDOCHARCOUNT   999\n#endif\n#ifndef STB_TEXTEDIT_CHARTYPE\n#define STB_TEXTEDIT_CHARTYPE        int\n#endif\n#ifndef STB_TEXTEDIT_POSITIONTYPE\n#define STB_TEXTEDIT_POSITIONTYPE    int\n#endif\n\ntypedef struct\n{\n\t// private data\n\tSTB_TEXTEDIT_POSITIONTYPE  where;\n\tshort           insert_length;\n\tshort           delete_length;\n\tshort           char_storage;\n} StbUndoRecord;\n\ntypedef struct\n{\n\t// private data\n\tStbUndoRecord          undo_rec[STB_TEXTEDIT_UNDOSTATECOUNT];\n\tSTB_TEXTEDIT_CHARTYPE  undo_char[STB_TEXTEDIT_UNDOCHARCOUNT];\n\tshort undo_point, redo_point;\n\tshort undo_char_point, redo_char_point;\n} StbUndoState;\n\ntypedef struct\n{\n\t/////////////////////\n\t//\n\t// public data\n\t//\n\n\tint cursor;\n\t// position of the text cursor within the string\n\n\tint select_start;          // selection start point\n\tint select_end;\n\t// selection start and end point in characters; if equal, no selection.\n\t// note that start may be less than or greater than end (e.g. when\n\t// dragging the mouse, start is where the initial click was, and you\n\t// can drag in either direction)\n\n\tunsigned char insert_mode;\n\t// each textfield keeps its own insert mode state. to keep an app-wide\n\t// insert mode, copy this value in/out of the app state\n\n\t/////////////////////\n\t//\n\t// private data\n\t//\n\tunsigned char cursor_at_end_of_line; // not implemented yet\n\tunsigned char initialized;\n\tunsigned char has_preferred_x;\n\tunsigned char single_line;\n\tunsigned char padding1, padding2, padding3;\n\tfloat preferred_x; // this determines where the cursor up/down tries to seek to along x\n\tStbUndoState undostate;\n} STB_TexteditState;\n\n\n////////////////////////////////////////////////////////////////////////\n//\n//     StbTexteditRow\n//\n// Result of layout query, used by stb_textedit to determine where\n// the text in each row is.\n\n// result of layout query\ntypedef struct\n{\n\tfloat x0, x1;             // starting x location, end x location (allows for align=right, etc)\n\tfloat baseline_y_delta;  // position of baseline relative to previous row's baseline\n\tfloat ymin, ymax;         // height of row above and below baseline\n\tint num_chars;\n} StbTexteditRow;\n#endif //INCLUDE_STB_TEXTEDIT_H\n\n\n////////////////////////////////////////////////////////////////////////////\n////////////////////////////////////////////////////////////////////////////\n////\n////   Implementation mode\n////\n////\n\n\n// implementation isn't include-guarded, since it might have indirectly\n// included just the \"header\" portion\n#ifdef STB_TEXTEDIT_IMPLEMENTATION\n\n#ifndef STB_TEXTEDIT_memmove\n#include <string.h>\n#define STB_TEXTEDIT_memmove memmove\n#endif\n\n\n/////////////////////////////////////////////////////////////////////////////\n//\n//      Mouse input handling\n//\n\n// traverse the layout to locate the nearest character to a display position\nstatic int stb_text_locate_coord(STB_TEXTEDIT_STRING *str, float x, float y)\n{\n\tStbTexteditRow r;\n\tint n = STB_TEXTEDIT_STRINGLEN(str);\n\tfloat base_y = 0, prev_x;\n\tint i = 0, k;\n\n\tr.x0 = r.x1 = 0;\n\tr.ymin = r.ymax = 0;\n\tr.num_chars = 0;\n\n\t// search rows to find one that straddles 'y'\n\twhile (i < n) {\n\t\tSTB_TEXTEDIT_LAYOUTROW(&r, str, i);\n\t\tif (r.num_chars <= 0)\n\t\t\treturn n;\n\n\t\tif (i == 0 && y < base_y + r.ymin)\n\t\t\treturn 0;\n\n\t\tif (y < base_y + r.ymax)\n\t\t\tbreak;\n\n\t\ti += r.num_chars;\n\t\tbase_y += r.baseline_y_delta;\n\t}\n\n\t// below all text, return 'after' last character\n\tif (i >= n)\n\t\treturn n;\n\n\t// check if it's before the beginning of the line\n\tif (x < r.x0)\n\t\treturn i;\n\n\t// check if it's before the end of the line\n\tif (x < r.x1) {\n\t\t// search characters in row for one that straddles 'x'\n\t\tprev_x = r.x0;\n\t\tfor (k = 0; k < r.num_chars; ++k) {\n\t\t\tfloat w = STB_TEXTEDIT_GETWIDTH(str, i, k);\n\t\t\tif (x < prev_x + w) {\n\t\t\t\tif (x < prev_x + w / 2)\n\t\t\t\t\treturn k + i;\n\t\t\t\telse\n\t\t\t\t\treturn k + i + 1;\n\t\t\t}\n\t\t\tprev_x += w;\n\t\t}\n\t\t// shouldn't happen, but if it does, fall through to end-of-line case\n\t}\n\n\t// if the last character is a newline, return that. otherwise return 'after' the last character\n\tif (STB_TEXTEDIT_GETCHAR(str, i + r.num_chars - 1) == STB_TEXTEDIT_NEWLINE)\n\t\treturn i + r.num_chars - 1;\n\telse\n\t\treturn i + r.num_chars;\n}\n\n// API click: on mouse down, move the cursor to the clicked location, and reset the selection\nstatic void stb_textedit_click(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n{\n\tstate->cursor = stb_text_locate_coord(str, x, y);\n\tstate->select_start = state->cursor;\n\tstate->select_end = state->cursor;\n\tstate->has_preferred_x = 0;\n}\n\n// API drag: on mouse drag, move the cursor and selection endpoint to the clicked location\nstatic void stb_textedit_drag(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, float x, float y)\n{\n\tint p = stb_text_locate_coord(str, x, y);\n\tif (state->select_start == state->select_end)\n\t\tstate->select_start = state->cursor;\n\tstate->cursor = state->select_end = p;\n}\n\n/////////////////////////////////////////////////////////////////////////////\n//\n//      Keyboard input handling\n//\n\n// forward declarations\nstatic void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state);\nstatic void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state);\nstatic void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length);\nstatic void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length);\nstatic void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length);\n\ntypedef struct\n{\n\tfloat x, y;    // position of n'th character\n\tfloat height; // height of line\n\tint first_char, length; // first char of row, and length\n\tint prev_first;  // first char of previous row\n} StbFindState;\n\n// find the x/y location of a character, and remember info about the previous row in\n// case we get a move-up event (for page up, we'll have to rescan)\nstatic void stb_textedit_find_charpos(StbFindState *find, STB_TEXTEDIT_STRING *str, int n, int single_line)\n{\n\tStbTexteditRow r;\n\tint prev_start = 0;\n\tint z = STB_TEXTEDIT_STRINGLEN(str);\n\tint i = 0, first;\n\n\tif (n == z) {\n\t\t// if it's at the end, then find the last line -- simpler than trying to\n\t\t// explicitly handle this case in the regular code\n\t\tif (single_line) {\n\t\t\tSTB_TEXTEDIT_LAYOUTROW(&r, str, 0);\n\t\t\tfind->y = 0;\n\t\t\tfind->first_char = 0;\n\t\t\tfind->length = z;\n\t\t\tfind->height = r.ymax - r.ymin;\n\t\t\tfind->x = r.x1;\n\t\t}\n\t\telse {\n\t\t\tfind->y = 0;\n\t\t\tfind->x = 0;\n\t\t\tfind->height = 1;\n\t\t\twhile (i < z) {\n\t\t\t\tSTB_TEXTEDIT_LAYOUTROW(&r, str, i);\n\t\t\t\tprev_start = i;\n\t\t\t\ti += r.num_chars;\n\t\t\t}\n\t\t\tfind->first_char = i;\n\t\t\tfind->length = 0;\n\t\t\tfind->prev_first = prev_start;\n\t\t}\n\t\treturn;\n\t}\n\n\t// search rows to find the one that straddles character n\n\tfind->y = 0;\n\n\tfor (;;) {\n\t\tSTB_TEXTEDIT_LAYOUTROW(&r, str, i);\n\t\tif (n < i + r.num_chars)\n\t\t\tbreak;\n\t\tprev_start = i;\n\t\ti += r.num_chars;\n\t\tfind->y += r.baseline_y_delta;\n\t}\n\n\tfind->first_char = first = i;\n\tfind->length = r.num_chars;\n\tfind->height = r.ymax - r.ymin;\n\tfind->prev_first = prev_start;\n\n\t// now scan to find xpos\n\tfind->x = r.x0;\n\ti = 0;\n\tfor (i = 0; first + i < n; ++i)\n\t\tfind->x += STB_TEXTEDIT_GETWIDTH(str, first, i);\n}\n\n#define STB_TEXT_HAS_SELECTION(s)   ((s)->select_start != (s)->select_end)\n\n// make the selection/cursor state valid if client altered the string\nstatic void stb_textedit_clamp(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n\tint n = STB_TEXTEDIT_STRINGLEN(str);\n\tif (STB_TEXT_HAS_SELECTION(state)) {\n\t\tif (state->select_start > n) state->select_start = n;\n\t\tif (state->select_end   > n) state->select_end = n;\n\t\t// if clamping forced them to be equal, move the cursor to match\n\t\tif (state->select_start == state->select_end)\n\t\t\tstate->cursor = state->select_start;\n\t}\n\tif (state->cursor > n) state->cursor = n;\n}\n\n// delete characters while updating undo\nstatic void stb_textedit_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int len)\n{\n\tstb_text_makeundo_delete(str, state, where, len);\n\tSTB_TEXTEDIT_DELETECHARS(str, where, len);\n\tstate->has_preferred_x = 0;\n}\n\n// delete the section\nstatic void stb_textedit_delete_selection(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n\tstb_textedit_clamp(str, state);\n\tif (STB_TEXT_HAS_SELECTION(state)) {\n\t\tif (state->select_start < state->select_end) {\n\t\t\tstb_textedit_delete(str, state, state->select_start, state->select_end - state->select_start);\n\t\t\tstate->select_end = state->cursor = state->select_start;\n\t\t}\n\t\telse {\n\t\t\tstb_textedit_delete(str, state, state->select_end, state->select_start - state->select_end);\n\t\t\tstate->select_start = state->cursor = state->select_end;\n\t\t}\n\t\tstate->has_preferred_x = 0;\n\t}\n}\n\n// canoncialize the selection so start <= end\nstatic void stb_textedit_sortselection(STB_TexteditState *state)\n{\n\tif (state->select_end < state->select_start) {\n\t\tint temp = state->select_end;\n\t\tstate->select_end = state->select_start;\n\t\tstate->select_start = temp;\n\t}\n}\n\n// move cursor to first character of selection\nstatic void stb_textedit_move_to_first(STB_TexteditState *state)\n{\n\tif (STB_TEXT_HAS_SELECTION(state)) {\n\t\tstb_textedit_sortselection(state);\n\t\tstate->cursor = state->select_start;\n\t\tstate->select_end = state->select_start;\n\t\tstate->has_preferred_x = 0;\n\t}\n}\n\n// move cursor to last character of selection\nstatic void stb_textedit_move_to_last(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n\tif (STB_TEXT_HAS_SELECTION(state)) {\n\t\tstb_textedit_sortselection(state);\n\t\tstb_textedit_clamp(str, state);\n\t\tstate->cursor = state->select_end;\n\t\tstate->select_start = state->select_end;\n\t\tstate->has_preferred_x = 0;\n\t}\n}\n\n#ifdef STB_TEXTEDIT_IS_SPACE\nstatic int is_word_boundary(STB_TEXTEDIT_STRING *str, int idx)\n{\n\treturn idx > 0 ? (STB_TEXTEDIT_IS_SPACE(STB_TEXTEDIT_GETCHAR(str, idx - 1)) && !STB_TEXTEDIT_IS_SPACE(STB_TEXTEDIT_GETCHAR(str, idx))) : 1;\n}\n\n#ifndef STB_TEXTEDIT_MOVEWORDLEFT\nstatic int stb_textedit_move_to_word_previous(STB_TEXTEDIT_STRING *str, int c)\n{\n\t--c; // always move at least one character\n\twhile (c >= 0 && !is_word_boundary(str, c))\n\t\t--c;\n\n\tif (c < 0)\n\t\tc = 0;\n\n\treturn c;\n}\n#define STB_TEXTEDIT_MOVEWORDLEFT stb_textedit_move_to_word_previous\n#endif\n\n#ifndef STB_TEXTEDIT_MOVEWORDRIGHT\nstatic int stb_textedit_move_to_word_next(STB_TEXTEDIT_STRING *str, int c)\n{\n\tconst int len = STB_TEXTEDIT_STRINGLEN(str);\n\t++c; // always move at least one character\n\twhile (c < len && !is_word_boundary(str, c))\n\t\t++c;\n\n\tif (c > len)\n\t\tc = len;\n\n\treturn c;\n}\n#define STB_TEXTEDIT_MOVEWORDRIGHT stb_textedit_move_to_word_next\n#endif\n\n#endif\n\n// update selection and cursor to match each other\nstatic void stb_textedit_prep_selection_at_cursor(STB_TexteditState *state)\n{\n\tif (!STB_TEXT_HAS_SELECTION(state))\n\t\tstate->select_start = state->select_end = state->cursor;\n\telse\n\t\tstate->cursor = state->select_end;\n}\n\n// API cut: delete selection\nstatic int stb_textedit_cut(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n\tif (STB_TEXT_HAS_SELECTION(state)) {\n\t\tstb_textedit_delete_selection(str, state); // implicity clamps\n\t\tstate->has_preferred_x = 0;\n\t\treturn 1;\n\t}\n\treturn 0;\n}\n\n// API paste: replace existing selection with passed-in text\nstatic int stb_textedit_paste(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, STB_TEXTEDIT_CHARTYPE const *ctext, int len)\n{\n\tSTB_TEXTEDIT_CHARTYPE *text = (STB_TEXTEDIT_CHARTYPE *)ctext;\n\t// if there's a selection, the paste should delete it\n\tstb_textedit_clamp(str, state);\n\tstb_textedit_delete_selection(str, state);\n\t// try to insert the characters\n\tif (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, text, len)) {\n\t\tstb_text_makeundo_insert(state, state->cursor, len);\n\t\tstate->cursor += len;\n\t\tstate->has_preferred_x = 0;\n\t\treturn 1;\n\t}\n\t// remove the undo since we didn't actually insert the characters\n\tif (state->undostate.undo_point)\n\t\t--state->undostate.undo_point;\n\treturn 0;\n}\n\n// API key: process a keyboard input\nstatic void stb_textedit_key(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int key)\n{\nretry:\n\tswitch (key) {\n\tdefault: {\n\t\tint c = STB_TEXTEDIT_KEYTOTEXT(key);\n\t\tif (c > 0) {\n\t\t\tSTB_TEXTEDIT_CHARTYPE ch = (STB_TEXTEDIT_CHARTYPE)c;\n\n\t\t\t// can't add newline in single-line mode\n\t\t\tif (c == '\\n' && state->single_line)\n\t\t\t\tbreak;\n\n\t\t\tif (state->insert_mode && !STB_TEXT_HAS_SELECTION(state) && state->cursor < STB_TEXTEDIT_STRINGLEN(str)) {\n\t\t\t\tstb_text_makeundo_replace(str, state, state->cursor, 1, 1);\n\t\t\t\tSTB_TEXTEDIT_DELETECHARS(str, state->cursor, 1);\n\t\t\t\tif (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {\n\t\t\t\t\t++state->cursor;\n\t\t\t\t\tstate->has_preferred_x = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstb_textedit_delete_selection(str, state); // implicity clamps\n\t\t\t\tif (STB_TEXTEDIT_INSERTCHARS(str, state->cursor, &ch, 1)) {\n\t\t\t\t\tstb_text_makeundo_insert(state, state->cursor, 1);\n\t\t\t\t\t++state->cursor;\n\t\t\t\t\tstate->has_preferred_x = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n\n#ifdef STB_TEXTEDIT_K_INSERT\n\tcase STB_TEXTEDIT_K_INSERT:\n\t\tstate->insert_mode = !state->insert_mode;\n\t\tbreak;\n#endif\n\n\tcase STB_TEXTEDIT_K_UNDO:\n\t\tstb_text_undo(str, state);\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_REDO:\n\t\tstb_text_redo(str, state);\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_LEFT:\n\t\t// if currently there's a selection, move cursor to start of selection\n\t\tif (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_move_to_first(state);\n\t\telse\n\t\t\tif (state->cursor > 0)\n\t\t\t\t--state->cursor;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_RIGHT:\n\t\t// if currently there's a selection, move cursor to end of selection\n\t\tif (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_move_to_last(str, state);\n\t\telse\n\t\t\t++state->cursor;\n\t\tstb_textedit_clamp(str, state);\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_LEFT | STB_TEXTEDIT_K_SHIFT:\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\t// move selection left\n\t\tif (state->select_end > 0)\n\t\t\t--state->select_end;\n\t\tstate->cursor = state->select_end;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_MOVEWORDLEFT\n\tcase STB_TEXTEDIT_K_WORDLEFT:\n\t\tif (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_move_to_first(state);\n\t\telse {\n\t\t\tstate->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor);\n\t\t\tstb_textedit_clamp(str, state);\n\t\t}\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_WORDLEFT | STB_TEXTEDIT_K_SHIFT:\n\t\tif (!STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_prep_selection_at_cursor(state);\n\n\t\tstate->cursor = STB_TEXTEDIT_MOVEWORDLEFT(str, state->cursor);\n\t\tstate->select_end = state->cursor;\n\n\t\tstb_textedit_clamp(str, state);\n\t\tbreak;\n#endif\n\n#ifdef STB_TEXTEDIT_MOVEWORDRIGHT\n\tcase STB_TEXTEDIT_K_WORDRIGHT:\n\t\tif (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_move_to_last(str, state);\n\t\telse {\n\t\t\tstate->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor);\n\t\t\tstb_textedit_clamp(str, state);\n\t\t}\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_WORDRIGHT | STB_TEXTEDIT_K_SHIFT:\n\t\tif (!STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_prep_selection_at_cursor(state);\n\n\t\tstate->cursor = STB_TEXTEDIT_MOVEWORDRIGHT(str, state->cursor);\n\t\tstate->select_end = state->cursor;\n\n\t\tstb_textedit_clamp(str, state);\n\t\tbreak;\n#endif\n\n\tcase STB_TEXTEDIT_K_RIGHT | STB_TEXTEDIT_K_SHIFT:\n\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\t// move selection right\n\t\t++state->select_end;\n\t\tstb_textedit_clamp(str, state);\n\t\tstate->cursor = state->select_end;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_DOWN:\n\tcase STB_TEXTEDIT_K_DOWN | STB_TEXTEDIT_K_SHIFT: {\n\t\tStbFindState find;\n\t\tStbTexteditRow row;\n\t\tint i, sel = (key & STB_TEXTEDIT_K_SHIFT) != 0;\n\n\t\tif (state->single_line) {\n\t\t\t// on windows, up&down in single-line behave like left&right\n\t\t\tkey = STB_TEXTEDIT_K_RIGHT | (key & STB_TEXTEDIT_K_SHIFT);\n\t\t\tgoto retry;\n\t\t}\n\n\t\tif (sel)\n\t\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\telse if (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_move_to_last(str, state);\n\n\t\t// compute current position of cursor point\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_find_charpos(&find, str, state->cursor, state->single_line);\n\n\t\t// now find character position down a row\n\t\tif (find.length) {\n\t\t\tfloat goal_x = state->has_preferred_x ? state->preferred_x : find.x;\n\t\t\tfloat x;\n\t\t\tint start = find.first_char + find.length;\n\t\t\tstate->cursor = start;\n\t\t\tSTB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor);\n\t\t\tx = row.x0;\n\t\t\tfor (i = 0; i < row.num_chars; ++i) {\n\t\t\t\tfloat dx = STB_TEXTEDIT_GETWIDTH(str, start, i);\n#ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE\n\t\t\t\tif (dx == STB_TEXTEDIT_GETWIDTH_NEWLINE)\n\t\t\t\t\tbreak;\n#endif\n\t\t\t\tx += dx;\n\t\t\t\tif (x > goal_x)\n\t\t\t\t\tbreak;\n\t\t\t\t++state->cursor;\n\t\t\t}\n\t\t\tstb_textedit_clamp(str, state);\n\n\t\t\tstate->has_preferred_x = 1;\n\t\t\tstate->preferred_x = goal_x;\n\n\t\t\tif (sel)\n\t\t\t\tstate->select_end = state->cursor;\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase STB_TEXTEDIT_K_UP:\n\tcase STB_TEXTEDIT_K_UP | STB_TEXTEDIT_K_SHIFT: {\n\t\tStbFindState find;\n\t\tStbTexteditRow row;\n\t\tint i, sel = (key & STB_TEXTEDIT_K_SHIFT) != 0;\n\n\t\tif (state->single_line) {\n\t\t\t// on windows, up&down become left&right\n\t\t\tkey = STB_TEXTEDIT_K_LEFT | (key & STB_TEXTEDIT_K_SHIFT);\n\t\t\tgoto retry;\n\t\t}\n\n\t\tif (sel)\n\t\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\telse if (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_move_to_first(state);\n\n\t\t// compute current position of cursor point\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_find_charpos(&find, str, state->cursor, state->single_line);\n\n\t\t// can only go up if there's a previous row\n\t\tif (find.prev_first != find.first_char) {\n\t\t\t// now find character position up a row\n\t\t\tfloat goal_x = state->has_preferred_x ? state->preferred_x : find.x;\n\t\t\tfloat x;\n\t\t\tstate->cursor = find.prev_first;\n\t\t\tSTB_TEXTEDIT_LAYOUTROW(&row, str, state->cursor);\n\t\t\tx = row.x0;\n\t\t\tfor (i = 0; i < row.num_chars; ++i) {\n\t\t\t\tfloat dx = STB_TEXTEDIT_GETWIDTH(str, find.prev_first, i);\n#ifdef STB_TEXTEDIT_GETWIDTH_NEWLINE\n\t\t\t\tif (dx == STB_TEXTEDIT_GETWIDTH_NEWLINE)\n\t\t\t\t\tbreak;\n#endif\n\t\t\t\tx += dx;\n\t\t\t\tif (x > goal_x)\n\t\t\t\t\tbreak;\n\t\t\t\t++state->cursor;\n\t\t\t}\n\t\t\tstb_textedit_clamp(str, state);\n\n\t\t\tstate->has_preferred_x = 1;\n\t\t\tstate->preferred_x = goal_x;\n\n\t\t\tif (sel)\n\t\t\t\tstate->select_end = state->cursor;\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase STB_TEXTEDIT_K_DELETE:\n\tcase STB_TEXTEDIT_K_DELETE | STB_TEXTEDIT_K_SHIFT:\n\t\tif (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_delete_selection(str, state);\n\t\telse {\n\t\t\tint n = STB_TEXTEDIT_STRINGLEN(str);\n\t\t\tif (state->cursor < n)\n\t\t\t\tstb_textedit_delete(str, state, state->cursor, 1);\n\t\t}\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\tcase STB_TEXTEDIT_K_BACKSPACE:\n\tcase STB_TEXTEDIT_K_BACKSPACE | STB_TEXTEDIT_K_SHIFT:\n\t\tif (STB_TEXT_HAS_SELECTION(state))\n\t\t\tstb_textedit_delete_selection(str, state);\n\t\telse {\n\t\t\tstb_textedit_clamp(str, state);\n\t\t\tif (state->cursor > 0) {\n\t\t\t\tstb_textedit_delete(str, state, state->cursor - 1, 1);\n\t\t\t\t--state->cursor;\n\t\t\t}\n\t\t}\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_K_TEXTSTART2\n\tcase STB_TEXTEDIT_K_TEXTSTART2:\n#endif\n\tcase STB_TEXTEDIT_K_TEXTSTART:\n\t\tstate->cursor = state->select_start = state->select_end = 0;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_K_TEXTEND2\n\tcase STB_TEXTEDIT_K_TEXTEND2:\n#endif\n\tcase STB_TEXTEDIT_K_TEXTEND:\n\t\tstate->cursor = STB_TEXTEDIT_STRINGLEN(str);\n\t\tstate->select_start = state->select_end = 0;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_K_TEXTSTART2\n\tcase STB_TEXTEDIT_K_TEXTSTART2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n\tcase STB_TEXTEDIT_K_TEXTSTART | STB_TEXTEDIT_K_SHIFT:\n\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\tstate->cursor = state->select_end = 0;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_K_TEXTEND2\n\tcase STB_TEXTEDIT_K_TEXTEND2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n\tcase STB_TEXTEDIT_K_TEXTEND | STB_TEXTEDIT_K_SHIFT:\n\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\tstate->cursor = state->select_end = STB_TEXTEDIT_STRINGLEN(str);\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n\n#ifdef STB_TEXTEDIT_K_LINESTART2\n\tcase STB_TEXTEDIT_K_LINESTART2:\n#endif\n\tcase STB_TEXTEDIT_K_LINESTART:\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_move_to_first(state);\n\t\tif (state->single_line)\n\t\t\tstate->cursor = 0;\n\t\telse while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor - 1) != STB_TEXTEDIT_NEWLINE)\n\t\t\t--state->cursor;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_K_LINEEND2\n\tcase STB_TEXTEDIT_K_LINEEND2:\n#endif\n\tcase STB_TEXTEDIT_K_LINEEND: {\n\t\tint n = STB_TEXTEDIT_STRINGLEN(str);\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_move_to_first(state);\n\t\tif (state->single_line)\n\t\t\tstate->cursor = n;\n\t\telse while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE)\n\t\t\t++state->cursor;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\t}\n\n#ifdef STB_TEXTEDIT_K_LINESTART2\n\tcase STB_TEXTEDIT_K_LINESTART2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n\tcase STB_TEXTEDIT_K_LINESTART | STB_TEXTEDIT_K_SHIFT:\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\tif (state->single_line)\n\t\t\tstate->cursor = 0;\n\t\telse while (state->cursor > 0 && STB_TEXTEDIT_GETCHAR(str, state->cursor - 1) != STB_TEXTEDIT_NEWLINE)\n\t\t\t--state->cursor;\n\t\tstate->select_end = state->cursor;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\n#ifdef STB_TEXTEDIT_K_LINEEND2\n\tcase STB_TEXTEDIT_K_LINEEND2 | STB_TEXTEDIT_K_SHIFT:\n#endif\n\tcase STB_TEXTEDIT_K_LINEEND | STB_TEXTEDIT_K_SHIFT: {\n\t\tint n = STB_TEXTEDIT_STRINGLEN(str);\n\t\tstb_textedit_clamp(str, state);\n\t\tstb_textedit_prep_selection_at_cursor(state);\n\t\tif (state->single_line)\n\t\t\tstate->cursor = n;\n\t\telse while (state->cursor < n && STB_TEXTEDIT_GETCHAR(str, state->cursor) != STB_TEXTEDIT_NEWLINE)\n\t\t\t++state->cursor;\n\t\tstate->select_end = state->cursor;\n\t\tstate->has_preferred_x = 0;\n\t\tbreak;\n\t}\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// @TODO:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t//    STB_TEXTEDIT_K_PGUP      - move cursor up a page\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t//    STB_TEXTEDIT_K_PGDOWN    - move cursor down a page\n\t}\n}\n\n/////////////////////////////////////////////////////////////////////////////\n//\n//      Undo processing\n//\n// @OPTIMIZE: the undo/redo buffer should be circular\n\nstatic void stb_textedit_flush_redo(StbUndoState *state)\n{\n\tstate->redo_point = STB_TEXTEDIT_UNDOSTATECOUNT;\n\tstate->redo_char_point = STB_TEXTEDIT_UNDOCHARCOUNT;\n}\n\n// discard the oldest entry in the undo list\nstatic void stb_textedit_discard_undo(StbUndoState *state)\n{\n\tif (state->undo_point > 0) {\n\t\t// if the 0th undo state has characters, clean those up\n\t\tif (state->undo_rec[0].char_storage >= 0) {\n\t\t\tint n = state->undo_rec[0].insert_length, i;\n\t\t\t// delete n characters from all other records\n\t\t\tstate->undo_char_point = state->undo_char_point - (short)n;  // vsnet05\n\t\t\tSTB_TEXTEDIT_memmove(state->undo_char, state->undo_char + n, (size_t)((size_t)state->undo_char_point * sizeof(STB_TEXTEDIT_CHARTYPE)));\n\t\t\tfor (i = 0; i < state->undo_point; ++i)\n\t\t\t\tif (state->undo_rec[i].char_storage >= 0)\n\t\t\t\t\tstate->undo_rec[i].char_storage = state->undo_rec[i].char_storage - (short)n; // vsnet05 // @OPTIMIZE: get rid of char_storage and infer it\n\t\t}\n\t\t--state->undo_point;\n\t\tSTB_TEXTEDIT_memmove(state->undo_rec, state->undo_rec + 1, (size_t)((size_t)state->undo_point * sizeof(state->undo_rec[0])));\n\t}\n}\n\n// discard the oldest entry in the redo list--it's bad if this\n// ever happens, but because undo & redo have to store the actual\n// characters in different cases, the redo character buffer can\n// fill up even though the undo buffer didn't\nstatic void stb_textedit_discard_redo(StbUndoState *state)\n{\n\tint k = STB_TEXTEDIT_UNDOSTATECOUNT - 1;\n\n\tif (state->redo_point <= k) {\n\t\t// if the k'th undo state has characters, clean those up\n\t\tif (state->undo_rec[k].char_storage >= 0) {\n\t\t\tint n = state->undo_rec[k].insert_length, i;\n\t\t\t// delete n characters from all other records\n\t\t\tstate->redo_char_point = state->redo_char_point + (short)n; // vsnet05\n\t\t\tSTB_TEXTEDIT_memmove(state->undo_char + state->redo_char_point, state->undo_char + state->redo_char_point - n, (size_t)((size_t)(STB_TEXTEDIT_UNDOCHARCOUNT - state->redo_char_point) * sizeof(STB_TEXTEDIT_CHARTYPE)));\n\t\t\tfor (i = state->redo_point; i < k; ++i)\n\t\t\t\tif (state->undo_rec[i].char_storage >= 0)\n\t\t\t\t\tstate->undo_rec[i].char_storage = state->undo_rec[i].char_storage + (short)n; // vsnet05\n\t\t}\n\t\tSTB_TEXTEDIT_memmove(state->undo_rec + state->redo_point, state->undo_rec + state->redo_point - 1, (size_t)((size_t)(STB_TEXTEDIT_UNDOSTATECOUNT - state->redo_point) * sizeof(state->undo_rec[0])));\n\t\t++state->redo_point;\n\t}\n}\n\nstatic StbUndoRecord *stb_text_create_undo_record(StbUndoState *state, int numchars)\n{\n\t// any time we create a new undo record, we discard redo\n\tstb_textedit_flush_redo(state);\n\n\t// if we have no free records, we have to make room, by sliding the\n\t// existing records down\n\tif (state->undo_point == STB_TEXTEDIT_UNDOSTATECOUNT)\n\t\tstb_textedit_discard_undo(state);\n\n\t// if the characters to store won't possibly fit in the buffer, we can't undo\n\tif (numchars > STB_TEXTEDIT_UNDOCHARCOUNT) {\n\t\tstate->undo_point = 0;\n\t\tstate->undo_char_point = 0;\n\t\treturn NULL;\n\t}\n\n\t// if we don't have enough free characters in the buffer, we have to make room\n\twhile (state->undo_char_point + numchars > STB_TEXTEDIT_UNDOCHARCOUNT)\n\t\tstb_textedit_discard_undo(state);\n\n\treturn &state->undo_rec[state->undo_point++];\n}\n\nstatic STB_TEXTEDIT_CHARTYPE *stb_text_createundo(StbUndoState *state, int pos, int insert_len, int delete_len)\n{\n\tStbUndoRecord *r = stb_text_create_undo_record(state, insert_len);\n\tif (r == NULL)\n\t\treturn NULL;\n\n\tr->where = pos;\n\tr->insert_length = (short)insert_len;\n\tr->delete_length = (short)delete_len;\n\n\tif (insert_len == 0) {\n\t\tr->char_storage = -1;\n\t\treturn NULL;\n\t}\n\telse {\n\t\tr->char_storage = state->undo_char_point;\n\t\tstate->undo_char_point = state->undo_char_point + (short)insert_len;\n\t\treturn &state->undo_char[r->char_storage];\n\t}\n}\n\nstatic void stb_text_undo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n\tStbUndoState *s = &state->undostate;\n\tStbUndoRecord u, *r;\n\tif (s->undo_point == 0)\n\t\treturn;\n\n\t// we need to do two things: apply the undo record, and create a redo record\n\tu = s->undo_rec[s->undo_point - 1];\n\tr = &s->undo_rec[s->redo_point - 1];\n\tr->char_storage = -1;\n\n\tr->insert_length = u.delete_length;\n\tr->delete_length = u.insert_length;\n\tr->where = u.where;\n\n\tif (u.delete_length) {\n\t\t// if the undo record says to delete characters, then the redo record will\n\t\t// need to re-insert the characters that get deleted, so we need to store\n\t\t// them.\n\n\t\t// there are three cases:\n\t\t//    there's enough room to store the characters\n\t\t//    characters stored for *redoing* don't leave room for redo\n\t\t//    characters stored for *undoing* don't leave room for redo\n\t\t// if the last is true, we have to bail\n\n\t\tif (s->undo_char_point + u.delete_length >= STB_TEXTEDIT_UNDOCHARCOUNT) {\n\t\t\t// the undo records take up too much character space; there's no space to store the redo characters\n\t\t\tr->insert_length = 0;\n\t\t}\n\t\telse {\n\t\t\tint i;\n\n\t\t\t// there's definitely room to store the characters eventually\n\t\t\twhile (s->undo_char_point + u.delete_length > s->redo_char_point) {\n\t\t\t\t// there's currently not enough room, so discard a redo record\n\t\t\t\tstb_textedit_discard_redo(s);\n\t\t\t\t// should never happen:\n\t\t\t\tif (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT)\n\t\t\t\t\treturn;\n\t\t\t}\n\t\t\tr = &s->undo_rec[s->redo_point - 1];\n\n\t\t\tr->char_storage = s->redo_char_point - u.delete_length;\n\t\t\ts->redo_char_point = s->redo_char_point - (short)u.delete_length;\n\n\t\t\t// now save the characters\n\t\t\tfor (i = 0; i < u.delete_length; ++i)\n\t\t\t\ts->undo_char[r->char_storage + i] = STB_TEXTEDIT_GETCHAR(str, u.where + i);\n\t\t}\n\n\t\t// now we can carry out the deletion\n\t\tSTB_TEXTEDIT_DELETECHARS(str, u.where, u.delete_length);\n\t}\n\n\t// check type of recorded action:\n\tif (u.insert_length) {\n\t\t// easy case: was a deletion, so we need to insert n characters\n\t\tSTB_TEXTEDIT_INSERTCHARS(str, u.where, &s->undo_char[u.char_storage], u.insert_length);\n\t\ts->undo_char_point -= u.insert_length;\n\t}\n\n\tstate->cursor = u.where + u.insert_length;\n\n\ts->undo_point--;\n\ts->redo_point--;\n}\n\nstatic void stb_text_redo(STB_TEXTEDIT_STRING *str, STB_TexteditState *state)\n{\n\tStbUndoState *s = &state->undostate;\n\tStbUndoRecord *u, r;\n\tif (s->redo_point == STB_TEXTEDIT_UNDOSTATECOUNT)\n\t\treturn;\n\n\t// we need to do two things: apply the redo record, and create an undo record\n\tu = &s->undo_rec[s->undo_point];\n\tr = s->undo_rec[s->redo_point];\n\n\t// we KNOW there must be room for the undo record, because the redo record\n\t// was derived from an undo record\n\n\tu->delete_length = r.insert_length;\n\tu->insert_length = r.delete_length;\n\tu->where = r.where;\n\tu->char_storage = -1;\n\n\tif (r.delete_length) {\n\t\t// the redo record requires us to delete characters, so the undo record\n\t\t// needs to store the characters\n\n\t\tif (s->undo_char_point + u->insert_length > s->redo_char_point) {\n\t\t\tu->insert_length = 0;\n\t\t\tu->delete_length = 0;\n\t\t}\n\t\telse {\n\t\t\tint i;\n\t\t\tu->char_storage = s->undo_char_point;\n\t\t\ts->undo_char_point = s->undo_char_point + u->insert_length;\n\n\t\t\t// now save the characters\n\t\t\tfor (i = 0; i < u->insert_length; ++i)\n\t\t\t\ts->undo_char[u->char_storage + i] = STB_TEXTEDIT_GETCHAR(str, u->where + i);\n\t\t}\n\n\t\tSTB_TEXTEDIT_DELETECHARS(str, r.where, r.delete_length);\n\t}\n\n\tif (r.insert_length) {\n\t\t// easy case: need to insert n characters\n\t\tSTB_TEXTEDIT_INSERTCHARS(str, r.where, &s->undo_char[r.char_storage], r.insert_length);\n\t\ts->redo_char_point += r.insert_length;\n\t}\n\n\tstate->cursor = r.where + r.insert_length;\n\n\ts->undo_point++;\n\ts->redo_point++;\n}\n\nstatic void stb_text_makeundo_insert(STB_TexteditState *state, int where, int length)\n{\n\tstb_text_createundo(&state->undostate, where, 0, length);\n}\n\nstatic void stb_text_makeundo_delete(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int length)\n{\n\tint i;\n\tSTB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, length, 0);\n\tif (p) {\n\t\tfor (i = 0; i < length; ++i)\n\t\t\tp[i] = STB_TEXTEDIT_GETCHAR(str, where + i);\n\t}\n}\n\nstatic void stb_text_makeundo_replace(STB_TEXTEDIT_STRING *str, STB_TexteditState *state, int where, int old_length, int new_length)\n{\n\tint i;\n\tSTB_TEXTEDIT_CHARTYPE *p = stb_text_createundo(&state->undostate, where, old_length, new_length);\n\tif (p) {\n\t\tfor (i = 0; i < old_length; ++i)\n\t\t\tp[i] = STB_TEXTEDIT_GETCHAR(str, where + i);\n\t}\n}\n\n// reset the state to default\nstatic void stb_textedit_clear_state(STB_TexteditState *state, int is_single_line)\n{\n\tstate->undostate.undo_point = 0;\n\tstate->undostate.undo_char_point = 0;\n\tstate->undostate.redo_point = STB_TEXTEDIT_UNDOSTATECOUNT;\n\tstate->undostate.redo_char_point = STB_TEXTEDIT_UNDOCHARCOUNT;\n\tstate->select_end = state->select_start = 0;\n\tstate->cursor = 0;\n\tstate->has_preferred_x = 0;\n\tstate->preferred_x = 0;\n\tstate->cursor_at_end_of_line = 0;\n\tstate->initialized = 1;\n\tstate->single_line = (unsigned char)is_single_line;\n\tstate->insert_mode = 0;\n}\n\n// API initialize\nstatic void stb_textedit_initialize_state(STB_TexteditState *state, int is_single_line)\n{\n\tstb_textedit_clear_state(state, is_single_line);\n}\n#endif//STB_TEXTEDIT_IMPLEMENTATION\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/imgui/stb_truetype.h",
    "content": "/*\n\nVisual#9999, Updated by bunyip24#9999 \n*/\n// stb_truetype.h - v1.14 - public domain\n// authored from 2009-2016 by Sean Barrett / RAD Game Tools\n//\n//   This library processes TrueType files:\n//        parse files\n//        extract glyph metrics\n//        extract glyph shapes\n//        render glyphs to one-channel bitmaps with antialiasing (box filter)\n//\n//   Todo:\n//        non-MS cmaps\n//        crashproof on bad data\n//        hinting? (no longer patented)\n//        cleartype-style AA?\n//        optimize: use simple memory allocator for intermediates\n//        optimize: build edge-list directly from curves\n//        optimize: rasterize directly from curves?\n//\n// ADDITIONAL CONTRIBUTORS\n//\n//   Mikko Mononen: compound shape support, more cmap formats\n//   Tor Andersson: kerning, subpixel rendering\n//   Dougall Johnson: OpenType / Type 2 font handling\n//\n//   Misc other:\n//       Ryan Gordon\n//       Simon Glass\n//       github:IntellectualKitty\n//\n//   Bug/warning reports/fixes:\n//       \"Zer\" on mollyrocket (with fix)\n//       Cass Everitt\n//       stoiko (Haemimont Games)\n//       Brian Hook \n//       Walter van Niftrik\n//       David Gow\n//       David Given\n//       Ivan-Assen Ivanov\n//       Anthony Pesch\n//       Johan Duparc\n//       Hou Qiming\n//       Fabian \"ryg\" Giesen\n//       Martins Mozeiko\n//       Cap Petschulat\n//       Omar Cornut\n//       github:aloucks\n//       Peter LaValle\n//       Sergey Popov\n//       Giumo X. Clanjor\n//       Higor Euripedes\n//       Thomas Fields\n//       Derek Vinyard\n//\n// VERSION HISTORY\n//\n//   1.13 (2017-01-02) support OpenType fonts, certain Apple fonts, num-fonts-in-TTC function\n//   1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual\n//   1.11 (2016-04-02) fix unused-variable warning\n//   1.10 (2016-04-02) user-defined fabs(); rare memory leak; remove duplicate typedef\n//   1.09 (2016-01-16) warning fix; avoid crash on outofmem; use allocation userdata properly\n//   1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges\n//   1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;\n//                     variant PackFontRanges to pack and render in separate phases;\n//                     fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);\n//                     fixed an assert() bug in the new rasterizer\n//                     replace assert() with STBTT_assert() in new rasterizer\n//\n//   Full history can be found at the end of this file.\n//\n// LICENSE\n//\n//   This software is dual-licensed to the public domain and under the following\n//   license: you are granted a perpetual, irrevocable license to copy, modify,\n//   publish, and distribute this file as you see fit.\n//\n// USAGE\n//\n//   Include this file in whatever places neeed to refer to it. In ONE C/C++\n//   file, write:\n//      #define STB_TRUETYPE_IMPLEMENTATION\n//   before the #include of this file. This expands out the actual\n//   implementation into that C/C++ file.\n//\n//   To make the implementation private to the file that generates the implementation,\n//      #define STBTT_STATIC\n//\n//   Simple 3D API (don't ship this, but it's fine for tools and quick start)\n//           stbtt_BakeFontBitmap()               -- bake a font to a bitmap for use as texture\n//           stbtt_GetBakedQuad()                 -- compute quad to draw for a given char\n//\n//   Improved 3D API (more shippable):\n//           #include \"stb_rect_pack.h\"           -- optional, but you really want it\n//           stbtt_PackBegin()\n//           stbtt_PackSetOversample()            -- for improved quality on small fonts\n//           stbtt_PackFontRanges()               -- pack and renders\n//           stbtt_PackEnd()\n//           stbtt_GetPackedQuad()\n//\n//   \"Load\" a font file from a memory buffer (you have to keep the buffer loaded)\n//           stbtt_InitFont()\n//           stbtt_GetFontOffsetForIndex()        -- indexing for TTC font collections\n//           stbtt_GetNumberOfFonts()             -- number of fonts for TTC font collections\n//\n//   Render a unicode codepoint to a bitmap\n//           stbtt_GetCodepointBitmap()           -- allocates and returns a bitmap\n//           stbtt_MakeCodepointBitmap()          -- renders into bitmap you provide\n//           stbtt_GetCodepointBitmapBox()        -- how big the bitmap must be\n//\n//   Character advance/positioning\n//           stbtt_GetCodepointHMetrics()\n//           stbtt_GetFontVMetrics()\n//           stbtt_GetCodepointKernAdvance()\n//\n//   Starting with version 1.06, the rasterizer was replaced with a new,\n//   faster and generally-more-precise rasterizer. The new rasterizer more\n//   accurately measures pixel coverage for anti-aliasing, except in the case\n//   where multiple shapes overlap, in which case it overestimates the AA pixel\n//   coverage. Thus, anti-aliasing of intersecting shapes may look wrong. If\n//   this turns out to be a problem, you can re-enable the old rasterizer with\n//        #define STBTT_RASTERIZER_VERSION 1\n//   which will incur about a 15% speed hit.\n//\n// ADDITIONAL DOCUMENTATION\n//\n//   Immediately after this block comment are a series of sample programs.\n//\n//   After the sample programs is the \"header file\" section. This section\n//   includes documentation for each API function.\n//\n//   Some important concepts to understand to use this library:\n//\n//      Codepoint\n//         Characters are defined by unicode codepoints, e.g. 65 is\n//         uppercase A, 231 is lowercase c with a cedilla, 0x7e30 is\n//         the hiragana for \"ma\".\n//\n//      Glyph\n//         A visual character shape (every codepoint is rendered as\n//         some glyph)\n//\n//      Glyph index\n//         A font-specific integer ID representing a glyph\n//\n//      Baseline\n//         Glyph shapes are defined relative to a baseline, which is the\n//         bottom of uppercase characters. Characters extend both above\n//         and below the baseline.\n//\n//      Current Point\n//         As you draw text to the screen, you keep track of a \"current point\"\n//         which is the origin of each character. The current point's vertical\n//         position is the baseline. Even \"baked fonts\" use this model.\n//\n//      Vertical Font Metrics\n//         The vertical qualities of the font, used to vertically position\n//         and space the characters. See docs for stbtt_GetFontVMetrics.\n//\n//      Font Size in Pixels or Points\n//         The preferred interface for specifying font sizes in stb_truetype\n//         is to specify how tall the font's vertical extent should be in pixels.\n//         If that sounds good enough, skip the next paragraph.\n//\n//         Most font APIs instead use \"points\", which are a common typographic\n//         measurement for describing font size, defined as 72 points per inch.\n//         stb_truetype provides a point API for compatibility. However, true\n//         \"per inch\" conventions don't make much sense on computer displays\n//         since they different monitors have different number of pixels per\n//         inch. For example, Windows traditionally uses a convention that\n//         there are 96 pixels per inch, thus making 'inch' measurements have\n//         nothing to do with inches, and thus effectively defining a point to\n//         be 1.333 pixels. Additionally, the TrueType font data provides\n//         an explicit scale factor to scale a given font's glyphs to points,\n//         but the author has observed that this scale factor is often wrong\n//         for non-commercial fonts, thus making fonts scaled in points\n//         according to the TrueType spec incoherently sized in practice.\n//\n// ADVANCED USAGE\n//\n//   Quality:\n//\n//    - Use the functions with Subpixel at the end to allow your characters\n//      to have subpixel positioning. Since the font is anti-aliased, not\n//      hinted, this is very import for quality. (This is not possible with\n//      baked fonts.)\n//\n//    - Kerning is now supported, and if you're supporting subpixel rendering\n//      then kerning is worth using to give your text a polished look.\n//\n//   Performance:\n//\n//    - Convert Unicode codepoints to glyph indexes and operate on the glyphs;\n//      if you don't do this, stb_truetype is forced to do the conversion on\n//      every call.\n//\n//    - There are a lot of memory allocations. We should modify it to take\n//      a temp buffer and allocate from the temp buffer (without freeing),\n//      should help performance a lot.\n//\n// NOTES\n//\n//   The system uses the raw data found in the .ttf file without changing it\n//   and without building auxiliary data structures. This is a bit inefficient\n//   on little-endian systems (the data is big-endian), but assuming you're\n//   caching the bitmaps or glyph shapes this shouldn't be a big deal.\n//\n//   It appears to be very hard to programmatically determine what font a\n//   given file is in a general way. I provide an API for this, but I don't\n//   recommend it.\n//\n//\n// SOURCE STATISTICS (based on v0.6c, 2050 LOC)\n//\n//   Documentation & header file        520 LOC  \\___ 660 LOC documentation\n//   Sample code                        140 LOC  /\n//   Truetype parsing                   620 LOC  ---- 620 LOC TrueType\n//   Software rasterization             240 LOC  \\                           .\n//   Curve tesselation                  120 LOC   \\__ 550 LOC Bitmap creation\n//   Bitmap management                  100 LOC   /\n//   Baked bitmap interface              70 LOC  /\n//   Font name matching & access        150 LOC  ---- 150 \n//   C runtime library abstraction       60 LOC  ----  60\n//\n//\n// PERFORMANCE MEASUREMENTS FOR 1.06:\n//\n//                      32-bit     64-bit\n//   Previous release:  8.83 s     7.68 s\n//   Pool allocations:  7.72 s     6.34 s\n//   Inline sort     :  6.54 s     5.65 s\n//   New rasterizer  :  5.63 s     5.00 s\n\n//////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////\n////\n////  SAMPLE PROGRAMS\n////\n//\n//  Incomplete text-in-3d-api example, which draws quads properly aligned to be lossless\n//\n#if 0\n#define STB_TRUETYPE_IMPLEMENTATION  // force following include to generate implementation\n#include \"stb_truetype.h\"\n\nunsigned char ttf_buffer[1 << 20];\nunsigned char temp_bitmap[512 * 512];\n\nstbtt_bakedchar cdata[96]; // ASCII 32..126 is 95 glyphs\nGLuint ftex;\n\nvoid my_stbtt_initfont(void)\n{\n\tfread(ttf_buffer, 1, 1 << 20, fopen(\"c:/windows/fonts/times.ttf\", \"rb\"));\n\tstbtt_BakeFontBitmap(ttf_buffer, 0, 32.0, temp_bitmap, 512, 512, 32, 96, cdata); // no guarantee this fits!\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t // can free ttf_buffer at this point\n\tglGenTextures(1, &ftex);\n\tglBindTexture(GL_TEXTURE_2D, ftex);\n\tglTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, 512, 512, 0, GL_ALPHA, GL_UNSIGNED_BYTE, temp_bitmap);\n\t// can free temp_bitmap at this point\n\tglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);\n}\n\nvoid my_stbtt_print(float x, float y, char *text)\n{\n\t// assume orthographic projection with units = screen pixels, origin at top left\n\tglEnable(GL_TEXTURE_2D);\n\tglBindTexture(GL_TEXTURE_2D, ftex);\n\tglBegin(GL_QUADS);\n\twhile (*text) {\n\t\tif (*text >= 32 && *text < 128) {\n\t\t\tstbtt_aligned_quad q;\n\t\t\tstbtt_GetBakedQuad(cdata, 512, 512, *text - 32, &x, &y, &q, 1);//1=opengl & d3d10+,0=d3d9\n\t\t\tglTexCoord2f(q.s0, q.t1); glVertex2f(q.x0, q.y0);\n\t\t\tglTexCoord2f(q.s1, q.t1); glVertex2f(q.x1, q.y0);\n\t\t\tglTexCoord2f(q.s1, q.t0); glVertex2f(q.x1, q.y1);\n\t\t\tglTexCoord2f(q.s0, q.t0); glVertex2f(q.x0, q.y1);\n\t\t}\n\t\t++text;\n\t}\n\tglEnd();\n}\n#endif\n//\n//\n//////////////////////////////////////////////////////////////////////////////\n//\n// Complete program (this compiles): get a single bitmap, print as ASCII art\n//\n#if 0\n#include <stdio.h>\n#define STB_TRUETYPE_IMPLEMENTATION  // force following include to generate implementation\n#include \"stb_truetype.h\"\n\nchar ttf_buffer[1 << 25];\n\nint main(int argc, char **argv)\n{\n\tstbtt_fontinfo font;\n\tunsigned char *bitmap;\n\tint w, h, i, j, c = (argc > 1 ? atoi(argv[1]) : 'a'), s = (argc > 2 ? atoi(argv[2]) : 20);\n\n\tfread(ttf_buffer, 1, 1 << 25, fopen(argc > 3 ? argv[3] : \"c:/windows/fonts/arialbd.ttf\", \"rb\"));\n\n\tstbtt_InitFont(&font, ttf_buffer, stbtt_GetFontOffsetForIndex(ttf_buffer, 0));\n\tbitmap = stbtt_GetCodepointBitmap(&font, 0, stbtt_ScaleForPixelHeight(&font, s), c, &w, &h, 0, 0);\n\n\tfor (j = 0; j < h; ++j) {\n\t\tfor (i = 0; i < w; ++i)\n\t\t\tputchar(\" .:ioVM@\"[bitmap[j*w + i] >> 5]);\n\t\tputchar('\\n');\n\t}\n\treturn 0;\n}\n#endif \n//\n// Output:\n//\n//     .ii.\n//    @@@@@@.\n//   V@Mio@@o\n//   :i.  V@V\n//     :oM@@M\n//   :@@@MM@M\n//   @@o  o@M\n//  :@@.  M@M\n//   @@@o@@@@\n//   :M@@V:@@.\n//  \n//////////////////////////////////////////////////////////////////////////////\n// \n// Complete program: print \"Hello World!\" banner, with bugs\n//\n#if 0\nchar buffer[24 << 20];\nunsigned char screen[20][79];\n\nint main(int arg, char **argv)\n{\n\tstbtt_fontinfo font;\n\tint i, j, ascent, baseline, ch = 0;\n\tfloat scale, xpos = 2; // leave a little padding in case the character extends left\n\tchar *text = \"Heljo World!\"; // intentionally misspelled to show 'lj' brokenness\n\n\tfread(buffer, 1, 1000000, fopen(\"c:/windows/fonts/arialbd.ttf\", \"rb\"));\n\tstbtt_InitFont(&font, buffer, 0);\n\n\tscale = stbtt_ScaleForPixelHeight(&font, 15);\n\tstbtt_GetFontVMetrics(&font, &ascent, 0, 0);\n\tbaseline = (int)(ascent*scale);\n\n\twhile (text[ch]) {\n\t\tint advance, lsb, x0, y0, x1, y1;\n\t\tfloat x_shift = xpos - (float)floor(xpos);\n\t\tstbtt_GetCodepointHMetrics(&font, text[ch], &advance, &lsb);\n\t\tstbtt_GetCodepointBitmapBoxSubpixel(&font, text[ch], scale, scale, x_shift, 0, &x0, &y0, &x1, &y1);\n\t\tstbtt_MakeCodepointBitmapSubpixel(&font, &screen[baseline + y0][(int)xpos + x0], x1 - x0, y1 - y0, 79, scale, scale, x_shift, 0, text[ch]);\n\t\t// note that this stomps the old data, so where character boxes overlap (e.g. 'lj') it's wrong\n\t\t// because this API is really for baking character bitmaps into textures. if you want to render\n\t\t// a sequence of characters, you really need to render each bitmap to a temp buffer, then\n\t\t// \"alpha blend\" that into the working buffer\n\t\txpos += (advance * scale);\n\t\tif (text[ch + 1])\n\t\t\txpos += scale*stbtt_GetCodepointKernAdvance(&font, text[ch], text[ch + 1]);\n\t\t++ch;\n\t}\n\n\tfor (j = 0; j < 20; ++j) {\n\t\tfor (i = 0; i < 78; ++i)\n\t\t\tputchar(\" .:ioVM@\"[screen[j][i] >> 5]);\n\t\tputchar('\\n');\n\t}\n\n\treturn 0;\n}\n#endif\n\n\n//////////////////////////////////////////////////////////////////////////////\n//////////////////////////////////////////////////////////////////////////////\n////\n////   INTEGRATION WITH YOUR CODEBASE\n////\n////   The following sections allow you to supply alternate definitions\n////   of C library functions used by stb_truetype.\n\n#ifdef STB_TRUETYPE_IMPLEMENTATION\n// #define your own (u)stbtt_int8/16/32 before including to override this\n#ifndef stbtt_uint8\ntypedef unsigned char   stbtt_uint8;\ntypedef signed   char   stbtt_int8;\ntypedef unsigned short  stbtt_uint16;\ntypedef signed   short  stbtt_int16;\ntypedef unsigned int    stbtt_uint32;\ntypedef signed   int    stbtt_int32;\n#endif\n\ntypedef char stbtt__check_size32[sizeof(stbtt_int32) == 4 ? 1 : -1];\ntypedef char stbtt__check_size16[sizeof(stbtt_int16) == 2 ? 1 : -1];\n\n// #define your own STBTT_ifloor/STBTT_iceil() to avoid math.h\n#ifndef STBTT_ifloor\n#include <math.h>\n#define STBTT_ifloor(x)   ((int) floor(x))\n#define STBTT_iceil(x)    ((int) ceil(x))\n#endif\n\n#ifndef STBTT_sqrt\n#include <math.h>\n#define STBTT_sqrt(x)      sqrt(x)\n#endif\n\n#ifndef STBTT_fabs\n#include <math.h>\n#define STBTT_fabs(x)      fabs(x)\n#endif\n\n// #define your own functions \"STBTT_malloc\" / \"STBTT_free\" to avoid malloc.h\n#ifndef STBTT_malloc\n#include <stdlib.h>\n#define STBTT_malloc(x,u)  ((void)(u),malloc(x))\n#define STBTT_free(x,u)    ((void)(u),free(x))\n#endif\n\n#ifndef STBTT_assert\n#include <assert.h>\n#define STBTT_assert(x)    assert(x)\n#endif\n\n#ifndef STBTT_strlen\n#include <string.h>\n#define STBTT_strlen(x)    strlen(x)\n#endif\n\n#ifndef STBTT_memcpy\n#include <memory.h>\n#define STBTT_memcpy       memcpy\n#define STBTT_memset       memset\n#endif\n#endif\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n////\n////   INTERFACE\n////\n////\n\n#ifndef __STB_INCLUDE_STB_TRUETYPE_H__\n#define __STB_INCLUDE_STB_TRUETYPE_H__\n\n#ifdef STBTT_STATIC\n#define STBTT_DEF static\n#else\n#define STBTT_DEF extern\n#endif\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n\t// private structure\n\ttypedef struct\n\t{\n\t\tunsigned char *data;\n\t\tint cursor;\n\t\tint size;\n\t} stbtt__buf;\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// TEXTURE BAKING API\n\t//\n\t// If you use this API, you only have to call two functions ever.\n\t//\n\n\ttypedef struct\n\t{\n\t\tunsigned short x0, y0, x1, y1; // coordinates of bbox in bitmap\n\t\tfloat xoff, yoff, xadvance;\n\t} stbtt_bakedchar;\n\n\tSTBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,  // font location (use offset=0 for plain .ttf)\n\t\tfloat pixel_height,                     // height of font in pixels\n\t\tunsigned char *pixels, int pw, int ph,  // bitmap to be filled in\n\t\tint first_char, int num_chars,          // characters to bake\n\t\tstbtt_bakedchar *chardata);             // you allocate this, it's num_chars long\n\t\t\t\t\t\t\t\t\t\t\t\t// if return is positive, the first unused row of the bitmap\n\t\t\t\t\t\t\t\t\t\t\t\t// if return is negative, returns the negative of the number of characters that fit\n\t\t\t\t\t\t\t\t\t\t\t\t// if return is 0, no characters fit and no rows were used\n\t\t\t\t\t\t\t\t\t\t\t\t// This uses a very crappy packing.\n\n\ttypedef struct\n\t{\n\t\tfloat x0, y0, s0, t0; // top-left\n\t\tfloat x1, y1, s1, t1; // bottom-right\n\t} stbtt_aligned_quad;\n\n\tSTBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph,  // same data as above\n\t\tint char_index,             // character to display\n\t\tfloat *xpos, float *ypos,   // pointers to current position in screen pixel space\n\t\tstbtt_aligned_quad *q,      // output: quad to draw\n\t\tint opengl_fillrule);       // true if opengl fill rule; false if DX9 or earlier\n\t\t\t\t\t\t\t\t\t// Call GetBakedQuad with char_index = 'character - first_char', and it\n\t\t\t\t\t\t\t\t\t// creates the quad you need to draw and advances the current position.\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t// The coordinate system used assumes y increases downwards.\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t// Characters will extend both above and below the current position;\n\t\t\t\t\t\t\t\t\t// see discussion of \"BASELINE\" above.\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t// It's inefficient; you might want to c&p it and optimize it.\n\n\n\n\t\t\t\t\t\t\t\t\t//////////////////////////////////////////////////////////////////////////////\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t// NEW TEXTURE BAKING API\n\t\t\t\t\t\t\t\t\t//\n\t\t\t\t\t\t\t\t\t// This provides options for packing multiple fonts into one atlas, not\n\t\t\t\t\t\t\t\t\t// perfectly but better than nothing.\n\n\ttypedef struct\n\t{\n\t\tunsigned short x0, y0, x1, y1; // coordinates of bbox in bitmap\n\t\tfloat xoff, yoff, xadvance;\n\t\tfloat xoff2, yoff2;\n\t} stbtt_packedchar;\n\n\ttypedef struct stbtt_pack_context stbtt_pack_context;\n\ttypedef struct stbtt_fontinfo stbtt_fontinfo;\n#ifndef STB_RECT_PACK_VERSION\n\ttypedef struct stbrp_rect stbrp_rect;\n#endif\n\n\tSTBTT_DEF int  stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int width, int height, int stride_in_bytes, int padding, void *alloc_context);\n\t// Initializes a packing context stored in the passed-in stbtt_pack_context.\n\t// Future calls using this context will pack characters into the bitmap passed\n\t// in here: a 1-channel bitmap that is width * height. stride_in_bytes is\n\t// the distance from one row to the next (or 0 to mean they are packed tightly\n\t// together). \"padding\" is the amount of padding to leave between each\n\t// character (normally you want '1' for bitmaps you'll use as textures with\n\t// bilinear filtering).\n\t//\n\t// Returns 0 on failure, 1 on success.\n\n\tSTBTT_DEF void stbtt_PackEnd(stbtt_pack_context *spc);\n\t// Cleans up the packing context and frees all memory.\n\n#define STBTT_POINT_SIZE(x)   (-(x))\n\n\tSTBTT_DEF int  stbtt_PackFontRange(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, float font_size,\n\t\tint first_unicode_char_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range);\n\t// Creates character bitmaps from the font_index'th font found in fontdata (use\n\t// font_index=0 if you don't know what that is). It creates num_chars_in_range\n\t// bitmaps for characters with unicode values starting at first_unicode_char_in_range\n\t// and increasing. Data for how to render them is stored in chardata_for_range;\n\t// pass these to stbtt_GetPackedQuad to get back renderable quads.\n\t//\n\t// font_size is the full height of the character from ascender to descender,\n\t// as computed by stbtt_ScaleForPixelHeight. To use a point size as computed\n\t// by stbtt_ScaleForMappingEmToPixels, wrap the point size in STBTT_POINT_SIZE()\n\t// and pass that result as 'font_size':\n\t//       ...,                  20 , ... // font max minus min y is 20 pixels tall\n\t//       ..., STBTT_POINT_SIZE(20), ... // 'M' is 20 pixels tall\n\n\ttypedef struct\n\t{\n\t\tfloat font_size;\n\t\tint first_unicode_codepoint_in_range;  // if non-zero, then the chars are continuous, and this is the first codepoint\n\t\tint *array_of_unicode_codepoints;       // if non-zero, then this is an array of unicode codepoints\n\t\tint num_chars;\n\t\tstbtt_packedchar *chardata_for_range; // output\n\t\tunsigned char h_oversample, v_oversample; // don't set these, they're used internally\n\t} stbtt_pack_range;\n\n\tSTBTT_DEF int  stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges);\n\t// Creates character bitmaps from multiple ranges of characters stored in\n\t// ranges. This will usually create a better-packed bitmap than multiple\n\t// calls to stbtt_PackFontRange. Note that you can call this multiple\n\t// times within a single PackBegin/PackEnd.\n\n\tSTBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample);\n\t// Oversampling a font increases the quality by allowing higher-quality subpixel\n\t// positioning, and is especially valuable at smaller text sizes.\n\t//\n\t// This function sets the amount of oversampling for all following calls to\n\t// stbtt_PackFontRange(s) or stbtt_PackFontRangesGatherRects for a given\n\t// pack context. The default (no oversampling) is achieved by h_oversample=1\n\t// and v_oversample=1. The total number of pixels required is\n\t// h_oversample*v_oversample larger than the default; for example, 2x2\n\t// oversampling requires 4x the storage of 1x1. For best results, render\n\t// oversampled textures with bilinear filtering. Look at the readme in\n\t// stb/tests/oversample for information about oversampled fonts\n\t//\n\t// To use with PackFontRangesGather etc., you must set it before calls\n\t// call to PackFontRangesGatherRects.\n\n\tSTBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph,  // same data as above\n\t\tint char_index,             // character to display\n\t\tfloat *xpos, float *ypos,   // pointers to current position in screen pixel space\n\t\tstbtt_aligned_quad *q,      // output: quad to draw\n\t\tint align_to_integer);\n\n\tSTBTT_DEF int  stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);\n\tSTBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects);\n\tSTBTT_DEF int  stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects);\n\t// Calling these functions in sequence is roughly equivalent to calling\n\t// stbtt_PackFontRanges(). If you more control over the packing of multiple\n\t// fonts, or if you want to pack custom data into a font texture, take a look\n\t// at the source to of stbtt_PackFontRanges() and create a custom version \n\t// using these functions, e.g. call GatherRects multiple times,\n\t// building up a single array of rects, then call PackRects once,\n\t// then call RenderIntoRects repeatedly. This may result in a\n\t// better packing than calling PackFontRanges multiple times\n\t// (or it may not).\n\n\t// this is an opaque structure that you shouldn't mess with which holds\n\t// all the context needed from PackBegin to PackEnd.\n\tstruct stbtt_pack_context {\n\t\tvoid *user_allocator_context;\n\t\tvoid *pack_info;\n\t\tint   width;\n\t\tint   height;\n\t\tint   stride_in_bytes;\n\t\tint   padding;\n\t\tunsigned int   h_oversample, v_oversample;\n\t\tunsigned char *pixels;\n\t\tvoid  *nodes;\n\t};\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// FONT LOADING\n\t//\n\t//\n\n\tSTBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data);\n\t// This function will determine the number of fonts in a font file.  TrueType\n\t// collection (.ttc) files may contain multiple fonts, while TrueType font\n\t// (.ttf) files only contain one font. The number of fonts can be used for\n\t// indexing with the previous function where the index is between zero and one\n\t// less than the total fonts. If an error occurs, -1 is returned.\n\n\tSTBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index);\n\t// Each .ttf/.ttc file may have more than one font. Each font has a sequential\n\t// index number starting from 0. Call this function to get the font offset for\n\t// a given index; it returns -1 if the index is out of range. A regular .ttf\n\t// file will only define one font and it always be at offset 0, so it will\n\t// return '0' for index 0, and -1 for all other indices.\n\n\t// The following structure is defined publically so you can declare one on\n\t// the stack or as a global or etc, but you should treat it as opaque.\n\tstruct stbtt_fontinfo\n\t{\n\t\tvoid           * userdata;\n\t\tunsigned char  * data;              // pointer to .ttf file\n\t\tint              fontstart;         // offset of start of font\n\n\t\tint numGlyphs;                     // number of glyphs, needed for range checking\n\n\t\tint loca, head, glyf, hhea, hmtx, kern; // table locations as offset from start of .ttf\n\t\tint index_map;                     // a cmap mapping for our chosen character encoding\n\t\tint indexToLocFormat;              // format needed to map from glyph index to glyph\n\n\t\tstbtt__buf cff;                    // cff font data\n\t\tstbtt__buf charstrings;            // the charstring index\n\t\tstbtt__buf gsubrs;                 // global charstring subroutines index\n\t\tstbtt__buf subrs;                  // private charstring subroutines index\n\t\tstbtt__buf fontdicts;              // array of font dicts\n\t\tstbtt__buf fdselect;               // map from glyph to fontdict\n\t};\n\n\tSTBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset);\n\t// Given an offset into the file that defines a font, this function builds\n\t// the necessary cached info for the rest of the system. You must allocate\n\t// the stbtt_fontinfo yourself, and stbtt_InitFont will fill it out. You don't\n\t// need to do anything special to free it, because the contents are pure\n\t// value data with no additional data structures. Returns 0 on failure.\n\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// CHARACTER TO GLYPH-INDEX CONVERSIOn\n\n\tSTBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint);\n\t// If you're going to perform multiple operations on the same character\n\t// and you want a speed-up, call this function with the character you're\n\t// going to process, then use glyph-based functions instead of the\n\t// codepoint-based functions.\n\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// CHARACTER PROPERTIES\n\t//\n\n\tSTBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float pixels);\n\t// computes a scale factor to produce a font whose \"height\" is 'pixels' tall.\n\t// Height is measured as the distance from the highest ascender to the lowest\n\t// descender; in other words, it's equivalent to calling stbtt_GetFontVMetrics\n\t// and computing:\n\t//       scale = pixels / (ascent - descent)\n\t// so if you prefer to measure height by the ascent only, use a similar calculation.\n\n\tSTBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels);\n\t// computes a scale factor to produce a font whose EM size is mapped to\n\t// 'pixels' tall. This is probably what traditional APIs compute, but\n\t// I'm not positive.\n\n\tSTBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap);\n\t// ascent is the coordinate above the baseline the font extends; descent\n\t// is the coordinate below the baseline the font extends (i.e. it is typically negative)\n\t// lineGap is the spacing between one row's descent and the next row's ascent...\n\t// so you should advance the vertical position by \"*ascent - *descent + *lineGap\"\n\t//   these are expressed in unscaled coordinates, so you must multiply by\n\t//   the scale factor for a given size\n\n\tSTBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1);\n\t// the bounding box around all possible characters\n\n\tSTBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing);\n\t// leftSideBearing is the offset from the current horizontal position to the left edge of the character\n\t// advanceWidth is the offset from the current horizontal position to the next horizontal position\n\t//   these are expressed in unscaled coordinates\n\n\tSTBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2);\n\t// an additional amount to add to the 'advance' value between ch1 and ch2\n\n\tSTBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1);\n\t// Gets the bounding box of the visible part of the glyph, in unscaled coordinates\n\n\tSTBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing);\n\tSTBTT_DEF int  stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2);\n\tSTBTT_DEF int  stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1);\n\t// as above, but takes one or more glyph indices for greater efficiency\n\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// GLYPH SHAPES (you probably don't need these, but they have to go before\n\t// the bitmaps for C declaration-order reasons)\n\t//\n\n#ifndef STBTT_vmove // you can predefine these to use different values (but why?)\n\tenum {\n\t\tSTBTT_vmove = 1,\n\t\tSTBTT_vline,\n\t\tSTBTT_vcurve,\n\t\tSTBTT_vcubic\n\t};\n#endif\n\n#ifndef stbtt_vertex // you can predefine this to use different values\n\t// (we share this with other code at RAD)\n#define stbtt_vertex_type short // can't use stbtt_int16 because that's not visible in the header file\n\ttypedef struct\n\t{\n\t\tstbtt_vertex_type x, y, cx, cy, cx1, cy1;\n\t\tunsigned char type, padding;\n\t} stbtt_vertex;\n#endif\n\n\tSTBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index);\n\t// returns non-zero if nothing is drawn for this glyph\n\n\tSTBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices);\n\tSTBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **vertices);\n\t// returns # of vertices and fills *vertices with the pointer to them\n\t//   these are expressed in \"unscaled\" coordinates\n\t//\n\t// The shape is a series of countours. Each one starts with\n\t// a STBTT_moveto, then consists of a series of mixed\n\t// STBTT_lineto and STBTT_curveto segments. A lineto\n\t// draws a line from previous endpoint to its x,y; a curveto\n\t// draws a quadratic bezier from previous endpoint to\n\t// its x,y, using cx,cy as the bezier control point.\n\n\tSTBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *vertices);\n\t// frees the data allocated above\n\n\t//////////////////////////////////////////////////////////////////////////////\n\t//\n\t// BITMAP RENDERING\n\t//\n\n\tSTBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata);\n\t// frees the bitmap allocated below\n\n\tSTBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff);\n\t// allocates a large-enough single-channel 8bpp bitmap and renders the\n\t// specified character/glyph at the specified scale into it, with\n\t// antialiasing. 0 is no coverage (transparent), 255 is fully covered (opaque).\n\t// *width & *height are filled out with the width & height of the bitmap,\n\t// which is stored left-to-right, top-to-bottom.\n\t//\n\t// xoff/yoff are the offset it pixel space from the glyph origin to the top-left of the bitmap\n\n\tSTBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff);\n\t// the same as stbtt_GetCodepoitnBitmap, but you can specify a subpixel\n\t// shift for the character\n\n\tSTBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint);\n\t// the same as stbtt_GetCodepointBitmap, but you pass in storage for the bitmap\n\t// in the form of 'output', with row spacing of 'out_stride' bytes. the bitmap\n\t// is clipped to out_w/out_h bytes. Call stbtt_GetCodepointBitmapBox to get the\n\t// width and height and positioning info for it first.\n\n\tSTBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint);\n\t// same as stbtt_MakeCodepointBitmap, but you can specify a subpixel\n\t// shift for the character\n\n\tSTBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);\n\t// get the bbox of the bitmap centered around the glyph origin; so the\n\t// bitmap width is ix1-ix0, height is iy1-iy0, and location to place\n\t// the bitmap top left is (leftSideBearing*scale,iy0).\n\t// (Note that the bitmap uses y-increases-down, but the shape uses\n\t// y-increases-up, so CodepointBitmapBox and CodepointBox are inverted.)\n\n\tSTBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1);\n\t// same as stbtt_GetCodepointBitmapBox, but you can specify a subpixel\n\t// shift for the character\n\n\t// the following functions are equivalent to the above functions, but operate\n\t// on glyph indices instead of Unicode codepoints (for efficiency)\n\tSTBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff);\n\tSTBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff);\n\tSTBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph);\n\tSTBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph);\n\tSTBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1);\n\tSTBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1);\n\n\n\t// @TODO: don't expose this structure\n\ttypedef struct\n\t{\n\t\tint w, h, stride;\n\t\tunsigned char *pixels;\n\t} stbtt__bitmap;\n\n\t// rasterize a shape with quadratic beziers into a bitmap\n\tSTBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result,        // 1-channel bitmap to draw into\n\t\tfloat flatness_in_pixels,     // allowable error of curve in pixels\n\t\tstbtt_vertex *vertices,       // array of vertices defining shape\n\t\tint num_verts,                // number of vertices in above array\n\t\tfloat scale_x, float scale_y, // scale applied to input vertices\n\t\tfloat shift_x, float shift_y, // translation applied to input vertices\n\t\tint x_off, int y_off,         // another translation applied to input\n\t\tint invert,                   // if non-zero, vertically flip shape\n\t\tvoid *userdata);              // context for to STBTT_MALLOC\n\n\t\t\t\t\t\t\t\t\t  //////////////////////////////////////////////////////////////////////////////\n\t\t\t\t\t\t\t\t\t  //\n\t\t\t\t\t\t\t\t\t  // Finding the right font...\n\t\t\t\t\t\t\t\t\t  //\n\t\t\t\t\t\t\t\t\t  // You should really just solve this offline, keep your own tables\n\t\t\t\t\t\t\t\t\t  // of what font is what, and don't try to get it out of the .ttf file.\n\t\t\t\t\t\t\t\t\t  // That's because getting it out of the .ttf file is really hard, because\n\t\t\t\t\t\t\t\t\t  // the names in the file can appear in many possible encodings, in many\n\t\t\t\t\t\t\t\t\t  // possible languages, and e.g. if you need a case-insensitive comparison,\n\t\t\t\t\t\t\t\t\t  // the details of that depend on the encoding & language in a complex way\n\t\t\t\t\t\t\t\t\t  // (actually underspecified in truetype, but also gigantic).\n\t\t\t\t\t\t\t\t\t  //\n\t\t\t\t\t\t\t\t\t  // But you can use the provided functions in two possible ways:\n\t\t\t\t\t\t\t\t\t  //     stbtt_FindMatchingFont() will use *case-sensitive* comparisons on\n\t\t\t\t\t\t\t\t\t  //             unicode-encoded names to try to find the font you want;\n\t\t\t\t\t\t\t\t\t  //             you can run this before calling stbtt_InitFont()\n\t\t\t\t\t\t\t\t\t  //\n\t\t\t\t\t\t\t\t\t  //     stbtt_GetFontNameString() lets you get any of the various strings\n\t\t\t\t\t\t\t\t\t  //             from the file yourself and do your own comparisons on them.\n\t\t\t\t\t\t\t\t\t  //             You have to have called stbtt_InitFont() first.\n\n\n\tSTBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags);\n\t// returns the offset (not index) of the font that matches, or -1 if none\n\t//   if you use STBTT_MACSTYLE_DONTCARE, use a font name like \"Arial Bold\".\n\t//   if you use any other flag, use a font name like \"Arial\"; this checks\n\t//     the 'macStyle' header field; i don't know if fonts set this consistently\n#define STBTT_MACSTYLE_DONTCARE     0\n#define STBTT_MACSTYLE_BOLD         1\n#define STBTT_MACSTYLE_ITALIC       2\n#define STBTT_MACSTYLE_UNDERSCORE   4\n#define STBTT_MACSTYLE_NONE         8   // <= not same as 0, this makes us check the bitfield is 0\n\n\tSTBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2);\n\t// returns 1/0 whether the first string interpreted as utf8 is identical to\n\t// the second string interpreted as big-endian utf16... useful for strings from next func\n\n\tSTBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID);\n\t// returns the string (which may be big-endian double byte, e.g. for unicode)\n\t// and puts the length in bytes in *length.\n\t//\n\t// some of the values for the IDs are below; for more see the truetype spec:\n\t//     http://developer.apple.com/textfonts/TTRefMan/RM06/Chap6name.html\n\t//     http://www.microsoft.com/typography/otspec/name.htm\n\n\tenum { // platformID\n\t\tSTBTT_PLATFORM_ID_UNICODE = 0,\n\t\tSTBTT_PLATFORM_ID_MAC = 1,\n\t\tSTBTT_PLATFORM_ID_ISO = 2,\n\t\tSTBTT_PLATFORM_ID_MICROSOFT = 3\n\t};\n\n\tenum { // encodingID for STBTT_PLATFORM_ID_UNICODE\n\t\tSTBTT_UNICODE_EID_UNICODE_1_0 = 0,\n\t\tSTBTT_UNICODE_EID_UNICODE_1_1 = 1,\n\t\tSTBTT_UNICODE_EID_ISO_10646 = 2,\n\t\tSTBTT_UNICODE_EID_UNICODE_2_0_BMP = 3,\n\t\tSTBTT_UNICODE_EID_UNICODE_2_0_FULL = 4\n\t};\n\n\tenum { // encodingID for STBTT_PLATFORM_ID_MICROSOFT\n\t\tSTBTT_MS_EID_SYMBOL = 0,\n\t\tSTBTT_MS_EID_UNICODE_BMP = 1,\n\t\tSTBTT_MS_EID_SHIFTJIS = 2,\n\t\tSTBTT_MS_EID_UNICODE_FULL = 10\n\t};\n\n\tenum { // encodingID for STBTT_PLATFORM_ID_MAC; same as Script Manager codes\n\t\tSTBTT_MAC_EID_ROMAN = 0, STBTT_MAC_EID_ARABIC = 4,\n\t\tSTBTT_MAC_EID_JAPANESE = 1, STBTT_MAC_EID_HEBREW = 5,\n\t\tSTBTT_MAC_EID_CHINESE_TRAD = 2, STBTT_MAC_EID_GREEK = 6,\n\t\tSTBTT_MAC_EID_KOREAN = 3, STBTT_MAC_EID_RUSSIAN = 7\n\t};\n\n\tenum { // languageID for STBTT_PLATFORM_ID_MICROSOFT; same as LCID...\n\t\t   // problematic because there are e.g. 16 english LCIDs and 16 arabic LCIDs\n\t\tSTBTT_MS_LANG_ENGLISH = 0x0409, STBTT_MS_LANG_ITALIAN = 0x0410,\n\t\tSTBTT_MS_LANG_CHINESE = 0x0804, STBTT_MS_LANG_JAPANESE = 0x0411,\n\t\tSTBTT_MS_LANG_DUTCH = 0x0413, STBTT_MS_LANG_KOREAN = 0x0412,\n\t\tSTBTT_MS_LANG_FRENCH = 0x040c, STBTT_MS_LANG_RUSSIAN = 0x0419,\n\t\tSTBTT_MS_LANG_GERMAN = 0x0407, STBTT_MS_LANG_SPANISH = 0x0409,\n\t\tSTBTT_MS_LANG_HEBREW = 0x040d, STBTT_MS_LANG_SWEDISH = 0x041D\n\t};\n\n\tenum { // languageID for STBTT_PLATFORM_ID_MAC\n\t\tSTBTT_MAC_LANG_ENGLISH = 0, STBTT_MAC_LANG_JAPANESE = 11,\n\t\tSTBTT_MAC_LANG_ARABIC = 12, STBTT_MAC_LANG_KOREAN = 23,\n\t\tSTBTT_MAC_LANG_DUTCH = 4, STBTT_MAC_LANG_RUSSIAN = 32,\n\t\tSTBTT_MAC_LANG_FRENCH = 1, STBTT_MAC_LANG_SPANISH = 6,\n\t\tSTBTT_MAC_LANG_GERMAN = 2, STBTT_MAC_LANG_SWEDISH = 5,\n\t\tSTBTT_MAC_LANG_HEBREW = 10, STBTT_MAC_LANG_CHINESE_SIMPLIFIED = 33,\n\t\tSTBTT_MAC_LANG_ITALIAN = 3, STBTT_MAC_LANG_CHINESE_TRAD = 19\n\t};\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif // __STB_INCLUDE_STB_TRUETYPE_H__\n\n///////////////////////////////////////////////////////////////////////////////\n///////////////////////////////////////////////////////////////////////////////\n////\n////   IMPLEMENTATION\n////\n////\n\n#ifdef STB_TRUETYPE_IMPLEMENTATION\n\n#ifndef STBTT_MAX_OVERSAMPLE\n#define STBTT_MAX_OVERSAMPLE   8\n#endif\n\n#if STBTT_MAX_OVERSAMPLE > 255\n//#error \"STBTT_MAX_OVERSAMPLE cannot be > 255\"\n#endif\n\ntypedef int stbtt__test_oversample_pow2[(STBTT_MAX_OVERSAMPLE & (STBTT_MAX_OVERSAMPLE - 1)) == 0 ? 1 : -1];\n\n#ifndef STBTT_RASTERIZER_VERSION\n#define STBTT_RASTERIZER_VERSION 2\n#endif\n\n#ifdef _MSC_VER\n#define STBTT__NOTUSED(v)  (void)(v)\n#else\n#define STBTT__NOTUSED(v)  (void)sizeof(v)\n#endif\n\n//////////////////////////////////////////////////////////////////////////\n//\n// stbtt__buf helpers to parse data from file\n//\n\nstatic stbtt_uint8 stbtt__buf_get8(stbtt__buf *b)\n{\n\tif (b->cursor >= b->size)\n\t\treturn 0;\n\treturn b->data[b->cursor++];\n}\n\nstatic stbtt_uint8 stbtt__buf_peek8(stbtt__buf *b)\n{\n\tif (b->cursor >= b->size)\n\t\treturn 0;\n\treturn b->data[b->cursor];\n}\n\nstatic void stbtt__buf_seek(stbtt__buf *b, int o)\n{\n\tSTBTT_assert(!(o > b->size || o < 0));\n\tb->cursor = (o > b->size || o < 0) ? b->size : o;\n}\n\nstatic void stbtt__buf_skip(stbtt__buf *b, int o)\n{\n\tstbtt__buf_seek(b, b->cursor + o);\n}\n\nstatic stbtt_uint32 stbtt__buf_get(stbtt__buf *b, int n)\n{\n\tstbtt_uint32 v = 0;\n\tint i;\n\tSTBTT_assert(n >= 1 && n <= 4);\n\tfor (i = 0; i < n; i++)\n\t\tv = (v << 8) | stbtt__buf_get8(b);\n\treturn v;\n}\n\nstatic stbtt__buf stbtt__new_buf(const void *p, size_t size)\n{\n\tstbtt__buf r;\n\tSTBTT_assert(size < 0x40000000);\n\tr.data = (stbtt_uint8*)p;\n\tr.size = (int)size;\n\tr.cursor = 0;\n\treturn r;\n}\n\n#define stbtt__buf_get16(b)  stbtt__buf_get((b), 2)\n#define stbtt__buf_get32(b)  stbtt__buf_get((b), 4)\n\nstatic stbtt__buf stbtt__buf_range(const stbtt__buf *b, int o, int s)\n{\n\tstbtt__buf r = stbtt__new_buf(NULL, 0);\n\tif (o < 0 || s < 0 || o > b->size || s > b->size - o) return r;\n\tr.data = b->data + o;\n\tr.size = s;\n\treturn r;\n}\n\nstatic stbtt__buf stbtt__cff_get_index(stbtt__buf *b)\n{\n\tint count, start, offsize;\n\tstart = b->cursor;\n\tcount = stbtt__buf_get16(b);\n\tif (count) {\n\t\toffsize = stbtt__buf_get8(b);\n\t\tSTBTT_assert(offsize >= 1 && offsize <= 4);\n\t\tstbtt__buf_skip(b, offsize * count);\n\t\tstbtt__buf_skip(b, stbtt__buf_get(b, offsize) - 1);\n\t}\n\treturn stbtt__buf_range(b, start, b->cursor - start);\n}\n\nstatic stbtt_uint32 stbtt__cff_int(stbtt__buf *b)\n{\n\tint b0 = stbtt__buf_get8(b);\n\tif (b0 >= 32 && b0 <= 246)       return b0 - 139;\n\telse if (b0 >= 247 && b0 <= 250) return (b0 - 247) * 256 + stbtt__buf_get8(b) + 108;\n\telse if (b0 >= 251 && b0 <= 254) return -(b0 - 251) * 256 - stbtt__buf_get8(b) - 108;\n\telse if (b0 == 28)               return stbtt__buf_get16(b);\n\telse if (b0 == 29)               return stbtt__buf_get32(b);\n\tSTBTT_assert(0);\n\treturn 0;\n}\n\nstatic void stbtt__cff_skip_operand(stbtt__buf *b) {\n\tint v, b0 = stbtt__buf_peek8(b);\n\tSTBTT_assert(b0 >= 28);\n\tif (b0 == 30) {\n\t\tstbtt__buf_skip(b, 1);\n\t\twhile (b->cursor < b->size) {\n\t\t\tv = stbtt__buf_get8(b);\n\t\t\tif ((v & 0xF) == 0xF || (v >> 4) == 0xF)\n\t\t\t\tbreak;\n\t\t}\n\t}\n\telse {\n\t\tstbtt__cff_int(b);\n\t}\n}\n\nstatic stbtt__buf stbtt__dict_get(stbtt__buf *b, int key)\n{\n\tstbtt__buf_seek(b, 0);\n\twhile (b->cursor < b->size) {\n\t\tint start = b->cursor, end, op;\n\t\twhile (stbtt__buf_peek8(b) >= 28)\n\t\t\tstbtt__cff_skip_operand(b);\n\t\tend = b->cursor;\n\t\top = stbtt__buf_get8(b);\n\t\tif (op == 12)  op = stbtt__buf_get8(b) | 0x100;\n\t\tif (op == key) return stbtt__buf_range(b, start, end - start);\n\t}\n\treturn stbtt__buf_range(b, 0, 0);\n}\n\nstatic void stbtt__dict_get_ints(stbtt__buf *b, int key, int outcount, stbtt_uint32 *out)\n{\n\tint i;\n\tstbtt__buf operands = stbtt__dict_get(b, key);\n\tfor (i = 0; i < outcount && operands.cursor < operands.size; i++)\n\t\tout[i] = stbtt__cff_int(&operands);\n}\n\nstatic int stbtt__cff_index_count(stbtt__buf *b)\n{\n\tstbtt__buf_seek(b, 0);\n\treturn stbtt__buf_get16(b);\n}\n\nstatic stbtt__buf stbtt__cff_index_get(stbtt__buf b, int i)\n{\n\tint count, offsize, start, end;\n\tstbtt__buf_seek(&b, 0);\n\tcount = stbtt__buf_get16(&b);\n\toffsize = stbtt__buf_get8(&b);\n\tSTBTT_assert(i >= 0 && i < count);\n\tSTBTT_assert(offsize >= 1 && offsize <= 4);\n\tstbtt__buf_skip(&b, i*offsize);\n\tstart = stbtt__buf_get(&b, offsize);\n\tend = stbtt__buf_get(&b, offsize);\n\treturn stbtt__buf_range(&b, 2 + (count + 1)*offsize + start, end - start);\n}\n\n//////////////////////////////////////////////////////////////////////////\n//\n// accessors to parse data from file\n//\n\n// on platforms that don't allow misaligned reads, if we want to allow\n// truetype fonts that aren't padded to alignment, define ALLOW_UNALIGNED_TRUETYPE\n\n#define ttBYTE(p)     (* (stbtt_uint8 *) (p))\n#define ttCHAR(p)     (* (stbtt_int8 *) (p))\n#define ttFixed(p)    ttLONG(p)\n\nstatic stbtt_uint16 ttUSHORT(stbtt_uint8 *p) { return p[0] * 256 + p[1]; }\nstatic stbtt_int16 ttSHORT(stbtt_uint8 *p) { return p[0] * 256 + p[1]; }\nstatic stbtt_uint32 ttULONG(stbtt_uint8 *p) { return (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; }\nstatic stbtt_int32 ttLONG(stbtt_uint8 *p) { return (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; }\n\n#define stbtt_tag4(p,c0,c1,c2,c3) ((p)[0] == (c0) && (p)[1] == (c1) && (p)[2] == (c2) && (p)[3] == (c3))\n#define stbtt_tag(p,str)           stbtt_tag4(p,str[0],str[1],str[2],str[3])\n\nstatic int stbtt__isfont(stbtt_uint8 *font)\n{\n\t// check the version number\n\tif (stbtt_tag4(font, '1', 0, 0, 0))  return 1; // TrueType 1\n\tif (stbtt_tag(font, \"typ1\"))   return 1; // TrueType with type 1 font -- we don't support this!\n\tif (stbtt_tag(font, \"OTTO\"))   return 1; // OpenType with CFF\n\tif (stbtt_tag4(font, 0, 1, 0, 0)) return 1; // OpenType 1.0\n\tif (stbtt_tag(font, \"true\"))   return 1; // Apple specification for TrueType fonts\n\treturn 0;\n}\n\n// @OPTIMIZE: binary search\nstatic stbtt_uint32 stbtt__find_table(stbtt_uint8 *data, stbtt_uint32 fontstart, const char *tag)\n{\n\tstbtt_int32 num_tables = ttUSHORT(data + fontstart + 4);\n\tstbtt_uint32 tabledir = fontstart + 12;\n\tstbtt_int32 i;\n\tfor (i = 0; i < num_tables; ++i) {\n\t\tstbtt_uint32 loc = tabledir + 16 * i;\n\t\tif (stbtt_tag(data + loc + 0, tag))\n\t\t\treturn ttULONG(data + loc + 8);\n\t}\n\treturn 0;\n}\n\nstatic int stbtt_GetFontOffsetForIndex_internal(unsigned char *font_collection, int index)\n{\n\t// if it's just a font, there's only one valid index\n\tif (stbtt__isfont(font_collection))\n\t\treturn index == 0 ? 0 : -1;\n\n\t// check if it's a TTC\n\tif (stbtt_tag(font_collection, \"ttcf\")) {\n\t\t// version 1?\n\t\tif (ttULONG(font_collection + 4) == 0x00010000 || ttULONG(font_collection + 4) == 0x00020000) {\n\t\t\tstbtt_int32 n = ttLONG(font_collection + 8);\n\t\t\tif (index >= n)\n\t\t\t\treturn -1;\n\t\t\treturn ttULONG(font_collection + 12 + index * 4);\n\t\t}\n\t}\n\treturn -1;\n}\n\nstatic int stbtt_GetNumberOfFonts_internal(unsigned char *font_collection)\n{\n\t// if it's just a font, there's only one valid font\n\tif (stbtt__isfont(font_collection))\n\t\treturn 1;\n\n\t// check if it's a TTC\n\tif (stbtt_tag(font_collection, \"ttcf\")) {\n\t\t// version 1?\n\t\tif (ttULONG(font_collection + 4) == 0x00010000 || ttULONG(font_collection + 4) == 0x00020000) {\n\t\t\treturn ttLONG(font_collection + 8);\n\t\t}\n\t}\n\treturn 0;\n}\n\nstatic stbtt__buf stbtt__get_subrs(stbtt__buf cff, stbtt__buf fontdict)\n{\n\tstbtt_uint32 subrsoff = 0, private_loc[2] = { 0, 0 };\n\tstbtt__buf pdict;\n\tstbtt__dict_get_ints(&fontdict, 18, 2, private_loc);\n\tif (!private_loc[1] || !private_loc[0]) return stbtt__new_buf(NULL, 0);\n\tpdict = stbtt__buf_range(&cff, private_loc[1], private_loc[0]);\n\tstbtt__dict_get_ints(&pdict, 19, 1, &subrsoff);\n\tif (!subrsoff) return stbtt__new_buf(NULL, 0);\n\tstbtt__buf_seek(&cff, private_loc[1] + subrsoff);\n\treturn stbtt__cff_get_index(&cff);\n}\n\nstatic int stbtt_InitFont_internal(stbtt_fontinfo *info, unsigned char *data, int fontstart)\n{\n\tstbtt_uint32 cmap, t;\n\tstbtt_int32 i, numTables;\n\n\tinfo->data = data;\n\tinfo->fontstart = fontstart;\n\tinfo->cff = stbtt__new_buf(NULL, 0);\n\n\tcmap = stbtt__find_table(data, fontstart, \"cmap\");       // required\n\tinfo->loca = stbtt__find_table(data, fontstart, \"loca\"); // required\n\tinfo->head = stbtt__find_table(data, fontstart, \"head\"); // required\n\tinfo->glyf = stbtt__find_table(data, fontstart, \"glyf\"); // required\n\tinfo->hhea = stbtt__find_table(data, fontstart, \"hhea\"); // required\n\tinfo->hmtx = stbtt__find_table(data, fontstart, \"hmtx\"); // required\n\tinfo->kern = stbtt__find_table(data, fontstart, \"kern\"); // not required\n\n\tif (!cmap || !info->head || !info->hhea || !info->hmtx)\n\t\treturn 0;\n\tif (info->glyf) {\n\t\t// required for truetype\n\t\tif (!info->loca) return 0;\n\t}\n\telse {\n\t\t// initialization for CFF / Type2 fonts (OTF)\n\t\tstbtt__buf b, topdict, topdictidx;\n\t\tstbtt_uint32 cstype = 2, charstrings = 0, fdarrayoff = 0, fdselectoff = 0;\n\t\tstbtt_uint32 cff;\n\n\t\tcff = stbtt__find_table(data, fontstart, \"CFF \");\n\t\tif (!cff) return 0;\n\n\t\tinfo->fontdicts = stbtt__new_buf(NULL, 0);\n\t\tinfo->fdselect = stbtt__new_buf(NULL, 0);\n\n\t\t// @TODO this should use size from table (not 512MB)\n\t\tinfo->cff = stbtt__new_buf(data + cff, 512 * 1024 * 1024);\n\t\tb = info->cff;\n\n\t\t// read the header\n\t\tstbtt__buf_skip(&b, 2);\n\t\tstbtt__buf_seek(&b, stbtt__buf_get8(&b)); // hdrsize\n\n\t\t\t\t\t\t\t\t\t\t\t\t  // @TODO the name INDEX could list multiple fonts,\n\t\t\t\t\t\t\t\t\t\t\t\t  // but we just use the first one.\n\t\tstbtt__cff_get_index(&b);  // name INDEX\n\t\ttopdictidx = stbtt__cff_get_index(&b);\n\t\ttopdict = stbtt__cff_index_get(topdictidx, 0);\n\t\tstbtt__cff_get_index(&b);  // string INDEX\n\t\tinfo->gsubrs = stbtt__cff_get_index(&b);\n\n\t\tstbtt__dict_get_ints(&topdict, 17, 1, &charstrings);\n\t\tstbtt__dict_get_ints(&topdict, 0x100 | 6, 1, &cstype);\n\t\tstbtt__dict_get_ints(&topdict, 0x100 | 36, 1, &fdarrayoff);\n\t\tstbtt__dict_get_ints(&topdict, 0x100 | 37, 1, &fdselectoff);\n\t\tinfo->subrs = stbtt__get_subrs(b, topdict);\n\n\t\t// we only support Type 2 charstrings\n\t\tif (cstype != 2) return 0;\n\t\tif (charstrings == 0) return 0;\n\n\t\tif (fdarrayoff) {\n\t\t\t// looks like a CID font\n\t\t\tif (!fdselectoff) return 0;\n\t\t\tstbtt__buf_seek(&b, fdarrayoff);\n\t\t\tinfo->fontdicts = stbtt__cff_get_index(&b);\n\t\t\tinfo->fdselect = stbtt__buf_range(&b, fdselectoff, b.size - fdselectoff);\n\t\t}\n\n\t\tstbtt__buf_seek(&b, charstrings);\n\t\tinfo->charstrings = stbtt__cff_get_index(&b);\n\t}\n\n\tt = stbtt__find_table(data, fontstart, \"maxp\");\n\tif (t)\n\t\tinfo->numGlyphs = ttUSHORT(data + t + 4);\n\telse\n\t\tinfo->numGlyphs = 0xffff;\n\n\t// find a cmap encoding table we understand *now* to avoid searching\n\t// later. (todo: could make this installable)\n\t// the same regardless of glyph.\n\tnumTables = ttUSHORT(data + cmap + 2);\n\tinfo->index_map = 0;\n\tfor (i = 0; i < numTables; ++i) {\n\t\tstbtt_uint32 encoding_record = cmap + 4 + 8 * i;\n\t\t// find an encoding we understand:\n\t\tswitch (ttUSHORT(data + encoding_record)) {\n\t\tcase STBTT_PLATFORM_ID_MICROSOFT:\n\t\t\tswitch (ttUSHORT(data + encoding_record + 2)) {\n\t\t\tcase STBTT_MS_EID_UNICODE_BMP:\n\t\t\tcase STBTT_MS_EID_UNICODE_FULL:\n\t\t\t\t// MS/Unicode\n\t\t\t\tinfo->index_map = cmap + ttULONG(data + encoding_record + 4);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase STBTT_PLATFORM_ID_UNICODE:\n\t\t\t// Mac/iOS has these\n\t\t\t// all the encodingIDs are unicode, so we don't bother to check it\n\t\t\tinfo->index_map = cmap + ttULONG(data + encoding_record + 4);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (info->index_map == 0)\n\t\treturn 0;\n\n\tinfo->indexToLocFormat = ttUSHORT(data + info->head + 50);\n\treturn 1;\n}\n\nSTBTT_DEF int stbtt_FindGlyphIndex(const stbtt_fontinfo *info, int unicode_codepoint)\n{\n\tstbtt_uint8 *data = info->data;\n\tstbtt_uint32 index_map = info->index_map;\n\n\tstbtt_uint16 format = ttUSHORT(data + index_map + 0);\n\tif (format == 0) { // apple byte encoding\n\t\tstbtt_int32 bytes = ttUSHORT(data + index_map + 2);\n\t\tif (unicode_codepoint < bytes - 6)\n\t\t\treturn ttBYTE(data + index_map + 6 + unicode_codepoint);\n\t\treturn 0;\n\t}\n\telse if (format == 6) {\n\t\tstbtt_uint32 first = ttUSHORT(data + index_map + 6);\n\t\tstbtt_uint32 count = ttUSHORT(data + index_map + 8);\n\t\tif ((stbtt_uint32)unicode_codepoint >= first && (stbtt_uint32)unicode_codepoint < first + count)\n\t\t\treturn ttUSHORT(data + index_map + 10 + (unicode_codepoint - first) * 2);\n\t\treturn 0;\n\t}\n\telse if (format == 2) {\n\t\tSTBTT_assert(0); // @TODO: high-byte mapping for japanese/chinese/korean\n\t\treturn 0;\n\t}\n\telse if (format == 4) { // standard mapping for windows fonts: binary search collection of ranges\n\t\tstbtt_uint16 segcount = ttUSHORT(data + index_map + 6) >> 1;\n\t\tstbtt_uint16 searchRange = ttUSHORT(data + index_map + 8) >> 1;\n\t\tstbtt_uint16 entrySelector = ttUSHORT(data + index_map + 10);\n\t\tstbtt_uint16 rangeShift = ttUSHORT(data + index_map + 12) >> 1;\n\n\t\t// do a binary search of the segments\n\t\tstbtt_uint32 endCount = index_map + 14;\n\t\tstbtt_uint32 search = endCount;\n\n\t\tif (unicode_codepoint > 0xffff)\n\t\t\treturn 0;\n\n\t\t// they lie from endCount .. endCount + segCount\n\t\t// but searchRange is the nearest power of two, so...\n\t\tif (unicode_codepoint >= ttUSHORT(data + search + rangeShift * 2))\n\t\t\tsearch += rangeShift * 2;\n\n\t\t// now decrement to bias correctly to find smallest\n\t\tsearch -= 2;\n\t\twhile (entrySelector) {\n\t\t\tstbtt_uint16 end;\n\t\t\tsearchRange >>= 1;\n\t\t\tend = ttUSHORT(data + search + searchRange * 2);\n\t\t\tif (unicode_codepoint > end)\n\t\t\t\tsearch += searchRange * 2;\n\t\t\t--entrySelector;\n\t\t}\n\t\tsearch += 2;\n\n\t\t{\n\t\t\tstbtt_uint16 offset, start;\n\t\t\tstbtt_uint16 item = (stbtt_uint16)((search - endCount) >> 1);\n\n\t\t\tSTBTT_assert(unicode_codepoint <= ttUSHORT(data + endCount + 2 * item));\n\t\t\tstart = ttUSHORT(data + index_map + 14 + segcount * 2 + 2 + 2 * item);\n\t\t\tif (unicode_codepoint < start)\n\t\t\t\treturn 0;\n\n\t\t\toffset = ttUSHORT(data + index_map + 14 + segcount * 6 + 2 + 2 * item);\n\t\t\tif (offset == 0)\n\t\t\t\treturn (stbtt_uint16)(unicode_codepoint + ttSHORT(data + index_map + 14 + segcount * 4 + 2 + 2 * item));\n\n\t\t\treturn ttUSHORT(data + offset + (unicode_codepoint - start) * 2 + index_map + 14 + segcount * 6 + 2 + 2 * item);\n\t\t}\n\t}\n\telse if (format == 12 || format == 13) {\n\t\tstbtt_uint32 ngroups = ttULONG(data + index_map + 12);\n\t\tstbtt_int32 low, high;\n\t\tlow = 0; high = (stbtt_int32)ngroups;\n\t\t// Binary search the right group.\n\t\twhile (low < high) {\n\t\t\tstbtt_int32 mid = low + ((high - low) >> 1); // rounds down, so low <= mid < high\n\t\t\tstbtt_uint32 start_char = ttULONG(data + index_map + 16 + mid * 12);\n\t\t\tstbtt_uint32 end_char = ttULONG(data + index_map + 16 + mid * 12 + 4);\n\t\t\tif ((stbtt_uint32)unicode_codepoint < start_char)\n\t\t\t\thigh = mid;\n\t\t\telse if ((stbtt_uint32)unicode_codepoint > end_char)\n\t\t\t\tlow = mid + 1;\n\t\t\telse {\n\t\t\t\tstbtt_uint32 start_glyph = ttULONG(data + index_map + 16 + mid * 12 + 8);\n\t\t\t\tif (format == 12)\n\t\t\t\t\treturn start_glyph + unicode_codepoint - start_char;\n\t\t\t\telse // format == 13\n\t\t\t\t\treturn start_glyph;\n\t\t\t}\n\t\t}\n\t\treturn 0; // not found\n\t}\n\t// @TODO\n\tSTBTT_assert(0);\n\treturn 0;\n}\n\nSTBTT_DEF int stbtt_GetCodepointShape(const stbtt_fontinfo *info, int unicode_codepoint, stbtt_vertex **vertices)\n{\n\treturn stbtt_GetGlyphShape(info, stbtt_FindGlyphIndex(info, unicode_codepoint), vertices);\n}\n\nstatic void stbtt_setvertex(stbtt_vertex *v, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy)\n{\n\tv->type = type;\n\tv->x = (stbtt_int16)x;\n\tv->y = (stbtt_int16)y;\n\tv->cx = (stbtt_int16)cx;\n\tv->cy = (stbtt_int16)cy;\n}\n\nstatic int stbtt__GetGlyfOffset(const stbtt_fontinfo *info, int glyph_index)\n{\n\tint g1, g2;\n\n\tSTBTT_assert(!info->cff.size);\n\n\tif (glyph_index >= info->numGlyphs) return -1; // glyph index out of range\n\tif (info->indexToLocFormat >= 2)    return -1; // unknown index->glyph map format\n\n\tif (info->indexToLocFormat == 0) {\n\t\tg1 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2) * 2;\n\t\tg2 = info->glyf + ttUSHORT(info->data + info->loca + glyph_index * 2 + 2) * 2;\n\t}\n\telse {\n\t\tg1 = info->glyf + ttULONG(info->data + info->loca + glyph_index * 4);\n\t\tg2 = info->glyf + ttULONG(info->data + info->loca + glyph_index * 4 + 4);\n\t}\n\n\treturn g1 == g2 ? -1 : g1; // if length is 0, return -1\n}\n\nstatic int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1);\n\nSTBTT_DEF int stbtt_GetGlyphBox(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1)\n{\n\tif (info->cff.size) {\n\t\tstbtt__GetGlyphInfoT2(info, glyph_index, x0, y0, x1, y1);\n\t}\n\telse {\n\t\tint g = stbtt__GetGlyfOffset(info, glyph_index);\n\t\tif (g < 0) return 0;\n\n\t\tif (x0) *x0 = ttSHORT(info->data + g + 2);\n\t\tif (y0) *y0 = ttSHORT(info->data + g + 4);\n\t\tif (x1) *x1 = ttSHORT(info->data + g + 6);\n\t\tif (y1) *y1 = ttSHORT(info->data + g + 8);\n\t}\n\treturn 1;\n}\n\nSTBTT_DEF int stbtt_GetCodepointBox(const stbtt_fontinfo *info, int codepoint, int *x0, int *y0, int *x1, int *y1)\n{\n\treturn stbtt_GetGlyphBox(info, stbtt_FindGlyphIndex(info, codepoint), x0, y0, x1, y1);\n}\n\nSTBTT_DEF int stbtt_IsGlyphEmpty(const stbtt_fontinfo *info, int glyph_index)\n{\n\tstbtt_int16 numberOfContours;\n\tint g;\n\tif (info->cff.size)\n\t\treturn stbtt__GetGlyphInfoT2(info, glyph_index, NULL, NULL, NULL, NULL) == 0;\n\tg = stbtt__GetGlyfOffset(info, glyph_index);\n\tif (g < 0) return 1;\n\tnumberOfContours = ttSHORT(info->data + g);\n\treturn numberOfContours == 0;\n}\n\nstatic int stbtt__close_shape(stbtt_vertex *vertices, int num_vertices, int was_off, int start_off,\n\tstbtt_int32 sx, stbtt_int32 sy, stbtt_int32 scx, stbtt_int32 scy, stbtt_int32 cx, stbtt_int32 cy)\n{\n\tif (start_off) {\n\t\tif (was_off)\n\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx + scx) >> 1, (cy + scy) >> 1, cx, cy);\n\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx, sy, scx, scy);\n\t}\n\telse {\n\t\tif (was_off)\n\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, sx, sy, cx, cy);\n\t\telse\n\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vline, sx, sy, 0, 0);\n\t}\n\treturn num_vertices;\n}\n\nstatic int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)\n{\n\tstbtt_int16 numberOfContours;\n\tstbtt_uint8 *endPtsOfContours;\n\tstbtt_uint8 *data = info->data;\n\tstbtt_vertex *vertices = 0;\n\tint num_vertices = 0;\n\tint g = stbtt__GetGlyfOffset(info, glyph_index);\n\n\t*pvertices = NULL;\n\n\tif (g < 0) return 0;\n\n\tnumberOfContours = ttSHORT(data + g);\n\n\tif (numberOfContours > 0) {\n\t\tstbtt_uint8 flags = 0, flagcount;\n\t\tstbtt_int32 ins, i, j = 0, m, n, next_move, was_off = 0, off, start_off = 0;\n\t\tstbtt_int32 x, y, cx, cy, sx, sy, scx, scy;\n\t\tstbtt_uint8 *points;\n\t\tendPtsOfContours = (data + g + 10);\n\t\tins = ttUSHORT(data + g + 10 + numberOfContours * 2);\n\t\tpoints = data + g + 10 + numberOfContours * 2 + 2 + ins;\n\n\t\tn = 1 + ttUSHORT(endPtsOfContours + numberOfContours * 2 - 2);\n\n\t\tm = n + 2 * numberOfContours;  // a loose bound on how many vertices we might need\n\t\tvertices = (stbtt_vertex *)STBTT_malloc(m * sizeof(vertices[0]), info->userdata);\n\t\tif (vertices == 0)\n\t\t\treturn 0;\n\n\t\tnext_move = 0;\n\t\tflagcount = 0;\n\n\t\t// in first pass, we load uninterpreted data into the allocated array\n\t\t// above, shifted to the end of the array so we won't overwrite it when\n\t\t// we create our final data starting from the front\n\n\t\toff = m - n; // starting offset for uninterpreted data, regardless of how m ends up being calculated\n\n\t\t\t\t\t // first load flags\n\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tif (flagcount == 0) {\n\t\t\t\tflags = *points++;\n\t\t\t\tif (flags & 8)\n\t\t\t\t\tflagcount = *points++;\n\t\t\t}\n\t\t\telse\n\t\t\t\t--flagcount;\n\t\t\tvertices[off + i].type = flags;\n\t\t}\n\n\t\t// now load x coordinates\n\t\tx = 0;\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tflags = vertices[off + i].type;\n\t\t\tif (flags & 2) {\n\t\t\t\tstbtt_int16 dx = *points++;\n\t\t\t\tx += (flags & 16) ? dx : -dx; // ???\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!(flags & 16)) {\n\t\t\t\t\tx = x + (stbtt_int16)(points[0] * 256 + points[1]);\n\t\t\t\t\tpoints += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvertices[off + i].x = (stbtt_int16)x;\n\t\t}\n\n\t\t// now load y coordinates\n\t\ty = 0;\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tflags = vertices[off + i].type;\n\t\t\tif (flags & 4) {\n\t\t\t\tstbtt_int16 dy = *points++;\n\t\t\t\ty += (flags & 32) ? dy : -dy; // ???\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!(flags & 32)) {\n\t\t\t\t\ty = y + (stbtt_int16)(points[0] * 256 + points[1]);\n\t\t\t\t\tpoints += 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tvertices[off + i].y = (stbtt_int16)y;\n\t\t}\n\n\t\t// now convert them to our format\n\t\tnum_vertices = 0;\n\t\tsx = sy = cx = cy = scx = scy = 0;\n\t\tfor (i = 0; i < n; ++i) {\n\t\t\tflags = vertices[off + i].type;\n\t\t\tx = (stbtt_int16)vertices[off + i].x;\n\t\t\ty = (stbtt_int16)vertices[off + i].y;\n\n\t\t\tif (next_move == i) {\n\t\t\t\tif (i != 0)\n\t\t\t\t\tnum_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx, sy, scx, scy, cx, cy);\n\n\t\t\t\t// now start the new one               \n\t\t\t\tstart_off = !(flags & 1);\n\t\t\t\tif (start_off) {\n\t\t\t\t\t// if we start off with an off-curve point, then when we need to find a point on the curve\n\t\t\t\t\t// where we can start, and we need to save some state for when we wraparound.\n\t\t\t\t\tscx = x;\n\t\t\t\t\tscy = y;\n\t\t\t\t\tif (!(vertices[off + i + 1].type & 1)) {\n\t\t\t\t\t\t// next point is also a curve point, so interpolate an on-point curve\n\t\t\t\t\t\tsx = (x + (stbtt_int32)vertices[off + i + 1].x) >> 1;\n\t\t\t\t\t\tsy = (y + (stbtt_int32)vertices[off + i + 1].y) >> 1;\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// otherwise just use the next point as our start point\n\t\t\t\t\t\tsx = (stbtt_int32)vertices[off + i + 1].x;\n\t\t\t\t\t\tsy = (stbtt_int32)vertices[off + i + 1].y;\n\t\t\t\t\t\t++i; // we're using point i+1 as the starting point, so skip it\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tsx = x;\n\t\t\t\t\tsy = y;\n\t\t\t\t}\n\t\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vmove, sx, sy, 0, 0);\n\t\t\t\twas_off = 0;\n\t\t\t\tnext_move = 1 + ttUSHORT(endPtsOfContours + j * 2);\n\t\t\t\t++j;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (!(flags & 1)) { // if it's a curve\n\t\t\t\t\tif (was_off) // two off-curve control points in a row means interpolate an on-curve midpoint\n\t\t\t\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, (cx + x) >> 1, (cy + y) >> 1, cx, cy);\n\t\t\t\t\tcx = x;\n\t\t\t\t\tcy = y;\n\t\t\t\t\twas_off = 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tif (was_off)\n\t\t\t\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vcurve, x, y, cx, cy);\n\t\t\t\t\telse\n\t\t\t\t\t\tstbtt_setvertex(&vertices[num_vertices++], STBTT_vline, x, y, 0, 0);\n\t\t\t\t\twas_off = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tnum_vertices = stbtt__close_shape(vertices, num_vertices, was_off, start_off, sx, sy, scx, scy, cx, cy);\n\t}\n\telse if (numberOfContours == -1) {\n\t\t// Compound shapes.\n\t\tint more = 1;\n\t\tstbtt_uint8 *comp = data + g + 10;\n\t\tnum_vertices = 0;\n\t\tvertices = 0;\n\t\twhile (more) {\n\t\t\tstbtt_uint16 flags, gidx;\n\t\t\tint comp_num_verts = 0, i;\n\t\t\tstbtt_vertex *comp_verts = 0, *tmp = 0;\n\t\t\tfloat mtx[6] = { 1,0,0,1,0,0 }, m, n;\n\n\t\t\tflags = ttSHORT(comp); comp += 2;\n\t\t\tgidx = ttSHORT(comp); comp += 2;\n\n\t\t\tif (flags & 2) { // XY values\n\t\t\t\tif (flags & 1) { // shorts\n\t\t\t\t\tmtx[4] = ttSHORT(comp); comp += 2;\n\t\t\t\t\tmtx[5] = ttSHORT(comp); comp += 2;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tmtx[4] = ttCHAR(comp); comp += 1;\n\t\t\t\t\tmtx[5] = ttCHAR(comp); comp += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// @TODO handle matching point\n\t\t\t\tSTBTT_assert(0);\n\t\t\t}\n\t\t\tif (flags & (1 << 3)) { // WE_HAVE_A_SCALE\n\t\t\t\tmtx[0] = mtx[3] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t\tmtx[1] = mtx[2] = 0;\n\t\t\t}\n\t\t\telse if (flags & (1 << 6)) { // WE_HAVE_AN_X_AND_YSCALE\n\t\t\t\tmtx[0] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t\tmtx[1] = mtx[2] = 0;\n\t\t\t\tmtx[3] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t}\n\t\t\telse if (flags & (1 << 7)) { // WE_HAVE_A_TWO_BY_TWO\n\t\t\t\tmtx[0] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t\tmtx[1] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t\tmtx[2] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t\tmtx[3] = ttSHORT(comp) / 16384.0f; comp += 2;\n\t\t\t}\n\n\t\t\t// Find transformation scales.\n\t\t\tm = (float)STBTT_sqrt(mtx[0] * mtx[0] + mtx[1] * mtx[1]);\n\t\t\tn = (float)STBTT_sqrt(mtx[2] * mtx[2] + mtx[3] * mtx[3]);\n\n\t\t\t// Get indexed glyph.\n\t\t\tcomp_num_verts = stbtt_GetGlyphShape(info, gidx, &comp_verts);\n\t\t\tif (comp_num_verts > 0) {\n\t\t\t\t// Transform vertices.\n\t\t\t\tfor (i = 0; i < comp_num_verts; ++i) {\n\t\t\t\t\tstbtt_vertex* v = &comp_verts[i];\n\t\t\t\t\tstbtt_vertex_type x, y;\n\t\t\t\t\tx = v->x; y = v->y;\n\t\t\t\t\tv->x = (stbtt_vertex_type)(m * (mtx[0] * x + mtx[2] * y + mtx[4]));\n\t\t\t\t\tv->y = (stbtt_vertex_type)(n * (mtx[1] * x + mtx[3] * y + mtx[5]));\n\t\t\t\t\tx = v->cx; y = v->cy;\n\t\t\t\t\tv->cx = (stbtt_vertex_type)(m * (mtx[0] * x + mtx[2] * y + mtx[4]));\n\t\t\t\t\tv->cy = (stbtt_vertex_type)(n * (mtx[1] * x + mtx[3] * y + mtx[5]));\n\t\t\t\t}\n\t\t\t\t// Append vertices.\n\t\t\t\ttmp = (stbtt_vertex*)STBTT_malloc((num_vertices + comp_num_verts) * sizeof(stbtt_vertex), info->userdata);\n\t\t\t\tif (!tmp) {\n\t\t\t\t\tif (vertices) STBTT_free(vertices, info->userdata);\n\t\t\t\t\tif (comp_verts) STBTT_free(comp_verts, info->userdata);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\tif (num_vertices > 0) STBTT_memcpy(tmp, vertices, num_vertices * sizeof(stbtt_vertex));\n\t\t\t\tSTBTT_memcpy(tmp + num_vertices, comp_verts, comp_num_verts * sizeof(stbtt_vertex));\n\t\t\t\tif (vertices) STBTT_free(vertices, info->userdata);\n\t\t\t\tvertices = tmp;\n\t\t\t\tSTBTT_free(comp_verts, info->userdata);\n\t\t\t\tnum_vertices += comp_num_verts;\n\t\t\t}\n\t\t\t// More components ?\n\t\t\tmore = flags & (1 << 5);\n\t\t}\n\t}\n\telse if (numberOfContours < 0) {\n\t\t// @TODO other compound variations?\n\t\tSTBTT_assert(0);\n\t}\n\telse {\n\t\t// numberOfCounters == 0, do nothing\n\t}\n\n\t*pvertices = vertices;\n\treturn num_vertices;\n}\n\ntypedef struct\n{\n\tint bounds;\n\tint started;\n\tfloat first_x, first_y;\n\tfloat x, y;\n\tstbtt_int32 min_x, max_x, min_y, max_y;\n\n\tstbtt_vertex *pvertices;\n\tint num_vertices;\n} stbtt__csctx;\n\n#define STBTT__CSCTX_INIT(bounds) {bounds,0, 0,0, 0,0, 0,0,0,0, NULL, 0}\n\nstatic void stbtt__track_vertex(stbtt__csctx *c, stbtt_int32 x, stbtt_int32 y)\n{\n\tif (x > c->max_x || !c->started) c->max_x = x;\n\tif (y > c->max_y || !c->started) c->max_y = y;\n\tif (x < c->min_x || !c->started) c->min_x = x;\n\tif (y < c->min_y || !c->started) c->min_y = y;\n\tc->started = 1;\n}\n\nstatic void stbtt__csctx_v(stbtt__csctx *c, stbtt_uint8 type, stbtt_int32 x, stbtt_int32 y, stbtt_int32 cx, stbtt_int32 cy, stbtt_int32 cx1, stbtt_int32 cy1)\n{\n\tif (c->bounds) {\n\t\tstbtt__track_vertex(c, x, y);\n\t\tif (type == STBTT_vcubic) {\n\t\t\tstbtt__track_vertex(c, cx, cy);\n\t\t\tstbtt__track_vertex(c, cx1, cy1);\n\t\t}\n\t}\n\telse {\n\t\tstbtt_setvertex(&c->pvertices[c->num_vertices], type, x, y, cx, cy);\n\t\tc->pvertices[c->num_vertices].cx1 = (stbtt_int16)cx1;\n\t\tc->pvertices[c->num_vertices].cy1 = (stbtt_int16)cy1;\n\t}\n\tc->num_vertices++;\n}\n\nstatic void stbtt__csctx_close_shape(stbtt__csctx *ctx)\n{\n\tif (ctx->first_x != ctx->x || ctx->first_y != ctx->y)\n\t\tstbtt__csctx_v(ctx, STBTT_vline, (int)ctx->first_x, (int)ctx->first_y, 0, 0, 0, 0);\n}\n\nstatic void stbtt__csctx_rmove_to(stbtt__csctx *ctx, float dx, float dy)\n{\n\tstbtt__csctx_close_shape(ctx);\n\tctx->first_x = ctx->x = ctx->x + dx;\n\tctx->first_y = ctx->y = ctx->y + dy;\n\tstbtt__csctx_v(ctx, STBTT_vmove, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0);\n}\n\nstatic void stbtt__csctx_rline_to(stbtt__csctx *ctx, float dx, float dy)\n{\n\tctx->x += dx;\n\tctx->y += dy;\n\tstbtt__csctx_v(ctx, STBTT_vline, (int)ctx->x, (int)ctx->y, 0, 0, 0, 0);\n}\n\nstatic void stbtt__csctx_rccurve_to(stbtt__csctx *ctx, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3)\n{\n\tfloat cx1 = ctx->x + dx1;\n\tfloat cy1 = ctx->y + dy1;\n\tfloat cx2 = cx1 + dx2;\n\tfloat cy2 = cy1 + dy2;\n\tctx->x = cx2 + dx3;\n\tctx->y = cy2 + dy3;\n\tstbtt__csctx_v(ctx, STBTT_vcubic, (int)ctx->x, (int)ctx->y, (int)cx1, (int)cy1, (int)cx2, (int)cy2);\n}\n\nstatic stbtt__buf stbtt__get_subr(stbtt__buf idx, int n)\n{\n\tint count = stbtt__cff_index_count(&idx);\n\tint bias = 107;\n\tif (count >= 33900)\n\t\tbias = 32768;\n\telse if (count >= 1240)\n\t\tbias = 1131;\n\tn += bias;\n\tif (n < 0 || n >= count)\n\t\treturn stbtt__new_buf(NULL, 0);\n\treturn stbtt__cff_index_get(idx, n);\n}\n\nstatic stbtt__buf stbtt__cid_get_glyph_subrs(const stbtt_fontinfo *info, int glyph_index)\n{\n\tstbtt__buf fdselect = info->fdselect;\n\tint nranges, start, end, v, fmt, fdselector = -1, i;\n\n\tstbtt__buf_seek(&fdselect, 0);\n\tfmt = stbtt__buf_get8(&fdselect);\n\tif (fmt == 0) {\n\t\t// untested\n\t\tstbtt__buf_skip(&fdselect, glyph_index);\n\t\tfdselector = stbtt__buf_get8(&fdselect);\n\t}\n\telse if (fmt == 3) {\n\t\tnranges = stbtt__buf_get16(&fdselect);\n\t\tstart = stbtt__buf_get16(&fdselect);\n\t\tfor (i = 0; i < nranges; i++) {\n\t\t\tv = stbtt__buf_get8(&fdselect);\n\t\t\tend = stbtt__buf_get16(&fdselect);\n\t\t\tif (glyph_index >= start && glyph_index < end) {\n\t\t\t\tfdselector = v;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tstart = end;\n\t\t}\n\t}\n\tif (fdselector == -1) stbtt__new_buf(NULL, 0);\n\treturn stbtt__get_subrs(info->cff, stbtt__cff_index_get(info->fontdicts, fdselector));\n}\n\nstatic int stbtt__run_charstring(const stbtt_fontinfo *info, int glyph_index, stbtt__csctx *c)\n{\n\tint in_header = 1, maskbits = 0, subr_stack_height = 0, sp = 0, v, i, b0;\n\tint has_subrs = 0, clear_stack;\n\tfloat s[48];\n\tstbtt__buf subr_stack[10], subrs = info->subrs, b;\n\tfloat f;\n\n#define STBTT__CSERR(s) (0)\n\n\t// this currently ignores the initial width value, which isn't needed if we have hmtx\n\tb = stbtt__cff_index_get(info->charstrings, glyph_index);\n\twhile (b.cursor < b.size) {\n\t\ti = 0;\n\t\tclear_stack = 1;\n\t\tb0 = stbtt__buf_get8(&b);\n\t\tswitch (b0) {\n\t\t\t// @TODO implement hinting\n\t\tcase 0x13: // hintmask\n\t\tcase 0x14: // cntrmask\n\t\t\tif (in_header)\n\t\t\t\tmaskbits += (sp / 2); // implicit \"vstem\"\n\t\t\tin_header = 0;\n\t\t\tstbtt__buf_skip(&b, (maskbits + 7) / 8);\n\t\t\tbreak;\n\n\t\tcase 0x01: // hstem\n\t\tcase 0x03: // vstem\n\t\tcase 0x12: // hstemhm\n\t\tcase 0x17: // vstemhm\n\t\t\tmaskbits += (sp / 2);\n\t\t\tbreak;\n\n\t\tcase 0x15: // rmoveto\n\t\t\tin_header = 0;\n\t\t\tif (sp < 2) return STBTT__CSERR(\"rmoveto stack\");\n\t\t\tstbtt__csctx_rmove_to(c, s[sp - 2], s[sp - 1]);\n\t\t\tbreak;\n\t\tcase 0x04: // vmoveto\n\t\t\tin_header = 0;\n\t\t\tif (sp < 1) return STBTT__CSERR(\"vmoveto stack\");\n\t\t\tstbtt__csctx_rmove_to(c, 0, s[sp - 1]);\n\t\t\tbreak;\n\t\tcase 0x16: // hmoveto\n\t\t\tin_header = 0;\n\t\t\tif (sp < 1) return STBTT__CSERR(\"hmoveto stack\");\n\t\t\tstbtt__csctx_rmove_to(c, s[sp - 1], 0);\n\t\t\tbreak;\n\n\t\tcase 0x05: // rlineto\n\t\t\tif (sp < 2) return STBTT__CSERR(\"rlineto stack\");\n\t\t\tfor (; i + 1 < sp; i += 2)\n\t\t\t\tstbtt__csctx_rline_to(c, s[i], s[i + 1]);\n\t\t\tbreak;\n\n\t\t\t// hlineto/vlineto and vhcurveto/hvcurveto alternate horizontal and vertical\n\t\t\t// starting from a different place.\n\n\t\tcase 0x07: // vlineto\n\t\t\tif (sp < 1) return STBTT__CSERR(\"vlineto stack\");\n\t\t\tgoto vlineto;\n\t\tcase 0x06: // hlineto\n\t\t\tif (sp < 1) return STBTT__CSERR(\"hlineto stack\");\n\t\t\tfor (;;) {\n\t\t\t\tif (i >= sp) break;\n\t\t\t\tstbtt__csctx_rline_to(c, s[i], 0);\n\t\t\t\ti++;\n\t\t\tvlineto:\n\t\t\t\tif (i >= sp) break;\n\t\t\t\tstbtt__csctx_rline_to(c, 0, s[i]);\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 0x1F: // hvcurveto\n\t\t\tif (sp < 4) return STBTT__CSERR(\"hvcurveto stack\");\n\t\t\tgoto hvcurveto;\n\t\tcase 0x1E: // vhcurveto\n\t\t\tif (sp < 4) return STBTT__CSERR(\"vhcurveto stack\");\n\t\t\tfor (;;) {\n\t\t\t\tif (i + 3 >= sp) break;\n\t\t\t\tstbtt__csctx_rccurve_to(c, 0, s[i], s[i + 1], s[i + 2], s[i + 3], (sp - i == 5) ? s[i + 4] : 0.0f);\n\t\t\t\ti += 4;\n\t\t\thvcurveto:\n\t\t\t\tif (i + 3 >= sp) break;\n\t\t\t\tstbtt__csctx_rccurve_to(c, s[i], 0, s[i + 1], s[i + 2], (sp - i == 5) ? s[i + 4] : 0.0f, s[i + 3]);\n\t\t\t\ti += 4;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 0x08: // rrcurveto\n\t\t\tif (sp < 6) return STBTT__CSERR(\"rcurveline stack\");\n\t\t\tfor (; i + 5 < sp; i += 6)\n\t\t\t\tstbtt__csctx_rccurve_to(c, s[i], s[i + 1], s[i + 2], s[i + 3], s[i + 4], s[i + 5]);\n\t\t\tbreak;\n\n\t\tcase 0x18: // rcurveline\n\t\t\tif (sp < 8) return STBTT__CSERR(\"rcurveline stack\");\n\t\t\tfor (; i + 5 < sp - 2; i += 6)\n\t\t\t\tstbtt__csctx_rccurve_to(c, s[i], s[i + 1], s[i + 2], s[i + 3], s[i + 4], s[i + 5]);\n\t\t\tif (i + 1 >= sp) return STBTT__CSERR(\"rcurveline stack\");\n\t\t\tstbtt__csctx_rline_to(c, s[i], s[i + 1]);\n\t\t\tbreak;\n\n\t\tcase 0x19: // rlinecurve\n\t\t\tif (sp < 8) return STBTT__CSERR(\"rlinecurve stack\");\n\t\t\tfor (; i + 1 < sp - 6; i += 2)\n\t\t\t\tstbtt__csctx_rline_to(c, s[i], s[i + 1]);\n\t\t\tif (i + 5 >= sp) return STBTT__CSERR(\"rlinecurve stack\");\n\t\t\tstbtt__csctx_rccurve_to(c, s[i], s[i + 1], s[i + 2], s[i + 3], s[i + 4], s[i + 5]);\n\t\t\tbreak;\n\n\t\tcase 0x1A: // vvcurveto\n\t\tcase 0x1B: // hhcurveto\n\t\t\tif (sp < 4) return STBTT__CSERR(\"(vv|hh)curveto stack\");\n\t\t\tf = 0.0;\n\t\t\tif (sp & 1) { f = s[i]; i++; }\n\t\t\tfor (; i + 3 < sp; i += 4) {\n\t\t\t\tif (b0 == 0x1B)\n\t\t\t\t\tstbtt__csctx_rccurve_to(c, s[i], f, s[i + 1], s[i + 2], s[i + 3], 0.0);\n\t\t\t\telse\n\t\t\t\t\tstbtt__csctx_rccurve_to(c, f, s[i], s[i + 1], s[i + 2], 0.0, s[i + 3]);\n\t\t\t\tf = 0.0;\n\t\t\t}\n\t\t\tbreak;\n\n\t\tcase 0x0A: // callsubr\n\t\t\tif (!has_subrs) {\n\t\t\t\tif (info->fdselect.size)\n\t\t\t\t\tsubrs = stbtt__cid_get_glyph_subrs(info, glyph_index);\n\t\t\t\thas_subrs = 1;\n\t\t\t}\n\t\t\t// fallthrough\n\t\tcase 0x1D: // callgsubr\n\t\t\tif (sp < 1) return STBTT__CSERR(\"call(g|)subr stack\");\n\t\t\tv = (int)s[--sp];\n\t\t\tif (subr_stack_height >= 10) return STBTT__CSERR(\"recursion limit\");\n\t\t\tsubr_stack[subr_stack_height++] = b;\n\t\t\tb = stbtt__get_subr(b0 == 0x0A ? subrs : info->gsubrs, v);\n\t\t\tif (b.size == 0) return STBTT__CSERR(\"subr not found\");\n\t\t\tb.cursor = 0;\n\t\t\tclear_stack = 0;\n\t\t\tbreak;\n\n\t\tcase 0x0B: // return\n\t\t\tif (subr_stack_height <= 0) return STBTT__CSERR(\"return outside subr\");\n\t\t\tb = subr_stack[--subr_stack_height];\n\t\t\tclear_stack = 0;\n\t\t\tbreak;\n\n\t\tcase 0x0E: // endchar\n\t\t\tstbtt__csctx_close_shape(c);\n\t\t\treturn 1;\n\n\t\tcase 0x0C: { // two-byte escape\n\t\t\tfloat dx1, dx2, dx3, dx4, dx5, dx6, dy1, dy2, dy3, dy4, dy5, dy6;\n\t\t\tfloat dx, dy;\n\t\t\tint b1 = stbtt__buf_get8(&b);\n\t\t\tswitch (b1) {\n\t\t\t\t// @TODO These \"flex\" implementations ignore the flex-depth and resolution,\n\t\t\t\t// and always draw beziers.\n\t\t\tcase 0x22: // hflex\n\t\t\t\tif (sp < 7) return STBTT__CSERR(\"hflex stack\");\n\t\t\t\tdx1 = s[0];\n\t\t\t\tdx2 = s[1];\n\t\t\t\tdy2 = s[2];\n\t\t\t\tdx3 = s[3];\n\t\t\t\tdx4 = s[4];\n\t\t\t\tdx5 = s[5];\n\t\t\t\tdx6 = s[6];\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx1, 0, dx2, dy2, dx3, 0);\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx4, 0, dx5, -dy2, dx6, 0);\n\t\t\t\tbreak;\n\n\t\t\tcase 0x23: // flex\n\t\t\t\tif (sp < 13) return STBTT__CSERR(\"flex stack\");\n\t\t\t\tdx1 = s[0];\n\t\t\t\tdy1 = s[1];\n\t\t\t\tdx2 = s[2];\n\t\t\t\tdy2 = s[3];\n\t\t\t\tdx3 = s[4];\n\t\t\t\tdy3 = s[5];\n\t\t\t\tdx4 = s[6];\n\t\t\t\tdy4 = s[7];\n\t\t\t\tdx5 = s[8];\n\t\t\t\tdy5 = s[9];\n\t\t\t\tdx6 = s[10];\n\t\t\t\tdy6 = s[11];\n\t\t\t\t//fd is s[12]\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3);\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6);\n\t\t\t\tbreak;\n\n\t\t\tcase 0x24: // hflex1\n\t\t\t\tif (sp < 9) return STBTT__CSERR(\"hflex1 stack\");\n\t\t\t\tdx1 = s[0];\n\t\t\t\tdy1 = s[1];\n\t\t\t\tdx2 = s[2];\n\t\t\t\tdy2 = s[3];\n\t\t\t\tdx3 = s[4];\n\t\t\t\tdx4 = s[5];\n\t\t\t\tdx5 = s[6];\n\t\t\t\tdy5 = s[7];\n\t\t\t\tdx6 = s[8];\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, 0);\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx4, 0, dx5, dy5, dx6, -(dy1 + dy2 + dy5));\n\t\t\t\tbreak;\n\n\t\t\tcase 0x25: // flex1\n\t\t\t\tif (sp < 11) return STBTT__CSERR(\"flex1 stack\");\n\t\t\t\tdx1 = s[0];\n\t\t\t\tdy1 = s[1];\n\t\t\t\tdx2 = s[2];\n\t\t\t\tdy2 = s[3];\n\t\t\t\tdx3 = s[4];\n\t\t\t\tdy3 = s[5];\n\t\t\t\tdx4 = s[6];\n\t\t\t\tdy4 = s[7];\n\t\t\t\tdx5 = s[8];\n\t\t\t\tdy5 = s[9];\n\t\t\t\tdx6 = dy6 = s[10];\n\t\t\t\tdx = dx1 + dx2 + dx3 + dx4 + dx5;\n\t\t\t\tdy = dy1 + dy2 + dy3 + dy4 + dy5;\n\t\t\t\tif (STBTT_fabs(dx) > STBTT_fabs(dy))\n\t\t\t\t\tdy6 = -dy;\n\t\t\t\telse\n\t\t\t\t\tdx6 = -dx;\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx1, dy1, dx2, dy2, dx3, dy3);\n\t\t\t\tstbtt__csctx_rccurve_to(c, dx4, dy4, dx5, dy5, dx6, dy6);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\treturn STBTT__CSERR(\"unimplemented\");\n\t\t\t}\n\t\t} break;\n\n\t\tdefault:\n\t\t\tif (b0 != 255 && b0 != 28 && (b0 < 32 || b0 > 254))\n\t\t\t\treturn STBTT__CSERR(\"reserved operator\");\n\n\t\t\t// push immediate\n\t\t\tif (b0 == 255) {\n\t\t\t\tf = (float)stbtt__buf_get32(&b) / 0x10000;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstbtt__buf_skip(&b, -1);\n\t\t\t\tf = (float)(stbtt_int16)stbtt__cff_int(&b);\n\t\t\t}\n\t\t\tif (sp >= 48) return STBTT__CSERR(\"push stack overflow\");\n\t\t\ts[sp++] = f;\n\t\t\tclear_stack = 0;\n\t\t\tbreak;\n\t\t}\n\t\tif (clear_stack) sp = 0;\n\t}\n\treturn STBTT__CSERR(\"no endchar\");\n\n#undef STBTT__CSERR\n}\n\nstatic int stbtt__GetGlyphShapeT2(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)\n{\n\t// runs the charstring twice, once to count and once to output (to avoid realloc)\n\tstbtt__csctx count_ctx = STBTT__CSCTX_INIT(1);\n\tstbtt__csctx output_ctx = STBTT__CSCTX_INIT(0);\n\tif (stbtt__run_charstring(info, glyph_index, &count_ctx)) {\n\t\t*pvertices = (stbtt_vertex*)STBTT_malloc(count_ctx.num_vertices * sizeof(stbtt_vertex), info->userdata);\n\t\toutput_ctx.pvertices = *pvertices;\n\t\tif (stbtt__run_charstring(info, glyph_index, &output_ctx)) {\n\t\t\tSTBTT_assert(output_ctx.num_vertices == count_ctx.num_vertices);\n\t\t\treturn output_ctx.num_vertices;\n\t\t}\n\t}\n\t*pvertices = NULL;\n\treturn 0;\n}\n\nstatic int stbtt__GetGlyphInfoT2(const stbtt_fontinfo *info, int glyph_index, int *x0, int *y0, int *x1, int *y1)\n{\n\tstbtt__csctx c = STBTT__CSCTX_INIT(1);\n\tint r = stbtt__run_charstring(info, glyph_index, &c);\n\tif (x0) {\n\t\t*x0 = r ? c.min_x : 0;\n\t\t*y0 = r ? c.min_y : 0;\n\t\t*x1 = r ? c.max_x : 0;\n\t\t*y1 = r ? c.max_y : 0;\n\t}\n\treturn r ? c.num_vertices : 0;\n}\n\nSTBTT_DEF int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_vertex **pvertices)\n{\n\tif (!info->cff.size)\n\t\treturn stbtt__GetGlyphShapeTT(info, glyph_index, pvertices);\n\telse\n\t\treturn stbtt__GetGlyphShapeT2(info, glyph_index, pvertices);\n}\n\nSTBTT_DEF void stbtt_GetGlyphHMetrics(const stbtt_fontinfo *info, int glyph_index, int *advanceWidth, int *leftSideBearing)\n{\n\tstbtt_uint16 numOfLongHorMetrics = ttUSHORT(info->data + info->hhea + 34);\n\tif (glyph_index < numOfLongHorMetrics) {\n\t\tif (advanceWidth)     *advanceWidth = ttSHORT(info->data + info->hmtx + 4 * glyph_index);\n\t\tif (leftSideBearing)  *leftSideBearing = ttSHORT(info->data + info->hmtx + 4 * glyph_index + 2);\n\t}\n\telse {\n\t\tif (advanceWidth)     *advanceWidth = ttSHORT(info->data + info->hmtx + 4 * (numOfLongHorMetrics - 1));\n\t\tif (leftSideBearing)  *leftSideBearing = ttSHORT(info->data + info->hmtx + 4 * numOfLongHorMetrics + 2 * (glyph_index - numOfLongHorMetrics));\n\t}\n}\n\nSTBTT_DEF int  stbtt_GetGlyphKernAdvance(const stbtt_fontinfo *info, int glyph1, int glyph2)\n{\n\tstbtt_uint8 *data = info->data + info->kern;\n\tstbtt_uint32 needle, straw;\n\tint l, r, m;\n\n\t// we only look at the first table. it must be 'horizontal' and format 0.\n\tif (!info->kern)\n\t\treturn 0;\n\tif (ttUSHORT(data + 2) < 1) // number of tables, need at least 1\n\t\treturn 0;\n\tif (ttUSHORT(data + 8) != 1) // horizontal flag must be set in format\n\t\treturn 0;\n\n\tl = 0;\n\tr = ttUSHORT(data + 10) - 1;\n\tneedle = glyph1 << 16 | glyph2;\n\twhile (l <= r) {\n\t\tm = (l + r) >> 1;\n\t\tstraw = ttULONG(data + 18 + (m * 6)); // note: unaligned read\n\t\tif (needle < straw)\n\t\t\tr = m - 1;\n\t\telse if (needle > straw)\n\t\t\tl = m + 1;\n\t\telse\n\t\t\treturn ttSHORT(data + 22 + (m * 6));\n\t}\n\treturn 0;\n}\n\nSTBTT_DEF int  stbtt_GetCodepointKernAdvance(const stbtt_fontinfo *info, int ch1, int ch2)\n{\n\tif (!info->kern) // if no kerning table, don't waste time looking up both codepoint->glyphs\n\t\treturn 0;\n\treturn stbtt_GetGlyphKernAdvance(info, stbtt_FindGlyphIndex(info, ch1), stbtt_FindGlyphIndex(info, ch2));\n}\n\nSTBTT_DEF void stbtt_GetCodepointHMetrics(const stbtt_fontinfo *info, int codepoint, int *advanceWidth, int *leftSideBearing)\n{\n\tstbtt_GetGlyphHMetrics(info, stbtt_FindGlyphIndex(info, codepoint), advanceWidth, leftSideBearing);\n}\n\nSTBTT_DEF void stbtt_GetFontVMetrics(const stbtt_fontinfo *info, int *ascent, int *descent, int *lineGap)\n{\n\tif (ascent) *ascent = ttSHORT(info->data + info->hhea + 4);\n\tif (descent) *descent = ttSHORT(info->data + info->hhea + 6);\n\tif (lineGap) *lineGap = ttSHORT(info->data + info->hhea + 8);\n}\n\nSTBTT_DEF void stbtt_GetFontBoundingBox(const stbtt_fontinfo *info, int *x0, int *y0, int *x1, int *y1)\n{\n\t*x0 = ttSHORT(info->data + info->head + 36);\n\t*y0 = ttSHORT(info->data + info->head + 38);\n\t*x1 = ttSHORT(info->data + info->head + 40);\n\t*y1 = ttSHORT(info->data + info->head + 42);\n}\n\nSTBTT_DEF float stbtt_ScaleForPixelHeight(const stbtt_fontinfo *info, float height)\n{\n\tint fheight = ttSHORT(info->data + info->hhea + 4) - ttSHORT(info->data + info->hhea + 6);\n\treturn (float)height / fheight;\n}\n\nSTBTT_DEF float stbtt_ScaleForMappingEmToPixels(const stbtt_fontinfo *info, float pixels)\n{\n\tint unitsPerEm = ttUSHORT(info->data + info->head + 18);\n\treturn pixels / unitsPerEm;\n}\n\nSTBTT_DEF void stbtt_FreeShape(const stbtt_fontinfo *info, stbtt_vertex *v)\n{\n\tSTBTT_free(v, info->userdata);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// antialiasing software rasterizer\n//\n\nSTBTT_DEF void stbtt_GetGlyphBitmapBoxSubpixel(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n\tint x0 = 0, y0 = 0, x1, y1; // =0 suppresses compiler warning\n\tif (!stbtt_GetGlyphBox(font, glyph, &x0, &y0, &x1, &y1)) {\n\t\t// e.g. space character\n\t\tif (ix0) *ix0 = 0;\n\t\tif (iy0) *iy0 = 0;\n\t\tif (ix1) *ix1 = 0;\n\t\tif (iy1) *iy1 = 0;\n\t}\n\telse {\n\t\t// move to integral bboxes (treating pixels as little squares, what pixels get touched)?\n\t\tif (ix0) *ix0 = STBTT_ifloor(x0 * scale_x + shift_x);\n\t\tif (iy0) *iy0 = STBTT_ifloor(-y1 * scale_y + shift_y);\n\t\tif (ix1) *ix1 = STBTT_iceil(x1 * scale_x + shift_x);\n\t\tif (iy1) *iy1 = STBTT_iceil(-y0 * scale_y + shift_y);\n\t}\n}\n\nSTBTT_DEF void stbtt_GetGlyphBitmapBox(const stbtt_fontinfo *font, int glyph, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n\tstbtt_GetGlyphBitmapBoxSubpixel(font, glyph, scale_x, scale_y, 0.0f, 0.0f, ix0, iy0, ix1, iy1);\n}\n\nSTBTT_DEF void stbtt_GetCodepointBitmapBoxSubpixel(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, float shift_x, float shift_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n\tstbtt_GetGlyphBitmapBoxSubpixel(font, stbtt_FindGlyphIndex(font, codepoint), scale_x, scale_y, shift_x, shift_y, ix0, iy0, ix1, iy1);\n}\n\nSTBTT_DEF void stbtt_GetCodepointBitmapBox(const stbtt_fontinfo *font, int codepoint, float scale_x, float scale_y, int *ix0, int *iy0, int *ix1, int *iy1)\n{\n\tstbtt_GetCodepointBitmapBoxSubpixel(font, codepoint, scale_x, scale_y, 0.0f, 0.0f, ix0, iy0, ix1, iy1);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n//  Rasterizer\n\ntypedef struct stbtt__hheap_chunk\n{\n\tstruct stbtt__hheap_chunk *next;\n} stbtt__hheap_chunk;\n\ntypedef struct stbtt__hheap\n{\n\tstruct stbtt__hheap_chunk *head;\n\tvoid   *first_free;\n\tint    num_remaining_in_head_chunk;\n} stbtt__hheap;\n\nstatic void *stbtt__hheap_alloc(stbtt__hheap *hh, size_t size, void *userdata)\n{\n\tif (hh->first_free) {\n\t\tvoid *p = hh->first_free;\n\t\thh->first_free = *(void **)p;\n\t\treturn p;\n\t}\n\telse {\n\t\tif (hh->num_remaining_in_head_chunk == 0) {\n\t\t\tint count = (size < 32 ? 2000 : size < 128 ? 800 : 100);\n\t\t\tstbtt__hheap_chunk *c = (stbtt__hheap_chunk *)STBTT_malloc(sizeof(stbtt__hheap_chunk) + size * count, userdata);\n\t\t\tif (c == NULL)\n\t\t\t\treturn NULL;\n\t\t\tc->next = hh->head;\n\t\t\thh->head = c;\n\t\t\thh->num_remaining_in_head_chunk = count;\n\t\t}\n\t\t--hh->num_remaining_in_head_chunk;\n\t\treturn (char *)(hh->head) + size * hh->num_remaining_in_head_chunk;\n\t}\n}\n\nstatic void stbtt__hheap_free(stbtt__hheap *hh, void *p)\n{\n\t*(void **)p = hh->first_free;\n\thh->first_free = p;\n}\n\nstatic void stbtt__hheap_cleanup(stbtt__hheap *hh, void *userdata)\n{\n\tstbtt__hheap_chunk *c = hh->head;\n\twhile (c) {\n\t\tstbtt__hheap_chunk *n = c->next;\n\t\tSTBTT_free(c, userdata);\n\t\tc = n;\n\t}\n}\n\ntypedef struct stbtt__edge {\n\tfloat x0, y0, x1, y1;\n\tint invert;\n} stbtt__edge;\n\n\ntypedef struct stbtt__active_edge\n{\n\tstruct stbtt__active_edge *next;\n#if STBTT_RASTERIZER_VERSION==1\n\tint x, dx;\n\tfloat ey;\n\tint direction;\n#elif STBTT_RASTERIZER_VERSION==2\n\tfloat fx, fdx, fdy;\n\tfloat direction;\n\tfloat sy;\n\tfloat ey;\n#else\n////#error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n} stbtt__active_edge;\n\n#if STBTT_RASTERIZER_VERSION == 1\n#define STBTT_FIXSHIFT   10\n#define STBTT_FIX        (1 << STBTT_FIXSHIFT)\n#define STBTT_FIXMASK    (STBTT_FIX-1)\n\nstatic stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, int off_x, float start_point, void *userdata)\n{\n\tstbtt__active_edge *z = (stbtt__active_edge *)stbtt__hheap_alloc(hh, sizeof(*z), userdata);\n\tfloat dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);\n\tSTBTT_assert(z != NULL);\n\tif (!z) return z;\n\n\t// round dx down to avoid overshooting\n\tif (dxdy < 0)\n\t\tz->dx = -STBTT_ifloor(STBTT_FIX * -dxdy);\n\telse\n\t\tz->dx = STBTT_ifloor(STBTT_FIX * dxdy);\n\n\tz->x = STBTT_ifloor(STBTT_FIX * e->x0 + z->dx * (start_point - e->y0)); // use z->dx so when we offset later it's by the same amount\n\tz->x -= off_x * STBTT_FIX;\n\n\tz->ey = e->y1;\n\tz->next = 0;\n\tz->direction = e->invert ? 1 : -1;\n\treturn z;\n}\n#elif STBTT_RASTERIZER_VERSION == 2\nstatic stbtt__active_edge *stbtt__new_active(stbtt__hheap *hh, stbtt__edge *e, int off_x, float start_point, void *userdata)\n{\n\tstbtt__active_edge *z = (stbtt__active_edge *)stbtt__hheap_alloc(hh, sizeof(*z), userdata);\n\tfloat dxdy = (e->x1 - e->x0) / (e->y1 - e->y0);\n\tSTBTT_assert(z != NULL);\n\t//STBTT_assert(e->y0 <= start_point);\n\tif (!z) return z;\n\tz->fdx = dxdy;\n\tz->fdy = dxdy != 0.0f ? (1.0f / dxdy) : 0.0f;\n\tz->fx = e->x0 + dxdy * (start_point - e->y0);\n\tz->fx -= off_x;\n\tz->direction = e->invert ? 1.0f : -1.0f;\n\tz->sy = e->y0;\n\tz->ey = e->y1;\n\tz->next = 0;\n\treturn z;\n}\n#else\n//#error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n\n#if STBTT_RASTERIZER_VERSION == 1\n// note: this routine clips fills that extend off the edges... ideally this\n// wouldn't happen, but it could happen if the truetype glyph bounding boxes\n// are wrong, or if the user supplies a too-small bitmap\nstatic void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__active_edge *e, int max_weight)\n{\n\t// non-zero winding fill\n\tint x0 = 0, w = 0;\n\n\twhile (e) {\n\t\tif (w == 0) {\n\t\t\t// if we're currently at zero, we need to record the edge start point\n\t\t\tx0 = e->x; w += e->direction;\n\t\t}\n\t\telse {\n\t\t\tint x1 = e->x; w += e->direction;\n\t\t\t// if we went to zero, we need to draw\n\t\t\tif (w == 0) {\n\t\t\t\tint i = x0 >> STBTT_FIXSHIFT;\n\t\t\t\tint j = x1 >> STBTT_FIXSHIFT;\n\n\t\t\t\tif (i < len && j >= 0) {\n\t\t\t\t\tif (i == j) {\n\t\t\t\t\t\t// x0,x1 are the same pixel, so compute combined coverage\n\t\t\t\t\t\tscanline[i] = scanline[i] + (stbtt_uint8)((x1 - x0) * max_weight >> STBTT_FIXSHIFT);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tif (i >= 0) // add antialiasing for x0\n\t\t\t\t\t\t\tscanline[i] = scanline[i] + (stbtt_uint8)(((STBTT_FIX - (x0 & STBTT_FIXMASK)) * max_weight) >> STBTT_FIXSHIFT);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ti = -1; // clip\n\n\t\t\t\t\t\tif (j < len) // add antialiasing for x1\n\t\t\t\t\t\t\tscanline[j] = scanline[j] + (stbtt_uint8)(((x1 & STBTT_FIXMASK) * max_weight) >> STBTT_FIXSHIFT);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tj = len; // clip\n\n\t\t\t\t\t\tfor (++i; i < j; ++i) // fill pixels between x0 and x1\n\t\t\t\t\t\t\tscanline[i] = scanline[i] + (stbtt_uint8)max_weight;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\te = e->next;\n\t}\n}\n\nstatic void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)\n{\n\tstbtt__hheap hh = { 0, 0, 0 };\n\tstbtt__active_edge *active = NULL;\n\tint y, j = 0;\n\tint max_weight = (255 / vsubsample);  // weight per vertical scanline\n\tint s; // vertical subsample index\n\tunsigned char scanline_data[512], *scanline;\n\n\tif (result->w > 512)\n\t\tscanline = (unsigned char *)STBTT_malloc(result->w, userdata);\n\telse\n\t\tscanline = scanline_data;\n\n\ty = off_y * vsubsample;\n\te[n].y0 = (off_y + result->h) * (float)vsubsample + 1;\n\n\twhile (j < result->h) {\n\t\tSTBTT_memset(scanline, 0, result->w);\n\t\tfor (s = 0; s < vsubsample; ++s) {\n\t\t\t// find center of pixel for this scanline\n\t\t\tfloat scan_y = y + 0.5f;\n\t\t\tstbtt__active_edge **step = &active;\n\n\t\t\t// update all active edges;\n\t\t\t// remove all active edges that terminate before the center of this scanline\n\t\t\twhile (*step) {\n\t\t\t\tstbtt__active_edge * z = *step;\n\t\t\t\tif (z->ey <= scan_y) {\n\t\t\t\t\t*step = z->next; // delete from list\n\t\t\t\t\tSTBTT_assert(z->direction);\n\t\t\t\t\tz->direction = 0;\n\t\t\t\t\tstbtt__hheap_free(&hh, z);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tz->x += z->dx; // advance to position for current scanline\n\t\t\t\t\tstep = &((*step)->next); // advance through list\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// resort the list if needed\n\t\t\tfor (;;) {\n\t\t\t\tint changed = 0;\n\t\t\t\tstep = &active;\n\t\t\t\twhile (*step && (*step)->next) {\n\t\t\t\t\tif ((*step)->x > (*step)->next->x) {\n\t\t\t\t\t\tstbtt__active_edge *t = *step;\n\t\t\t\t\t\tstbtt__active_edge *q = t->next;\n\n\t\t\t\t\t\tt->next = q->next;\n\t\t\t\t\t\tq->next = t;\n\t\t\t\t\t\t*step = q;\n\t\t\t\t\t\tchanged = 1;\n\t\t\t\t\t}\n\t\t\t\t\tstep = &(*step)->next;\n\t\t\t\t}\n\t\t\t\tif (!changed) break;\n\t\t\t}\n\n\t\t\t// insert all edges that start before the center of this scanline -- omit ones that also end on this scanline\n\t\t\twhile (e->y0 <= scan_y) {\n\t\t\t\tif (e->y1 > scan_y) {\n\t\t\t\t\tstbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y, userdata);\n\t\t\t\t\tif (z != NULL) {\n\t\t\t\t\t\t// find insertion point\n\t\t\t\t\t\tif (active == NULL)\n\t\t\t\t\t\t\tactive = z;\n\t\t\t\t\t\telse if (z->x < active->x) {\n\t\t\t\t\t\t\t// insert at front\n\t\t\t\t\t\t\tz->next = active;\n\t\t\t\t\t\t\tactive = z;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t// find thing to insert AFTER\n\t\t\t\t\t\t\tstbtt__active_edge *p = active;\n\t\t\t\t\t\t\twhile (p->next && p->next->x < z->x)\n\t\t\t\t\t\t\t\tp = p->next;\n\t\t\t\t\t\t\t// at this point, p->next->x is NOT < z->x\n\t\t\t\t\t\t\tz->next = p->next;\n\t\t\t\t\t\t\tp->next = z;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t++e;\n\t\t\t}\n\n\t\t\t// now process all active edges in XOR fashion\n\t\t\tif (active)\n\t\t\t\tstbtt__fill_active_edges(scanline, result->w, active, max_weight);\n\n\t\t\t++y;\n\t\t}\n\t\tSTBTT_memcpy(result->pixels + j * result->stride, scanline, result->w);\n\t\t++j;\n\t}\n\n\tstbtt__hheap_cleanup(&hh, userdata);\n\n\tif (scanline != scanline_data)\n\t\tSTBTT_free(scanline, userdata);\n}\n\n#elif STBTT_RASTERIZER_VERSION == 2\n\n// the edge passed in here does not cross the vertical line at x or the vertical line at x+1\n// (i.e. it has already been clipped to those)\nstatic void stbtt__handle_clipped_edge(float *scanline, int x, stbtt__active_edge *e, float x0, float y0, float x1, float y1)\n{\n\tif (y0 == y1) return;\n\tSTBTT_assert(y0 < y1);\n\tSTBTT_assert(e->sy <= e->ey);\n\tif (y0 > e->ey) return;\n\tif (y1 < e->sy) return;\n\tif (y0 < e->sy) {\n\t\tx0 += (x1 - x0) * (e->sy - y0) / (y1 - y0);\n\t\ty0 = e->sy;\n\t}\n\tif (y1 > e->ey) {\n\t\tx1 += (x1 - x0) * (e->ey - y1) / (y1 - y0);\n\t\ty1 = e->ey;\n\t}\n\n\tif (x0 == x)\n\t\tSTBTT_assert(x1 <= x + 1);\n\telse if (x0 == x + 1)\n\t\tSTBTT_assert(x1 >= x);\n\telse if (x0 <= x)\n\t\tSTBTT_assert(x1 <= x);\n\telse if (x0 >= x + 1)\n\t\tSTBTT_assert(x1 >= x + 1);\n\telse\n\t\tSTBTT_assert(x1 >= x && x1 <= x + 1);\n\n\tif (x0 <= x && x1 <= x)\n\t\tscanline[x] += e->direction * (y1 - y0);\n\telse if (x0 >= x + 1 && x1 >= x + 1)\n\t\t;\n\telse {\n\t\tSTBTT_assert(x0 >= x && x0 <= x + 1 && x1 >= x && x1 <= x + 1);\n\t\tscanline[x] += e->direction * (y1 - y0) * (1 - ((x0 - x) + (x1 - x)) / 2); // coverage = 1 - average x position\n\t}\n}\n\nstatic void stbtt__fill_active_edges_new(float *scanline, float *scanline_fill, int len, stbtt__active_edge *e, float y_top)\n{\n\tfloat y_bottom = y_top + 1;\n\n\twhile (e) {\n\t\t// brute force every pixel\n\n\t\t// compute intersection points with top & bottom\n\t\tSTBTT_assert(e->ey >= y_top);\n\n\t\tif (e->fdx == 0) {\n\t\t\tfloat x0 = e->fx;\n\t\t\tif (x0 < len) {\n\t\t\t\tif (x0 >= 0) {\n\t\t\t\t\tstbtt__handle_clipped_edge(scanline, (int)x0, e, x0, y_top, x0, y_bottom);\n\t\t\t\t\tstbtt__handle_clipped_edge(scanline_fill - 1, (int)x0 + 1, e, x0, y_top, x0, y_bottom);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tstbtt__handle_clipped_edge(scanline_fill - 1, 0, e, x0, y_top, x0, y_bottom);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tfloat x0 = e->fx;\n\t\t\tfloat dx = e->fdx;\n\t\t\tfloat xb = x0 + dx;\n\t\t\tfloat x_top, x_bottom;\n\t\t\tfloat sy0, sy1;\n\t\t\tfloat dy = e->fdy;\n\t\t\tSTBTT_assert(e->sy <= y_bottom && e->ey >= y_top);\n\n\t\t\t// compute endpoints of line segment clipped to this scanline (if the\n\t\t\t// line segment starts on this scanline. x0 is the intersection of the\n\t\t\t// line with y_top, but that may be off the line segment.\n\t\t\tif (e->sy > y_top) {\n\t\t\t\tx_top = x0 + dx * (e->sy - y_top);\n\t\t\t\tsy0 = e->sy;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx_top = x0;\n\t\t\t\tsy0 = y_top;\n\t\t\t}\n\t\t\tif (e->ey < y_bottom) {\n\t\t\t\tx_bottom = x0 + dx * (e->ey - y_top);\n\t\t\t\tsy1 = e->ey;\n\t\t\t}\n\t\t\telse {\n\t\t\t\tx_bottom = xb;\n\t\t\t\tsy1 = y_bottom;\n\t\t\t}\n\n\t\t\tif (x_top >= 0 && x_bottom >= 0 && x_top < len && x_bottom < len) {\n\t\t\t\t// from here on, we don't have to range check x values\n\n\t\t\t\tif ((int)x_top == (int)x_bottom) {\n\t\t\t\t\tfloat height;\n\t\t\t\t\t// simple case, only spans one pixel\n\t\t\t\t\tint x = (int)x_top;\n\t\t\t\t\theight = sy1 - sy0;\n\t\t\t\t\tSTBTT_assert(x >= 0 && x < len);\n\t\t\t\t\tscanline[x] += e->direction * (1 - ((x_top - x) + (x_bottom - x)) / 2)  * height;\n\t\t\t\t\tscanline_fill[x] += e->direction * height; // everything right of this pixel is filled\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tint x, x1, x2;\n\t\t\t\t\tfloat y_crossing, step, sign, area;\n\t\t\t\t\t// covers 2+ pixels\n\t\t\t\t\tif (x_top > x_bottom) {\n\t\t\t\t\t\t// flip scanline vertically; signed area is the same\n\t\t\t\t\t\tfloat t;\n\t\t\t\t\t\tsy0 = y_bottom - (sy0 - y_top);\n\t\t\t\t\t\tsy1 = y_bottom - (sy1 - y_top);\n\t\t\t\t\t\tt = sy0, sy0 = sy1, sy1 = t;\n\t\t\t\t\t\tt = x_bottom, x_bottom = x_top, x_top = t;\n\t\t\t\t\t\tdx = -dx;\n\t\t\t\t\t\tdy = -dy;\n\t\t\t\t\t\tt = x0, x0 = xb, xb = t;\n\t\t\t\t\t}\n\n\t\t\t\t\tx1 = (int)x_top;\n\t\t\t\t\tx2 = (int)x_bottom;\n\t\t\t\t\t// compute intersection with y axis at x1+1\n\t\t\t\t\ty_crossing = (x1 + 1 - x0) * dy + y_top;\n\n\t\t\t\t\tsign = e->direction;\n\t\t\t\t\t// area of the rectangle covered from y0..y_crossing\n\t\t\t\t\tarea = sign * (y_crossing - sy0);\n\t\t\t\t\t// area of the triangle (x_top,y0), (x+1,y0), (x+1,y_crossing)\n\t\t\t\t\tscanline[x1] += area * (1 - ((x_top - x1) + (x1 + 1 - x1)) / 2);\n\n\t\t\t\t\tstep = sign * dy;\n\t\t\t\t\tfor (x = x1 + 1; x < x2; ++x) {\n\t\t\t\t\t\tscanline[x] += area + step / 2;\n\t\t\t\t\t\tarea += step;\n\t\t\t\t\t}\n\t\t\t\t\ty_crossing += dy * (x2 - (x1 + 1));\n\n\t\t\t\t\tSTBTT_assert(STBTT_fabs(area) <= 1.01f);\n\n\t\t\t\t\tscanline[x2] += area + sign * (1 - ((x2 - x2) + (x_bottom - x2)) / 2) * (sy1 - y_crossing);\n\n\t\t\t\t\tscanline_fill[x2] += sign * (sy1 - sy0);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// if edge goes outside of box we're drawing, we require\n\t\t\t\t// clipping logic. since this does not match the intended use\n\t\t\t\t// of this library, we use a different, very slow brute\n\t\t\t\t// force implementation\n\t\t\t\tint x;\n\t\t\t\tfor (x = 0; x < len; ++x) {\n\t\t\t\t\t// cases:\n\t\t\t\t\t//\n\t\t\t\t\t// there can be up to two intersections with the pixel. any intersection\n\t\t\t\t\t// with left or right edges can be handled by splitting into two (or three)\n\t\t\t\t\t// regions. intersections with top & bottom do not necessitate case-wise logic.\n\t\t\t\t\t//\n\t\t\t\t\t// the old way of doing this found the intersections with the left & right edges,\n\t\t\t\t\t// then used some simple logic to produce up to three segments in sorted order\n\t\t\t\t\t// from top-to-bottom. however, this had a problem: if an x edge was epsilon\n\t\t\t\t\t// across the x border, then the corresponding y position might not be distinct\n\t\t\t\t\t// from the other y segment, and it might ignored as an empty segment. to avoid\n\t\t\t\t\t// that, we need to explicitly produce segments based on x positions.\n\n\t\t\t\t\t// rename variables to clear pairs\n\t\t\t\t\tfloat y0 = y_top;\n\t\t\t\t\tfloat x1 = (float)(x);\n\t\t\t\t\tfloat x2 = (float)(x + 1);\n\t\t\t\t\tfloat x3 = xb;\n\t\t\t\t\tfloat y3 = y_bottom;\n\t\t\t\t\tfloat y1, y2;\n\n\t\t\t\t\t// x = e->x + e->dx * (y-y_top)\n\t\t\t\t\t// (y-y_top) = (x - e->x) / e->dx\n\t\t\t\t\t// y = (x - e->x) / e->dx + y_top\n\t\t\t\t\ty1 = (x - x0) / dx + y_top;\n\t\t\t\t\ty2 = (x + 1 - x0) / dx + y_top;\n\n\t\t\t\t\tif (x0 < x1 && x3 > x2) {         // three segments descending down-right\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x1, y1);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x1, y1, x2, y2);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x2, y2, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t\telse if (x3 < x1 && x0 > x2) {  // three segments descending down-left\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x2, y2);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x2, y2, x1, y1);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x1, y1, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t\telse if (x0 < x1 && x3 > x1) {  // two segments across x, down-right\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x1, y1);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x1, y1, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t\telse if (x3 < x1 && x0 > x1) {  // two segments across x, down-left\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x1, y1);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x1, y1, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t\telse if (x0 < x2 && x3 > x2) {  // two segments across x+1, down-right\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x2, y2);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x2, y2, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t\telse if (x3 < x2 && x0 > x2) {  // two segments across x+1, down-left\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x2, y2);\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x2, y2, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t\telse {  // one segment\n\t\t\t\t\t\tstbtt__handle_clipped_edge(scanline, x, e, x0, y0, x3, y3);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\te = e->next;\n\t}\n}\n\n// directly AA rasterize edges w/o supersampling\nstatic void stbtt__rasterize_sorted_edges(stbtt__bitmap *result, stbtt__edge *e, int n, int vsubsample, int off_x, int off_y, void *userdata)\n{\n\tstbtt__hheap hh = { 0, 0, 0 };\n\tstbtt__active_edge *active = NULL;\n\tint y, j = 0, i;\n\tfloat scanline_data[129], *scanline, *scanline2;\n\n\tSTBTT__NOTUSED(vsubsample);\n\n\tif (result->w > 64)\n\t\tscanline = (float *)STBTT_malloc((result->w * 2 + 1) * sizeof(float), userdata);\n\telse\n\t\tscanline = scanline_data;\n\n\tscanline2 = scanline + result->w;\n\n\ty = off_y;\n\te[n].y0 = (float)(off_y + result->h) + 1;\n\n\twhile (j < result->h) {\n\t\t// find center of pixel for this scanline\n\t\tfloat scan_y_top = y + 0.0f;\n\t\tfloat scan_y_bottom = y + 1.0f;\n\t\tstbtt__active_edge **step = &active;\n\n\t\tSTBTT_memset(scanline, 0, result->w * sizeof(scanline[0]));\n\t\tSTBTT_memset(scanline2, 0, (result->w + 1) * sizeof(scanline[0]));\n\n\t\t// update all active edges;\n\t\t// remove all active edges that terminate before the top of this scanline\n\t\twhile (*step) {\n\t\t\tstbtt__active_edge * z = *step;\n\t\t\tif (z->ey <= scan_y_top) {\n\t\t\t\t*step = z->next; // delete from list\n\t\t\t\tSTBTT_assert(z->direction);\n\t\t\t\tz->direction = 0;\n\t\t\t\tstbtt__hheap_free(&hh, z);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tstep = &((*step)->next); // advance through list\n\t\t\t}\n\t\t}\n\n\t\t// insert all edges that start before the bottom of this scanline\n\t\twhile (e->y0 <= scan_y_bottom) {\n\t\t\tif (e->y0 != e->y1) {\n\t\t\t\tstbtt__active_edge *z = stbtt__new_active(&hh, e, off_x, scan_y_top, userdata);\n\t\t\t\tif (z != NULL) {\n\t\t\t\t\tSTBTT_assert(z->ey >= scan_y_top);\n\t\t\t\t\t// insert at front\n\t\t\t\t\tz->next = active;\n\t\t\t\t\tactive = z;\n\t\t\t\t}\n\t\t\t}\n\t\t\t++e;\n\t\t}\n\n\t\t// now process all active edges\n\t\tif (active)\n\t\t\tstbtt__fill_active_edges_new(scanline, scanline2 + 1, result->w, active, scan_y_top);\n\n\t\t{\n\t\t\tfloat sum = 0;\n\t\t\tfor (i = 0; i < result->w; ++i) {\n\t\t\t\tfloat k;\n\t\t\t\tint m;\n\t\t\t\tsum += scanline2[i];\n\t\t\t\tk = scanline[i] + sum;\n\t\t\t\tk = (float)STBTT_fabs(k) * 255 + 0.5f;\n\t\t\t\tm = (int)k;\n\t\t\t\tif (m > 255) m = 255;\n\t\t\t\tresult->pixels[j*result->stride + i] = (unsigned char)m;\n\t\t\t}\n\t\t}\n\t\t// advance all the edges\n\t\tstep = &active;\n\t\twhile (*step) {\n\t\t\tstbtt__active_edge *z = *step;\n\t\t\tz->fx += z->fdx; // advance to position for current scanline\n\t\t\tstep = &((*step)->next); // advance through list\n\t\t}\n\n\t\t++y;\n\t\t++j;\n\t}\n\n\tstbtt__hheap_cleanup(&hh, userdata);\n\n\tif (scanline != scanline_data)\n\t\tSTBTT_free(scanline, userdata);\n}\n#else\n//#error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n\n#define STBTT__COMPARE(a,b)  ((a)->y0 < (b)->y0)\n\nstatic void stbtt__sort_edges_ins_sort(stbtt__edge *p, int n)\n{\n\tint i, j;\n\tfor (i = 1; i < n; ++i) {\n\t\tstbtt__edge t = p[i], *a = &t;\n\t\tj = i;\n\t\twhile (j > 0) {\n\t\t\tstbtt__edge *b = &p[j - 1];\n\t\t\tint c = STBTT__COMPARE(a, b);\n\t\t\tif (!c) break;\n\t\t\tp[j] = p[j - 1];\n\t\t\t--j;\n\t\t}\n\t\tif (i != j)\n\t\t\tp[j] = t;\n\t}\n}\n\nstatic void stbtt__sort_edges_quicksort(stbtt__edge *p, int n)\n{\n\t/* threshhold for transitioning to insertion sort */\n\twhile (n > 12) {\n\t\tstbtt__edge t;\n\t\tint c01, c12, c, m, i, j;\n\n\t\t/* compute median of three */\n\t\tm = n >> 1;\n\t\tc01 = STBTT__COMPARE(&p[0], &p[m]);\n\t\tc12 = STBTT__COMPARE(&p[m], &p[n - 1]);\n\t\t/* if 0 >= mid >= end, or 0 < mid < end, then use mid */\n\t\tif (c01 != c12) {\n\t\t\t/* otherwise, we'll need to swap something else to middle */\n\t\t\tint z;\n\t\t\tc = STBTT__COMPARE(&p[0], &p[n - 1]);\n\t\t\t/* 0>mid && mid<n:  0>n => n; 0<n => 0 */\n\t\t\t/* 0<mid && mid>n:  0>n => 0; 0<n => n */\n\t\t\tz = (c == c12) ? 0 : n - 1;\n\t\t\tt = p[z];\n\t\t\tp[z] = p[m];\n\t\t\tp[m] = t;\n\t\t}\n\t\t/* now p[m] is the median-of-three */\n\t\t/* swap it to the beginning so it won't move around */\n\t\tt = p[0];\n\t\tp[0] = p[m];\n\t\tp[m] = t;\n\n\t\t/* partition loop */\n\t\ti = 1;\n\t\tj = n - 1;\n\t\tfor (;;) {\n\t\t\t/* handling of equality is crucial here */\n\t\t\t/* for sentinels & efficiency with duplicates */\n\t\t\tfor (;; ++i) {\n\t\t\t\tif (!STBTT__COMPARE(&p[i], &p[0])) break;\n\t\t\t}\n\t\t\tfor (;; --j) {\n\t\t\t\tif (!STBTT__COMPARE(&p[0], &p[j])) break;\n\t\t\t}\n\t\t\t/* make sure we haven't crossed */\n\t\t\tif (i >= j) break;\n\t\t\tt = p[i];\n\t\t\tp[i] = p[j];\n\t\t\tp[j] = t;\n\n\t\t\t++i;\n\t\t\t--j;\n\t\t}\n\t\t/* recurse on smaller side, iterate on larger */\n\t\tif (j < (n - i)) {\n\t\t\tstbtt__sort_edges_quicksort(p, j);\n\t\t\tp = p + i;\n\t\t\tn = n - i;\n\t\t}\n\t\telse {\n\t\t\tstbtt__sort_edges_quicksort(p + i, n - i);\n\t\t\tn = j;\n\t\t}\n\t}\n}\n\nstatic void stbtt__sort_edges(stbtt__edge *p, int n)\n{\n\tstbtt__sort_edges_quicksort(p, n);\n\tstbtt__sort_edges_ins_sort(p, n);\n}\n\ntypedef struct\n{\n\tfloat x, y;\n} stbtt__point;\n\nstatic void stbtt__rasterize(stbtt__bitmap *result, stbtt__point *pts, int *wcount, int windings, float scale_x, float scale_y, float shift_x, float shift_y, int off_x, int off_y, int invert, void *userdata)\n{\n\tfloat y_scale_inv = invert ? -scale_y : scale_y;\n\tstbtt__edge *e;\n\tint n, i, j, k, m;\n#if STBTT_RASTERIZER_VERSION == 1\n\tint vsubsample = result->h < 8 ? 15 : 5;\n#elif STBTT_RASTERIZER_VERSION == 2\n\tint vsubsample = 1;\n#else\n//#error \"Unrecognized value of STBTT_RASTERIZER_VERSION\"\n#endif\n\t// vsubsample should divide 255 evenly; otherwise we won't reach full opacity\n\n\t// now we have to blow out the windings into explicit edge lists\n\tn = 0;\n\tfor (i = 0; i < windings; ++i)\n\t\tn += wcount[i];\n\n\te = (stbtt__edge *)STBTT_malloc(sizeof(*e) * (n + 1), userdata); // add an extra one as a sentinel\n\tif (e == 0) return;\n\tn = 0;\n\n\tm = 0;\n\tfor (i = 0; i < windings; ++i) {\n\t\tstbtt__point *p = pts + m;\n\t\tm += wcount[i];\n\t\tj = wcount[i] - 1;\n\t\tfor (k = 0; k < wcount[i]; j = k++) {\n\t\t\tint a = k, b = j;\n\t\t\t// skip the edge if horizontal\n\t\t\tif (p[j].y == p[k].y)\n\t\t\t\tcontinue;\n\t\t\t// add edge from j to k to the list\n\t\t\te[n].invert = 0;\n\t\t\tif (invert ? p[j].y > p[k].y : p[j].y < p[k].y) {\n\t\t\t\te[n].invert = 1;\n\t\t\t\ta = j, b = k;\n\t\t\t}\n\t\t\te[n].x0 = p[a].x * scale_x + shift_x;\n\t\t\te[n].y0 = (p[a].y * y_scale_inv + shift_y) * vsubsample;\n\t\t\te[n].x1 = p[b].x * scale_x + shift_x;\n\t\t\te[n].y1 = (p[b].y * y_scale_inv + shift_y) * vsubsample;\n\t\t\t++n;\n\t\t}\n\t}\n\n\t// now sort the edges by their highest point (should snap to integer, and then by x)\n\t//STBTT_sort(e, n, sizeof(e[0]), stbtt__edge_compare);\n\tstbtt__sort_edges(e, n);\n\n\t// now, traverse the scanlines and find the intersections on each scanline, use xor winding rule\n\tstbtt__rasterize_sorted_edges(result, e, n, vsubsample, off_x, off_y, userdata);\n\n\tSTBTT_free(e, userdata);\n}\n\nstatic void stbtt__add_point(stbtt__point *points, int n, float x, float y)\n{\n\tif (!points) return; // during first pass, it's unallocated\n\tpoints[n].x = x;\n\tpoints[n].y = y;\n}\n\n// tesselate until threshhold p is happy... @TODO warped to compensate for non-linear stretching\nstatic int stbtt__tesselate_curve(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float objspace_flatness_squared, int n)\n{\n\t// midpoint\n\tfloat mx = (x0 + 2 * x1 + x2) / 4;\n\tfloat my = (y0 + 2 * y1 + y2) / 4;\n\t// versus directly drawn line\n\tfloat dx = (x0 + x2) / 2 - mx;\n\tfloat dy = (y0 + y2) / 2 - my;\n\tif (n > 16) // 65536 segments on one curve better be enough!\n\t\treturn 1;\n\tif (dx*dx + dy*dy > objspace_flatness_squared) { // half-pixel error allowed... need to be smaller if AA\n\t\tstbtt__tesselate_curve(points, num_points, x0, y0, (x0 + x1) / 2.0f, (y0 + y1) / 2.0f, mx, my, objspace_flatness_squared, n + 1);\n\t\tstbtt__tesselate_curve(points, num_points, mx, my, (x1 + x2) / 2.0f, (y1 + y2) / 2.0f, x2, y2, objspace_flatness_squared, n + 1);\n\t}\n\telse {\n\t\tstbtt__add_point(points, *num_points, x2, y2);\n\t\t*num_points = *num_points + 1;\n\t}\n\treturn 1;\n}\n\nstatic void stbtt__tesselate_cubic(stbtt__point *points, int *num_points, float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3, float objspace_flatness_squared, int n)\n{\n\t// @TODO this \"flatness\" calculation is just made-up nonsense that seems to work well enough\n\tfloat dx0 = x1 - x0;\n\tfloat dy0 = y1 - y0;\n\tfloat dx1 = x2 - x1;\n\tfloat dy1 = y2 - y1;\n\tfloat dx2 = x3 - x2;\n\tfloat dy2 = y3 - y2;\n\tfloat dx = x3 - x0;\n\tfloat dy = y3 - y0;\n\tfloat longlen = (float)(STBTT_sqrt(dx0*dx0 + dy0*dy0) + STBTT_sqrt(dx1*dx1 + dy1*dy1) + STBTT_sqrt(dx2*dx2 + dy2*dy2));\n\tfloat shortlen = (float)STBTT_sqrt(dx*dx + dy*dy);\n\tfloat flatness_squared = longlen*longlen - shortlen*shortlen;\n\n\tif (n > 16) // 65536 segments on one curve better be enough!\n\t\treturn;\n\n\tif (flatness_squared > objspace_flatness_squared) {\n\t\tfloat x01 = (x0 + x1) / 2;\n\t\tfloat y01 = (y0 + y1) / 2;\n\t\tfloat x12 = (x1 + x2) / 2;\n\t\tfloat y12 = (y1 + y2) / 2;\n\t\tfloat x23 = (x2 + x3) / 2;\n\t\tfloat y23 = (y2 + y3) / 2;\n\n\t\tfloat xa = (x01 + x12) / 2;\n\t\tfloat ya = (y01 + y12) / 2;\n\t\tfloat xb = (x12 + x23) / 2;\n\t\tfloat yb = (y12 + y23) / 2;\n\n\t\tfloat mx = (xa + xb) / 2;\n\t\tfloat my = (ya + yb) / 2;\n\n\t\tstbtt__tesselate_cubic(points, num_points, x0, y0, x01, y01, xa, ya, mx, my, objspace_flatness_squared, n + 1);\n\t\tstbtt__tesselate_cubic(points, num_points, mx, my, xb, yb, x23, y23, x3, y3, objspace_flatness_squared, n + 1);\n\t}\n\telse {\n\t\tstbtt__add_point(points, *num_points, x3, y3);\n\t\t*num_points = *num_points + 1;\n\t}\n}\n\n// returns number of contours\nstatic stbtt__point *stbtt_FlattenCurves(stbtt_vertex *vertices, int num_verts, float objspace_flatness, int **contour_lengths, int *num_contours, void *userdata)\n{\n\tstbtt__point *points = 0;\n\tint num_points = 0;\n\n\tfloat objspace_flatness_squared = objspace_flatness * objspace_flatness;\n\tint i, n = 0, start = 0, pass;\n\n\t// count how many \"moves\" there are to get the contour count\n\tfor (i = 0; i < num_verts; ++i)\n\t\tif (vertices[i].type == STBTT_vmove)\n\t\t\t++n;\n\n\t*num_contours = n;\n\tif (n == 0) return 0;\n\n\t*contour_lengths = (int *)STBTT_malloc(sizeof(**contour_lengths) * n, userdata);\n\n\tif (*contour_lengths == 0) {\n\t\t*num_contours = 0;\n\t\treturn 0;\n\t}\n\n\t// make two passes through the points so we don't need to realloc\n\tfor (pass = 0; pass < 2; ++pass) {\n\t\tfloat x = 0, y = 0;\n\t\tif (pass == 1) {\n\t\t\tpoints = (stbtt__point *)STBTT_malloc(num_points * sizeof(points[0]), userdata);\n\t\t\tif (points == NULL) goto error;\n\t\t}\n\t\tnum_points = 0;\n\t\tn = -1;\n\t\tfor (i = 0; i < num_verts; ++i) {\n\t\t\tswitch (vertices[i].type) {\n\t\t\tcase STBTT_vmove:\n\t\t\t\t// start the next contour\n\t\t\t\tif (n >= 0)\n\t\t\t\t\t(*contour_lengths)[n] = num_points - start;\n\t\t\t\t++n;\n\t\t\t\tstart = num_points;\n\n\t\t\t\tx = vertices[i].x, y = vertices[i].y;\n\t\t\t\tstbtt__add_point(points, num_points++, x, y);\n\t\t\t\tbreak;\n\t\t\tcase STBTT_vline:\n\t\t\t\tx = vertices[i].x, y = vertices[i].y;\n\t\t\t\tstbtt__add_point(points, num_points++, x, y);\n\t\t\t\tbreak;\n\t\t\tcase STBTT_vcurve:\n\t\t\t\tstbtt__tesselate_curve(points, &num_points, x, y,\n\t\t\t\t\tvertices[i].cx, vertices[i].cy,\n\t\t\t\t\tvertices[i].x, vertices[i].y,\n\t\t\t\t\tobjspace_flatness_squared, 0);\n\t\t\t\tx = vertices[i].x, y = vertices[i].y;\n\t\t\t\tbreak;\n\t\t\tcase STBTT_vcubic:\n\t\t\t\tstbtt__tesselate_cubic(points, &num_points, x, y,\n\t\t\t\t\tvertices[i].cx, vertices[i].cy,\n\t\t\t\t\tvertices[i].cx1, vertices[i].cy1,\n\t\t\t\t\tvertices[i].x, vertices[i].y,\n\t\t\t\t\tobjspace_flatness_squared, 0);\n\t\t\t\tx = vertices[i].x, y = vertices[i].y;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t(*contour_lengths)[n] = num_points - start;\n\t}\n\n\treturn points;\nerror:\n\tSTBTT_free(points, userdata);\n\tSTBTT_free(*contour_lengths, userdata);\n\t*contour_lengths = 0;\n\t*num_contours = 0;\n\treturn NULL;\n}\n\nSTBTT_DEF void stbtt_Rasterize(stbtt__bitmap *result, float flatness_in_pixels, stbtt_vertex *vertices, int num_verts, float scale_x, float scale_y, float shift_x, float shift_y, int x_off, int y_off, int invert, void *userdata)\n{\n\tfloat scale = scale_x > scale_y ? scale_y : scale_x;\n\tint winding_count, *winding_lengths;\n\tstbtt__point *windings = stbtt_FlattenCurves(vertices, num_verts, flatness_in_pixels / scale, &winding_lengths, &winding_count, userdata);\n\tif (windings) {\n\t\tstbtt__rasterize(result, windings, winding_lengths, winding_count, scale_x, scale_y, shift_x, shift_y, x_off, y_off, invert, userdata);\n\t\tSTBTT_free(winding_lengths, userdata);\n\t\tSTBTT_free(windings, userdata);\n\t}\n}\n\nSTBTT_DEF void stbtt_FreeBitmap(unsigned char *bitmap, void *userdata)\n{\n\tSTBTT_free(bitmap, userdata);\n}\n\nSTBTT_DEF unsigned char *stbtt_GetGlyphBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int glyph, int *width, int *height, int *xoff, int *yoff)\n{\n\tint ix0, iy0, ix1, iy1;\n\tstbtt__bitmap gbm;\n\tstbtt_vertex *vertices;\n\tint num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);\n\n\tif (scale_x == 0) scale_x = scale_y;\n\tif (scale_y == 0) {\n\t\tif (scale_x == 0) {\n\t\t\tSTBTT_free(vertices, info->userdata);\n\t\t\treturn NULL;\n\t\t}\n\t\tscale_y = scale_x;\n\t}\n\n\tstbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0, &iy0, &ix1, &iy1);\n\n\t// now we get the size\n\tgbm.w = (ix1 - ix0);\n\tgbm.h = (iy1 - iy0);\n\tgbm.pixels = NULL; // in case we error\n\n\tif (width) *width = gbm.w;\n\tif (height) *height = gbm.h;\n\tif (xoff) *xoff = ix0;\n\tif (yoff) *yoff = iy0;\n\n\tif (gbm.w && gbm.h) {\n\t\tgbm.pixels = (unsigned char *)STBTT_malloc(gbm.w * gbm.h, info->userdata);\n\t\tif (gbm.pixels) {\n\t\t\tgbm.stride = gbm.w;\n\n\t\t\tstbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata);\n\t\t}\n\t}\n\tSTBTT_free(vertices, info->userdata);\n\treturn gbm.pixels;\n}\n\nSTBTT_DEF unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int glyph, int *width, int *height, int *xoff, int *yoff)\n{\n\treturn stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, glyph, width, height, xoff, yoff);\n}\n\nSTBTT_DEF void stbtt_MakeGlyphBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int glyph)\n{\n\tint ix0, iy0;\n\tstbtt_vertex *vertices;\n\tint num_verts = stbtt_GetGlyphShape(info, glyph, &vertices);\n\tstbtt__bitmap gbm;\n\n\tstbtt_GetGlyphBitmapBoxSubpixel(info, glyph, scale_x, scale_y, shift_x, shift_y, &ix0, &iy0, 0, 0);\n\tgbm.pixels = output;\n\tgbm.w = out_w;\n\tgbm.h = out_h;\n\tgbm.stride = out_stride;\n\n\tif (gbm.w && gbm.h)\n\t\tstbtt_Rasterize(&gbm, 0.35f, vertices, num_verts, scale_x, scale_y, shift_x, shift_y, ix0, iy0, 1, info->userdata);\n\n\tSTBTT_free(vertices, info->userdata);\n}\n\nSTBTT_DEF void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph)\n{\n\tstbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f, 0.0f, glyph);\n}\n\nSTBTT_DEF unsigned char *stbtt_GetCodepointBitmapSubpixel(const stbtt_fontinfo *info, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint, int *width, int *height, int *xoff, int *yoff)\n{\n\treturn stbtt_GetGlyphBitmapSubpixel(info, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info, codepoint), width, height, xoff, yoff);\n}\n\nSTBTT_DEF void stbtt_MakeCodepointBitmapSubpixel(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, float shift_x, float shift_y, int codepoint)\n{\n\tstbtt_MakeGlyphBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, shift_x, shift_y, stbtt_FindGlyphIndex(info, codepoint));\n}\n\nSTBTT_DEF unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff)\n{\n\treturn stbtt_GetCodepointBitmapSubpixel(info, scale_x, scale_y, 0.0f, 0.0f, codepoint, width, height, xoff, yoff);\n}\n\nSTBTT_DEF void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint)\n{\n\tstbtt_MakeCodepointBitmapSubpixel(info, output, out_w, out_h, out_stride, scale_x, scale_y, 0.0f, 0.0f, codepoint);\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// bitmap baking\n//\n// This is SUPER-CRAPPY packing to keep source code small\n\nstatic int stbtt_BakeFontBitmap_internal(unsigned char *data, int offset,  // font location (use offset=0 for plain .ttf)\n\tfloat pixel_height,                     // height of font in pixels\n\tunsigned char *pixels, int pw, int ph,  // bitmap to be filled in\n\tint first_char, int num_chars,          // characters to bake\n\tstbtt_bakedchar *chardata)\n{\n\tfloat scale;\n\tint x, y, bottom_y, i;\n\tstbtt_fontinfo f;\n\tf.userdata = NULL;\n\tif (!stbtt_InitFont(&f, data, offset))\n\t\treturn -1;\n\tSTBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels\n\tx = y = 1;\n\tbottom_y = 1;\n\n\tscale = stbtt_ScaleForPixelHeight(&f, pixel_height);\n\n\tfor (i = 0; i < num_chars; ++i) {\n\t\tint advance, lsb, x0, y0, x1, y1, gw, gh;\n\t\tint g = stbtt_FindGlyphIndex(&f, first_char + i);\n\t\tstbtt_GetGlyphHMetrics(&f, g, &advance, &lsb);\n\t\tstbtt_GetGlyphBitmapBox(&f, g, scale, scale, &x0, &y0, &x1, &y1);\n\t\tgw = x1 - x0;\n\t\tgh = y1 - y0;\n\t\tif (x + gw + 1 >= pw)\n\t\t\ty = bottom_y, x = 1; // advance to next row\n\t\tif (y + gh + 1 >= ph) // check if it fits vertically AFTER potentially moving to next row\n\t\t\treturn -i;\n\t\tSTBTT_assert(x + gw < pw);\n\t\tSTBTT_assert(y + gh < ph);\n\t\tstbtt_MakeGlyphBitmap(&f, pixels + x + y*pw, gw, gh, pw, scale, scale, g);\n\t\tchardata[i].x0 = (stbtt_int16)x;\n\t\tchardata[i].y0 = (stbtt_int16)y;\n\t\tchardata[i].x1 = (stbtt_int16)(x + gw);\n\t\tchardata[i].y1 = (stbtt_int16)(y + gh);\n\t\tchardata[i].xadvance = scale * advance;\n\t\tchardata[i].xoff = (float)x0;\n\t\tchardata[i].yoff = (float)y0;\n\t\tx = x + gw + 1;\n\t\tif (y + gh + 1 > bottom_y)\n\t\t\tbottom_y = y + gh + 1;\n\t}\n\treturn bottom_y;\n}\n\nSTBTT_DEF void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int opengl_fillrule)\n{\n\tfloat d3d_bias = opengl_fillrule ? 0 : -0.5f;\n\tfloat ipw = 1.0f / pw, iph = 1.0f / ph;\n\tstbtt_bakedchar *b = chardata + char_index;\n\tint round_x = STBTT_ifloor((*xpos + b->xoff) + 0.5f);\n\tint round_y = STBTT_ifloor((*ypos + b->yoff) + 0.5f);\n\n\tq->x0 = round_x + d3d_bias;\n\tq->y0 = round_y + d3d_bias;\n\tq->x1 = round_x + b->x1 - b->x0 + d3d_bias;\n\tq->y1 = round_y + b->y1 - b->y0 + d3d_bias;\n\n\tq->s0 = b->x0 * ipw;\n\tq->t0 = b->y0 * iph;\n\tq->s1 = b->x1 * ipw;\n\tq->t1 = b->y1 * iph;\n\n\t*xpos += b->xadvance;\n}\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// rectangle packing replacement routines if you don't have stb_rect_pack.h\n//\n\n#ifndef STB_RECT_PACK_VERSION\n\ntypedef int stbrp_coord;\n\n////////////////////////////////////////////////////////////////////////////////////\n//                                                                                //\n//                                                                                //\n// COMPILER WARNING ?!?!?                                                         //\n//                                                                                //\n//                                                                                //\n// if you get a compile warning due to these symbols being defined more than      //\n// once, move #include \"stb_rect_pack.h\" before #include \"stb_truetype.h\"         //\n//                                                                                //\n////////////////////////////////////////////////////////////////////////////////////\n\ntypedef struct\n{\n\tint width, height;\n\tint x, y, bottom_y;\n} stbrp_context;\n\ntypedef struct\n{\n\tunsigned char x;\n} stbrp_node;\n\nstruct stbrp_rect\n{\n\tstbrp_coord x, y;\n\tint id, w, h, was_packed;\n};\n\nstatic void stbrp_init_target(stbrp_context *con, int pw, int ph, stbrp_node *nodes, int num_nodes)\n{\n\tcon->width = pw;\n\tcon->height = ph;\n\tcon->x = 0;\n\tcon->y = 0;\n\tcon->bottom_y = 0;\n\tSTBTT__NOTUSED(nodes);\n\tSTBTT__NOTUSED(num_nodes);\n}\n\nstatic void stbrp_pack_rects(stbrp_context *con, stbrp_rect *rects, int num_rects)\n{\n\tint i;\n\tfor (i = 0; i < num_rects; ++i) {\n\t\tif (con->x + rects[i].w > con->width) {\n\t\t\tcon->x = 0;\n\t\t\tcon->y = con->bottom_y;\n\t\t}\n\t\tif (con->y + rects[i].h > con->height)\n\t\t\tbreak;\n\t\trects[i].x = con->x;\n\t\trects[i].y = con->y;\n\t\trects[i].was_packed = 1;\n\t\tcon->x += rects[i].w;\n\t\tif (con->y + rects[i].h > con->bottom_y)\n\t\t\tcon->bottom_y = con->y + rects[i].h;\n\t}\n\tfor (; i < num_rects; ++i)\n\t\trects[i].was_packed = 0;\n}\n#endif\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// bitmap baking\n//\n// This is SUPER-AWESOME (tm Ryan Gordon) packing using stb_rect_pack.h. If\n// stb_rect_pack.h isn't available, it uses the BakeFontBitmap strategy.\n\nSTBTT_DEF int stbtt_PackBegin(stbtt_pack_context *spc, unsigned char *pixels, int pw, int ph, int stride_in_bytes, int padding, void *alloc_context)\n{\n\tstbrp_context *context = (stbrp_context *)STBTT_malloc(sizeof(*context), alloc_context);\n\tint            num_nodes = pw - padding;\n\tstbrp_node    *nodes = (stbrp_node    *)STBTT_malloc(sizeof(*nodes) * num_nodes, alloc_context);\n\n\tif (context == NULL || nodes == NULL) {\n\t\tif (context != NULL) STBTT_free(context, alloc_context);\n\t\tif (nodes != NULL) STBTT_free(nodes, alloc_context);\n\t\treturn 0;\n\t}\n\n\tspc->user_allocator_context = alloc_context;\n\tspc->width = pw;\n\tspc->height = ph;\n\tspc->pixels = pixels;\n\tspc->pack_info = context;\n\tspc->nodes = nodes;\n\tspc->padding = padding;\n\tspc->stride_in_bytes = stride_in_bytes != 0 ? stride_in_bytes : pw;\n\tspc->h_oversample = 1;\n\tspc->v_oversample = 1;\n\n\tstbrp_init_target(context, pw - padding, ph - padding, nodes, num_nodes);\n\n\tif (pixels)\n\t\tSTBTT_memset(pixels, 0, pw*ph); // background of 0 around pixels\n\n\treturn 1;\n}\n\nSTBTT_DEF void stbtt_PackEnd(stbtt_pack_context *spc)\n{\n\tSTBTT_free(spc->nodes, spc->user_allocator_context);\n\tSTBTT_free(spc->pack_info, spc->user_allocator_context);\n}\n\nSTBTT_DEF void stbtt_PackSetOversampling(stbtt_pack_context *spc, unsigned int h_oversample, unsigned int v_oversample)\n{\n\tSTBTT_assert(h_oversample <= STBTT_MAX_OVERSAMPLE);\n\tSTBTT_assert(v_oversample <= STBTT_MAX_OVERSAMPLE);\n\tif (h_oversample <= STBTT_MAX_OVERSAMPLE)\n\t\tspc->h_oversample = h_oversample;\n\tif (v_oversample <= STBTT_MAX_OVERSAMPLE)\n\t\tspc->v_oversample = v_oversample;\n}\n\n#define STBTT__OVER_MASK  (STBTT_MAX_OVERSAMPLE-1)\n\nstatic void stbtt__h_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width)\n{\n\tunsigned char buffer[STBTT_MAX_OVERSAMPLE];\n\tint safe_w = w - kernel_width;\n\tint j;\n\tSTBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze\n\tfor (j = 0; j < h; ++j) {\n\t\tint i;\n\t\tunsigned int total;\n\t\tSTBTT_memset(buffer, 0, kernel_width);\n\n\t\ttotal = 0;\n\n\t\t// make kernel_width a constant in common cases so compiler can optimize out the divide\n\t\tswitch (kernel_width) {\n\t\tcase 2:\n\t\t\tfor (i = 0; i <= safe_w; ++i) {\n\t\t\t\ttotal += pixels[i] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i];\n\t\t\t\tpixels[i] = (unsigned char)(total / 2);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tfor (i = 0; i <= safe_w; ++i) {\n\t\t\t\ttotal += pixels[i] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i];\n\t\t\t\tpixels[i] = (unsigned char)(total / 3);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tfor (i = 0; i <= safe_w; ++i) {\n\t\t\t\ttotal += pixels[i] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i];\n\t\t\t\tpixels[i] = (unsigned char)(total / 4);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tfor (i = 0; i <= safe_w; ++i) {\n\t\t\t\ttotal += pixels[i] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i];\n\t\t\t\tpixels[i] = (unsigned char)(total / 5);\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfor (i = 0; i <= safe_w; ++i) {\n\t\t\t\ttotal += pixels[i] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i];\n\t\t\t\tpixels[i] = (unsigned char)(total / kernel_width);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tfor (; i < w; ++i) {\n\t\t\tSTBTT_assert(pixels[i] == 0);\n\t\t\ttotal -= buffer[i & STBTT__OVER_MASK];\n\t\t\tpixels[i] = (unsigned char)(total / kernel_width);\n\t\t}\n\n\t\tpixels += stride_in_bytes;\n\t}\n}\n\nstatic void stbtt__v_prefilter(unsigned char *pixels, int w, int h, int stride_in_bytes, unsigned int kernel_width)\n{\n\tunsigned char buffer[STBTT_MAX_OVERSAMPLE];\n\tint safe_h = h - kernel_width;\n\tint j;\n\tSTBTT_memset(buffer, 0, STBTT_MAX_OVERSAMPLE); // suppress bogus warning from VS2013 -analyze\n\tfor (j = 0; j < w; ++j) {\n\t\tint i;\n\t\tunsigned int total;\n\t\tSTBTT_memset(buffer, 0, kernel_width);\n\n\t\ttotal = 0;\n\n\t\t// make kernel_width a constant in common cases so compiler can optimize out the divide\n\t\tswitch (kernel_width) {\n\t\tcase 2:\n\t\t\tfor (i = 0; i <= safe_h; ++i) {\n\t\t\t\ttotal += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n\t\t\t\tpixels[i*stride_in_bytes] = (unsigned char)(total / 2);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tfor (i = 0; i <= safe_h; ++i) {\n\t\t\t\ttotal += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n\t\t\t\tpixels[i*stride_in_bytes] = (unsigned char)(total / 3);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tfor (i = 0; i <= safe_h; ++i) {\n\t\t\t\ttotal += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n\t\t\t\tpixels[i*stride_in_bytes] = (unsigned char)(total / 4);\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tfor (i = 0; i <= safe_h; ++i) {\n\t\t\t\ttotal += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n\t\t\t\tpixels[i*stride_in_bytes] = (unsigned char)(total / 5);\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tfor (i = 0; i <= safe_h; ++i) {\n\t\t\t\ttotal += pixels[i*stride_in_bytes] - buffer[i & STBTT__OVER_MASK];\n\t\t\t\tbuffer[(i + kernel_width) & STBTT__OVER_MASK] = pixels[i*stride_in_bytes];\n\t\t\t\tpixels[i*stride_in_bytes] = (unsigned char)(total / kernel_width);\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\tfor (; i < h; ++i) {\n\t\t\tSTBTT_assert(pixels[i*stride_in_bytes] == 0);\n\t\t\ttotal -= buffer[i & STBTT__OVER_MASK];\n\t\t\tpixels[i*stride_in_bytes] = (unsigned char)(total / kernel_width);\n\t\t}\n\n\t\tpixels += 1;\n\t}\n}\n\nstatic float stbtt__oversample_shift(int oversample)\n{\n\tif (!oversample)\n\t\treturn 0.0f;\n\n\t// The prefilter is a box filter of width \"oversample\",\n\t// which shifts phase by (oversample - 1)/2 pixels in\n\t// oversampled space. We want to shift in the opposite\n\t// direction to counter this.\n\treturn (float)-(oversample - 1) / (2.0f * (float)oversample);\n}\n\n// rects array must be big enough to accommodate all characters in the given ranges\nSTBTT_DEF int stbtt_PackFontRangesGatherRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects)\n{\n\tint i, j, k;\n\n\tk = 0;\n\tfor (i = 0; i < num_ranges; ++i) {\n\t\tfloat fh = ranges[i].font_size;\n\t\tfloat scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh);\n\t\tranges[i].h_oversample = (unsigned char)spc->h_oversample;\n\t\tranges[i].v_oversample = (unsigned char)spc->v_oversample;\n\t\tfor (j = 0; j < ranges[i].num_chars; ++j) {\n\t\t\tint x0, y0, x1, y1;\n\t\t\tint codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];\n\t\t\tint glyph = stbtt_FindGlyphIndex(info, codepoint);\n\t\t\tstbtt_GetGlyphBitmapBoxSubpixel(info, glyph,\n\t\t\t\tscale * spc->h_oversample,\n\t\t\t\tscale * spc->v_oversample,\n\t\t\t\t0, 0,\n\t\t\t\t&x0, &y0, &x1, &y1);\n\t\t\trects[k].w = (stbrp_coord)(x1 - x0 + spc->padding + spc->h_oversample - 1);\n\t\t\trects[k].h = (stbrp_coord)(y1 - y0 + spc->padding + spc->v_oversample - 1);\n\t\t\t++k;\n\t\t}\n\t}\n\n\treturn k;\n}\n\n// rects array must be big enough to accommodate all characters in the given ranges\nSTBTT_DEF int stbtt_PackFontRangesRenderIntoRects(stbtt_pack_context *spc, const stbtt_fontinfo *info, stbtt_pack_range *ranges, int num_ranges, stbrp_rect *rects)\n{\n\tint i, j, k, return_value = 1;\n\n\t// save current values\n\tint old_h_over = spc->h_oversample;\n\tint old_v_over = spc->v_oversample;\n\n\tk = 0;\n\tfor (i = 0; i < num_ranges; ++i) {\n\t\tfloat fh = ranges[i].font_size;\n\t\tfloat scale = fh > 0 ? stbtt_ScaleForPixelHeight(info, fh) : stbtt_ScaleForMappingEmToPixels(info, -fh);\n\t\tfloat recip_h, recip_v, sub_x, sub_y;\n\t\tspc->h_oversample = ranges[i].h_oversample;\n\t\tspc->v_oversample = ranges[i].v_oversample;\n\t\trecip_h = 1.0f / spc->h_oversample;\n\t\trecip_v = 1.0f / spc->v_oversample;\n\t\tsub_x = stbtt__oversample_shift(spc->h_oversample);\n\t\tsub_y = stbtt__oversample_shift(spc->v_oversample);\n\t\tfor (j = 0; j < ranges[i].num_chars; ++j) {\n\t\t\tstbrp_rect *r = &rects[k];\n\t\t\tif (r->was_packed) {\n\t\t\t\tstbtt_packedchar *bc = &ranges[i].chardata_for_range[j];\n\t\t\t\tint advance, lsb, x0, y0, x1, y1;\n\t\t\t\tint codepoint = ranges[i].array_of_unicode_codepoints == NULL ? ranges[i].first_unicode_codepoint_in_range + j : ranges[i].array_of_unicode_codepoints[j];\n\t\t\t\tint glyph = stbtt_FindGlyphIndex(info, codepoint);\n\t\t\t\tstbrp_coord pad = (stbrp_coord)spc->padding;\n\n\t\t\t\t// pad on left and top\n\t\t\t\tr->x += pad;\n\t\t\t\tr->y += pad;\n\t\t\t\tr->w -= pad;\n\t\t\t\tr->h -= pad;\n\t\t\t\tstbtt_GetGlyphHMetrics(info, glyph, &advance, &lsb);\n\t\t\t\tstbtt_GetGlyphBitmapBox(info, glyph,\n\t\t\t\t\tscale * spc->h_oversample,\n\t\t\t\t\tscale * spc->v_oversample,\n\t\t\t\t\t&x0, &y0, &x1, &y1);\n\t\t\t\tstbtt_MakeGlyphBitmapSubpixel(info,\n\t\t\t\t\tspc->pixels + r->x + r->y*spc->stride_in_bytes,\n\t\t\t\t\tr->w - spc->h_oversample + 1,\n\t\t\t\t\tr->h - spc->v_oversample + 1,\n\t\t\t\t\tspc->stride_in_bytes,\n\t\t\t\t\tscale * spc->h_oversample,\n\t\t\t\t\tscale * spc->v_oversample,\n\t\t\t\t\t0, 0,\n\t\t\t\t\tglyph);\n\n\t\t\t\tif (spc->h_oversample > 1)\n\t\t\t\t\tstbtt__h_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes,\n\t\t\t\t\t\tr->w, r->h, spc->stride_in_bytes,\n\t\t\t\t\t\tspc->h_oversample);\n\n\t\t\t\tif (spc->v_oversample > 1)\n\t\t\t\t\tstbtt__v_prefilter(spc->pixels + r->x + r->y*spc->stride_in_bytes,\n\t\t\t\t\t\tr->w, r->h, spc->stride_in_bytes,\n\t\t\t\t\t\tspc->v_oversample);\n\n\t\t\t\tbc->x0 = (stbtt_int16)r->x;\n\t\t\t\tbc->y0 = (stbtt_int16)r->y;\n\t\t\t\tbc->x1 = (stbtt_int16)(r->x + r->w);\n\t\t\t\tbc->y1 = (stbtt_int16)(r->y + r->h);\n\t\t\t\tbc->xadvance = scale * advance;\n\t\t\t\tbc->xoff = (float)x0 * recip_h + sub_x;\n\t\t\t\tbc->yoff = (float)y0 * recip_v + sub_y;\n\t\t\t\tbc->xoff2 = (x0 + r->w) * recip_h + sub_x;\n\t\t\t\tbc->yoff2 = (y0 + r->h) * recip_v + sub_y;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn_value = 0; // if any fail, report failure\n\t\t\t}\n\n\t\t\t++k;\n\t\t}\n\t}\n\n\t// restore original values\n\tspc->h_oversample = old_h_over;\n\tspc->v_oversample = old_v_over;\n\n\treturn return_value;\n}\n\nSTBTT_DEF void stbtt_PackFontRangesPackRects(stbtt_pack_context *spc, stbrp_rect *rects, int num_rects)\n{\n\tstbrp_pack_rects((stbrp_context *)spc->pack_info, rects, num_rects);\n}\n\nSTBTT_DEF int stbtt_PackFontRanges(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, stbtt_pack_range *ranges, int num_ranges)\n{\n\tstbtt_fontinfo info;\n\tint i, j, n, return_value = 1;\n\t//stbrp_context *context = (stbrp_context *) spc->pack_info;\n\tstbrp_rect    *rects;\n\n\t// flag all characters as NOT packed\n\tfor (i = 0; i < num_ranges; ++i)\n\t\tfor (j = 0; j < ranges[i].num_chars; ++j)\n\t\t\tranges[i].chardata_for_range[j].x0 =\n\t\t\tranges[i].chardata_for_range[j].y0 =\n\t\t\tranges[i].chardata_for_range[j].x1 =\n\t\t\tranges[i].chardata_for_range[j].y1 = 0;\n\n\tn = 0;\n\tfor (i = 0; i < num_ranges; ++i)\n\t\tn += ranges[i].num_chars;\n\n\trects = (stbrp_rect *)STBTT_malloc(sizeof(*rects) * n, spc->user_allocator_context);\n\tif (rects == NULL)\n\t\treturn 0;\n\n\tinfo.userdata = spc->user_allocator_context;\n\tstbtt_InitFont(&info, fontdata, stbtt_GetFontOffsetForIndex(fontdata, font_index));\n\n\tn = stbtt_PackFontRangesGatherRects(spc, &info, ranges, num_ranges, rects);\n\n\tstbtt_PackFontRangesPackRects(spc, rects, n);\n\n\treturn_value = stbtt_PackFontRangesRenderIntoRects(spc, &info, ranges, num_ranges, rects);\n\n\tSTBTT_free(rects, spc->user_allocator_context);\n\treturn return_value;\n}\n\nSTBTT_DEF int stbtt_PackFontRange(stbtt_pack_context *spc, unsigned char *fontdata, int font_index, float font_size,\n\tint first_unicode_codepoint_in_range, int num_chars_in_range, stbtt_packedchar *chardata_for_range)\n{\n\tstbtt_pack_range range;\n\trange.first_unicode_codepoint_in_range = first_unicode_codepoint_in_range;\n\trange.array_of_unicode_codepoints = NULL;\n\trange.num_chars = num_chars_in_range;\n\trange.chardata_for_range = chardata_for_range;\n\trange.font_size = font_size;\n\treturn stbtt_PackFontRanges(spc, fontdata, font_index, &range, 1);\n}\n\nSTBTT_DEF void stbtt_GetPackedQuad(stbtt_packedchar *chardata, int pw, int ph, int char_index, float *xpos, float *ypos, stbtt_aligned_quad *q, int align_to_integer)\n{\n\tfloat ipw = 1.0f / pw, iph = 1.0f / ph;\n\tstbtt_packedchar *b = chardata + char_index;\n\n\tif (align_to_integer) {\n\t\tfloat x = (float)STBTT_ifloor((*xpos + b->xoff) + 0.5f);\n\t\tfloat y = (float)STBTT_ifloor((*ypos + b->yoff) + 0.5f);\n\t\tq->x0 = x;\n\t\tq->y0 = y;\n\t\tq->x1 = x + b->xoff2 - b->xoff;\n\t\tq->y1 = y + b->yoff2 - b->yoff;\n\t}\n\telse {\n\t\tq->x0 = *xpos + b->xoff;\n\t\tq->y0 = *ypos + b->yoff;\n\t\tq->x1 = *xpos + b->xoff2;\n\t\tq->y1 = *ypos + b->yoff2;\n\t}\n\n\tq->s0 = b->x0 * ipw;\n\tq->t0 = b->y0 * iph;\n\tq->s1 = b->x1 * ipw;\n\tq->t1 = b->y1 * iph;\n\n\t*xpos += b->xadvance;\n}\n\n\n//////////////////////////////////////////////////////////////////////////////\n//\n// font name matching -- recommended not to use this\n//\n\n// check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string\nstatic stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2)\n{\n\tstbtt_int32 i = 0;\n\n\t// convert utf16 to utf8 and compare the results while converting\n\twhile (len2) {\n\t\tstbtt_uint16 ch = s2[0] * 256 + s2[1];\n\t\tif (ch < 0x80) {\n\t\t\tif (i >= len1) return -1;\n\t\t\tif (s1[i++] != ch) return -1;\n\t\t}\n\t\telse if (ch < 0x800) {\n\t\t\tif (i + 1 >= len1) return -1;\n\t\t\tif (s1[i++] != 0xc0 + (ch >> 6)) return -1;\n\t\t\tif (s1[i++] != 0x80 + (ch & 0x3f)) return -1;\n\t\t}\n\t\telse if (ch >= 0xd800 && ch < 0xdc00) {\n\t\t\tstbtt_uint32 c;\n\t\t\tstbtt_uint16 ch2 = s2[2] * 256 + s2[3];\n\t\t\tif (i + 3 >= len1) return -1;\n\t\t\tc = ((ch - 0xd800) << 10) + (ch2 - 0xdc00) + 0x10000;\n\t\t\tif (s1[i++] != 0xf0 + (c >> 18)) return -1;\n\t\t\tif (s1[i++] != 0x80 + ((c >> 12) & 0x3f)) return -1;\n\t\t\tif (s1[i++] != 0x80 + ((c >> 6) & 0x3f)) return -1;\n\t\t\tif (s1[i++] != 0x80 + ((c) & 0x3f)) return -1;\n\t\t\ts2 += 2; // plus another 2 below\n\t\t\tlen2 -= 2;\n\t\t}\n\t\telse if (ch >= 0xdc00 && ch < 0xe000) {\n\t\t\treturn -1;\n\t\t}\n\t\telse {\n\t\t\tif (i + 2 >= len1) return -1;\n\t\t\tif (s1[i++] != 0xe0 + (ch >> 12)) return -1;\n\t\t\tif (s1[i++] != 0x80 + ((ch >> 6) & 0x3f)) return -1;\n\t\t\tif (s1[i++] != 0x80 + ((ch) & 0x3f)) return -1;\n\t\t}\n\t\ts2 += 2;\n\t\tlen2 -= 2;\n\t}\n\treturn i;\n}\n\nstatic int stbtt_CompareUTF8toUTF16_bigendian_internal(char *s1, int len1, char *s2, int len2)\n{\n\treturn len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8*)s1, len1, (stbtt_uint8*)s2, len2);\n}\n\n// returns results in whatever encoding you request... but note that 2-byte encodings\n// will be BIG-ENDIAN... use stbtt_CompareUTF8toUTF16_bigendian() to compare\nSTBTT_DEF const char *stbtt_GetFontNameString(const stbtt_fontinfo *font, int *length, int platformID, int encodingID, int languageID, int nameID)\n{\n\tstbtt_int32 i, count, stringOffset;\n\tstbtt_uint8 *fc = font->data;\n\tstbtt_uint32 offset = font->fontstart;\n\tstbtt_uint32 nm = stbtt__find_table(fc, offset, \"name\");\n\tif (!nm) return NULL;\n\n\tcount = ttUSHORT(fc + nm + 2);\n\tstringOffset = nm + ttUSHORT(fc + nm + 4);\n\tfor (i = 0; i < count; ++i) {\n\t\tstbtt_uint32 loc = nm + 6 + 12 * i;\n\t\tif (platformID == ttUSHORT(fc + loc + 0) && encodingID == ttUSHORT(fc + loc + 2)\n\t\t\t&& languageID == ttUSHORT(fc + loc + 4) && nameID == ttUSHORT(fc + loc + 6)) {\n\t\t\t*length = ttUSHORT(fc + loc + 8);\n\t\t\treturn (const char *)(fc + stringOffset + ttUSHORT(fc + loc + 10));\n\t\t}\n\t}\n\treturn NULL;\n}\n\nstatic int stbtt__matchpair(stbtt_uint8 *fc, stbtt_uint32 nm, stbtt_uint8 *name, stbtt_int32 nlen, stbtt_int32 target_id, stbtt_int32 next_id)\n{\n\tstbtt_int32 i;\n\tstbtt_int32 count = ttUSHORT(fc + nm + 2);\n\tstbtt_int32 stringOffset = nm + ttUSHORT(fc + nm + 4);\n\n\tfor (i = 0; i < count; ++i) {\n\t\tstbtt_uint32 loc = nm + 6 + 12 * i;\n\t\tstbtt_int32 id = ttUSHORT(fc + loc + 6);\n\t\tif (id == target_id) {\n\t\t\t// find the encoding\n\t\t\tstbtt_int32 platform = ttUSHORT(fc + loc + 0), encoding = ttUSHORT(fc + loc + 2), language = ttUSHORT(fc + loc + 4);\n\n\t\t\t// is this a Unicode encoding?\n\t\t\tif (platform == 0 || (platform == 3 && encoding == 1) || (platform == 3 && encoding == 10)) {\n\t\t\t\tstbtt_int32 slen = ttUSHORT(fc + loc + 8);\n\t\t\t\tstbtt_int32 off = ttUSHORT(fc + loc + 10);\n\n\t\t\t\t// check if there's a prefix match\n\t\t\t\tstbtt_int32 matchlen = stbtt__CompareUTF8toUTF16_bigendian_prefix(name, nlen, fc + stringOffset + off, slen);\n\t\t\t\tif (matchlen >= 0) {\n\t\t\t\t\t// check for target_id+1 immediately following, with same encoding & language\n\t\t\t\t\tif (i + 1 < count && ttUSHORT(fc + loc + 12 + 6) == next_id && ttUSHORT(fc + loc + 12) == platform && ttUSHORT(fc + loc + 12 + 2) == encoding && ttUSHORT(fc + loc + 12 + 4) == language) {\n\t\t\t\t\t\tslen = ttUSHORT(fc + loc + 12 + 8);\n\t\t\t\t\t\toff = ttUSHORT(fc + loc + 12 + 10);\n\t\t\t\t\t\tif (slen == 0) {\n\t\t\t\t\t\t\tif (matchlen == nlen)\n\t\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (matchlen < nlen && name[matchlen] == ' ') {\n\t\t\t\t\t\t\t++matchlen;\n\t\t\t\t\t\t\tif (stbtt_CompareUTF8toUTF16_bigendian_internal((char*)(name + matchlen), nlen - matchlen, (char*)(fc + stringOffset + off), slen))\n\t\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\t// if nothing immediately following\n\t\t\t\t\t\tif (matchlen == nlen)\n\t\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// @TODO handle other encodings\n\t\t}\n\t}\n\treturn 0;\n}\n\nstatic int stbtt__matches(stbtt_uint8 *fc, stbtt_uint32 offset, stbtt_uint8 *name, stbtt_int32 flags)\n{\n\tstbtt_int32 nlen = (stbtt_int32)STBTT_strlen((char *)name);\n\tstbtt_uint32 nm, hd;\n\tif (!stbtt__isfont(fc + offset)) return 0;\n\n\t// check italics/bold/underline flags in macStyle...\n\tif (flags) {\n\t\thd = stbtt__find_table(fc, offset, \"head\");\n\t\tif ((ttUSHORT(fc + hd + 44) & 7) != (flags & 7)) return 0;\n\t}\n\n\tnm = stbtt__find_table(fc, offset, \"name\");\n\tif (!nm) return 0;\n\n\tif (flags) {\n\t\t// if we checked the macStyle flags, then just check the family and ignore the subfamily\n\t\tif (stbtt__matchpair(fc, nm, name, nlen, 16, -1))  return 1;\n\t\tif (stbtt__matchpair(fc, nm, name, nlen, 1, -1))  return 1;\n\t\tif (stbtt__matchpair(fc, nm, name, nlen, 3, -1))  return 1;\n\t}\n\telse {\n\t\tif (stbtt__matchpair(fc, nm, name, nlen, 16, 17))  return 1;\n\t\tif (stbtt__matchpair(fc, nm, name, nlen, 1, 2))  return 1;\n\t\tif (stbtt__matchpair(fc, nm, name, nlen, 3, -1))  return 1;\n\t}\n\n\treturn 0;\n}\n\nstatic int stbtt_FindMatchingFont_internal(unsigned char *font_collection, char *name_utf8, stbtt_int32 flags)\n{\n\tstbtt_int32 i;\n\tfor (i = 0;; ++i) {\n\t\tstbtt_int32 off = stbtt_GetFontOffsetForIndex(font_collection, i);\n\t\tif (off < 0) return off;\n\t\tif (stbtt__matches((stbtt_uint8 *)font_collection, off, (stbtt_uint8*)name_utf8, flags))\n\t\t\treturn off;\n\t}\n}\n\n#if defined(__GNUC__) || defined(__clang__)\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wcast-qual\"\n#endif\n\nSTBTT_DEF int stbtt_BakeFontBitmap(const unsigned char *data, int offset,\n\tfloat pixel_height, unsigned char *pixels, int pw, int ph,\n\tint first_char, int num_chars, stbtt_bakedchar *chardata)\n{\n\treturn stbtt_BakeFontBitmap_internal((unsigned char *)data, offset, pixel_height, pixels, pw, ph, first_char, num_chars, chardata);\n}\n\nSTBTT_DEF int stbtt_GetFontOffsetForIndex(const unsigned char *data, int index)\n{\n\treturn stbtt_GetFontOffsetForIndex_internal((unsigned char *)data, index);\n}\n\nSTBTT_DEF int stbtt_GetNumberOfFonts(const unsigned char *data)\n{\n\treturn stbtt_GetNumberOfFonts_internal((unsigned char *)data);\n}\n\nSTBTT_DEF int stbtt_InitFont(stbtt_fontinfo *info, const unsigned char *data, int offset)\n{\n\treturn stbtt_InitFont_internal(info, (unsigned char *)data, offset);\n}\n\nSTBTT_DEF int stbtt_FindMatchingFont(const unsigned char *fontdata, const char *name, int flags)\n{\n\treturn stbtt_FindMatchingFont_internal((unsigned char *)fontdata, (char *)name, flags);\n}\n\nSTBTT_DEF int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2)\n{\n\treturn stbtt_CompareUTF8toUTF16_bigendian_internal((char *)s1, len1, (char *)s2, len2);\n}\n\n#if defined(__GNUC__) || defined(__clang__)\n#pragma GCC diagnostic pop\n#endif\n\n#endif // STB_TRUETYPE_IMPLEMENTATION\n\n\n// FULL VERSION HISTORY\n//\n//   1.12 (2016-10-25) suppress warnings about casting away const with -Wcast-qual\n//   1.11 (2016-04-02) fix unused-variable warning\n//   1.10 (2016-04-02) allow user-defined fabs() replacement\n//                     fix memory leak if fontsize=0.0\n//                     fix warning from duplicate typedef\n//   1.09 (2016-01-16) warning fix; avoid crash on outofmem; use alloc userdata for PackFontRanges\n//   1.08 (2015-09-13) document stbtt_Rasterize(); fixes for vertical & horizontal edges\n//   1.07 (2015-08-01) allow PackFontRanges to accept arrays of sparse codepoints;\n//                     allow PackFontRanges to pack and render in separate phases;\n//                     fix stbtt_GetFontOFfsetForIndex (never worked for non-0 input?);\n//                     fixed an assert() bug in the new rasterizer\n//                     replace assert() with STBTT_assert() in new rasterizer\n//   1.06 (2015-07-14) performance improvements (~35% faster on x86 and x64 on test machine)\n//                     also more precise AA rasterizer, except if shapes overlap\n//                     remove need for STBTT_sort\n//   1.05 (2015-04-15) fix misplaced definitions for STBTT_STATIC\n//   1.04 (2015-04-15) typo in example\n//   1.03 (2015-04-12) STBTT_STATIC, fix memory leak in new packing, various fixes\n//   1.02 (2014-12-10) fix various warnings & compile issues w/ stb_rect_pack, C++\n//   1.01 (2014-12-08) fix subpixel position when oversampling to exactly match\n//                        non-oversampled; STBTT_POINT_SIZE for packed case only\n//   1.00 (2014-12-06) add new PackBegin etc. API, w/ support for oversampling\n//   0.99 (2014-09-18) fix multiple bugs with subpixel rendering (ryg)\n//   0.9  (2014-08-07) support certain mac/iOS fonts without an MS platformID\n//   0.8b (2014-07-07) fix a warning\n//   0.8  (2014-05-25) fix a few more warnings\n//   0.7  (2013-09-25) bugfix: subpixel glyph bug fixed in 0.5 had come back\n//   0.6c (2012-07-24) improve documentation\n//   0.6b (2012-07-20) fix a few more warnings\n//   0.6  (2012-07-17) fix warnings; added stbtt_ScaleForMappingEmToPixels,\n//                        stbtt_GetFontBoundingBox, stbtt_IsGlyphEmpty\n//   0.5  (2011-12-09) bugfixes:\n//                        subpixel glyph renderer computed wrong bounding box\n//                        first vertex of shape can be off-curve (FreeSans)\n//   0.4b (2011-12-03) fixed an error in the font baking example\n//   0.4  (2011-12-01) kerning, subpixel rendering (tor)\n//                    bugfixes for:\n//                        codepoint-to-glyph conversion using table fmt=12\n//                        codepoint-to-glyph conversion using table fmt=4\n//                        stbtt_GetBakedQuad with non-square texture (Zer)\n//                    updated Hello World! sample to use kerning and subpixel\n//                    fixed some warnings\n//   0.3  (2009-06-24) cmap fmt=12, compound shapes (MM)\n//                    userdata, malloc-from-userdata, non-zero fill (stb)\n//   0.2  (2009-03-11) Fix unsigned/signed char warnings\n//   0.1  (2009-03-09) First public release\n//\n"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate/spoofinternal.asm",
    "content": "PUBLIC RetSpoofStub\n     \n.code\n     \nRetSpoofStub PROC\n    pop r11\n    add rsp, 8\n    mov rax, [rsp + 24]\n  \n    mov r10, [rax]\n    mov [rsp], r10\n        \n    mov r10, [rax + 8]\n    mov [rax + 8], r11\n     \n    mov [rax + 16], rdi\n    lea rdi, fixup\n    mov [rax], rdi\n    mov rdi, rax\n        \n    jmp r10\n     \nfixup:\n    sub rsp, 16\n    mov rcx, rdi\n    mov rdi, [rcx + 16]\n    jmp QWORD PTR [rcx + 8]\nRetSpoofStub ENDP\n     \nEND"
  },
  {
    "path": "FortniteCheatSRCUpdateEveryUpdate.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 16\r\nVisualStudioVersion = 16.0.30011.22\r\nMinimumVisualStudioVersion = 10.0.40219.1\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"FortniteCheatSRCUpdateEveryUpdate\", \"FortniteCheatSRCUpdateEveryUpdate\\FortniteCheatSRCUpdateEveryUpdate.vcxproj\", \"{432CD352-DFE6-4AC6-B858-3F74D5CB161F}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|x64 = Debug|x64\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|x64 = Release|x64\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Debug|x64.ActiveCfg = Debug|x64\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Debug|x64.Build.0 = Debug|x64\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Debug|x86.ActiveCfg = Debug|Win32\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Debug|x86.Build.0 = Debug|Win32\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Release|x64.ActiveCfg = Release|x64\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Release|x64.Build.0 = Release|x64\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Release|x86.ActiveCfg = Release|Win32\r\n\t\t{432CD352-DFE6-4AC6-B858-3F74D5CB161F}.Release|x86.Build.0 = Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\t\tSolutionGuid = {3F5DFA77-8842-4790-93CA-FE9D2DA4F9B3}\r\n\tEndGlobalSection\r\nEndGlobal\r\n\r\n"
  },
  {
    "path": "LICENSE",
    "content": "“Commons Clause” License Condition v1.0\nCopyright Visual9999 2020-2021\n\nThe Software is provided to you by the Licensor under the\nLicense, as defined below, subject to the following condition.\n\nWithout limiting other conditions in the License, the grant\nof rights under the License will not include, and the License\ndoes not grant to you, the right to Sell the Software.\n\nFor purposes of the foregoing, “Sell” means practicing any or\nall of the rights granted to you under the License to provide\nto third parties, for a fee or other consideration (including\nwithout limitation fees for hosting or consulting/ support\nservices related to the Software), a product or service whose\nvalue derives, entirely or substantially, from the functionality\nof the Software. Any license notice or attribution required by\nthe License must also include this Commons Clause License\nCondition notice.\n\nSoftware: FortniteCheatSRCUpdateEveryUpdate\n\nLicense: Apache 2.0\n\n---------------------------------------------------------------------\n  \n  \n  \n  Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "### THIS REP IS NOT SUPPORTED ANYMORE, JUST SEMI-UPDATES, UPDATE DISCORD HOOK SIG AND OTHER SIGS/OFFSETS THEN IT WORKS\n\n# Updated to 16.30\nWhat is FortniteCheatSRCUpdateEveryUpdate?\n\nA Fortnite cheat source code, that will be updated every fortnite update.\n\n# Visual Studio 2019\nRelease x64\n\n# Inject\nRelease deleted, cuz injector and driver detected, i will upload new one if the cheat is updated.\n\n\n# SUPPORT\nno support atm.\n"
  }
]