[simgui] Add GUI context getter hooks (#8127)

This enables GUI libraries to be linked statically with shared context.
This commit is contained in:
Peter Johnson
2025-07-30 21:29:24 -07:00
committed by GitHub
parent e678a338b4
commit 0478176e47
4 changed files with 52 additions and 0 deletions

View File

@@ -65,6 +65,12 @@ __declspec(dllexport)
reinterpret_cast<void*>((AddGuiEarlyExecuteFn)&AddGuiEarlyExecute));
HAL_RegisterExtension(HALSIMGUI_EXT_GUIEXIT,
reinterpret_cast<void*>((GuiExitFn)&GuiExit));
HAL_RegisterExtension(
HALSIMGUI_EXT_GETGUICONTEXT,
reinterpret_cast<void*>((GetGuiContextFn)&gui::GetCurrentContext));
HAL_RegisterExtension(
HALSIMGUI_EXT_GETGLASSCONTEXT,
reinterpret_cast<void*>((GetGlassContextFn)&glass::GetCurrentContext));
HALSimGui::GlobalInit();
DriverStationGui::GlobalInit();
@@ -158,6 +164,9 @@ __declspec(dllexport)
ImGuiConfigFlags_DockingEnable)) {
return 0;
}
HAL_RegisterExtension(
HALSIMGUI_EXT_GETIMGUICONTEXT,
reinterpret_cast<void*>((GetImguiContextFn)&ImGui::GetCurrentContext));
HAL_RegisterExtensionListener(
nullptr, [](void*, const char* name, void* data) {
if (std::string_view{name} == "ds_socket") {