mirror of
				https://github.com/Drezil/imgui.git
				synced 2025-10-31 05:01:05 +01:00 
			
		
		
		
	Fix to allow compiling in unity builds where stb_rectpack/stb_truetype may be already included in the same compilation unit.
This commit is contained in:
		| @@ -69,6 +69,7 @@ Other Changes: | |||||||
| - Fonts: When building font atlas, glyphs that are missing in the fonts are not using the glyph slot to render a dummy/default glyph. Saves space and allow merging fonts with  | - Fonts: When building font atlas, glyphs that are missing in the fonts are not using the glyph slot to render a dummy/default glyph. Saves space and allow merging fonts with  | ||||||
|   overlapping font ranges such as FontAwesome5 which split out the Brands separately from the Solid fonts. (#1703, #1671) |   overlapping font ranges such as FontAwesome5 which split out the Brands separately from the Solid fonts. (#1703, #1671) | ||||||
| - Misc: Added IMGUI_CHECKVERSION() macro to compare version string and data structure sizes in order to catch issues with mismatching compilation unit settings. (#1695, #1769) | - Misc: Added IMGUI_CHECKVERSION() macro to compare version string and data structure sizes in order to catch issues with mismatching compilation unit settings. (#1695, #1769) | ||||||
|  | - Misc: Fix to allow compiling in unity builds where stb_rectpack/stb_truetype may be already included in the same compilation unit. | ||||||
| - Demo: Fixed Overlay: Added a context menu item to enable freely moving the window.  | - Demo: Fixed Overlay: Added a context menu item to enable freely moving the window.  | ||||||
| - Examples: Calling IMGUI_CHECKVERSION() in the main.cpp of every example application. | - Examples: Calling IMGUI_CHECKVERSION() in the main.cpp of every example application. | ||||||
| - Examples: Allegro 5: Added support for 32-bit indices setup via defining ImDrawIdx, to avoid an unnecessary conversion (Allegro 5 doesn't support 16-bit indices). | - Examples: Allegro 5: Added support for 32-bit indices setup via defining ImDrawIdx, to avoid an unnecessary conversion (Allegro 5 doesn't support 16-bit indices). | ||||||
|   | |||||||
| @@ -2594,10 +2594,10 @@ float ImGui::CalcWrapWidthForPos(const ImVec2& pos, float wrap_pos_x) | |||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| void* ImGui::MemAlloc(size_t sz) | void* ImGui::MemAlloc(size_t size) | ||||||
| { | { | ||||||
|     GImAllocatorActiveAllocationsCount++; |     GImAllocatorActiveAllocationsCount++; | ||||||
|     return GImAllocatorAllocFunc(sz, GImAllocatorUserData); |     return GImAllocatorAllocFunc(size, GImAllocatorUserData); | ||||||
| } | } | ||||||
|  |  | ||||||
| void ImGui::MemFree(void* ptr) | void ImGui::MemFree(void* ptr) | ||||||
|   | |||||||
| @@ -91,6 +91,7 @@ namespace IMGUI_STB_NAMESPACE | |||||||
| #pragma GCC diagnostic ignored "-Wcast-qual"                // warning: cast from type 'const xxxx *' to type 'xxxx *' casts away qualifiers | #pragma GCC diagnostic ignored "-Wcast-qual"                // warning: cast from type 'const xxxx *' to type 'xxxx *' casts away qualifiers | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #ifndef STB_RECT_PACK_IMPLEMENTATION                        // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds) | ||||||
| #ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION | #ifndef IMGUI_DISABLE_STB_RECT_PACK_IMPLEMENTATION | ||||||
| #define STBRP_STATIC | #define STBRP_STATIC | ||||||
| #define STBRP_ASSERT(x)    IM_ASSERT(x) | #define STBRP_ASSERT(x)    IM_ASSERT(x) | ||||||
| @@ -101,7 +102,9 @@ namespace IMGUI_STB_NAMESPACE | |||||||
| #else | #else | ||||||
| #include "stb_rect_pack.h" | #include "stb_rect_pack.h" | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
|  | #ifndef STB_TRUETYPE_IMPLEMENTATION                         // in case the user already have an implementation in the _same_ compilation unit (e.g. unity builds) | ||||||
| #ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION | #ifndef IMGUI_DISABLE_STB_TRUETYPE_IMPLEMENTATION | ||||||
| #define STBTT_malloc(x,u)  ((void)(u), ImGui::MemAlloc(x)) | #define STBTT_malloc(x,u)  ((void)(u), ImGui::MemAlloc(x)) | ||||||
| #define STBTT_free(x,u)    ((void)(u), ImGui::MemFree(x)) | #define STBTT_free(x,u)    ((void)(u), ImGui::MemFree(x)) | ||||||
| @@ -116,6 +119,7 @@ namespace IMGUI_STB_NAMESPACE | |||||||
| #else | #else | ||||||
| #include "stb_truetype.h" | #include "stb_truetype.h" | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifdef __GNUC__ | #ifdef __GNUC__ | ||||||
| #pragma GCC diagnostic pop | #pragma GCC diagnostic pop | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user