Dear ImGui Addons Branch = plain unmodified dear imgui plus some extra addon.

Overview

Dear ImGui

Build Status Static Analysis Status

(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If your company is using Dear ImGui, please consider reaching out.)

Businesses: support continued development and maintenance via invoiced technical support, maintenance, sponsoring contracts:
  E-mail: contact @ dearimgui dot com

Individuals: support continued development and maintenance here.

Also see Sponsors page.


Dear ImGui is a bloat-free graphical user interface library for C++. It outputs optimized vertex buffers that you can render anytime in your 3D-pipeline enabled application. It is fast, portable, renderer agnostic and self-contained (no external dependencies).

Dear ImGui is designed to enable fast iterations and to empower programmers to create content creation tools and visualization / debug tools (as opposed to UI for the average end-user). It favors simplicity and productivity toward this goal, and lacks certain features normally found in more high-level libraries.

Dear ImGui is particularly suited to integration in games engine (for tooling), real-time 3D applications, fullscreen applications, embedded applications, or any applications on consoles platforms where operating system features are non-standard.

Usage - How it works - Releases & Changelogs - Demo - Integration
Upcoming changes - Gallery - Support, FAQ - How to help - Sponsors - Credits - License
Wiki - Languages & frameworks backends/bindings - Software using Dear ImGui - User quotes

Usage

The core of Dear ImGui is self-contained within a few platform-agnostic files which you can easily compile in your application/engine. They are all the files in the root folder of the repository (imgui*.cpp, imgui*.h).

No specific build process is required. You can add the .cpp files to your existing project.

You will need a backend to integrate Dear ImGui in your app. The backend passes mouse/keyboard/gamepad inputs and variety of settings to Dear ImGui, and is in charge of rendering the resulting vertices.

Backends for a variety of graphics api and rendering platforms are provided in the backends/ folder, along with example applications in the examples/ folder. See the Integration section of this document for details. You may also create your own backend. Anywhere where you can render textured triangles, you can render Dear ImGui.

After Dear ImGui is setup in your application, you can use it from _anywhere_ in your program loop:

Code:

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);

Result:
sample code output (dark) sample code output (light)
(settings: Dark style (left), Light style (right) / Font: Roboto-Medium, 16px)

Code:

// 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();

Result:
sample code output

Dear ImGui allows you to create elaborate tools as well as very short-lived ones. On the extreme side of short-livedness: using the Edit&Continue (hot code reload) feature of modern compilers you can add a few widgets to tweaks variables while your application is running, and remove the code a minute later! Dear ImGui is not just for tweaking values. You can use it to trace a running algorithm by just emitting text commands. You can use it along with your own reflection data to browse your dataset live. You can use it to expose the internals of a subsystem in your engine, to create a logger, an inspection tool, a profiler, a debugger, an entire game making editor/framework, etc.

How it works

Check out the Wiki's About the IMGUI paradigm section if you want to understand the core principles behind the IMGUI paradigm. An IMGUI tries to minimize superfluous state duplication, state synchronization and state retention from the user's point of view. It is less error prone (less code and less bugs) than traditional retained-mode interfaces, and lends itself to create dynamic user interfaces.

Dear ImGui outputs vertex buffers and command lists that you can easily render in your application. The number of draw calls and state changes required to render them is fairly small. Because Dear ImGui doesn't know or touch graphics state directly, you can call its functions anywhere in your code (e.g. in the middle of a running algorithm, or in the middle of your own rendering process). Refer to the sample applications in the examples/ folder for instructions on how to integrate Dear ImGui with your existing codebase.

A common misunderstanding is to mistake immediate mode gui for immediate mode rendering, which usually implies hammering your driver/GPU with a bunch of inefficient draw calls and state changes as the gui functions are called. This is NOT what Dear ImGui does. Dear ImGui outputs vertex buffers and a small list of draw calls batches. It never touches your GPU directly. The draw call batches are decently optimal and you can render them later, in your app or even remotely.

Releases & Changelogs

See Releases page. Reading the changelogs is a good way to keep up to date with the things Dear ImGui has to offer, and maybe will give you ideas of some features that you've been ignoring until now!

Demo

Calling the ImGui::ShowDemoWindow() function will create a demo window showcasing variety of features and examples. The code is always available for reference in imgui_demo.cpp.

screenshot demo

You should be able to build the examples from sources (tested on Windows/Mac/Linux). If you don't, let us know! If you want to have a quick look at some Dear ImGui features, you can download Windows binaries of the demo app here:

The demo applications are not DPI aware so expect some blurriness on a 4K screen. For DPI awareness in your application, you can load/reload your font at different scale, and scale your style with style.ScaleAllSizes() (see FAQ).

Integration

On most platforms and when using C++, you should be able to use a combination of the imgui_impl_xxxx backends without modification (e.g. imgui_impl_win32.cpp + imgui_impl_dx11.cpp). If your engine supports multiple platforms, consider using more of the imgui_impl_xxxx files instead of rewriting them: this will be less work for you and you can get Dear ImGui running immediately. You can later decide to rewrite a custom backend using your custom engine functions if you wish so.

Integrating Dear ImGui within your custom engine is a matter of 1) wiring mouse/keyboard/gamepad inputs 2) uploading one texture to your GPU/render engine 3) providing a render function that can bind textures and render textured triangles. The examples/ folder is populated with applications doing just that. If you are an experienced programmer at ease with those concepts, it should take you less than two hours to integrate Dear ImGui in your custom engine. Make sure to spend time reading the FAQ, comments, and some of the examples/ application!

Officially maintained backends/bindings (in repository):

  • Renderers: DirectX9, DirectX10, DirectX11, DirectX12, Metal, OpenGL/ES/ES2, SDL_Renderer, Vulkan, WebGPU.
  • Platforms: GLFW, SDL2, Win32, Glut, OSX, Android.
  • Frameworks: Allegro5, Emscripten.

Third-party backends/bindings wiki page:

  • Languages: C, C# and: Beef, ChaiScript, Crystal, D, Go, Haskell, Haxe/hxcpp, Java, JavaScript, Julia, Kotlin, Lobster, Lua, Odin, Pascal, PureBasic, Python, Ruby, Rust, Swift...
  • Frameworks: AGS/Adventure Game Studio, Amethyst, Blender, bsf, Cinder, Cocos2d-x, Diligent Engine, Flexium, GML/Game Maker Studio2, GLEQ, Godot, GTK3+OpenGL3, Irrlicht Engine, LÖVE+LUA, Magnum, Monogame, NanoRT, nCine, Nim Game Lib, Nintendo 3DS & Switch (homebrew), Ogre, openFrameworks, OSG/OpenSceneGraph, Orx, Photoshop, px_render, Qt/QtDirect3D, SDL_Renderer, SFML, Sokol, Unity, Unreal Engine 4, vtk, VulkanHpp, VulkanSceneGraph, Win32 GDI, WxWidgets.
  • Note that C bindings (cimgui) are auto-generated, you can use its json/lua output to generate bindings for other languages.

Useful Extensions/Widgets wiki page:

  • Text editors, node editors, timeline editors, plotting, software renderers, remote network access, memory editors, gizmos etc.

Also see Wiki for more links and ideas.

Upcoming Changes

