### Gamepad Navigation Setup Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Enable gamepad navigation by mapping inputs to io.NavInputs and setting ImGuiConfigFlags_NavEnableGamepad. ```cpp io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; ``` -------------------------------- ### Testing ImGuiKey_KeyPadEnter Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt Example of testing for the newly added ImGuiKey_KeyPadEnter key within InputText widgets. ```cpp InputText: Testing for newly added ImGuiKey_KeyPadEnter key. (#2677, #2005) [@amc522] ``` -------------------------------- ### Allocator Functions Setup Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt Allocator parameters are no longer passed to CreateContext(). Instead, they are set using SetAllocatorFunctions() and are shared across all contexts. ```cpp ImGui::SetAllocatorFunctions(my_malloc, my_free); ``` -------------------------------- ### Rendering Draw Lists Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt The io.RenderDrawListsFn callback is obsolete. Instead, call your graphics engine's render function after ImGui::Render(). For example, use ImDrawData* draw_data = ImGui::GetDrawData(); ImGui_ImplXXXX_RenderDrawData(draw_data); ```cpp ImGui::Render(); ImDrawData* draw_data = ImGui::GetDrawData(); ImGui_ImplXXXX_RenderDrawData(draw_data); ``` -------------------------------- ### Load Default Font Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FONTS.txt Loads the default embedded font. This is the simplest way to get started with fonts. ```cpp ImGuiIO& io = ImGui::GetIO(); io.Fonts->AddFontDefault(); ``` -------------------------------- ### Creating an ImGui Window with Menu and Widgets Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/README.md Shows how to create a window with a menu bar, including menu items for actions like open, save, and close. It also demonstrates using a color picker, plotting data, and displaying text within a scrollable child region. ```cpp // Create a window called "My First Tool", with a menu bar. ImGui::Begin("My First Tool", &my_tool_active, ImGuiWindowFlags_MenuBar); if (ImGui::BeginMenuBar()) { if (ImGui::BeginMenu("File")) { if (ImGui::MenuItem("Open..", "Ctrl+O")) { /* Do stuff */ } if (ImGui::MenuItem("Save", "Ctrl+S")) { /* Do stuff */ } if (ImGui::MenuItem("Close", "Ctrl+W")) { my_tool_active = false; } ImGui::EndMenu(); } ImGui::EndMenuBar(); } // Edit a color (stored as ~4 floats) ImGui::ColorEdit4("Color", my_color); // Plot some values const float my_values[] = { 0.2f, 0.1f, 1.0f, 0.5f, 0.9f, 2.2f }; ImGui::PlotLines("Frame Times", my_values, IM_ARRAYSIZE(my_values)); // Display contents in a scrolling region ImGui::TextColored(ImVec4(1,1,0,1), "Important Stuff"); ImGui::BeginChild("Scrolling"); for (int n = 0; n < 50; n++) ImGui::Text("%04d: Some text", n); ImGui::EndChild(); ImGui::End(); ``` -------------------------------- ### Renamed Help Menu to Tools Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt The 'Help' menu in the demo has been renamed to 'Tools' for better accuracy. ```cpp Demo: Renamed the "Help" menu to "Tools" (more accurate). ``` -------------------------------- ### Get ImGui Module Properties Source: https://github.com/segross/unrealimgui/blob/master/README.md Access the properties interface of the ImGui module to modify its behavior. This is typically done through the FImGuiModule instance. ```cpp FImGuiModule::Get().GetProperties(); ``` -------------------------------- ### Basic ImGui UI Elements Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/README.md Demonstrates the usage of common ImGui widgets such as text display, buttons, input fields, and sliders. These are fundamental building blocks for creating user interfaces. ```cp ImGui::Text("Hello, world %d", 123); if (ImGui::Button("Save")) MySaveFunction(); ImGui::InputText("string", buf, IM_ARRAYSIZE(buf)); ImGui::SliderFloat("float", &f, 0.0f, 1.0f); ``` -------------------------------- ### ID Collision Example Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Shows a scenario where two buttons with the same label in the same scope cause an ID collision, leading to unintended interactions. ```c Button("OK"); Button("OK"); // ID collision! Interacting with either button will trigger the first one. ``` -------------------------------- ### Using PushID/PopID with Pointers Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Shows how to use PushID with object pointers to differentiate UI elements associated with different data instances in a loop. ```c Begin("Window"); // ... previous loop ... for (int i = 0; i < 100; i++) { MyObject* obj = Objects[i]; PushID(obj); Button("Click"); // Label = "Click", ID = hash of ("Window", obj pointer, "Click") PopID(); } // ... other loops ... ``` -------------------------------- ### Using PushID/PopID with Integers Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Demonstrates how to use PushID with integer values to create unique scopes for programmatically generated UI elements within a loop. ```c Begin("Window"); for (int i = 0; i < 100; i++) { PushID(i); // Push i to the id tack Button("Click"); // Label = "Click", ID = hash of ("Window", i, "Click") PopID(); } // ... other loops ... ``` -------------------------------- ### Context Management: Create and Destroy Context Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt You now need to explicitly create and destroy ImGui contexts. Call ImGui::CreateContext() at the beginning of your application and ImGui::DestroyContext() at the end. This replaces the old Shutdown() function. ```cpp ImGui::CreateContext(); // ... your app code ... ImGui::DestroyContext(); ``` -------------------------------- ### Load Multiple Fonts Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FONTS.txt Loads multiple fonts and demonstrates how to switch between them at runtime using PushFont and PopFont. ```cpp ImGuiIO& io = ImGui::GetIO(); ImFont* font1 = io.Fonts->AddFontFromFileTTF("font.ttf", size_pixels); ImFont* font2 = io.Fonts->AddFontFromFileTTF("anotherfont.otf", size_pixels); // Select font at runtime ImGui::Text("Hello"); // use the default font (which is the first loaded font) ImGui::PushFont(font2); ImGui::Text("Hello with another font"); ImGui::PopFont(); ``` -------------------------------- ### Registering and Using Textures with Unreal ImGui Source: https://github.com/segross/unrealimgui/blob/master/README.md Demonstrates how to register, update, release, and find ImGui textures within Unreal Engine. The texture handle can be implicitly converted to ImTextureID for use with ImGui. ```C++ // Texture handle defined like this FImGuiTextureHandle TextureHandle; // Registration and update TextureHandle = FImGuiModule::Get().RegisterTexture("TextureName", Texture); // Release FImGuiModule::Get().ReleaseTexture(TextureHandle); // Find by name TextureHandle = FImGuiModule::Get().FindTextureHandle("TextureName"); // Example of usage (it is implicitly converted to ImTextureID) ImGui::Image(TextureHandle, Size); ``` -------------------------------- ### Nested PushID Scopes Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Demonstrates how to create deeply nested ID scopes using multiple PushID calls to uniquely identify elements within complex UI structures. ```c Button("Click"); // Label = "Click", ID = hash of (..., "Click") PushID("node"); Button("Click"); // Label = "Click", ID = hash of (..., "node", "Click") PushID(my_ptr); Button("Click"); // Label = "Click", ID = hash of (..., "node", my_ptr, "Click") PopID(); PopID(); ``` -------------------------------- ### Using PushID/PopID with String Pointers Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Illustrates using PushID with string pointers (e.g., object names) to create unique IDs for UI elements based on associated string data. ```c Begin("Window"); // ... previous loops ... for (int i = 0; i < 100; i++) { MyObject* obj = Objects[i]; PushID(obj->Name); Button("Click"); // Label = "Click", ID = hash of ("Window", obj->Name, "Click") PopID(); } End(); ``` -------------------------------- ### Check ImGui Input Capture Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Use io.WantCaptureMouse, io.WantCaptureKeyboard, and io.WantTextInput flags to determine if ImGui is handling input. Pass all inputs to ImGui even when flags are false. ```cpp if (ImGui::GetIO().WantCaptureMouse) { // ImGui wants mouse input } if (ImGui::GetIO().WantCaptureKeyboard) { // ImGui wants keyboard input } if (ImGui::GetIO().WantTextInput) { // ImGui wants text input (e.g., for on-screen keyboard) } ``` -------------------------------- ### Basic Button Labels Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FAQ.md Demonstrates how simple string labels are used to generate unique IDs for buttons. ```c Button("OK"); // Label = "OK", ID = hash of (..., "OK") Button("Cancel"); // Label = "Cancel", ID = hash of (..., "Cancel") ``` -------------------------------- ### Disabling Metrics Window Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt Illustrates how to compile out the ShowMetricsWindow() function using the IMGUI_DISABLE_METRICS_WINDOW setting in imconfig.h. ```cpp Misc: Added IMGUI_DISABLE_METRICS_WINDOW imconfig.h setting to explicitly compile out ShowMetricsWindow(). ``` -------------------------------- ### Stateless Auto-Scrolling in Demo Log Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt The demo's Log and Console now use a simpler stateless pattern for auto-scrolling. ```cpp Demo: Log, Console: Using a simpler stateless pattern for auto-scrolling. ``` -------------------------------- ### Enabling Keyboard Navigation Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt To enable keyboard navigation, set io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard. NewFrame() will automatically populate io.NavInputs[] based on your io.KeysDown[] and io.KeyMap[] arrays. ```cpp io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; ``` -------------------------------- ### Checking for Any Window Focused Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt The obsolete IsAnyWindowFocused() function is replaced by IsWindowFocused(ImGuiFocusedFlags_AnyWindow). A redirection function is kept but will be obsoleted. ```cpp if (ImGui::IsWindowFocused(ImGuiFocusedFlags_AnyWindow)) { // ... } ``` -------------------------------- ### Auto-Scrolling with Stateless Pattern Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt Demonstrates a simpler stateless pattern for auto-scrolling by checking if the current scroll position is at the maximum and then setting the scroll to make the last item visible. ```cpp // (Submit items..) if (ImGui::GetScrollY() >= ImGui::GetScrollMaxY()) // If scrolling at the already at the bottom.. ImGui::SetScrollHereY(1.0f); // ..make last item fully visible ``` -------------------------------- ### Enabling Gamepad Navigation Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/CHANGELOG.txt To enable gamepad navigation, set io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad. You also need to set io.BackendFlags |= ImGuiBackendFlags_HasGamepad and fill the io.NavInputs[] fields before calling NewFrame(). ```cpp io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; io.BackendFlags |= ImGuiBackendFlags_HasGamepad; // Fill io.NavInputs[] here ``` -------------------------------- ### Add ImGui as a Public Dependency Source: https://github.com/segross/unrealimgui/blob/master/README.md Include the ImGui module as a public dependency in your module's Build.cs file. Use this if other modules need to directly access ImGui functionalities. ```csharp PublicDependencyModuleNames.Add("ImGui"); ``` -------------------------------- ### Building Font Atlas and Retrieving Texture Data Source: https://github.com/segross/unrealimgui/blob/master/Source/ThirdParty/ImGuiLibrary/Docs/FONTS.txt Builds the font atlas, making fonts ready for use, and retrieves the font texture data in RGBA format for potential modification. ```cpp // Build atlas io.Fonts->Build(); // Retrieve texture in RGBA format unsigned char* tex_pixels = NULL; int tex_width, tex_height; io.Fonts->GetTexDataAsRGBA32(&tex_pixels, &tex_width, &tex_height); ```