ocornut / imgui

Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
MIT License
57.74k stars 9.9k forks source link

Plugin architecture in imgui(C++)? #7605

Open AmanRathoreP opened 1 month ago

AmanRathoreP commented 1 month ago

Version/Branch of Dear ImGui:

Version 1.90.6 Branch: docking

Back-ends:

imgui_impl_opengl3.cpp

Compiler, OS:

Windows/Linux/MacOS

Full config/build information:

No response

Details:

Plugin Architecture

Well, I had searched enough to know that plugin architecture in compiled languages like C/C++ is quite difficult (if not impossible) to implement. I don't want do fancy tasks via plugins but just to draw some extra widgets, tools, windows etc. in my application(of imgui). I want to ask whether there is any example or way of how to achieve this goal.

Screenshots/Video:

No response

Minimal, Complete and Verifiable Example code:

No response

WerWolv commented 1 month ago

This is probably not really an ImGui specific thing but I implemented a pretty extensive plugin system in ImHex. Mainly focused around loading shared libraries that link to a central interface library but there's also support for C# plugins that can also draw their own ImGui interfaces by going through ImGui.NET -> cimgui -> ImGui

ocornut commented 1 month ago

Implementing a plug-in system in a C/C++ app is not particularly difficult. The plugin could have access to imgui header with correct IMGUI_API define to refer to code linked inside main app. I don’t remember the details but it’s not imgui specific.

AmanRathoreP commented 1 month ago

Implementing a plug-in system in a C/C++ app is not particularly difficult. The plugin could have access to imgui header with correct IMGUI_API define to refer to code linked inside main app. I don’t remember the details but it’s not imgui specific.

I know it's may not be imgui specific but could you provide me links of some of the repositories that uses imgui with plugins via C/C++(C#/Java/Rust will also work)

alien-brother commented 1 month ago

If the main application and the plugin dll are statically linked to ImGui, I guess one would need to make sure that they use the same context (assuming that it contains all global state).