Closed benjitrosch closed 1 year ago
Looks like a good idea, but I need to roll this around in the back of my head for a bit ;) All those 'event' functions are actually fairly recent and it didn't occur to me that it might make sense to make them public.
Can you have a look at the CI errors? Looks like some places still call the old _simgui_...
version (probably in sokol-app specific code paths).
Can you have a look at the CI errors? Looks like some places still call the old
_simgui_...
version (probably in sokol-app specific code paths).
Good catch sorry for missing that earlier! Pushed up a fix and reran test_macos.sh
locally (since that's what I'm developing on) and it's passing now, hopefully should mean the others pass as well.
A couple more changes needed, sorry that I missed this earlier:
ImGuiIO* io
parameter needs to be removed, because the public API functions cannot have any Dear ImGui types in their signature (just call ImGui::GetIO()
in the C++ part, and igGetIO()
in the C part)Ok merged, many thanks!
@floooh thanks so much! Hope others find it helpful 😄
I was adding
sokol_imgui
withcimgui
to mysokol_gfx
andSDL2
project when I came across this comment:I took a look and realized that almost all of the internal functions for event handling were platform agnostic between
sokol_app
andSDL2
, with only two exceptions:_simgui_add_sapp_key_event
_simgui_update_modifiers
I made the rest of them public and available even when
SOKOL_IMGUI_NO_SOKOL_APP
is defined, and added a new function calledsimgui_add_key_event
which works like_simgui_add_sapp_key_event
but takes in a function pointer that allows the user to map the keycodes to imgui themselves.Doing this saves a lot of boilerplate. Here's how you can make
sokol_imgui
work withSDL2
pretty easily by exposing these functions:Let me know if you think this would be a good addition or if you'd rather leave it out for people to implement themselves.