We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
master
Any
Default
Guys... how about implementing generic RAII for basic backend aspects... for example:
RAII
namespace ImGui { namespace RAII { struct Frame { Frame() { NewFrame(); } ~Frame() { Render(); } }; namespace Backend { template<void (*NewFrame)()> struct Frame { Frame() { NewFrame(); } }; template<void (*NewFrame)(), void (*RenderDrawData)(ImDrawData*)> struct FrameWithRender : public Frame<NewFrame> { ~FrameWithRender() { RenderDrawData(GetDrawData()); } }; } // namespace Backend } // namespace RAII
Then instantiating it... example:
namespace ImGui { using OpenGL2Frame = Backend::FrameWithRender< ImGui_ImplOpenGL2_NewFrame, ImGui_ImplOpenGL2_RenderDrawData>; using Win32Frame = Backend::Frame< ImGui_ImplWin32_NewFrame>; }
Using it would be as easy. as:
int main() { while (/* condition */) { { Win32Frame imw32Frame; OpenGL2Frame imglFrame; ImGui::Frame imFrame; /*User Imgui Code Here*/ } // Platform Present } }
No response
The text was updated successfully, but these errors were encountered:
See #2096 and #2197 for existing discussions/implementation of using RAII patterns with Dear ImGui.
Personally I feel that your specific examples feel like RAII for the sake of RAII.
Sorry, something went wrong.
Hello, I am afraid I also only see negative aspects to your proposal. It doesn’t seem like a good idea. I’ll close this.
No branches or pull requests
Version/Branch of Dear ImGui:
master
Back-ends:
Any
Compiler, OS:
Default
Full config/build information:
Default
Details:
Guys... how about implementing generic
RAII
for basic backend aspects... for example:Then instantiating it... example:
Using it would be as easy. as:
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: