48 #ifdef IMGUI_USER_CONFIG
49 #include IMGUI_USER_CONFIG
51 #if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H)
69 #define IMGUI_VERSION "1.85"
70 #define IMGUI_VERSION_NUM 18500
71 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
72 #define IMGUI_HAS_TABLE
80 #ifndef IMGUI_IMPL_API
81 #define IMGUI_IMPL_API IMGUI_API
87 #define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h
89 #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*(_ARR)))) // Size of a static C-style array. Don't use on pointers!
90 #define IM_UNUSED(_VAR) ((void)(_VAR)) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
91 #if (__cplusplus >= 201100) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201100)
92 #define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11
94 #define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
98 #if !defined(IMGUI_USE_STB_SPRINTF) && defined(__MINGW32__) && !defined(__clang__)
99 #define IM_FMTARGS(FMT) __attribute__((format(gnu_printf, FMT, FMT+1)))
100 #define IM_FMTLIST(FMT) __attribute__((format(gnu_printf, FMT, 0)))
101 #elif !defined(IMGUI_USE_STB_SPRINTF) && (defined(__clang__) || defined(__GNUC__))
102 #define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1)))
103 #define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
105 #define IM_FMTARGS(FMT)
106 #define IM_FMTLIST(FMT)
110 #if defined(_MSC_VER) && !defined(__clang__) && !defined(IMGUI_DEBUG_PARANOID)
111 #define IM_MSVC_RUNTIME_CHECKS_OFF __pragma(runtime_checks("",off)) __pragma(check_stack(off)) __pragma(strict_gs_check(push,off))
112 #define IM_MSVC_RUNTIME_CHECKS_RESTORE __pragma(runtime_checks("",restore)) __pragma(check_stack()) __pragma(strict_gs_check(pop))
114 #define IM_MSVC_RUNTIME_CHECKS_OFF
115 #define IM_MSVC_RUNTIME_CHECKS_RESTORE
120 #pragma warning (push)
121 #pragma warning (disable: 26495) // [Static Analyzer] Variable 'XXX' is uninitialized. Always initialize a member variable (type.6).
123 #if defined(__clang__)
124 #pragma clang diagnostic push
125 #pragma clang diagnostic ignored "-Wold-style-cast"
126 #if __has_warning("-Wzero-as-null-pointer-constant")
127 #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
129 #elif defined(__GNUC__)
130 #pragma GCC diagnostic push
131 #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
132 #pragma GCC diagnostic ignored "-Wclass-memaccess" // [__GNUC__ >= 8] warning: 'memset/memcpy' clearing/writing an object of type 'xxxx' with no trivial copy-assignment; use assignment or value-initialization instead
231 #if defined(_MSC_VER) && !defined(__clang__)
232 typedef signed __int64
ImS64;
233 typedef unsigned __int64
ImU64;
234 #elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100)
247 #ifdef IMGUI_USE_WCHAR32 // ImWchar [configurable type: override in imconfig.h with '#define IMGUI_USE_WCHAR32' to support Unicode planes 1-16]
256 typedef void* (*ImGuiMemAllocFunc)(
size_t sz,
void* user_data);
269 #ifdef IM_VEC2_CLASS_EXTRA
279 ImVec4(
float _x,
float _y,
float _z,
float _w) {
x = _x;
y = _y;
z = _z;
w = _w; }
280 #ifdef IM_VEC4_CLASS_EXTRA
479 IMGUI_API void PushID(
const char* str_id_begin,
const char* str_id_end);
509 IMGUI_API void Image(
ImTextureID user_texture_id,
const ImVec2& size,
const ImVec2& uv0 =
ImVec2(0, 0),
const ImVec2& uv1 =
ImVec2(1,1),
const ImVec4& tint_col =
ImVec4(1,1,1,1),
const ImVec4& border_col =
ImVec4(0,0,0,0));
510 IMGUI_API bool ImageButton(
ImTextureID user_texture_id,
const ImVec2& size,
const ImVec2& uv0 =
ImVec2(0, 0),
const ImVec2& uv1 =
ImVec2(1,1),
int frame_padding = -1,
const ImVec4& bg_col =
ImVec4(0,0,0,0),
const ImVec4& tint_col =
ImVec4(1,1,1,1));
524 IMGUI_API bool Combo(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int popup_max_height_in_items = -1);
525 IMGUI_API bool Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int popup_max_height_in_items = -1);
526 IMGUI_API bool Combo(
const char* label,
int* current_item,
bool(*items_getter)(
void*
data,
int idx,
const char** out_text),
void* data,
int items_count,
int popup_max_height_in_items = -1);
543 IMGUI_API bool DragFloatRange2(
const char* label,
float* v_current_min,
float* v_current_max,
float v_speed = 1.0
f,
float v_min = 0.0
f,
float v_max = 0.0
f,
const char*
format =
"%.3f",
const char* format_max = NULL,
ImGuiSliderFlags flags = 0);
548 IMGUI_API bool DragIntRange2(
const char* label,
int* v_current_min,
int* v_current_max,
float v_speed = 1.0
f,
int v_min = 0,
int v_max = 0,
const char*
format =
"%d",
const char* format_max = NULL,
ImGuiSliderFlags flags = 0);
635 IMGUI_API bool ListBox(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items = -1);
636 IMGUI_API bool ListBox(
const char* label,
int* current_item,
bool (*items_getter)(
void* data,
int idx,
const char** out_text),
void* data,
int items_count,
int height_in_items = -1);
640 IMGUI_API void PlotLines(
const char* label,
const float*
values,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
ImVec2 graph_size =
ImVec2(0, 0),
int stride =
sizeof(
float));
641 IMGUI_API void PlotLines(
const char* label,
float(*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
ImVec2 graph_size =
ImVec2(0, 0));
642 IMGUI_API void PlotHistogram(
const char* label,
const float* values,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
ImVec2 graph_size =
ImVec2(0, 0),
int stride =
sizeof(
float));
643 IMGUI_API void PlotHistogram(
const char* label,
float(*values_getter)(
void* data,
int idx),
void* data,
int values_count,
int values_offset = 0,
const char* overlay_text = NULL,
float scale_min = FLT_MAX,
float scale_max = FLT_MAX,
ImVec2 graph_size =
ImVec2(0, 0));
650 IMGUI_API void Value(
const char* prefix,
float v,
const char* float_format = NULL);
663 IMGUI_API bool MenuItem(
const char* label,
const char* shortcut = NULL,
bool selected =
false,
bool enabled =
true);
875 IMGUI_API void CalcListClipping(
int items_count,
float items_height,
int* out_items_display_start,
int* out_items_display_end);
880 IMGUI_API ImVec2 CalcTextSize(
const char* text,
const char* text_end = NULL,
bool hide_text_after_double_hash =
false,
float wrap_width = -1.0
f);
1017 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1195 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1238 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1318 #define IMGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F" // float[3]: Standard type for colors, without alpha. User code may use this type.
1319 #define IMGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F" // float[4]: Standard type for colors. User code may use this type.
1605 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1622 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1679 #define IM_ALLOC(_SIZE) ImGui::MemAlloc(_SIZE)
1680 #define IM_FREE(_PTR) ImGui::MemFree(_PTR)
1681 #define IM_PLACEMENT_NEW(_PTR) new(ImNewWrapper(), _PTR)
1682 #define IM_NEW(_TYPE) new(ImNewWrapper(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
1697 template<
typename T>
1747 inline T*
erase(
const T* it) {
IM_ASSERT(it >=
Data && it <
Data +
Size);
const ptrdiff_t off = it -
Data; memmove(Data + off, Data + off + 1, ((
size_t)
Size - (
size_t)off - 1) *
sizeof(T));
Size--;
return Data + off; }
1748 inline T*
erase(
const T* it,
const T* it_last){
IM_ASSERT(it >=
Data && it < Data + Size && it_last > it && it_last <=
Data +
Size);
const ptrdiff_t
count = it_last - it;
const ptrdiff_t off = it -
Data; memmove(Data + off, Data + off + count, ((
size_t)
Size - (
size_t)off - count) *
sizeof(T));
Size -= (
int)count;
return Data + off; }
1751 inline bool contains(
const T&
v)
const {
const T*
data =
Data;
const T* data_end =
Data +
Size;
while (data < data_end)
if (*data++ == v)
return true;
return false; }
1753 inline const T*
find(
const T&
v)
const {
const T*
data =
Data;
const T* data_end =
Data +
Size;
while (data < data_end)
if (*data == v)
break;
else ++
data;
return data; }
1873 const char* (*GetClipboardTextFn)(
void* user_data);
2063 #define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Invalid Unicode code point (standard value).
2064 #ifdef IMGUI_USE_WCHAR32
2065 #define IM_UNICODE_CODEPOINT_MAX 0x10FFFF // Maximum Unicode code point supported by this build.
2067 #define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Maximum Unicode code point supported by this build.
2140 union {
int val_i;
float val_f;
void*
val_p; };
2215 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2216 inline ImGuiListClipper(
int items_count,
float items_height = -1.0
f) { memset(
this, 0,
sizeof(*
this)); ItemsCount = -1;
Begin(items_count, items_height); }
2221 #ifdef IMGUI_USE_BGRA_PACKED_COLOR
2222 #define IM_COL32_R_SHIFT 16
2223 #define IM_COL32_G_SHIFT 8
2224 #define IM_COL32_B_SHIFT 0
2225 #define IM_COL32_A_SHIFT 24
2226 #define IM_COL32_A_MASK 0xFF000000
2228 #define IM_COL32_R_SHIFT 0
2229 #define IM_COL32_G_SHIFT 8
2230 #define IM_COL32_B_SHIFT 16
2231 #define IM_COL32_A_SHIFT 24
2232 #define IM_COL32_A_MASK 0xFF000000
2234 #define IM_COL32(R,G,B,A) (((ImU32)(A)<<IM_COL32_A_SHIFT) | ((ImU32)(B)<<IM_COL32_B_SHIFT) | ((ImU32)(G)<<IM_COL32_G_SHIFT) | ((ImU32)(R)<<IM_COL32_R_SHIFT))
2235 #define IM_COL32_WHITE IM_COL32(255,255,255,255) // Opaque white = 0xFFFFFFFF
2236 #define IM_COL32_BLACK IM_COL32(0,0,0,255) // Opaque black
2237 #define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0) // Transparent black = 0x00000000
2257 static ImColor HSV(
float h,
float s,
float v,
float a = 1.0
f) {
float r,
g,
b;
ImGui::ColorConvertHSVtoRGB(h, s, v, r, g, b);
return ImColor(r, g, b,
a); }
2266 #ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX
2267 #define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (63)
2277 #ifndef ImDrawCallback
2285 #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1)
2309 #ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
2321 IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
2350 inline void Clear() { _Current = 0; _Count = 1; }
2423 IMGUI_API void PushClipRectFullScreen();
2444 IMGUI_API void AddCircle(
const ImVec2& center,
float radius,
ImU32 col,
int num_segments = 0,
float thickness = 1.0
f);
2445 IMGUI_API void AddCircleFilled(
const ImVec2& center,
float radius,
ImU32 col,
int num_segments = 0);
2446 IMGUI_API void AddNgon(
const ImVec2& center,
float radius,
ImU32 col,
int num_segments,
float thickness = 1.0
f);
2448 IMGUI_API void AddText(
const ImVec2& pos,
ImU32 col,
const char* text_begin,
const char* text_end = NULL);
2449 IMGUI_API void AddText(
const ImFont* font,
float font_size,
const ImVec2& pos,
ImU32 col,
const char* text_begin,
const char* text_end = NULL,
float wrap_width = 0.0
f,
const ImVec4* cpu_fine_clip_rect = NULL);
2460 IMGUI_API void AddImageQuad(
ImTextureID user_texture_id,
const ImVec2& p1,
const ImVec2& p2,
const ImVec2& p3,
const ImVec2& p4,
const ImVec2& uv1 =
ImVec2(0, 0),
const ImVec2& uv2 =
ImVec2(1, 0),
const ImVec2& uv3 =
ImVec2(1, 1),
const ImVec2& uv4 =
ImVec2(0, 1),
ImU32 col =
IM_COL32_WHITE);
2469 IMGUI_API void PathArcTo(
const ImVec2& center,
float radius,
float a_min,
float a_max,
int num_segments = 0);
2470 IMGUI_API void PathArcToFast(
const ImVec2& center,
float radius,
int a_min_of_12,
int a_max_of_12);
2472 IMGUI_API void PathBezierQuadraticCurveTo(
const ImVec2& p2,
const ImVec2& p3,
int num_segments = 0);
2493 IMGUI_API void PrimReserve(
int idx_count,
int vtx_count);
2494 IMGUI_API void PrimUnreserve(
int idx_count,
int vtx_count);
2498 inline void PrimWriteVtx(
const ImVec2& pos,
const ImVec2& uv,
ImU32 col) { _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
2502 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2503 inline void AddBezierCurve(
const ImVec2& p1,
const ImVec2& p2,
const ImVec2& p3,
const ImVec2& p4,
ImU32 col,
float thickness,
int num_segments = 0) { AddBezierCubic(p1, p2, p3, p4, col, thickness, num_segments); }
2515 IMGUI_API int _CalcCircleAutoSegmentCount(
float radius)
const;
2516 IMGUI_API void _PathArcToFastEx(
const ImVec2& center,
float radius,
int a_min_sample,
int a_max_sample,
int a_step);
2517 IMGUI_API void _PathArcToN(
const ImVec2& center,
float radius,
float a_min,
float a_max,
int num_segments);
2536 void Clear() { memset(
this, 0,
sizeof(*
this)); }
2576 unsigned int Colored : 1;
2577 unsigned int Visible : 1;
2578 unsigned int Codepoint : 30;
2592 inline bool GetBit(
size_t n)
const {
int off = (
int)(n >> 5);
ImU32 mask = 1u << (n & 31);
return (UsedChars[off] & mask) != 0; }
2595 IMGUI_API void AddText(
const char* text,
const char* text_end = NULL);
2647 IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(
const void* compressed_font_data,
int compressed_font_size,
float size_pixels,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL);
2648 IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(
const char* compressed_font_data_base85,
float size_pixels,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL);
2660 IMGUI_API void GetTexDataAsAlpha8(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2661 IMGUI_API void GetTexDataAsRGBA32(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2662 bool IsBuilt()
const {
return Fonts.Size > 0 && TexReady; }
2733 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2772 bool IsLoaded()
const {
return ContainerAtlas != NULL; }
2773 const char*
GetDebugName()
const {
return ConfigData ? ConfigData->Name :
"<unknown>"; }
2777 IMGUI_API ImVec2 CalcTextSizeA(
float size,
float max_width,
float wrap_width,
const char* text_begin,
const char* text_end = NULL,
const char** remaining = NULL)
const;
2778 IMGUI_API const char* CalcWordWrapPositionA(
float scale,
const char* text,
const char* text_end,
float wrap_width)
const;
2786 IMGUI_API void AddGlyph(
const ImFontConfig* src_cfg,
ImWchar c,
float x0,
float y0,
float x1,
float y1,
float u0,
float v0,
float u1,
float v1,
float advance_x);
2789 IMGUI_API bool IsGlyphRangeUnused(
unsigned int c_begin,
unsigned int c_last);
2833 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2849 static inline bool DragFloat(
const char* label,
float*
v,
float v_speed,
float v_min,
float v_max,
const char*
format,
float power) {
return DragScalar(label,
ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, power); }
2850 static inline bool DragFloat2(
const char* label,
float v[2],
float v_speed,
float v_min,
float v_max,
const char*
format,
float power) {
return DragScalarN(label,
ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, power); }
2851 static inline bool DragFloat3(
const char* label,
float v[3],
float v_speed,
float v_min,
float v_max,
const char*
format,
float power) {
return DragScalarN(label,
ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, power); }
2852 static inline bool DragFloat4(
const char* label,
float v[4],
float v_speed,
float v_min,
float v_max,
const char*
format,
float power) {
return DragScalarN(label,
ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, power); }
2855 static inline bool SliderFloat(
const char* label,
float*
v,
float v_min,
float v_max,
const char*
format,
float power) {
return SliderScalar(label,
ImGuiDataType_Float, v, &v_min, &v_max, format, power); }
2856 static inline bool SliderFloat2(
const char* label,
float v[2],
float v_min,
float v_max,
const char*
format,
float power) {
return SliderScalarN(label,
ImGuiDataType_Float, v, 2, &v_min, &v_max, format, power); }
2857 static inline bool SliderFloat3(
const char* label,
float v[3],
float v_min,
float v_max,
const char*
format,
float power) {
return SliderScalarN(label,
ImGuiDataType_Float, v, 3, &v_min, &v_max, format, power); }
2858 static inline bool SliderFloat4(
const char* label,
float v[4],
float v_min,
float v_max,
const char*
format,
float power) {
return SliderScalarN(label,
ImGuiDataType_Float, v, 4, &v_min, &v_max, format, power); }
2897 #endif // #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2901 #if defined(__clang__)
2902 #pragma clang diagnostic pop
2903 #elif defined(__GNUC__)
2904 #pragma GCC diagnostic pop
2908 #pragma warning (pop)
2912 #ifdef IMGUI_INCLUDE_IMGUI_USER_H
2916 #endif // #ifndef IMGUI_DISABLE