Skip to content

Commit 1d4b5de

Browse files
committed
Alter definition of IM_UNICODE_ defines to faclitate C-binding. (ocornut#2538, ocornut#2541, ocornut#2815)
1 parent 670367e commit 1d4b5de

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

imgui.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ Index of this file:
9292
#else
9393
#define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
9494
#endif
95-
#define IM_UNICODE_CODEPOINT_MAX (sizeof(ImWchar) == 2 ? 0xFFFF : 0x10FFFF) // Last Unicode code point supported by this build.
96-
#define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Standard invalid Unicode code point.
9795

9896
// Warnings
9997
#if defined(__clang__)
@@ -1652,6 +1650,14 @@ typedef ImGuiInputTextCallbackData ImGuiTextEditCallbackData;
16521650
// Helpers
16531651
//-----------------------------------------------------------------------------
16541652

1653+
// Helper: Unicode defines
1654+
#define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Invalid Unicode code point (standard value).
1655+
#ifdef IMGUI_USE_WCHAR32
1656+
#define IM_UNICODE_CODEPOINT_MAX 0x10FFFF // Maximum Unicode code point supported by this build.
1657+
#else
1658+
#define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Maximum Unicode code point supported by this build.
1659+
#endif
1660+
16551661
// Helper: Execute a block of code at maximum once a frame. Convenient if you want to quickly create an UI within deep-nested code that runs multiple times every frame.
16561662
// Usage: static ImGuiOnceUponAFrame oaf; if (oaf) ImGui::Text("This will be called only once per frame");
16571663
struct ImGuiOnceUponAFrame

0 commit comments

Comments
 (0)