|
@@ -1,4 +1,4 @@
|
1
|
|
-// ImGui library v1.19 wip
|
|
1
|
+// ImGui library v1.20
|
2
|
2
|
// See .cpp file for commentary.
|
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.
|
|
@@ -19,6 +19,7 @@ struct ImGuiWindow;
|
19
|
19
|
#include <stdarg.h> // va_list
|
20
|
20
|
#include <stddef.h> // ptrdiff_t
|
21
|
21
|
#include <stdlib.h> // NULL, malloc
|
|
22
|
+#include <string.h> // memset, memmove
|
22
|
23
|
|
23
|
24
|
#ifndef IM_ASSERT
|
24
|
25
|
#include <assert.h>
|
|
@@ -170,8 +171,8 @@ namespace ImGui
|
170
|
171
|
|
171
|
172
|
IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
172
|
173
|
IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use positive 'offset' to access sub components of a multiple component widget.
|
173
|
|
- IMGUI_API void SetTreeStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it).
|
174
|
|
- IMGUI_API ImGuiStorage* GetTreeStateStorage();
|
|
174
|
+ IMGUI_API void SetStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it).
|
|
175
|
+ IMGUI_API ImGuiStorage* GetStateStorage();
|
175
|
176
|
|
176
|
177
|
IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case. default to ~2/3 of windows width.
|
177
|
178
|
IMGUI_API void PopItemWidth();
|
|
@@ -212,6 +213,7 @@ namespace ImGui
|
212
|
213
|
|
213
|
214
|
// ID scopes
|
214
|
215
|
// If you are creating repeated widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them.
|
|
216
|
+ // You can also use ## within your widget name to distinguish them from each others (see 'Programmer Guide')
|
215
|
217
|
IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the *entire* stack!
|
216
|
218
|
IMGUI_API void PushID(const void* ptr_id);
|
217
|
219
|
IMGUI_API void PushID(const int int_id);
|
|
@@ -240,6 +242,9 @@ namespace ImGui
|
240
|
242
|
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);
|
241
|
243
|
IMGUI_API bool SliderAngle(const char* label, float* v, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); // *v in radians
|
242
|
244
|
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
|
245
|
+ IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
|
246
|
+ IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
|
247
|
+ IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
243
|
248
|
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));
|
244
|
249
|
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));
|
245
|
250
|
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));
|
|
@@ -271,7 +276,7 @@ namespace ImGui
|
271
|
276
|
IMGUI_API void TreePop();
|
272
|
277
|
IMGUI_API void OpenNextNode(bool open); // force open/close the next TreeNode or CollapsingHeader
|
273
|
278
|
|
274
|
|
- // Value helper output "name: value". tip: freely declare your own within the ImGui namespace!
|
|
279
|
+ // Value() Helpers: output single value in "name: value" format. Tip: freely declare your own within the ImGui namespace!
|
275
|
280
|
IMGUI_API void Value(const char* prefix, bool b);
|
276
|
281
|
IMGUI_API void Value(const char* prefix, int v);
|
277
|
282
|
IMGUI_API void Value(const char* prefix, unsigned int v);
|
|
@@ -279,11 +284,13 @@ namespace ImGui
|
279
|
284
|
IMGUI_API void Color(const char* prefix, const ImVec4& v);
|
280
|
285
|
IMGUI_API void Color(const char* prefix, unsigned int v);
|
281
|
286
|
|
282
|
|
- // Logging
|
283
|
|
- IMGUI_API void LogButtons();
|
284
|
|
- IMGUI_API void LogToTTY(int max_depth = -1);
|
285
|
|
- IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL);
|
286
|
|
- IMGUI_API void LogToClipboard(int max_depth = -1);
|
|
287
|
+ // Logging: All text output from your interface are redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
|
288
|
+ IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty
|
|
289
|
+ IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file
|
|
290
|
+ IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard
|
|
291
|
+ IMGUI_API void LogFinish(); // stop logging (close file, etc.)
|
|
292
|
+ IMGUI_API void LogButtons(); // helper to display buttons for logging to tty/file/clipboard
|
|
293
|
+ IMGUI_API void LogText(const char* fmt, ...); // pass text data straight to log (without being displayed)
|
287
|
294
|
|
288
|
295
|
// Utilities
|
289
|
296
|
IMGUI_API bool IsItemHovered(); // was the last item active area hovered by mouse?
|
|
@@ -301,7 +308,7 @@ namespace ImGui
|
301
|
308
|
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
302
|
309
|
IMGUI_API float GetTime();
|
303
|
310
|
IMGUI_API int GetFrameCount();
|
304
|
|
- IMGUI_API const char* GetStyleColorName(ImGuiCol idx);
|
|
311
|
+ IMGUI_API const char* GetStyleColName(ImGuiCol idx);
|
305
|
312
|
IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
306
|
313
|
IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
307
|
314
|
|
|
@@ -380,6 +387,7 @@ enum ImGuiCol_
|
380
|
387
|
ImGuiCol_ComboBg,
|
381
|
388
|
ImGuiCol_CheckHovered,
|
382
|
389
|
ImGuiCol_CheckActive,
|
|
390
|
+ ImGuiCol_CheckMark,
|
383
|
391
|
ImGuiCol_SliderGrab,
|
384
|
392
|
ImGuiCol_SliderGrabActive,
|
385
|
393
|
ImGuiCol_Button,
|
|
@@ -417,7 +425,6 @@ enum ImGuiStyleVar_
|
417
|
425
|
ImGuiStyleVar_ItemSpacing, // ImVec2
|
418
|
426
|
ImGuiStyleVar_ItemInnerSpacing, // ImVec2
|
419
|
427
|
ImGuiStyleVar_TreeNodeSpacing, // float
|
420
|
|
- ImGuiStyleVar_ColumnsMinSpacing // float
|
421
|
428
|
};
|
422
|
429
|
|
423
|
430
|
// Enumeration for ColorEditMode()
|
|
@@ -443,13 +450,13 @@ struct ImGuiStyle
|
443
|
450
|
float Alpha; // Global alpha applies to everything in ImGui
|
444
|
451
|
ImVec2 WindowPadding; // Padding within a window
|
445
|
452
|
ImVec2 WindowMinSize; // Minimum window size
|
|
453
|
+ float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
446
|
454
|
ImVec2 FramePadding; // Padding within a framed rectangle (used by most widgets)
|
447
|
455
|
ImVec2 ItemSpacing; // Horizontal and vertical spacing between widgets/lines
|
448
|
456
|
ImVec2 ItemInnerSpacing; // Horizontal and vertical spacing between within elements of a composed widget (e.g. a slider and its label)
|
449
|
457
|
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!
|
450
|
458
|
ImVec2 AutoFitPadding; // Extra space after auto-fit (double-clicking on resize grip)
|
451
|
459
|
float WindowFillAlphaDefault; // Default alpha of window background, if not specified in ImGui::Begin()
|
452
|
|
- float WindowRounding; // Radius of window corners rounding. Set to 0.0f to have rectangular windows
|
453
|
460
|
float TreeNodeSpacing; // Horizontal spacing when entering a tree node
|
454
|
461
|
float ColumnsMinSpacing; // Minimum horizontal spacing between two columns
|
455
|
462
|
float ScrollBarWidth; // Width of the vertical scroll bar
|
|
@@ -604,6 +611,7 @@ struct ImGuiTextBuffer
|
604
|
611
|
bool empty() { return Buf.empty(); }
|
605
|
612
|
void clear() { Buf.clear(); Buf.push_back(0); }
|
606
|
613
|
IMGUI_API void append(const char* fmt, ...);
|
|
614
|
+ IMGUI_API void appendv(const char* fmt, va_list args);
|
607
|
615
|
};
|
608
|
616
|
|
609
|
617
|
// Helper: Key->value storage
|
|
@@ -679,7 +687,7 @@ struct ImDrawVert
|
679
|
687
|
ImU32 col;
|
680
|
688
|
};
|
681
|
689
|
#else
|
682
|
|
-// You can change the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT.
|
|
690
|
+// You can change the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT in imconfig.h
|
683
|
691
|
// The code expect ImVec2 pos (8 bytes), ImVec2 uv (8 bytes), ImU32 col (4 bytes), but you can re-order them or add other fields as needed to simplify integration in your engine.
|
684
|
692
|
// The type has to be described by the #define (you can either declare the struct or use a typedef)
|
685
|
693
|
IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
|
@@ -737,7 +745,7 @@ struct ImFont
|
737
|
745
|
|
738
|
746
|
// Settings
|
739
|
747
|
float Scale; // = 1.0f // Base font scale, multiplied by the per-window font scale which you can adjust with SetFontScale()
|
740
|
|
- ImVec2 DisplayOffset; // = (0.0f,0.0f // Offset font rendering by xx pixels
|
|
748
|
+ ImVec2 DisplayOffset; // = (0.0f,0.0f) // Offset font rendering by xx pixels
|
741
|
749
|
ImVec2 TexUvForWhite; // = (0.0f,0.0f) // Font texture must have a white pixel at this UV coordinate. Adjust if you are using custom texture.
|
742
|
750
|
ImWchar FallbackChar; // = '?' // Replacement glyph is one isn't found.
|
743
|
751
|
|