From bf1893272a95b118bb7dda9114380cfd59f19178 Mon Sep 17 00:00:00 2001 From: slowriot Date: Tue, 31 Mar 2026 16:45:11 +0100 Subject: [PATCH] add imgui include and use IMGUI_IMPL_API and honour IMGUI_DISABLE Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- backends/imgui_impl_emscripten.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/backends/imgui_impl_emscripten.h b/backends/imgui_impl_emscripten.h index 17a0669c6..d7f0b63e5 100644 --- a/backends/imgui_impl_emscripten.h +++ b/backends/imgui_impl_emscripten.h @@ -32,19 +32,24 @@ // Don't forget to set io.BackendFlags |= ImGuiBackendFlags_HasGamepad when a gamepad is connected. #pragma once +#include "imgui.h" + +#ifndef IMGUI_DISABLE #ifndef __EMSCRIPTEN__ -#error The imgui_impl_emscripten backend requires Emscripten. +#error The imgui_impl_emscripten backend reqiuires Emscripten. #endif // Initialise the Emscripten backend, setting input callbacks. This should be called after ImGui::CreateContext(); -void ImGui_ImplEmscripten_Init(); +IMGUI_IMPL_API void ImGui_ImplEmscripten_Init(); // Shut down the Emscripten backend. This unsets all Emscripten input callbacks set by Init. // Note it'll also unset any Emscripten input callbacks set elsewhere in the program! // Note also there is no obligation to ever call this, as there is not necessarily any such concept as "shutting down" when running in the browser, and we have no resources to release. The user can just close the tab. -void ImGui_ImplEmscripten_Shutdown(); +IMGUI_IMPL_API void ImGui_ImplEmscripten_Shutdown(); -// Call every frame to synchronize Dear ImGui's cursor state with the browser's native cursors. -// If you are not using browser native cursor rendering (i.e. if Dear ImGui is rendering cursors internally), you don't need to call this. -void ImGui_ImplEmscripten_NewFrame(); +// Call every frame to update polled input events, i.e. gamepads, and update imgui's cursors. +// If you aren't using gamepad input to control imgui, and you're not using browser native cursor rendering (i.e. if imgui is rendering cursors internally), you don't need to call this. +IMGUI_IMPL_API void ImGui_ImplEmscripten_NewFrame(); + +#endif // IMGUI_DISABLE