Skip to content
New issue

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

how to use cimgui to wrap imgui_impl_sdl2, imgui_impl_sdlrenderer2 ? #258

Open
hw-claudio opened this issue Jan 2, 2024 · 2 comments
Open

Comments

@hw-claudio
Copy link

Hi I am trying to use imgui, but my code is all C which I prefer due to compilation times (and no real need for C++ features).

I found this cimgui project, and I am able to compile in the code using the pre-generated assets from the builds
(cimgui.json, cimgui.h, cimgui.cpp).

Since I am using SDL2 and SDL2 render API, I am also interested in the SDL2 backends,
is there some cimgui_sdl2.h, cimgui_sdl2_renderer.h I can use so as to leverage the existing SDL2 code in cimgui?

I found this Issue that I did not really understand:

#157

And I found also a reference to some LUA stuff as:

https://github.com/sonoro1234/LuaJIT-ImGui

but I am not interested in LUA, I just would like to have functions to call from C code in order to render the cimgui using SDL2 and SDL2 renderer.

Thanks for any hint!

@hw-claudio
Copy link
Author

btw I got it done by manually changing imgui_impl_sdl2.h and imgui_impl_sdlrenderer2.h with:

--- a/imgui/imgui_impl_sdl2.h
+++ b/imgui/imgui_impl_sdl2.h
@@ -19,25 +19,25 @@
// - Introduction, links and more at the top of imgui.cpp

#pragma once
-#include "imgui.h" // IMGUI_IMPL_API
-#ifndef IMGUI_DISABLE
+#ifdef __cplusplus
+extern "C"
+{
+#endif /* __cplusplus */

and adjusted a few more things here and there and it works.
I think it would be good though to leave the original files as they are and provide a cimgui_impl_sdl2.h and a cimgui_impl_sdl2renderer2.h automatically generated like is already done with cimgui.h

@0Alastair1
Copy link

ImGui_ImplDX9 need bindings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants