|
@@ -1,4 +1,4 @@
|
1
|
|
-// ImGui library v1.37
|
|
1
|
+// ImGui library v1.38 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,7 +13,7 @@
|
13
|
13
|
#include <stdlib.h> // NULL, malloc, free, qsort, atoi
|
14
|
14
|
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
15
|
15
|
|
16
|
|
-#define IMGUI_VERSION "1.37"
|
|
16
|
+#define IMGUI_VERSION "1.38 WIP"
|
17
|
17
|
|
18
|
18
|
// Define assertion handler.
|
19
|
19
|
#ifndef IM_ASSERT
|
|
@@ -53,10 +53,10 @@ typedef int (*ImGuiTextEditCallback)(ImGuiTextEditCallbackData *data);
|
53
|
53
|
struct ImVec2
|
54
|
54
|
{
|
55
|
55
|
float x, y;
|
56
|
|
- ImVec2() {}
|
|
56
|
+ ImVec2() { x = y = 0.0f; }
|
57
|
57
|
ImVec2(float _x, float _y) { x = _x; y = _y; }
|
58
|
58
|
|
59
|
|
-#ifdef IM_VEC2_CLASS_EXTRA
|
|
59
|
+#ifdef IM_VEC2_CLASS_EXTRA // Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2.
|
60
|
60
|
IM_VEC2_CLASS_EXTRA
|
61
|
61
|
#endif
|
62
|
62
|
};
|
|
@@ -64,10 +64,10 @@ struct ImVec2
|
64
|
64
|
struct ImVec4
|
65
|
65
|
{
|
66
|
66
|
float x, y, z, w;
|
67
|
|
- ImVec4() {}
|
|
67
|
+ ImVec4() { x = y = z = w = 0.0f; }
|
68
|
68
|
ImVec4(float _x, float _y, float _z, float _w) { x = _x; y = _y; z = _z; w = _w; }
|
69
|
69
|
|
70
|
|
-#ifdef IM_VEC4_CLASS_EXTRA
|
|
70
|
+#ifdef IM_VEC4_CLASS_EXTRA // Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec4.
|
71
|
71
|
IM_VEC4_CLASS_EXTRA
|
72
|
72
|
#endif
|
73
|
73
|
};
|
|
@@ -147,7 +147,7 @@ public:
|
147
|
147
|
// - struct ImFont // TTF font loader, bake glyphs into bitmap
|
148
|
148
|
|
149
|
149
|
// ImGui end-user API
|
150
|
|
-// In a namespace so that user can add extra functions (e.g. Value() helpers for your vector or common types)
|
|
150
|
+// In a namespace so that user can add extra functions in a separate file (e.g. Value() helpers for your vector or common types)
|
151
|
151
|
namespace ImGui
|
152
|
152
|
{
|
153
|
153
|
// Main
|
|
@@ -156,9 +156,10 @@ namespace ImGui
|
156
|
156
|
IMGUI_API void NewFrame();
|
157
|
157
|
IMGUI_API void Render();
|
158
|
158
|
IMGUI_API void Shutdown();
|
159
|
|
- IMGUI_API void ShowUserGuide();
|
160
|
|
- IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL);
|
161
|
|
- IMGUI_API void ShowTestWindow(bool* open = NULL);
|
|
159
|
+ IMGUI_API void ShowUserGuide(); // help block
|
|
160
|
+ IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL); // style editor block
|
|
161
|
+ IMGUI_API void ShowTestWindow(bool* opened = NULL); // test window, demonstrate ImGui features
|
|
162
|
+ IMGUI_API void ShowMetricsWindow(bool* opened = NULL); // metrics window
|
162
|
163
|
|
163
|
164
|
// Window
|
164
|
165
|
// See implementation in .cpp for details
|
|
@@ -191,7 +192,7 @@ namespace ImGui
|
191
|
192
|
IMGUI_API void SetWindowPos(const char* name, const ImVec2& pos, ImGuiSetCond cond = 0); // set named window position - call within Begin()/End(). may incur tearing
|
192
|
193
|
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
|
193
|
194
|
IMGUI_API void SetWindowCollapsed(const char* name, bool collapsed, ImGuiSetCond cond = 0); // set named window collapsed state
|
194
|
|
- IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most
|
|
195
|
+ IMGUI_API void SetWindowFocus(const char* name); // set named window to be focused / front-most. use NULL to remove focus.
|
195
|
196
|
|
196
|
197
|
IMGUI_API float GetScrollPosY(); // get scrolling position [0..GetScrollMaxY()]
|
197
|
198
|
IMGUI_API float GetScrollMaxY(); // get maximum scrolling position == ContentSize.Y - WindowSize.Y
|
|
@@ -259,10 +260,12 @@ namespace ImGui
|
259
|
260
|
// If you are creating widgets in a loop you most likely want to push a unique identifier so ImGui can differentiate them
|
260
|
261
|
// You can also use "##extra" within your widget name to distinguish them from each others (see 'Programmer Guide')
|
261
|
262
|
IMGUI_API void PushID(const char* str_id); // push identifier into the ID stack. IDs are hash of the *entire* stack!
|
|
263
|
+ IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end);
|
262
|
264
|
IMGUI_API void PushID(const void* ptr_id);
|
263
|
265
|
IMGUI_API void PushID(const int int_id);
|
264
|
266
|
IMGUI_API void PopID();
|
265
|
267
|
IMGUI_API ImGuiID GetID(const char* str_id); // calculate unique ID (hash of whole ID stack + given parameter). useful if you want to query into ImGuiStorage yourself. otherwise rarely needed
|
|
268
|
+ IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end);
|
266
|
269
|
IMGUI_API ImGuiID GetID(const void* ptr_id);
|
267
|
270
|
|
268
|
271
|
// Widgets
|
|
@@ -284,25 +287,41 @@ namespace ImGui
|
284
|
287
|
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));
|
285
|
288
|
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
|
286
|
289
|
IMGUI_API bool CollapsingHeader(const char* label, const char* str_id = NULL, bool display_frame = true, bool default_open = false);
|
|
290
|
+ IMGUI_API bool Checkbox(const char* label, bool* v);
|
|
291
|
+ IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
|
292
|
+ IMGUI_API bool RadioButton(const char* label, bool active);
|
|
293
|
+ IMGUI_API bool RadioButton(const char* label, int* v, int v_button);
|
|
294
|
+ IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
|
295
|
+ 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
|
|
296
|
+ 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);
|
|
297
|
+ IMGUI_API bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
|
|
298
|
+ IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
|
299
|
+ IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
|
300
|
+ IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
|
301
|
+ 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));
|
|
302
|
+ 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));
|
|
303
|
+ 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));
|
|
304
|
+ 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));
|
|
305
|
+
|
|
306
|
+ // Widgets: Sliders (tip: ctrl+click on a slider to input text)
|
287
|
307
|
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
|
288
|
308
|
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);
|
289
|
309
|
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);
|
290
|
310
|
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);
|
291
|
|
- IMGUI_API bool SliderAngle(const char* label, float* v, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); // *v in radians
|
|
311
|
+ IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
|
292
|
312
|
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
293
|
313
|
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
294
|
314
|
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
295
|
315
|
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
296
|
316
|
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);
|
297
|
317
|
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
298
|
|
- 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));
|
299
|
|
- 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));
|
300
|
|
- 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));
|
301
|
|
- 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));
|
302
|
|
- IMGUI_API bool Checkbox(const char* label, bool* v);
|
303
|
|
- IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
304
|
|
- IMGUI_API bool RadioButton(const char* label, bool active);
|
305
|
|
- IMGUI_API bool RadioButton(const char* label, int* v, int v_button);
|
|
318
|
+
|
|
319
|
+ // Widgets: Drags (tip: ctrl+click on a drag box to input text)
|
|
320
|
+ // ImGui 1.38+ work-in-progress, may change name or API.
|
|
321
|
+ IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_max >= v_max we have no bound
|
|
322
|
+ IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_max >= v_max we have no bound
|
|
323
|
+
|
|
324
|
+ // Widgets: Input
|
306
|
325
|
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
307
|
326
|
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);
|
308
|
327
|
IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
|
|
@@ -312,15 +331,8 @@ namespace ImGui
|
312
|
331
|
IMGUI_API bool InputInt2(const char* label, int v[2]);
|
313
|
332
|
IMGUI_API bool InputInt3(const char* label, int v[3]);
|
314
|
333
|
IMGUI_API bool InputInt4(const char* label, int v[4]);
|
315
|
|
- IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
316
|
|
- 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
|
317
|
|
- 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);
|
318
|
|
- IMGUI_API bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
|
319
|
|
- IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
320
|
|
- IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
321
|
|
- IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
322
|
334
|
|
323
|
|
- // Trees
|
|
335
|
+ // Widgets: Trees
|
324
|
336
|
IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop
|
325
|
337
|
IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...); // "
|
326
|
338
|
IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...); // "
|
|
@@ -331,7 +343,7 @@ namespace ImGui
|
331
|
343
|
IMGUI_API void TreePop();
|
332
|
344
|
IMGUI_API void SetNextTreeNodeOpened(bool opened, ImGuiSetCond cond = 0); // set next tree node to be opened.
|
333
|
345
|
|
334
|
|
- // Selectable / Lists
|
|
346
|
+ // Widgets: Selectable / Lists
|
335
|
347
|
IMGUI_API bool Selectable(const char* label, bool selected = false, const ImVec2& size = ImVec2(0,0));
|
336
|
348
|
IMGUI_API bool Selectable(const char* label, bool* p_selected, const ImVec2& size = ImVec2(0,0));
|
337
|
349
|
IMGUI_API bool ListBox(const char* label, int* current_item, const char** items, int items_count, int height_in_items = -1);
|
|
@@ -340,7 +352,7 @@ namespace ImGui
|
340
|
352
|
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
341
|
353
|
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
342
|
354
|
|
343
|
|
- // Value() Helpers: output single value in "name: value" format. Tip: freely declare your own within the ImGui namespace!
|
|
355
|
+ // Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare your own within the ImGui namespace!)
|
344
|
356
|
IMGUI_API void Value(const char* prefix, bool b);
|
345
|
357
|
IMGUI_API void Value(const char* prefix, int v);
|
346
|
358
|
IMGUI_API void Value(const char* prefix, unsigned int v);
|
|
@@ -348,7 +360,7 @@ namespace ImGui
|
348
|
360
|
IMGUI_API void Color(const char* prefix, const ImVec4& v);
|
349
|
361
|
IMGUI_API void Color(const char* prefix, unsigned int v);
|
350
|
362
|
|
351
|
|
- // Logging: All text output from your interface are redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
|
363
|
+ // Logging: all text output from interface is redirected to tty/file/clipboard. Tree nodes are automatically opened.
|
352
|
364
|
IMGUI_API void LogToTTY(int max_depth = -1); // start logging to tty
|
353
|
365
|
IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL); // start logging to file
|
354
|
366
|
IMGUI_API void LogToClipboard(int max_depth = -1); // start logging to OS clipboard
|
|
@@ -361,13 +373,14 @@ namespace ImGui
|
361
|
373
|
IMGUI_API bool IsItemHoveredRect(); // was the last item hovered by mouse? even if another item is active while we are hovering this
|
362
|
374
|
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)
|
363
|
375
|
IMGUI_API bool IsAnyItemActive(); //
|
364
|
|
- IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item
|
|
376
|
+ IMGUI_API bool IsItemVisible();
|
|
377
|
+ IMGUI_API ImVec2 GetItemRectMin(); // get bounding rect of last item in screen space
|
365
|
378
|
IMGUI_API ImVec2 GetItemRectMax(); // "
|
366
|
379
|
IMGUI_API ImVec2 GetItemRectSize(); // "
|
367
|
380
|
IMGUI_API bool IsWindowFocused(); // is current window focused (differentiate child windows from each others)
|
368
|
381
|
IMGUI_API bool IsRootWindowFocused(); // is current root window focused
|
369
|
382
|
IMGUI_API bool IsRootWindowOrAnyChildFocused(); // is current root window or any of its child (including current window) focused
|
370
|
|
- IMGUI_API bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimization)
|
|
383
|
+ IMGUI_API bool IsRectClipped(const ImVec2& size); // test if rectangle of given size starting from cursor pos is out of clipping region. to perform coarse clipping on user's side (as an optimization)
|
371
|
384
|
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
|
372
|
385
|
IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
373
|
386
|
IMGUI_API bool IsMouseDoubleClicked(int button);
|
|
@@ -378,6 +391,7 @@ namespace ImGui
|
378
|
391
|
IMGUI_API bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window
|
379
|
392
|
IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
380
|
393
|
IMGUI_API ImVec2 GetMouseDragDelta(int button = 0, float lock_threshold = -1.0f); // dragging amount since clicking, also see: GetItemActiveDragDelta(). if lock_threshold < -1.0f uses io.MouseDraggingThreshold
|
|
394
|
+ IMGUI_API void ResetMouseDragDelta(int button = 0);
|
381
|
395
|
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired cursor type, reset in ImGui::NewFrame(), this updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
|
382
|
396
|
IMGUI_API void SetMouseCursor(ImGuiMouseCursor type); // set desired cursor type
|
383
|
397
|
IMGUI_API float GetTime();
|
|
@@ -406,6 +420,7 @@ namespace ImGui
|
406
|
420
|
static inline bool GetWindowIsFocused() { return ImGui::IsWindowFocused(); } // OBSOLETE
|
407
|
421
|
static inline ImVec2 GetItemBoxMin() { return GetItemRectMin(); } // OBSOLETE
|
408
|
422
|
static inline ImVec2 GetItemBoxMax() { return GetItemRectMax(); } // OBSOLETE
|
|
423
|
+ static inline bool IsClipped(const ImVec2& size) { return IsRectClipped(size); } // OBSOLETE
|
409
|
424
|
static inline bool IsMouseHoveringBox(const ImVec2& rect_min, const ImVec2& rect_max) { return IsMouseHoveringRect(rect_min, rect_max); } // OBSOLETE
|
410
|
425
|
|
411
|
426
|
} // namespace ImGui
|
|
@@ -480,6 +495,8 @@ enum ImGuiCol_
|
480
|
495
|
ImGuiCol_Border,
|
481
|
496
|
ImGuiCol_BorderShadow,
|
482
|
497
|
ImGuiCol_FrameBg, // Background of checkbox, radio button, plot, slider, text input
|
|
498
|
+ ImGuiCol_FrameBgHovered,
|
|
499
|
+ ImGuiCol_FrameBgActive,
|
483
|
500
|
ImGuiCol_TitleBg,
|
484
|
501
|
ImGuiCol_TitleBgCollapsed,
|
485
|
502
|
ImGuiCol_ScrollbarBg,
|
|
@@ -487,8 +504,6 @@ enum ImGuiCol_
|
487
|
504
|
ImGuiCol_ScrollbarGrabHovered,
|
488
|
505
|
ImGuiCol_ScrollbarGrabActive,
|
489
|
506
|
ImGuiCol_ComboBg,
|
490
|
|
- ImGuiCol_CheckHovered,
|
491
|
|
- ImGuiCol_CheckActive,
|
492
|
507
|
ImGuiCol_CheckMark,
|
493
|
508
|
ImGuiCol_SliderGrab,
|
494
|
509
|
ImGuiCol_SliderGrabActive,
|
|
@@ -546,12 +561,12 @@ enum ImGuiColorEditMode_
|
546
|
561
|
enum ImGuiMouseCursor_
|
547
|
562
|
{
|
548
|
563
|
ImGuiMouseCursor_Arrow = 0,
|
549
|
|
- ImGuiMouseCursor_TextInput,
|
550
|
|
- ImGuiMouseCursor_Move, // Unused by ImGui
|
551
|
|
- ImGuiMouseCursor_ResizeNS, // Unused by ImGui
|
552
|
|
- ImGuiMouseCursor_ResizeEW, // Unused by ImGui
|
553
|
|
- ImGuiMouseCursor_ResizeNESW, // Unused by ImGui
|
554
|
|
- ImGuiMouseCursor_ResizeNWSE,
|
|
564
|
+ ImGuiMouseCursor_TextInput, // When hovering over InputText, etc.
|
|
565
|
+ ImGuiMouseCursor_Move, // Unused
|
|
566
|
+ ImGuiMouseCursor_ResizeNS, // Unused
|
|
567
|
+ ImGuiMouseCursor_ResizeEW, // When hovering over a column
|
|
568
|
+ ImGuiMouseCursor_ResizeNESW, // Unused
|
|
569
|
+ ImGuiMouseCursor_ResizeNWSE, // When hovering over the bottom-right corner of a window
|
555
|
570
|
ImGuiMouseCursor_Count_
|
556
|
571
|
};
|
557
|
572
|
|
|
@@ -660,6 +675,7 @@ struct ImGuiIO
|
660
|
675
|
bool WantCaptureMouse; // Mouse is hovering a window or widget is active (= ImGui will use your mouse input)
|
661
|
676
|
bool WantCaptureKeyboard; // Widget is active (= ImGui will use your keyboard input)
|
662
|
677
|
float Framerate; // Framerate estimation, in frame per second. Rolling average estimation based on IO.DeltaTime over 120 frames
|
|
678
|
+ int MetricsRenderVertices; // Vertices processed during last call to Render()
|
663
|
679
|
|
664
|
680
|
//------------------------------------------------------------------
|
665
|
681
|
// [Internal] ImGui will maintain those fields for you
|
|
@@ -873,6 +889,7 @@ IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
873
|
889
|
// At the moment, each ImGui window contains its own ImDrawList but they could potentially be merged in the future.
|
874
|
890
|
// 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.
|
875
|
891
|
// You can interleave normal ImGui:: calls and adding primitives to the current draw list.
|
|
892
|
+// 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).
|
876
|
893
|
// 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
|
877
|
894
|
struct ImDrawList
|
878
|
895
|
{
|
|
@@ -896,26 +913,29 @@ struct ImDrawList
|
896
|
913
|
|
897
|
914
|
// Primitives
|
898
|
915
|
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
899
|
|
- IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
900
|
|
- IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
|
916
|
+ IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
|
|
917
|
+ IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
|
901
|
918
|
IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
902
|
919
|
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
903
|
920
|
IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
904
|
|
- 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));
|
|
921
|
+ IMGUI_API void AddArcFast(const ImVec2& center, float radius, ImU32 col, int a_min_12, int a_max_12, bool filled = false, const ImVec2& third_point_offset = ImVec2(0,0)); // Angles in 0..12 range
|
905
|
922
|
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);
|
906
|
923
|
IMGUI_API void AddImage(ImTextureID user_texture_id, const ImVec2& a, const ImVec2& b, const ImVec2& uv0, const ImVec2& uv1, ImU32 col = 0xFFFFFFFF);
|
907
|
924
|
|
908
|
925
|
// Advanced
|
909
|
|
- IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'user_callback' in ImDrawCmd and call the function instead of rendering triangles.
|
910
|
|
- IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible
|
|
926
|
+ IMGUI_API void AddCallback(ImDrawCallback callback, void* callback_data); // Your rendering function must check for 'user_callback' in ImDrawCmd and call the function instead of rendering triangles.
|
|
927
|
+ IMGUI_API void AddDrawCmd(); // This is useful if you need to forcefully create a new draw call (to allow for dependent rendering / blending). Otherwise primitives are merged into the same draw-call as much as possible
|
911
|
928
|
|
912
|
929
|
// Internal helpers
|
913
|
|
- IMGUI_API void ReserveVertices(unsigned int vtx_count);
|
914
|
|
- IMGUI_API void AddVtx(const ImVec2& pos, ImU32 col);
|
915
|
|
- IMGUI_API void AddVtxUV(const ImVec2& pos, ImU32 col, const ImVec2& uv);
|
916
|
|
- IMGUI_API void AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
|
930
|
+ IMGUI_API void PrimReserve(unsigned int vtx_count);
|
|
931
|
+ IMGUI_API void PrimTriangle(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
|
932
|
+ IMGUI_API void PrimRect(const ImVec2& a, const ImVec2& b, ImU32 col);
|
|
933
|
+ IMGUI_API void PrimRectUV(const ImVec2& a, const ImVec2& b, const ImVec2& uv_a, const ImVec2& uv_b, ImU32 col);
|
|
934
|
+ IMGUI_API void PrimQuad(const ImVec2& a, const ImVec2& b, const ImVec2& c, const ImVec2& d, ImU32 col);
|
|
935
|
+ IMGUI_API void PrimLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
917
|
936
|
IMGUI_API void UpdateClipRect();
|
918
|
937
|
IMGUI_API void UpdateTextureID();
|
|
938
|
+ IMGUI_API void PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col) { vtx_write->pos = pos; vtx_write->uv = uv; vtx_write->col = col; vtx_write++; }
|
919
|
939
|
};
|
920
|
940
|
|
921
|
941
|
// Load and rasterize multiple TTF fonts into a same texture.
|
|
@@ -925,14 +945,15 @@ struct ImDrawList
|
925
|
945
|
// 2. Call GetTexDataAsAlpha8() or GetTexDataAsRGBA32() to build and retrieve pixels data.
|
926
|
946
|
// 3. Upload the pixels data into a texture within your graphics system.
|
927
|
947
|
// 4. Call SetTexID(my_tex_id); and pass the pointer/identifier to your texture. This value will be passed back to you during rendering to identify the texture.
|
928
|
|
-// 5. Call ClearPixelsData() to free textures memory on the heap.
|
|
948
|
+// 5. Call ClearTexData() to free textures memory on the heap.
|
929
|
949
|
struct ImFontAtlas
|
930
|
950
|
{
|
931
|
951
|
IMGUI_API ImFontAtlas();
|
932
|
952
|
IMGUI_API ~ImFontAtlas();
|
933
|
953
|
IMGUI_API ImFont* AddFontDefault();
|
934
|
954
|
IMGUI_API ImFont* AddFontFromFileTTF(const char* filename, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0);
|
935
|
|
- IMGUI_API ImFont* AddFontFromMemoryTTF(void* in_ttf_data, size_t in_ttf_data_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // Pass ownership of 'in_ttf_data' memory.
|
|
955
|
+ IMGUI_API ImFont* AddFontFromMemoryTTF(void* in_ttf_data, unsigned int in_ttf_data_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // Pass ownership of 'in_ttf_data' memory, will be deleted after build
|
|
956
|
+ IMGUI_API ImFont* AddFontFromMemoryCompressedTTF(const void* in_compressed_ttf_data, unsigned int in_compressed_ttf_data_size, float size_pixels, const ImWchar* glyph_ranges = NULL, int font_no = 0); // 'in_compressed_ttf_data' untouched and still owned by caller. compress with binary_to_compressed_c.
|
936
|
957
|
IMGUI_API void ClearTexData(); // Saves RAM once the texture has been copied to graphics memory.
|
937
|
958
|
IMGUI_API void Clear();
|
938
|
959
|
|
|
@@ -998,19 +1019,19 @@ struct ImFont
|
998
|
1019
|
|
999
|
1020
|
// Methods
|
1000
|
1021
|
IMGUI_API ImFont();
|
1001
|
|
- IMGUI_API ~ImFont() { Clear(); }
|
1002
|
|
- IMGUI_API void Clear();
|
1003
|
|
- IMGUI_API void BuildLookupTable();
|
1004
|
|
- IMGUI_API const Glyph* FindGlyph(unsigned short c) const;
|
1005
|
|
- IMGUI_API void SetFallbackChar(ImWchar c);
|
1006
|
|
- IMGUI_API bool IsLoaded() const { return ContainerAtlas != NULL; }
|
|
1022
|
+ IMGUI_API ~ImFont();
|
|
1023
|
+ IMGUI_API void Clear();
|
|
1024
|
+ IMGUI_API void BuildLookupTable();
|
|
1025
|
+ IMGUI_API const Glyph* FindGlyph(unsigned short c) const;
|
|
1026
|
+ IMGUI_API void SetFallbackChar(ImWchar c);
|
|
1027
|
+ IMGUI_API bool IsLoaded() const { return ContainerAtlas != NULL; }
|
1007
|
1028
|
|
1008
|
1029
|
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
|
1009
|
1030
|
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
1010
|
|
- 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; // utf8
|
1011
|
|
- IMGUI_API ImVec2 CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const; // wchar
|
1012
|
|
- IMGUI_API void RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL) const;
|
1013
|
|
- IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
|
|
1031
|
+ 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; // utf8
|
|
1032
|
+ IMGUI_API ImVec2 CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const; // wchar
|
|
1033
|
+ IMGUI_API void RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawList* draw_list, float wrap_width = 0.0f, const ImVec2* cpu_clip_max = NULL) const;
|
|
1034
|
+ IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) const;
|
1014
|
1035
|
};
|
1015
|
1036
|
|
1016
|
1037
|
//---- Include imgui_user.h at the end of imgui.h
|