34 #ifdef IMGUI_USER_CONFIG
35 #include IMGUI_USER_CONFIG
37 #if !defined(IMGUI_DISABLE_INCLUDE_IMCONFIG_H) || defined(IMGUI_INCLUDE_IMCONFIG_H)
53 #define IMGUI_VERSION "1.74"
54 #define IMGUI_VERSION_NUM 17400
55 #define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert), sizeof(ImDrawIdx))
63 #ifndef IMGUI_IMPL_API
64 #define IMGUI_IMPL_API IMGUI_API
70 #define IM_ASSERT(_EXPR) assert(_EXPR) // You can override the default assert handler by editing imconfig.h
72 #if defined(__clang__) || defined(__GNUC__)
73 #define IM_FMTARGS(FMT) __attribute__((format(printf, FMT, FMT+1))) // To apply printf-style warnings to our functions.
74 #define IM_FMTLIST(FMT) __attribute__((format(printf, FMT, 0)))
76 #define IM_FMTARGS(FMT)
77 #define IM_FMTLIST(FMT)
79 #define IM_ARRAYSIZE(_ARR) ((int)(sizeof(_ARR) / sizeof(*_ARR))) // Size of a static C-style array. Don't use on pointers!
80 #define IM_UNUSED(_VAR) ((void)_VAR) // Used to silence "unused variable warnings". Often useful as asserts may be stripped out from final builds.
81 #if (__cplusplus >= 201100)
82 #define IM_OFFSETOF(_TYPE,_MEMBER) offsetof(_TYPE, _MEMBER) // Offset of _MEMBER within _TYPE. Standardized as offsetof() in C++11
84 #define IM_OFFSETOF(_TYPE,_MEMBER) ((size_t)&(((_TYPE*)0)->_MEMBER)) // Offset of _MEMBER within _TYPE. Old style macro.
86 #define IM_UNICODE_CODEPOINT_MAX 0xFFFF // Last Unicode code point supported by this build.
87 #define IM_UNICODE_CODEPOINT_INVALID 0xFFFD // Standard invalid Unicode code point.
90 #if defined(__clang__)
91 #pragma clang diagnostic push
92 #pragma clang diagnostic ignored "-Wold-style-cast"
93 #if __has_warning("-Wzero-as-null-pointer-constant")
94 #pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
96 #elif defined(__GNUC__)
97 #pragma GCC diagnostic push
98 #pragma GCC diagnostic ignored "-Wpragmas" // warning: unknown option after '#pragma GCC diagnostic' kind
99 #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
172 #if defined(_MSC_VER) && !defined(__clang__)
173 typedef signed __int64
ImS64;
174 typedef unsigned __int64
ImU64;
175 #elif (defined(__clang__) || defined(__GNUC__)) && (__cplusplus < 201100)
192 #ifdef IM_VEC2_CLASS_EXTRA
202 ImVec4(
float _x,
float _y,
float _z,
float _w) {
x = _x;
y = _y;
z = _z;
w = _w; }
203 #ifdef IM_VEC4_CLASS_EXTRA
385 IMGUI_API void PushID(
const char* str_id_begin,
const char* str_id_end);
415 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));
416 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));
429 IMGUI_API bool Combo(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int popup_max_height_in_items = -1);
430 IMGUI_API bool Combo(
const char* label,
int* current_item,
const char* items_separated_by_zeros,
int popup_max_height_in_items = -1);
431 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);
440 IMGUI_API bool DragFloat(
const char* label,
float* v,
float v_speed = 1.0
f,
float v_min = 0.0
f,
float v_max = 0.0
f,
const char*
format =
"%.3f",
float power = 1.0
f);
441 IMGUI_API bool DragFloat2(
const char* label,
float v[2],
float v_speed = 1.0
f,
float v_min = 0.0
f,
float v_max = 0.0
f,
const char*
format =
"%.3f",
float power = 1.0
f);
442 IMGUI_API bool DragFloat3(
const char* label,
float v[3],
float v_speed = 1.0
f,
float v_min = 0.0
f,
float v_max = 0.0
f,
const char*
format =
"%.3f",
float power = 1.0
f);
443 IMGUI_API bool DragFloat4(
const char* label,
float v[4],
float v_speed = 1.0
f,
float v_min = 0.0
f,
float v_max = 0.0
f,
const char*
format =
"%.3f",
float power = 1.0
f);
444 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,
float power = 1.0
f);
445 IMGUI_API bool DragInt(
const char* label,
int* v,
float v_speed = 1.0
f,
int v_min = 0,
int v_max = 0,
const char*
format =
"%d");
446 IMGUI_API bool DragInt2(
const char* label,
int v[2],
float v_speed = 1.0
f,
int v_min = 0,
int v_max = 0,
const char*
format =
"%d");
447 IMGUI_API bool DragInt3(
const char* label,
int v[3],
float v_speed = 1.0
f,
int v_min = 0,
int v_max = 0,
const char*
format =
"%d");
448 IMGUI_API bool DragInt4(
const char* label,
int v[4],
float v_speed = 1.0
f,
int v_min = 0,
int v_max = 0,
const char*
format =
"%d");
449 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);
460 IMGUI_API bool SliderAngle(
const char* label,
float* v_rad,
float v_degrees_min = -360.0
f,
float v_degrees_max = +360.0
f,
const char*
format =
"%.0f deg");
527 IMGUI_API bool ListBox(
const char* label,
int* current_item,
const char*
const items[],
int items_count,
int height_in_items = -1);
528 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);
534 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));
535 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));
536 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));
537 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));
544 IMGUI_API void Value(
const char* prefix,
float v,
const char* float_format = NULL);
555 IMGUI_API bool MenuItem(
const char* label,
const char* shortcut = NULL,
bool selected =
false,
bool enabled =
true);
664 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);
665 IMGUI_API void CalcListClipping(
int items_count,
float items_height,
int* out_items_display_start,
int* out_items_display_end);
713 IMGUI_API void SetAllocatorFunctions(
void* (*alloc_func)(
size_t sz,
void* user_data),
void (*free_func)(
void* ptr,
void* user_data),
void* user_data = NULL);
814 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
917 #define IMGUI_PAYLOAD_TYPE_COLOR_3F "_COL3F" // float[3]: Standard type for colors, without alpha. User code may use this type.
918 #define IMGUI_PAYLOAD_TYPE_COLOR_4F "_COL4F" // float[4]: Standard type for colors. User code may use this type.
1090 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1130 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1176 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1197 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1221 inline void*
operator new(size_t,
ImNewDummy,
void* ptr) {
return ptr; }
1223 #define IM_ALLOC(_SIZE) ImGui::MemAlloc(_SIZE)
1224 #define IM_FREE(_PTR) ImGui::MemFree(_PTR)
1225 #define IM_PLACEMENT_NEW(_PTR) new(ImNewDummy(), _PTR)
1226 #define IM_NEW(_TYPE) new(ImNewDummy(), ImGui::MemAlloc(sizeof(_TYPE))) _TYPE
1240 template<
typename T>
1286 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; }
1287 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; }
1290 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; }
1292 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; }
1402 const char* (*GetClipboardTextFn)(
void* user_data);
1411 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1417 void* RenderDrawListsFnUnused;
1563 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
1672 union {
int val_i;
float val_f;
void*
val_p; };
1726 int ItemsCount,
StepNo, DisplayStart, DisplayEnd;
1740 #ifdef IMGUI_USE_BGRA_PACKED_COLOR
1741 #define IM_COL32_R_SHIFT 16
1742 #define IM_COL32_G_SHIFT 8
1743 #define IM_COL32_B_SHIFT 0
1744 #define IM_COL32_A_SHIFT 24
1745 #define IM_COL32_A_MASK 0xFF000000
1747 #define IM_COL32_R_SHIFT 0
1748 #define IM_COL32_G_SHIFT 8
1749 #define IM_COL32_B_SHIFT 16
1750 #define IM_COL32_A_SHIFT 24
1751 #define IM_COL32_A_MASK 0xFF000000
1753 #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))
1754 #define IM_COL32_WHITE IM_COL32(255,255,255,255) // Opaque white = 0xFFFFFFFF
1755 #define IM_COL32_BLACK IM_COL32(0,0,0,255) // Opaque black
1756 #define IM_COL32_BLACK_TRANS IM_COL32(0,0,0,0) // Transparent black = 0x00000000
1776 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); }
1791 #ifndef ImDrawCallback
1799 #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-1)
1814 ImDrawCmd() { ElemCount = 0; TextureId = (
ImTextureID)NULL; VtxOffset = IdxOffset = 0; UserCallback = NULL; UserCallbackData = NULL; }
1825 #ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
1837 IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
1857 inline void Clear() { _Current = 0; _Count = 1; }
1918 IMGUI_API void PushClipRectFullScreen();
1935 IMGUI_API void AddCircle(
const ImVec2& center,
float radius,
ImU32 col,
int num_segments = 12,
float thickness = 1.0
f);
1936 IMGUI_API void AddCircleFilled(
const ImVec2& center,
float radius,
ImU32 col,
int num_segments = 12);
1937 IMGUI_API void AddText(
const ImVec2& pos,
ImU32 col,
const char* text_begin,
const char* text_end = NULL);
1938 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);
1948 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);
1956 inline void PathStroke(
ImU32 col,
bool closed,
float thickness = 1.0
f) { AddPolyline(_Path.Data, _Path.Size, col, closed, thickness); _Path.Size = 0; }
1957 IMGUI_API void PathArcTo(
const ImVec2& center,
float radius,
float a_min,
float a_max,
int num_segments = 10);
1958 IMGUI_API void PathArcToFast(
const ImVec2& center,
float radius,
int a_min_of_12,
int a_max_of_12);
1978 IMGUI_API void PrimReserve(
int idx_count,
int vtx_count);
1982 inline void PrimWriteVtx(
const ImVec2& pos,
const ImVec2& uv,
ImU32 col){ _VtxWritePtr->pos = pos; _VtxWritePtr->uv = uv; _VtxWritePtr->col = col; _VtxWritePtr++; _VtxCurrentIdx++; }
2006 void Clear() { Valid =
false; CmdLists = NULL; CmdListsCount = TotalVtxCount = TotalIdxCount = 0; DisplayPos = DisplaySize = FramebufferScale =
ImVec2(0.
f, 0.
f); }
2058 inline bool GetBit(
int n)
const {
int off = (n >> 5);
ImU32 mask = 1u << (n & 31);
return (UsedChars[off] & mask) != 0; }
2061 IMGUI_API void AddText(
const char* text,
const char* text_end = NULL);
2111 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);
2112 IMGUI_API ImFont* AddFontFromMemoryCompressedBase85TTF(
const char* compressed_font_data_base85,
float size_pixels,
const ImFontConfig* font_cfg = NULL,
const ImWchar* glyph_ranges = NULL);
2124 IMGUI_API void GetTexDataAsAlpha8(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2125 IMGUI_API void GetTexDataAsRGBA32(
unsigned char** out_pixels,
int* out_width,
int* out_height,
int* out_bytes_per_pixel = NULL);
2126 bool IsBuilt()
const {
return Fonts.Size > 0 && (TexPixelsAlpha8 != NULL || TexPixelsRGBA32 != NULL); }
2183 int CustomRectIds[1];
2185 #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2223 bool IsLoaded()
const {
return ContainerAtlas != NULL; }
2224 const char*
GetDebugName()
const {
return ConfigData ? ConfigData->Name :
"<unknown>"; }
2228 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;
2229 IMGUI_API const char* CalcWordWrapPositionA(
float scale,
const char* text,
const char* text_end,
float wrap_width)
const;
2242 #if defined(__clang__)
2243 #pragma clang diagnostic pop
2244 #elif defined(__GNUC__)
2245 #pragma GCC diagnostic pop
2249 #ifdef IMGUI_INCLUDE_IMGUI_USER_H