1
0
Fork 0
mirror of https://github.com/ocornut/imgui.git synced 2026-01-11 00:04:24 +00:00

Backends: Initialize and shutdown renderer backend for SDL_Surface

This commit is contained in:
moonpower 2025-12-26 02:48:40 +01:00
parent 9084ab8861
commit b3c5626b1f

View file

@ -119,6 +119,12 @@ SDL_Surface* ImGui_ImplSDLSurface2_CreateFontAtlasSurface()
bool ImGui_ImplSDLSurface2_Init(SDL_Surface* surface)
{
if (!surface) return false;
ImGuiIO& io = ImGui::GetIO();
IM_ASSERT(io.BackendRendererName == nullptr && "Already initialized a renderer backend!");
io.BackendRendererName = "imgui_impl_sdlsurface2";
io.BackendFlags |= ImGuiBackendFlags_RendererHasTextures;
g_TargetSurface = surface;
g_FontSurface = ImGui_ImplSDLSurface2_CreateFontAtlasSurface();
if (g_FontSurface)
@ -139,6 +145,10 @@ bool ImGui_ImplSDLSurface2_Init(SDL_Surface* surface)
void ImGui_ImplSDLSurface2_Shutdown()
{
ImGuiIO& io = ImGui::GetIO();
io.BackendRendererName = nullptr;
io.BackendFlags &= ~ImGuiBackendFlags_RendererHasTextures;
ImGui::GetIO().Fonts->TexID = nullptr;
if (g_FontSurface)
{