|
|
|
@ -53,10 +53,10 @@ typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
|
|
|
|
|
struct ImVec2
|
|
|
|
|
{
|
|
|
|
|
float x, y;
|
|
|
|
|
ImVec2() {}
|
|
|
|
|
ImVec2() { x = y = 0.0f; }
|
|
|
|
|
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
|
|
|
|
|
|
|
|
|
#ifdef IM_VEC2_CLASS_EXTRA
|
|
|
|
|
#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2.
|
|
|
|
|
IM_VEC2_CLASS_EXTRA
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
@ -64,10 +64,10 @@ struct ImVec2
|
|
|
|
|
struct ImVec4
|
|
|
|
|
{
|
|
|
|
|
float x, y, z, w;
|
|
|
|
|
ImVec4() {}
|
|
|
|
|
ImVec4() { x = y = z = w = 0.0f; }
|
|
|
|
|
ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }
|
|
|
|
|
|
|
|
|
|
#ifdef IM_VEC4_CLASS_EXTRA
|
|
|
|
|
#ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec4.
|
|
|
|
|
IM_VEC4_CLASS_EXTRA
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
@ -147,7 +147,7 @@ public:
|
|
|
|
|
// - struct ImFont // TTF font loader, bake glyphs into bitmap
|
|
|
|
|
|
|
|
|
|
// ImGui end-user API
|
|
|
|
|
// In a namespace so that user can add extra functions (e.g. Value() helpers for your vector or common types)
|
|
|
|
|
// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
|
|
|
|
namespace ImGui
|
|
|
|
|
{
|
|
|
|
|
// Main
|
|
|
|
@ -156,9 +156,10 @@ namespace ImGui
|
|
|
|
|
IMGUI_API void NewFrame();
|
|
|
|
|
IMGUI_API void Render();
|
|
|
|
|
IMGUI_API void Shutdown();
|
|
|
|
|
IMGUI_API void ShowUserGuide();
|
|
|
|
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL);
|
|
|
|
|
IMGUI_API void ShowTestWindow(bool* open = NULL);
|
|
|
|
|
IMGUI_API void ShowUserGuide(); // help block
|
|
|
|
|
IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block
|
|
|
|
|
IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features
|
|
|
|
|
IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window
|
|
|
|
|
|
|
|
|
|
// Window
|
|
|
|
|
// See implementation in .cpp for details
|
|
|
|
@ -191,7 +192,7 @@ namespace ImGui
|
|
|
|
|
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing
|
|
|
|
|
IMGUI_API void SetWindowSize(const char* name, const ImVec2& size, ImGuiSetCond cond = 0); // set named window size. set to ImVec2(0,0) to force an auto-fit. may incur tearing
|
|
|
|
|
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state
|
|
|
|
|
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most
|
|
|
|
|
IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus.
|
|
|
|
|
|
|
|
|
|
IMGUI_API float GetScrollPosY(); // get scrolling position [0..GetScrollMaxY()]
|
|
|
|
|
IMGUI_API float GetScrollMaxY(); // get maximum scrolling position == ContentSize.Y - WindowSize.Y
|
|
|
|
@ -284,25 +285,41 @@ namespace ImGui
|
|
|
|
|
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));
|
|
|
|
|
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,1), const ImVec4& tint_col = ImVec4(1,1,1,1)); // <0 frame_padding uses default frame padding settings. 0 for no padding
|
|
|
|
|
IMGUI_API bool CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false);
|
|
|
|
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
|
|
|
|
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
|
|
|
|
IMGUI_API bool RadioButton(const char* label, bool active);
|
|
|
|
|
IMGUI_API bool RadioButton(const char* label, int* v, int v_button);
|
|
|
|
|
IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
|
|
|
|
IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1); // separate items with \0, end item-list with \0\0
|
|
|
|
|
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 height_in_items = -1);
|
|
|
|
|
IMGUI_API bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
|
|
|
|
|
IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
|
|
|
|
IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
|
|
|
|
IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
|
|
|
|
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), size_t stride = sizeof(float));
|
|
|
|
|
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));
|
|
|
|
|
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), size_t stride = sizeof(float));
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
// Widgets: Sliders (tip: ctrl+click on a slider to input text)
|
|
|
|
|
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f); // adjust display_format to decorate the value with a prefix or a suffix. Use power!=1.0 for logarithmic sliders
|
|
|
|
|
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
|
|
|
|
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
|
|
|
|
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
|
|
|
|
IMGUI_API bool SliderAngle(const char* label, float* v, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); // *v in radians
|
|
|
|
|
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
|
|
|
|
|
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
|
|
|
|
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
|
|
|
|
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
|
|
|
|
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
|
|
|
|
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
|
|
|
|
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
|
|
|
|
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), size_t stride = sizeof(float));
|
|
|
|
|
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));
|
|
|
|
|
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), size_t stride = sizeof(float));
|
|
|
|
|
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));
|
|
|
|
|
IMGUI_API bool Checkbox(const char* label, bool* v);
|
|
|
|
|
IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
|
|
|
|
IMGUI_API bool RadioButton(const char* label, bool active);
|
|
|
|
|
IMGUI_API bool RadioButton(const char* label, int* v, int v_button);
|
|
|
|
|
|
|
|
|
|
// Widgets: Drags (tip: ctrl+click on a drag box to input text)
|
|
|
|
|
// ImGui 1.38+ work-in-progress, may change name or API.
|
|
|
|
|
IMGUI_API bool DragFloat(const char* label, float* v, float v_step = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f"); // If v_max >= v_max we have no bound
|
|
|
|
|
IMGUI_API bool DragInt(const char* label, int* v, int v_step = 1, int v_min = 0.0f, int v_max = 0.0f, const char* display_format = "%.0f"); // If v_max >= v_max we have no bound
|
|
|
|
|
|
|
|
|
|
// Widgets: Input
|
|
|
|
|
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
|
|
|
|
IMGUI_API bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
|
|
|
|
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
|
|
|
|
@ -312,15 +329,8 @@ namespace ImGui
|
|
|
|
|
IMGUI_API bool InputInt2(const char* label, int v[2]);
|
|
|
|
|
IMGUI_API bool InputInt3(const char* label, int v[3]);
|
|
|
|
|
IMGUI_API bool InputInt4(const char* label, int v[4]);
|
|
|
|
|
IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
|
|
|
|
IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int height_in_items = -1); // separate items with \0, end item-list with \0\0
|
|
|
|
|
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 height_in_items = -1);
|
|
|
|
|
IMGUI_API bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
|
|
|
|
|
IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
|
|
|
|
IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
|
|
|
|
IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
|
|
|
|
|
|
|
|
|
// Trees
|
|
|
|
|
// Widgets: Trees
|
|
|
|
|
IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop
|
|
|
|
|
IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...); // "
|
|
|
|
|
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...); // "
|
|
|
|
@ -331,7 +341,7 @@ namespace ImGui
|
|
|
|
|
IMGUI_API void TreePop();
|
|
|
|
|
IMGUI_API void SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond = 0); // set next tree node to be opened.
|
|
|
|
|
|
|
|
|
|
// Selectable / Lists
|
|
|
|
|
// Widgets: Selectable / Lists
|
|
|
|
|
IMGUI_API bool Selectable(const char* label, bool selected = false, const ImVec2& size = ImVec2(0,0));
|
|
|
|
|
IMGUI_API bool Selectable(const char* label, bool* p_selected, const ImVec2& size = ImVec2(0,0));
|
|
|
|
|
IMGUI_API bool ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
|
|
|
@ -340,7 +350,7 @@ namespace ImGui
|
|
|
|
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
|
|
|
|
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
|
|
|
|
|
|
|
|
|
// Value() Helpers: output single value in "name: value" format. Tip: freely declare your own within the ImGui namespace!
|
|
|
|
|
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
|
|
|
|
|
IMGUI_API void Value(const char* prefix, bool b);
|
|
|
|
|
IMGUI_API void Value(const char* prefix, int v);
|
|
|
|
|
IMGUI_API void Value(const char* prefix, unsigned int v);
|
|
|
|
@ -348,7 +358,7 @@ namespace ImGui
|
|
|
|
|
IMGUI_API void Color(const char* prefix, const ImVec4& v);
|
|
|
|
|
IMGUI_API void Color(const char* prefix, unsigned int v);
|
|
|
|
|
|
|
|
|
|
// Logging: All text output from your interface are redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
|
|
|
|
// Logging: all text output from interface is redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
|
|
|
|
IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty
|
|
|
|
|
IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file
|
|
|
|
|
IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard
|
|
|
|
@ -480,6 +490,8 @@ enum ImGuiCol_
|
|
|
|
|
ImGuiCol_Border,
|
|
|
|
|
ImGuiCol_BorderShadow,
|
|
|
|
|
ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input
|
|
|
|
|
ImGuiCol_FrameBgHovered,
|
|
|
|
|
ImGuiCol_FrameBgActive,
|
|
|
|
|
ImGuiCol_TitleBg,
|
|
|
|
|
ImGuiCol_TitleBgCollapsed,
|
|
|
|
|
ImGuiCol_ScrollbarBg,
|
|
|
|
@ -487,8 +499,6 @@ enum ImGuiCol_
|
|
|
|
|
ImGuiCol_ScrollbarGrabHovered,
|
|
|
|
|
ImGuiCol_ScrollbarGrabActive,
|
|
|
|
|
ImGuiCol_ComboBg,
|
|
|
|
|
ImGuiCol_CheckHovered,
|
|
|
|
|
ImGuiCol_CheckActive,
|
|
|
|
|
ImGuiCol_CheckMark,
|
|
|
|
|
ImGuiCol_SliderGrab,
|
|
|
|
|
ImGuiCol_SliderGrabActive,
|
|
|
|
@ -546,12 +556,12 @@ enum ImGuiColorEditMode_
|
|
|
|
|
enum ImGuiMouseCursor_
|
|
|
|
|
{
|
|
|
|
|
ImGuiMouseCursor_Arrow = 0,
|
|
|
|
|
ImGuiMouseCursor_TextInput,
|
|
|
|
|
ImGuiMouseCursor_Move, // Unused by ImGui
|
|
|
|
|
ImGuiMouseCursor_ResizeNS, // Unused by ImGui
|
|
|
|
|
ImGuiMouseCursor_ResizeEW, // Unused by ImGui
|
|
|
|
|
ImGuiMouseCursor_ResizeNESW, // Unused by ImGui
|
|
|
|
|
ImGuiMouseCursor_ResizeNWSE,
|
|
|
|
|
ImGuiMouseCursor_TextInput, // When hovering over InputText, etc.
|
|
|
|
|
ImGuiMouseCursor_Move, // Unused
|
|
|
|
|
ImGuiMouseCursor_ResizeNS, // Unused
|
|
|
|
|
ImGuiMouseCursor_ResizeEW, // When hovering over a column
|
|
|
|
|
ImGuiMouseCursor_ResizeNESW, // Unused
|
|
|
|
|
ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
|
|
|
|
|
ImGuiMouseCursor_Count_
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -660,6 +670,7 @@ struct ImGuiIO
|
|
|
|
|
bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
|
|
|
|
|
bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input)
|
|
|
|
|
float Framerate; // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames
|
|
|
|
|
int MetricsVertices; // Vertices processed during last call to Render()
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
|
// [Internal] ImGui will maintain those fields for you
|
|
|
|
@ -873,6 +884,7 @@ IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
|
|
|
|
// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future.
|
|
|
|
|
// If you want to add custom rendering within a window, you can use ImGui::GetWindowDrawList() to access the current draw list and add your own primitives.
|
|
|
|
|
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
|
|
|
|
|
// All positions are in screen coordinates (0,0=top-left, 1 pixel per unit). Primitives are always added to the list and not culled (culling is done at render time and at a higher-level by ImGui:: functions).
|
|
|
|
|
// Note that this only gives you access to rendering polygons. If your intent is to create custom widgets and the publicly exposed functions/data aren't sufficient, you can add code in imgui_user.inl
|
|
|
|
|
struct ImDrawList
|
|
|
|
|
{
|
|
|
|
@ -1008,7 +1020,7 @@ struct ImFont
|
|
|
|
|
|
|
|
|
|
// Methods
|
|
|
|
|
IMGUI_API ImFont();
|
|
|
|
|
IMGUI_API ~ImFont() { Clear(); }
|
|
|
|
|
IMGUI_API ~ImFont();
|
|
|
|
|
IMGUI_API void Clear();
|
|
|
|
|
IMGUI_API void BuildLookupTable();
|
|
|
|
|
IMGUI_API const Glyph* FindGlyph(unsigned short c) const;
|
|
|
|
|