From dbffbacaf664fcbed1a5eb3abeef84d4c44cf21c Mon Sep 17 00:00:00 2001 From: ocornut Date: Wed, 21 Jan 2015 11:59:11 +0100 Subject: [PATCH] Added IMGUI_DISABLE_STB_***_IMPLEMENTATION --- imgui.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 044a771e5..0b46400f7 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -334,6 +334,8 @@ struct ImGuiTextEditState; //#define IMGUI_STB_NAMESPACE ImStb +//#define IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION +//#define IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION #ifdef IMGUI_STB_NAMESPACE namespace IMGUI_STB_NAMESPACE @@ -346,15 +348,19 @@ namespace IMGUI_STB_NAMESPACE #pragma clang diagnostic ignored "-Wmissing-prototypes" #endif -#define STBRP_STATIC #define STBRP_ASSERT(x) IM_ASSERT(x) +#ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION +#define STBRP_STATIC #define STB_RECT_PACK_IMPLEMENTATION +#endif #include "stb_rect_pack.h" -#define STB_TRUETYPE_IMPLEMENTATION #define STBTT_malloc(x,u) ((void)(u), ImGui::MemAlloc(x)) #define STBTT_free(x,u) ((void)(u), ImGui::MemFree(x)) #define STBTT_assert(x) IM_ASSERT(x) +#ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION +#define STB_TRUETYPE_IMPLEMENTATION +#endif #include "stb_truetype.h" #define STB_TEXTEDIT_STRING ImGuiTextEditState @@ -4695,8 +4701,15 @@ enum STB_TEXTEDIT_K_SHIFT = 1 << 17 }; +#ifdef IMGUI_STB_NAMESPACE +namespace IMGUI_STB_NAMESPACE +{ +#endif #define STB_TEXTEDIT_IMPLEMENTATION #include "stb_textedit.h" +#ifdef IMGUI_STB_NAMESPACE +} +#endif void ImGuiTextEditState::OnKeyPressed(int key) {