Some of the goals for 2022 are:

  • Work on Docking (see #2109, in public docking branch)
  • Work on Multi-Viewport / Multiple OS windows. (see #1542, in public docking branch looking for feedback)
  • Work on gamepad/keyboard controls. (see #787)
  • Work on automation and testing system, both to test the library and end-user apps. (see #435)
  • Make the examples look better, improve styles, improve font support, make the examples hi-DPI and multi-DPI aware.

Gallery

For more user-submitted screenshots of projects using Dear ImGui, check out the Gallery Threads!

For a list of third-party widgets and extensions, check out the Useful Extensions/Widgets wiki page.

Custom engine screenshot game

Custom engine screenshot tool

Tracy Profiler tracy profiler

Support, Frequently Asked Questions (FAQ)

See: Frequently Asked Questions (FAQ) where common questions are answered.

See: Wiki for many links, references, articles.

See: Articles about the IMGUI paradigm to read/learn about the Immediate Mode GUI paradigm.

Getting started? For first-time users having issues compiling/linking/running or issues loading fonts, please use GitHub Discussions.

For other questions, bug reports, requests, feedback, you may post on GitHub Issues. Please read and fill the New Issue template carefully.

Private support is available for paying business customers (E-mail: contact @ dearimgui dot com).

Which version should I get?

We occasionally tag Releases but it is generally safe and recommended to sync to master/latest. The library is fairly stable and regressions tend to be fixed fast when reported.

Advanced users may want to use the docking branch with Multi-Viewport and Docking features. This branch is kept in sync with master regularly.

Who uses Dear ImGui?

See the Quotes, Sponsors, Software using dear imgui Wiki pages for an idea of who is using Dear ImGui. Please add your game/software if you can! Also see the Gallery Threads!

How to help

How can I help?

  • See GitHub Forum/issues and Github Discussions.
  • You may help with development and submit pull requests! Please understand that by submitting a PR you are also submitting a request for the maintainer to review your code and then take over its maintenance forever. PR should be crafted both in the interest in the end-users and also to ease the maintainer into understanding and accepting it.
  • See Help wanted on the Wiki for some more ideas.
  • Have your company financially support this project (please reach by e-mail)

How can I help financing further development of Dear ImGui?

See Sponsors page.

Sponsors

Ongoing Dear ImGui development is currently financially supported by users and private sponsors:

Platinum-chocolate sponsors

Double-chocolate sponsors

Chocolate sponsors

Salty-caramel sponsors

Please see detailed list of Dear ImGui supporters for past sponsors. From November 2014 to December 2019, ongoing development has also been financially supported by its users on Patreon and through individual donations.

THANK YOU to all past and present supporters for helping to keep this project alive and thriving!

Dear ImGui is using software and services provided free of charge for open source projects:

Credits

Developed by Omar Cornut and every direct or indirect contributors to the GitHub. The early version of this library was developed with the support of Media Molecule and first used internally on the game Tearaway (PS Vita).

Recurring contributors (2020): Omar Cornut @ocornut, Rokas Kupstys @rokups, Ben Carter @ShironekoBen. A large portion of work on automation systems, regression tests and other features are currently unpublished.

Sponsoring, support contracts and other B2B transactions are hosted and handled by Lizardcube.

Omar: "I first discovered the IMGUI paradigm at Q-Games where Atman Binstock had dropped his own simple implementation in the codebase, which I spent quite some time improving and thinking about. It turned out that Atman was exposed to the concept directly by working with Casey. When I moved to Media Molecule I rewrote a new library trying to overcome the flaws and limitations of the first one I've worked with. It became this library and since then I have spent an unreasonable amount of time iterating and improving it."

Embeds ProggyClean.ttf font by Tristan Grimmer (MIT license).

Embeds stb_textedit.h, stb_truetype.h, stb_rect_pack.h by Sean Barrett (public domain).

Inspiration, feedback, and testing for early versions: Casey Muratori, Atman Binstock, Mikko Mononen, Emmanuel Briney, Stefan Kamoda, Anton Mikhailov, Matt Willis. Also thank you to everyone posting feedback, questions and patches on GitHub.

License

Dear ImGui is licensed under the MIT License, see LICENSE.txt for more information.

Comments
  • Visual C++ 2010 compiler hangs when trying to compile main2.cpp in addons_examples

    Visual C++ 2010 compiler hangs when trying to compile main2.cpp in addons_examples

    Version/Branch of Dear ImGui: Version: Dear IMGUI 1.69 WIP Branch: addons

    Back-end/Renderer/Compiler/OS Back-ends: win32 + gl3w Compiler: Visual C++ 2010 Operating System: Windows 7 X64

    My Issue/Question: Visual C++ 2010 hangs when trying to compile main2.cpp in addons_examples Command line used is: cl /I . /I .. /I ..\addons /DIMGUI_INCLUDE_IMGUI_USER_H /DIMGUI_INCLUDE_IMGUI_USER_INL /DIMGUI_USE_WINAPI_BINDING /DIMGUI_USE_GL3W /DIMIMPL_SHADER_GL3 main2.cpp

    main.cpp however compiles fine and I can generate the executable with this: cl /Feimguiaddon.exe /I . /I .. /I ..\addons /DIMGUI_INCLUDE_IMGUI_USER_H /DIMGUI_INCLUDE_IMGUI_USER_INL /DIMGUI_USE_WINAPI_BINDING /DIMGUI_USE_GL3W /DIMIMPL_SHADER_GL3 gl3w.c ..\imgui.cpp ..\imgui_demo.cpp ..\imgui_draw.cpp imgui_impl_win32.cpp main.cpp version.lib winmm.lib shell32.lib gdi32.lib ole32.lib advapi32.lib oleaut32.lib Opengl32.lib

    Screenshots/Video Standalone, minimal, complete and verifiable example: _(see ```

    opened by jjn555 13
  • v1.60: Remove global DockContext, require CreateDockContext()

    v1.60: Remove global DockContext, require CreateDockContext()

    Since dear imgui v1.60, calling CreateContext is required as the static global context has been removed. The purpose of this PR is to reflect that design decision in the imguidock addon.

    No new API calls were added. I have reused the existing CreateDockContext SetCurrentDockContext and DestroyDockContext functions:

    
    // A dock context needs to be present.
    ImGui::DockContext *dockCtx = ImGui::CreateDockContext();
    ImGui::SetCurrentDockContext(dockCtx);
    
    // Context cleanup (will also set the current context to null):
    ImGui::DestroyDockContext(dockCtx);
    

    I have added this same example to the header usage code.

    In case anybody forgets to set up a context, I have sprinkled IM_ASSERT before all g_dock dereferences so that any null pointer dereference issues easier to debug.

    This would benefit the people who are hotloading code.

    opened by justas-d 11
  • DateChooser, two calendars simultaneously

    DateChooser, two calendars simultaneously

    Hi Flix01,

    Please, I'm trying DateChooser and is really delicious. Nice looking calendar that respects the leap year (28-29 February), but has enough serious errors. When I want to view two calendars side by side so I will not see me neither. Respectively button displays an actual calendar but did not. Maybe it's a BUG or bad I use it myself but you ought to know about it. Ted does not know what the council ...: - / I am not sufficiently powerful computer for uploading video screen but here is my code:

            ImGui::PushID("dateFrom");
            ImGui::Text("%s", "Paper will be published from:");
            static tm dateFrom = ImGui::GetCurrentDate();
            ImGui::DateChooser("##dateFrom",dateFrom);
            ImGui::PopID();
    
            ImGui::PushID("dateTo");
            ImGui::Text("%s", "Paper will be published only to:");
            static tm dateTo = ImGui::GetCurrentDate();
            ImGui::DateChooser("##dateTo",dateTo);
            ImGui::PopID();
    

    Ala Google translate

    bug 
    opened by colesnicov 10
  • NodeGraphEditor FieldEnum with dynamic options

    NodeGraphEditor FieldEnum with dynamic options

    Hello! I'm planning use your NodeGraphEditor in my graduation work as a part of a cellular automata GUI I'm developing. First of all, thanks for open your code, it's a nice and versatile 'widget'. I'm still a noob in imgui, so maybe I haven't see the solution to this, but seems like the function (passed in addFieldEnum()) that returns the name of a selected index, must be static (as your APPLE/ LEMON/ ORANGE example). Once my application allows the user to define in execution time some objects that will appear as options in a FieldEnum, I can't define it statically.

    So, there is a way to do this? Would be great if I can use your NodeGraphEditor on my work :)

    opened by rff255 9
  • How to open dialog box without ImGui::Button

    How to open dialog box without ImGui::Button

    I am trying to open dialog box on pressing ImGui::MenuItem or by simple bool variable, but it doesn't work.

    // Inside a ImGui window:
    const bool browseButtonPressed = ImGui::Button("...");                          // we need a trigger boolean variable
    static ImGuiFs::Dialog dlg;                                                     // one per dialog (and must be static)
    const char* chosenPath = dlg.chooseFileDialog(browseButtonPressed);             // see other dialog types and the full list of arguments for advanced usage
    if (strlen(chosenPath)>0) {
        // A path (chosenPath) has been chosen RIGHT NOW. However we can retrieve it later more comfortably using: dlg.getChosenPath()
    }
    if (strlen(dlg.getChosenPath())>0) {
        ImGui::Text("Chosen file: \"%s\"",dlg.getChosenPath());
    }
    
    // If you want to copy the (valid) returned path somewhere, you can use something like:
    static char myPath[ImGuiFs::MAX_PATH_BYTES];
    if (strlen(dlg.getChosenPath())>0) {
        strcpy(myPath,dlg.getChosenPath());
    }
    
    opened by traw 8
  • I use VS2013 to compile it,but unable to compile correctly!

    I use VS2013 to compile it,but unable to compile correctly!

    VS2013 to compile addons,but unble to compile correctly,turn on as below error "error C3861: 'snprintf': identifier not found" qq 20160706123324

    i had added codes in imguilistview.h as below:

    if _MSC_VER

    define snprintf _snprintf

    endif

    recompile,but still unble to compile correctly,turn on as below error: qq 1111

    pls help me to compile it correctly using vs2013?

    opened by zhouxs1023 7
  • [imguidock] Dock splits aren't draggable any more

    [imguidock] Dock splits aren't draggable any more

    Upgraded my imgui submodule for the first time in a while and the dock splits aren't draggable!

    Affects 54509c59590c721e54ac7459ec84497766c64049, the revision I'm currently using in my project. (I am a bit behind! I will be upgrading, just not yet. Dealing with the dear imgui input changes will mean a bit of work.)

    Also affects 008d358ea2bf61fb07a63b34a8f72e2f8906dc64 (current head revision), I think, as I can reproduce it in Chrome with https://rawgit.com/Flix01/imgui/imgui_with_addons/examples/addons_examples/html/main.html

    After a bit of poking about it looks like the invisible buttons (e.g., https://github.com/Flix01/imgui/blob/54509c59590c721e54ac7459ec84497766c64049/addons/imguidock/imguidock.cpp#L362) are never getting classed as hovered, even when the mouse is over them.

    I'm going to attempt to fix this, but I thought I'd raise an issue anyway. I haven't been paying much attention to recent dear imgui changes, so maybe it's actually something pretty obvious...

    Thanks,

    --Tom

    bug 
    opened by tom-seddon 6
  • datechooser localization

    datechooser localization

    Would it be possible to allow the user to specify the month names and day names? This would be useful when the application is using a language other than english.

    opened by newk5 6
  • How to use PDFViewer

    How to use PDFViewer

    Hello Flix01, Please, could you advise how to use imguipdfviewer? I tried to spice things up as follows:

            static ImGui::PdfViewer pdf;
            pdf.loadFromFile(ResourceManager::getInstance()->createAssetsPath("sldb2011_zv.pdf").c_str());
            pdf.render(ImVec2(800, 600));
    

    But nothing - Segmentation fault: 139 ...

    opened by colesnicov 6
  • How to use the imguidock addon in visual studio

    How to use the imguidock addon in visual studio

    I want to use imguidock in visual studio.

    I used the following code in the main loop:

    // Windowed:
    ImGui::SetNextWindowSize(ImVec2(500, 500),ImGuiCond_Once);        
    if (ImGui::Begin("imguidock window (= lumix engine's dock system)",NULL,ImGuiWindowFlags_NoScrollbar)) {
            ImGui::BeginDockspace();
            static char tmp[128];
            for (int i=0;i<10;i++)  {
                    sprintf(tmp,"Dock %d",i);
                    if (i==9) ImGui::SetNextDock(ImGuiDockSlot_Bottom);// optional
                    if(ImGui::BeginDock(tmp))  {
                        ImGui::Text("Content of dock window %d goes here",i);
                    }
                ImGui::EndDock();
            }
            ImGui::EndDockspace();
     }
     ImGui::End();
    

    but I got the following errors:

    Severity	Code	Description	Project	File	Line	Suppression State
    Error (active)		namespace "ImGui" has no member "BeginDockspace"	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	141	
    Error (active)		identifier "sprintf" is undefined	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	144	
    Error (active)		namespace "ImGui" has no member "SetNextDock"	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	145	
    Error (active)		identifier "ImGuiDockSlot_Bottom" is undefined	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	145	
    Error (active)		namespace "ImGui" has no member "BeginDock"	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	146	
    Error (active)		namespace "ImGui" has no member "EndDock"	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	149	
    Error (active)		namespace "ImGui" has no member "EndDockspace"	example_win32_directx9	d:\Demo\Flix01-imgui\examples\example_win32_directx9\main.cpp	151	
    Error	C2039	'BeginDockspace': is not a member of 'ImGui'	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	141	
    Error	C3861	'BeginDockspace': identifier not found	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	141	
    Error	C3861	'sprintf': identifier not found	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	144	
    Error	C2039	'SetNextDock': is not a member of 'ImGui'	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	145	
    Error	C2065	'ImGuiDockSlot_Bottom': undeclared identifier	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	145	
    Error	C3861	'SetNextDock': identifier not found	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	145	
    Error	C2039	'BeginDock': is not a member of 'ImGui'	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	146	
    Error	C3861	'BeginDock': identifier not found	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	146	
    Error	C2039	'EndDock': is not a member of 'ImGui'	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	149	
    Error	C3861	'EndDock': identifier not found	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	149	
    Error	C2039	'EndDockspace': is not a member of 'ImGui'	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	151	
    Error	C3861	'EndDockspace': identifier not found	example_win32_directx9	d:\demo\flix01-imgui\examples\example_win32_directx9\main.cpp	151	
    

    What can I do to recognize the addons file? Thanks

    opened by zhouxs1023 5
  • Memory issues when ImGui::TabLabels are stored in a vector

    Memory issues when ImGui::TabLabels are stored in a vector

    I've triggered by incommon usage a memory use after free by having a nodegrapheditor in an own class as member and moving my object into a std-vector. the nodegrapheditor inherits from TabLabel which has pointer-members to label, tooltip and userText. I think my sequence to trigger the error is: create nodegrapheditor and by that a tablabel with a label-string. now I move this nodegrapheditor into the vector which calls the (implicit) copy-constructor of tablabel which copies the pointers, afterwards the old object gets deleted and calls the MemFree-functions, but the pointers are still used in the copied object and are now unsafe to use.

    I've written a copy-constructor and a copy assignment operator to fix it:

        TabLabel(const TabLabel &other) {
            label = tooltip = userText = NULL;
            userPtr = other.userPtr;
            userInt = other.userInt;
            closable = other.closable;
            draggable = other.draggable;
            mustCloseNextFrame = other.mustCloseNextFrame;
            mustSelectNextFrame = other.mustSelectNextFrame;
            wndFlags = other.wndFlags;
            modified = other.modified;
            if(other.label) {
                label = (char*)ImGui::MemAlloc(strlen(other.label)+2);
                strcpy(label, other.label);
            }
            if(other.tooltip) {
                tooltip = (char*)ImGui::MemAlloc(strlen(other.tooltip)+1);
                strcpy(tooltip, other.tooltip);
            }
            if(other.userText) {
                userText = (char*)ImGui::MemAlloc(strlen(other.userText)+1);
                strcpy(userText, other.userText);
            }
        }
        TabLabel &operator=(const TabLabel &other) {
            if(this != &other) {
                label = tooltip = userText = NULL;
                userPtr = other.userPtr;
                userInt = other.userInt;
                closable = other.closable;
                draggable = other.draggable;
                mustCloseNextFrame = other.mustCloseNextFrame;
                mustSelectNextFrame = other.mustSelectNextFrame;
                wndFlags = other.wndFlags;
                modified = other.modified;
                if(other.label) {
                    label = (char*)ImGui::MemAlloc(strlen(other.label)+2);
                    strcpy(label, other.label);
                }
                if(other.tooltip) {
                    tooltip = (char*)ImGui::MemAlloc(strlen(other.tooltip)+1);
                    strcpy(tooltip, other.tooltip);
                }
                if(other.userText) {
                    userText = (char*)ImGui::MemAlloc(strlen(other.userText)+1);
                    strcpy(userText, other.userText);
                }
            }
            return *this;
        }
    

    with that included I have no longer the memory usage after free in my codebase....

    opened by questor 5
  • Hope to provide titlebar drawing function.

    Hope to provide titlebar drawing function.

    In order to change titlebar background color,I hope to provide titlebar drawing function as like ImWindow(https://github.com/thennequin/ImWindow.git branch:titlebar) 360-16331130495794

    opened by zhouxs1023 0
  • Help-me for build with mingw on windows

    Help-me for build with mingw on windows

    Hello good evening, I'm having problems compiling your lib in my project, a good part of the implementations are compiling correctly in my MINGW compiler on a Windows machine.

    However, adding #include "imguifilesystem.h" in the main.cpp file generates several errors like:

    /usr/share/mingw-w64/include/minwindef.h:142:17: error: 'typedef float FLOAT' redeclared as different kind of symbol
    /usr/share/mingw-w64/include/winnt.h:598:16: error: 'typedef BYTE BOOLEAN' redeclared as different kind of symbol  typedef BYTE BOOLEAN;
    /usr/share/mingw-w64/include/winnt.h:3651:7: error: 'BOOLEAN' does not name a type BOOLEAN EffectiveOnly;
    

    I'm including your lib in Cmake as follows:

    set (IMGUI_INCLUDE_DIRS
      $ {CMAKE_CURRENT_SOURCE_DIR} / dependencies / imgui /
      $ {CMAKE_CURRENT_SOURCE_DIR} / dependencies / imgui / addons
      $ {CMAKE_CURRENT_SOURCE_DIR} / dependencies / imgui / addons / imguifilesystem)
    
    set (IMGUI_LIBRARY imgui)
    
    set (IMGUI_USE_MINIZIP OFF CACHE BOOL "IMGUI_USE_MINIZIP")
    add_definitions (-DYES_IMGUIADDONS_ALL)
    
    INCLUDE_DIRECTORIES (
        $ {CMAKE_CURRENT_SOURCE_DIR} / imgui / addons /
        $ {CMAKE_CURRENT_SOURCE_DIR} / imgui /
        $ {CMAKE_CURRENT_SOURCE_DIR} / imgui / addons / imguifilesystem /
    )
    
    add_library (imgui STATIC
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/imgui.h
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/imgui.cpp
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/imgui_demo.cpp
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/imgui_draw.cpp
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/addons/imgui_user.h
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/addons/imguifilesystem/dirent_portable.h
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/addons/imguifilesystem/imguifilesystem.h
        $ {CMAKE_CURRENT_SOURCE_DIR} /imgui/addons/imguifilesystem/imguifilesystem.cpp
        )
    

    How can I proceed with a solution? Thank you for your cooperation.

    opened by MarcosSoares10 5
  • consider using IMGUI_API

    consider using IMGUI_API

    I use ImGui as a dll by setting IMGUI_API to either export or import symbols appropriately - currently the addons are unusable for me because the interface (forward declarations of functions in headers) is not annotated with IMGUI_API accordingly.

    enhancement 
    opened by onqtam 2
  • A better way to implement IMGUI::filesystem.

    A better way to implement IMGUI::filesystem.

    My operating system is Windows 10 64-bits and the system's language is chinese. Here I have a folder, its cotents show like these: 1 When I use the IMGUIFs::Dialog and enter this folder, I got:

    2 It seems that:

    1. All files or directries with non-ASCII name are not listed;
    2. Files with long name are shrinked.

    Both 1 and 2 are caused by using of API scandir. I hadn't known this API before. But when I debug into the Directory::GetFiles and Directory::GetDirectories I make sure it is the causing reason.

    (By the way, I got compiler error when I compiler filesystem.cpp under Visual Studio 2015 X64 model. I fix it by adding #ifdef _WIN32 #include <Windows.h> #endif piror to the first include directive in this file.)

    For myself, I modified the filesystem.cpp to resolve this as following: Add supporting header and API:

    #ifdef IMGUI_FILESYSTEM_USE_STD_FILESYSTEM
    #include <experimental\filesystem> // VS-builtin experimental library for c++17
    #include <boost\locale.hpp> // encoding related
    /* the so-called `exec_char_enc` is a kind of encoding that C++'s specified compiler use in C++ standard API such as printf std::cout and so on. When you write "IMGUI", the string has this encoding. ` */
    inline std::string to_exec_char_enc(
    	const std::string &text,
    	const std::string &fromencoding)
    {
    	return boost::locale::conv::between(text, "GB2312", fromencoding);
    }
    
    inline std::string u8_to_exec_char_enc(
    	const std::string &text)
    {
    	return to_exec_char_enc(text, "UTF-8");
    }
    #endif
    

    Subsitute the code fragments in Directory::GetFiles or Directory::GetDirectorys by:

    #ifdef IMGUI_FILESYSTEM_USE_STD_FILESYSTEM
    namespace fs = std::experimental::filesystem;
    		{
    			auto srcdir = u8_to_exec_char_enc(directoryName);
    			result.clear();
    			if (pOptionalNamesOut)
    				pOptionalNamesOut->clear();
    			fs::path rootpath(srcdir);
    			std::error_code errc;
    			auto r = fs::directory_iterator(rootpath, errc);
    			if (errc)
    				return;
    			for (auto &item : r)
    			{
    				if (item.status().type() == fs::file_type::directory) // or, fs::file_type::regular_file
    				{
    					auto stdstr = item.path().u8string();
    					String::PushBack(result, stdstr.c_str());
    					auto fnamepath = item.path().filename().u8string();
    					if (pOptionalNamesOut)
    						String::PushBack(*pOptionalNamesOut, fnamepath.c_str());
    				}
    			}
    			return;
    		}
    #endif
    

    The result:

    3 Hope this helps. ------ Leslie.

    enhancement 
    opened by daysofbeingwild 7
  • Code editor

    Code editor

    As I read status of current implementation is not good, but I did some improvements for "BadCodeEditor" (not another one) and I want to reimplement folding in this method but I don't really understand the structure of that, could you explain please?

    opened by luckyycode 1
  • got it working but i get some problems

    got it working but i get some problems

    I got the dialog to pop up and show the current dir. but the opengl window frame the dialog is being drawn on is following the mouse motion I make. it wont stay still like the demo window where you can interact with the examples. how do I fix this?

    opened by edselmalasig 1
Releases(v.1.52)
This is a C plus plus coding template for Compitative programming. This template is very optimized for the Online Judgment

C-plusplus-compitative-Programming-Template Tech We Used C++ Features Easy to compile Easy debug facility Analysised and optimized base template Steps

Alan Binu 15 Jan 27, 2022
This repo does not contain any skins that work by themselves, but rather addons to already existing skins like CakeOS and Polybar

Rainmeter-addons ⚠ This repo does not contain any skins that work by themselves, but rather addons to already existing skins like CakeOS and Polybar E

null 3 Nov 3, 2022
Cobaltstrike addons to interact with clipboard

Cobalt-Clip Cobalt-clip is clipboard addons for cobaltstrike to interact with clipboard. With this you can dump, edit and monitor the content of q cli

null 72 Dec 14, 2022
Blender addon for AutoRemesher by huxingyi

AutoRemesher Blender 2.8 Blender addon implementation of AutoRemesher by huxingyi. This implementation works on Windows 10 and Ubuntu. Install the add

null 75 Dec 2, 2022
Add extra features to Discord via patches!

DiscordExtras An iOS tweak that lets you apply patches the iOS Discord client. Available on my repo here. Components DiscordExtrasPrefs This includes

Zoey 32 Sep 28, 2022
A HEIF/HEIC addon for Pillow using libheif library through CFFI, with binary wheels.

pillow_heif A HEIF/HEIC addon for Pillow using libheif library through CFFI, with binary wheels(Python 3.6-3.9, linux/macos - x64,aarch64). Based most

Alexander Piskun 69 Dec 28, 2022
Extra Credit Project for CS 411

#Extra Credit Project for CS 411 CS411ExtraCredit Commands to run JOINS with Nation and Region Files *NOTE region.tbl files and nation.tbl files are a

null 1 Nov 27, 2021
The FLIP Fluids addon is a tool that helps you set up, run, and render high quality liquid fluid effects all within Blender, the free and open source 3D creation suite.

FLIP Fluids The FLIP Fluids addon is a tool that helps you set up, run, and render liquid simulation effects. Our custom built fluid engine is based a

Ryan Guy 1.4k Dec 22, 2022
Diff Match Patch is a high-performance library in multiple languages that manipulates plain text.

The Diff Match and Patch libraries offer robust algorithms to perform the operations required for synchronizing plain text. Diff: Compare two blocks o

Google 5.9k Dec 31, 2022
Tiny blocker of Windows tracking and telemetry written in plain C++/Win32 API.

Tiny blocker of Windows tracking and telemetry written in plain C++/Win32 API. Just run once as admin and forget. No questions asked. No harmful actions performed like other Windows spying blockers try.

null 6 Dec 23, 2022
A fast and simple 6502 emulator in plain C.

6502js But C A hobby project that replicates the 6502js emulator, but with the speed of C. Why? For fun and learning :D Simple on the outside: Replica

Lim Ding Wen 2 Nov 25, 2021
Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

Paulo Rafael Ramalho 0 Jan 1, 2023
Hydrogen is a tiny GDI Malware, with some bytebeat music, many payloads and some shaders

Hydrogen is a tiny GDI Malware, with some bytebeat music, many payloads and some shaders

Leo Lezury 28 Nov 12, 2022
The home for algorithms ranging from searching to search all the way to dynamic programming, branch and bound, etc.

Algorithms The home for algorithms ranging from searching and sorting all the way to dynamic programming algorithms, divide and conquer, etc. What are

null 1 Dec 6, 2021
Half-Life : Extended main branch for developing purposes

Half Life : Extended SDK Source Code of Half Life : Extended as a open source modbase for everyone publicly, make your own mod with alot of features e

Bacontsu 15 Dec 12, 2022
A drop-in entity editor for EnTT with Dear ImGui

imgui_entt_entity_editor A drop-in, single-file entity editor for EnTT, with ImGui as graphical backend. demo-code (live) Editor Editor with Entiy-Lis

Erik Scholz 151 Jan 2, 2023
A single-file, immediate-mode sequencer widget for C++17, Dear ImGui and EnTT

A single-file, immediate-mode sequencer widget for C++17, Dear ImGui and EnTT Table of Contents Overview Features Design Decisions Todo Open Questions

Alan Jefferson 194 Dec 16, 2022
A small, dependency-free node editor extension for dear imgui.

imnodes A small, dependency-free node editor extension for dear imgui. Features: Create nodes, links, and pins in an immediate-mode style Single heade

Johann Muszynski 1.3k Dec 28, 2022
An improved plot widget for Dear ImGui, aimed at displaying audio data

imgui-plot An improved plot widget for Dear ImGui, aimed at displaying audio data TOC Screenshots Rationale Usage Installation FAQ Screenshots Display

Anton Lobashev 399 Jan 3, 2023