|
@@ -1,4 +1,4 @@
|
1
|
|
-// ImGui library v1.35
|
|
1
|
+// ImGui library v1.37 WIP
|
2
|
2
|
// See .cpp file for documentation.
|
3
|
3
|
// See ImGui::ShowTestWindow() for sample code.
|
4
|
4
|
// Read 'Programmer guide' in .cpp for notes on how to setup ImGui in your codebase.
|
|
@@ -13,6 +13,8 @@
|
13
|
13
|
#include <stdlib.h> // NULL, malloc
|
14
|
14
|
#include <string.h> // memset, memmove
|
15
|
15
|
|
|
16
|
+#define IMGUI_VERSION "1.37 WIP"
|
|
17
|
+
|
16
|
18
|
// Define assertion handler.
|
17
|
19
|
#ifndef IM_ASSERT
|
18
|
20
|
#include <assert.h>
|
|
@@ -164,7 +166,6 @@ namespace ImGui
|
164
|
166
|
IMGUI_API bool BeginChild(const char* str_id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // size==0.0f: use remaining window size, size<0.0f: use remaining window size minus abs(size). on each axis.
|
165
|
167
|
IMGUI_API bool BeginChild(ImGuiID id, const ImVec2& size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0); // "
|
166
|
168
|
IMGUI_API void EndChild();
|
167
|
|
- IMGUI_API bool GetWindowIsFocused();
|
168
|
169
|
IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries, in windows coordinates
|
169
|
170
|
IMGUI_API ImVec2 GetWindowContentRegionMin(); // window boundaries, in windows coordinates
|
170
|
171
|
IMGUI_API ImVec2 GetWindowContentRegionMax();
|
|
@@ -222,9 +223,13 @@ namespace ImGui
|
222
|
223
|
IMGUI_API void EndTooltip();
|
223
|
224
|
|
224
|
225
|
// Layout
|
|
226
|
+ IMGUI_API void BeginGroup();
|
|
227
|
+ IMGUI_API void EndGroup();
|
225
|
228
|
IMGUI_API void Separator(); // horizontal line
|
226
|
|
- IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets to layout them horizontally
|
227
|
|
- IMGUI_API void Spacing();
|
|
229
|
+ IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets or groups to layout them horizontally
|
|
230
|
+ IMGUI_API void Spacing(); // add vertical spacing
|
|
231
|
+ IMGUI_API void Indent(); // move content position toward the right by style.IndentSpacing pixels
|
|
232
|
+ IMGUI_API void Unindent(); // move content position back to the left (cancel Indent)
|
228
|
233
|
IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns
|
229
|
234
|
IMGUI_API void NextColumn(); // next column
|
230
|
235
|
IMGUI_API int GetColumnIndex(); // get current column index
|
|
@@ -282,6 +287,8 @@ namespace ImGui
|
282
|
287
|
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
283
|
288
|
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
284
|
289
|
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
|
290
|
+ 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);
|
|
291
|
+ IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
285
|
292
|
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));
|
286
|
293
|
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));
|
287
|
294
|
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));
|
|
@@ -296,6 +303,9 @@ namespace ImGui
|
296
|
303
|
IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1);
|
297
|
304
|
IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1);
|
298
|
305
|
IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
|
306
|
+ IMGUI_API bool InputInt2(const char* label, int v[2]);
|
|
307
|
+ IMGUI_API bool InputInt3(const char* label, int v[3]);
|
|
308
|
+ IMGUI_API bool InputInt4(const char* label, int v[4]);
|
299
|
309
|
IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
300
|
310
|
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
|
301
|
311
|
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);
|
|
@@ -342,22 +352,29 @@ namespace ImGui
|
342
|
352
|
|
343
|
353
|
// Utilities
|
344
|
354
|
IMGUI_API bool IsItemHovered(); // was the last item hovered by mouse?
|
|
355
|
+ IMGUI_API bool IsItemHoveredRectOnly(); // was the last item hovered by mouse? even if another item is active while we are hovering this.
|
345
|
356
|
IMGUI_API bool IsItemActive(); // was the last item active? (e.g. button being held, text field being edited- items that don't interact will always return false)
|
346
|
357
|
IMGUI_API bool IsAnyItemActive(); //
|
347
|
|
- IMGUI_API ImVec2 GetItemBoxMin(); // get bounding box of last item
|
348
|
|
- IMGUI_API ImVec2 GetItemBoxMax(); // get bounding box of last item
|
|
358
|
+ IMGUI_API ImVec2 GetItemActiveDragDelta(); // mouse delta from the time the item first got active
|
|
359
|
+ IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item
|
|
360
|
+ IMGUI_API ImVec2 GetItemRectMax(); // "
|
|
361
|
+ IMGUI_API ImVec2 GetItemRectSize(); // "
|
|
362
|
+ IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
|
363
|
+ IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
|
364
|
+ IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
349
|
365
|
IMGUI_API bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimization)
|
350
|
366
|
IMGUI_API bool IsKeyPressed(int key_index, bool repeat = true); // key_index into the keys_down[512] array, imgui doesn't know the semantic of each entry
|
351
|
367
|
IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
352
|
368
|
IMGUI_API bool IsMouseDoubleClicked(int button);
|
353
|
369
|
IMGUI_API bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window)
|
354
|
370
|
IMGUI_API bool IsMouseHoveringAnyWindow(); // is mouse hovering any active imgui window
|
355
|
|
- IMGUI_API bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is mouse hovering given bounding box
|
|
371
|
+ IMGUI_API bool IsMouseHoveringRect(const ImVec2& rect_min, const ImVec2& rect_max);// is mouse hovering given bounding rect
|
356
|
372
|
IMGUI_API bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window
|
357
|
373
|
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
358
|
374
|
IMGUI_API float GetTime();
|
359
|
375
|
IMGUI_API int GetFrameCount();
|
360
|
376
|
IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
|
377
|
+ IMGUI_API ImVec2 CalcItemRectClosestPoint(const ImVec2& pos, bool on_edge = false, float outward = +0.0f); // utility to find the closest point the last item bounding rectangle edge. useful to visually link items.
|
361
|
378
|
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
362
|
379
|
IMGUI_API void CalcListClipping(int items_count, float items_height, int* out_items_display_start, int* out_items_display_end); // helper to manually clip large list of items. see comments in implementation.
|
363
|
380
|
|
|
@@ -369,13 +386,18 @@ namespace ImGui
|
369
|
386
|
IMGUI_API void ColorConvertHSVtoRGB(float h, float s, float v, float& out_r, float& out_g, float& out_b);
|
370
|
387
|
|
371
|
388
|
// Internal state access - if you want to share ImGui state between modules (e.g. DLL) or allocate it yourself
|
|
389
|
+ IMGUI_API const char* GetVersion();
|
372
|
390
|
IMGUI_API void* GetInternalState();
|
373
|
391
|
IMGUI_API size_t GetInternalStateSize();
|
374
|
392
|
IMGUI_API void SetInternalState(void* state, bool construct = false);
|
375
|
393
|
|
376
|
394
|
// Obsolete (will be removed)
|
377
|
|
- IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
378
|
|
- static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); }
|
|
395
|
+ IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size); // OBSOLETE
|
|
396
|
+ static inline void OpenNextNode(bool open) { ImGui::SetNextTreeNodeOpened(open, 0); } // OBSOLETE
|
|
397
|
+ static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE
|
|
398
|
+ static inline ImVec2 GetItemBoxMin() { return GetItemRectMin(); } // OBSOLETE
|
|
399
|
+ static inline ImVec2 GetItemBoxMax() { return GetItemRectMax(); } // OBSOLETE
|
|
400
|
+ static inline bool IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); } // OBSOLETE
|
379
|
401
|
|
380
|
402
|
} // namespace ImGui
|
381
|
403
|
|
|
@@ -496,7 +518,8 @@ enum ImGuiStyleVar_
|
496
|
518
|
ImGuiStyleVar_FrameRounding, // float
|
497
|
519
|
ImGuiStyleVar_ItemSpacing, // ImVec2
|
498
|
520
|
ImGuiStyleVar_ItemInnerSpacing, // ImVec2
|
499
|
|
- ImGuiStyleVar_TreeNodeSpacing // float
|
|
521
|
+ ImGuiStyleVar_IndentSpacing, // float
|
|
522
|
+ ImGuiStyleVar_GrabMinSize // float
|
500
|
523
|
};
|
501
|
524
|
|
502
|
525
|
// Enumeration for ColorEditMode()
|
|
@@ -529,10 +552,10 @@ struct ImGuiStyle
|
529
|
552
|
float FrameRounding; // Radius of frame corners rounding. Set to 0.0f to have rectangular frame (used by most widgets).
|
530
|
553
|
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines
|
531
|
554
|
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
532
|
|
- ImVec2 TouchExtraPadding; // Expand bounding box for touch-based system where touch position is not accurate enough (unnecessary for mouse inputs). Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget running. So dont grow this too much!
|
|
555
|
+ ImVec2 TouchExtraPadding; // Expand reactive bounding box for touch-based system where touch position is not accurate enough. Unfortunately we don't sort widgets so priority on overlap will always be given to the first widget. So don't grow this too much!
|
533
|
556
|
ImVec2 AutoFitPadding; // Extra space after auto-fit (double-clicking on resize grip)
|
534
|
557
|
float WindowFillAlphaDefault; // Default alpha of window background, if not specified in ImGui::Begin()
|
535
|
|
- float TreeNodeSpacing; // Horizontal spacing when entering a tree node
|
|
558
|
+ float IndentSpacing; // Horizontal indentation when e.g. entering a tree node
|
536
|
559
|
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
|
537
|
560
|
float ScrollbarWidth; // Width of the vertical scrollbar
|
538
|
561
|
float GrabMinSize; // Minimum width/height of a slider or scrollbar grab
|
|
@@ -598,6 +621,7 @@ struct ImGuiIO
|
598
|
621
|
bool MouseDrawCursor; // Request ImGui to draw a mouse cursor for you (if you are on a platform without a mouse cursor).
|
599
|
622
|
bool KeyCtrl; // Keyboard modifier pressed: Control
|
600
|
623
|
bool KeyShift; // Keyboard modifier pressed: Shift
|
|
624
|
+ bool KeyAlt; // Keyboard modifier pressed: Alt
|
601
|
625
|
bool KeysDown[512]; // Keyboard keys that are pressed (in whatever storage order you naturally have access to keyboard data)
|
602
|
626
|
ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
603
|
627
|
|
|
@@ -686,7 +710,6 @@ struct ImGuiTextBuffer
|
686
|
710
|
ImVector<char> Buf;
|
687
|
711
|
|
688
|
712
|
ImGuiTextBuffer() { Buf.push_back(0); }
|
689
|
|
- ~ImGuiTextBuffer() { }
|
690
|
713
|
const char* begin() const { return &Buf.front(); }
|
691
|
714
|
const char* end() const { return &Buf.back(); } // Buf is zero-terminated, so end() will point on the zero-terminator
|
692
|
715
|
size_t size() const { return Buf.size()-1; }
|
|
@@ -839,19 +862,20 @@ struct ImDrawList
|
839
|
862
|
ImDrawList() { Clear(); }
|
840
|
863
|
IMGUI_API void Clear();
|
841
|
864
|
IMGUI_API void PushClipRect(const ImVec4& clip_rect); // Scissoring. The values are x1, y1, x2, y2.
|
|
865
|
+ IMGUI_API void PushClipRectFullScreen();
|
842
|
866
|
IMGUI_API void PopClipRect();
|
843
|
867
|
IMGUI_API void PushTextureID(const ImTextureID& texture_id);
|
844
|
868
|
IMGUI_API void PopTextureID();
|
845
|
869
|
|
846
|
870
|
// Primitives
|
847
|
|
- IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
|
871
|
+ IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness = 0.50f);
|
848
|
872
|
IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
849
|
873
|
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
850
|
874
|
IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
851
|
875
|
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
852
|
876
|
IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
853
|
877
|
IMGUI_API void AddArc(const ImVec2& center, float rad, ImU32 col, int a_min, int a_max, bool tris = false, const ImVec2& third_point_offset = ImVec2(0,0));
|
854
|
|
- IMGUI_API void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end = NULL, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL);
|
|
878
|
+ 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.0f, const ImVec2* cpu_clip_max = NULL);
|
855
|
879
|
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
|
856
|
880
|
|
857
|
881
|
// Advanced
|
|
@@ -862,7 +886,7 @@ struct ImDrawList
|
862
|
886
|
IMGUI_API void ReserveVertices(unsigned int vtx_count);
|
863
|
887
|
IMGUI_API void AddVtx(const ImVec2& pos, ImU32 col);
|
864
|
888
|
IMGUI_API void AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
|
865
|
|
- IMGUI_API void AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
|
889
|
+ IMGUI_API void AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col, float half_thickness = 0.50f);
|
866
|
890
|
IMGUI_API void UpdateClipRect();
|
867
|
891
|
IMGUI_API void UpdateTextureID();
|
868
|
892
|
};
|
|
@@ -895,7 +919,7 @@ struct ImFontAtlas
|
895
|
919
|
IMGUI_API void SetTexID(void* id) { TexID = id; }
|
896
|
920
|
|
897
|
921
|
// Helpers to retrieve list of common Unicode ranges (2 value per range, values are inclusive, zero-terminated list)
|
898
|
|
- // (Those functions could be static, aren't so simple use case doesn't have to refer to the ImFontAtlas:: type ever if in their code)
|
|
922
|
+ // (Those functions could be static but aren't so most users don't have to refer to the ImFontAtlas:: name ever if in their code; just using io.Fonts->)
|
899
|
923
|
IMGUI_API const ImWchar* GetGlyphRangesDefault(); // Basic Latin, Extended Latin
|
900
|
924
|
IMGUI_API const ImWchar* GetGlyphRangesJapanese(); // Default + Hiragana, Katakana, Half-Width, Selection of 1946 Ideographs
|
901
|
925
|
IMGUI_API const ImWchar* GetGlyphRangesChinese(); // Japanese + full set of about 21000 CJK Unified Ideographs
|