|
@@ -1,4 +1,4 @@
|
1
|
|
-// ImGui library v1.15 wip
|
|
1
|
+// ImGui library v1.16 wip
|
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.
|
|
@@ -25,10 +25,15 @@ struct ImGuiWindow;
|
25
|
25
|
#define IM_ASSERT(_EXPR) assert(_EXPR)
|
26
|
26
|
#endif
|
27
|
27
|
|
|
28
|
+#ifndef IMGUI_API
|
|
29
|
+#define IMGUI_API
|
|
30
|
+#endif
|
|
31
|
+
|
28
|
32
|
typedef unsigned int ImU32;
|
29
|
33
|
typedef unsigned short ImWchar;
|
30
|
34
|
typedef ImU32 ImGuiID;
|
31
|
35
|
typedef int ImGuiCol; // enum ImGuiCol_
|
|
36
|
+typedef int ImGuiStyleVar; // enum ImGuiStyleVar_
|
32
|
37
|
typedef int ImGuiKey; // enum ImGuiKey_
|
33
|
38
|
typedef int ImGuiColorEditMode; // enum ImGuiColorEditMode_
|
34
|
39
|
typedef int ImGuiWindowFlags; // enum ImGuiWindowFlags_
|
|
@@ -60,9 +65,9 @@ struct ImVec4
|
60
|
65
|
namespace ImGui
|
61
|
66
|
{
|
62
|
67
|
// Proxy functions to access the MemAllocFn/MemFreeFn/MemReallocFn pointers in ImGui::GetIO(). The only reason they exist here is to allow ImVector<> to compile inline.
|
63
|
|
- void* MemAlloc(size_t sz);
|
64
|
|
- void MemFree(void* ptr);
|
65
|
|
- void* MemRealloc(void* ptr, size_t sz);
|
|
68
|
+ IMGUI_API void* MemAlloc(size_t sz);
|
|
69
|
+ IMGUI_API void MemFree(void* ptr);
|
|
70
|
+ IMGUI_API void* MemRealloc(void* ptr, size_t sz);
|
66
|
71
|
}
|
67
|
72
|
|
68
|
73
|
// std::vector<> like class to avoid dragging dependencies (also: windows implementation of STL with debug enabled is absurdly slow, so let's bypass it so our code runs fast in debug).
|
|
@@ -111,8 +116,8 @@ public:
|
111
|
116
|
inline void push_back(const value_type& v) { if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); Data[Size++] = v; }
|
112
|
117
|
inline void pop_back() { IM_ASSERT(Size > 0); Size--; }
|
113
|
118
|
|
114
|
|
- inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const ptrdiff_t off = it - begin(); memmove(Data + off, Data + off + 1, (Size - off - 1) * sizeof(value_type)); Size--; return Data + off; }
|
115
|
|
- inline void insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const ptrdiff_t off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - off) * sizeof(value_type)); Data[off] = v; Size++; }
|
|
119
|
+ inline iterator erase(const_iterator it) { IM_ASSERT(it >= begin() && it < end()); const ptrdiff_t off = it - begin(); memmove(Data + off, Data + off + 1, (Size - (size_t)off - 1) * sizeof(value_type)); Size--; return Data + off; }
|
|
120
|
+ inline void insert(const_iterator it, const value_type& v) { IM_ASSERT(it >= begin() && it <= end()); const ptrdiff_t off = it - begin(); if (Size == Capacity) reserve(Capacity ? Capacity * 2 : 4); if (off < (int)Size) memmove(Data + off + 1, Data + off, (Size - (size_t)off) * sizeof(value_type)); Data[off] = v; Size++; }
|
116
|
121
|
};
|
117
|
122
|
#endif // #ifndef ImVector
|
118
|
123
|
|
|
@@ -129,158 +134,168 @@ public:
|
129
|
134
|
namespace ImGui
|
130
|
135
|
{
|
131
|
136
|
// Main
|
132
|
|
- ImGuiIO& GetIO();
|
133
|
|
- ImGuiStyle& GetStyle();
|
134
|
|
- void NewFrame();
|
135
|
|
- void Render();
|
136
|
|
- void Shutdown();
|
137
|
|
- void ShowUserGuide();
|
138
|
|
- void ShowStyleEditor(ImGuiStyle* ref = NULL);
|
139
|
|
- void ShowTestWindow(bool* open = NULL);
|
|
137
|
+ IMGUI_API ImGuiIO& GetIO();
|
|
138
|
+ IMGUI_API ImGuiStyle& GetStyle();
|
|
139
|
+ IMGUI_API void NewFrame();
|
|
140
|
+ IMGUI_API void Render();
|
|
141
|
+ IMGUI_API void Shutdown();
|
|
142
|
+ IMGUI_API void ShowUserGuide();
|
|
143
|
+ IMGUI_API void ShowStyleEditor(ImGuiStyle* ref = NULL);
|
|
144
|
+ IMGUI_API void ShowTestWindow(bool* open = NULL);
|
140
|
145
|
|
141
|
146
|
// Window
|
142
|
|
- bool Begin(const char* name = "Debug", bool* open = NULL, ImVec2 size = ImVec2(0,0), float fill_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code.
|
143
|
|
- void End();
|
144
|
|
- void BeginChild(const char* str_id, ImVec2 size = ImVec2(0,0), bool border = false, ImGuiWindowFlags extra_flags = 0);
|
145
|
|
- void EndChild();
|
146
|
|
- bool GetWindowIsFocused();
|
147
|
|
- ImVec2 GetWindowSize();
|
148
|
|
- float GetWindowWidth();
|
149
|
|
- void SetWindowSize(const ImVec2& size); // set to ImVec2(0,0) to force an auto-fit
|
150
|
|
- ImVec2 GetWindowPos(); // you should rarely need/care about the window position, but it can be useful if you want to use your own drawing.
|
151
|
|
- void SetWindowPos(const ImVec2& pos); // set current window pos.
|
152
|
|
- ImVec2 GetWindowContentRegionMin();
|
153
|
|
- ImVec2 GetWindowContentRegionMax();
|
154
|
|
- ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives.
|
155
|
|
- ImFont GetWindowFont();
|
156
|
|
- float GetWindowFontSize();
|
157
|
|
- void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontBaseScale if you want to scale all windows together.
|
158
|
|
- void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
159
|
|
- void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use 'offset' to access sub components of a multiple component widget.
|
160
|
|
- void SetTreeStateStorage(ImGuiStorage* tree); // replace tree state storage with our own (if you want to manipulate it yourself, typically clear subsection of it).
|
161
|
|
- ImGuiStorage* GetTreeStateStorage();
|
162
|
|
- void PushItemWidth(float item_width);
|
163
|
|
- void PopItemWidth();
|
164
|
|
- float GetItemWidth();
|
165
|
|
- void PushAllowKeyboardFocus(bool v); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.
|
166
|
|
- void PopAllowKeyboardFocus();
|
167
|
|
- void PushStyleColor(ImGuiCol idx, const ImVec4& col);
|
168
|
|
- void PopStyleColor();
|
|
147
|
+ IMGUI_API bool Begin(const char* name = "Debug", bool* open = NULL, ImVec2 size = ImVec2(0,0), float fill_alpha = -1.0f, ImGuiWindowFlags flags = 0); // return false when window is collapsed, so you can early out in your code.
|
|
148
|
+ IMGUI_API void End();
|
|
149
|
+ IMGUI_API void BeginChild(const char* str_id, 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.
|
|
150
|
+ IMGUI_API void EndChild();
|
|
151
|
+ IMGUI_API bool GetWindowIsFocused();
|
|
152
|
+ IMGUI_API ImVec2 GetWindowSize();
|
|
153
|
+ IMGUI_API float GetWindowWidth();
|
|
154
|
+ IMGUI_API void SetWindowSize(const ImVec2& size); // set to ImVec2(0,0) to force an auto-fit
|
|
155
|
+ IMGUI_API ImVec2 GetWindowPos(); // you should rarely need/care about the window position, but it can be useful if you want to use your own drawing.
|
|
156
|
+ IMGUI_API void SetWindowPos(const ImVec2& pos); // set current window pos.
|
|
157
|
+ IMGUI_API ImVec2 GetContentRegionMax(); // window or current column boundaries
|
|
158
|
+ IMGUI_API ImVec2 GetWindowContentRegionMin(); // window boundaries
|
|
159
|
+ IMGUI_API ImVec2 GetWindowContentRegionMax();
|
|
160
|
+ IMGUI_API ImDrawList* GetWindowDrawList(); // get rendering command-list if you want to append your own draw primitives.
|
|
161
|
+ IMGUI_API ImFont GetWindowFont();
|
|
162
|
+ IMGUI_API float GetWindowFontSize();
|
|
163
|
+ IMGUI_API void SetWindowFontScale(float scale); // per-window font scale. Adjust IO.FontBaseScale if you want to scale all windows together.
|
|
164
|
+ IMGUI_API void SetScrollPosHere(); // adjust scrolling position to center into the current cursor position.
|
|
165
|
+ IMGUI_API void SetKeyboardFocusHere(int offset = 0); // focus keyboard on the next widget. Use 'offset' to access sub components of a multiple component widget.
|
|
166
|
+ 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).
|
|
167
|
+ IMGUI_API ImGuiStorage* GetTreeStateStorage();
|
|
168
|
+
|
|
169
|
+ IMGUI_API void PushItemWidth(float item_width); // width of items for the common item+label case. default to ~2/3 of windows width.
|
|
170
|
+ IMGUI_API void PopItemWidth();
|
|
171
|
+ IMGUI_API float GetItemWidth();
|
|
172
|
+ IMGUI_API void PushAllowKeyboardFocus(bool v); // allow focusing using TAB/Shift-TAB, enabled by default but you can disable it for certain widgets.
|
|
173
|
+ IMGUI_API void PopAllowKeyboardFocus();
|
|
174
|
+ IMGUI_API void PushStyleColor(ImGuiCol idx, const ImVec4& col);
|
|
175
|
+ IMGUI_API void PopStyleColor();
|
|
176
|
+ IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val);
|
|
177
|
+ IMGUI_API void PushStyleVar(ImGuiStyleVar idx, const ImVec2& val);
|
|
178
|
+ IMGUI_API void PopStyleVar();
|
|
179
|
+ IMGUI_API void PushTextWrapPos(float wrap_pos_x = 0.0f); // word-wrapping for Text*() commands. < 0.0f: no wrapping; 0.0f: wrap to end of window (or column); > 0.0f: wrap at 'wrap_pos_x' position in window local space.
|
|
180
|
+ IMGUI_API void PopTextWrapPos();
|
169
|
181
|
|
170
|
182
|
// Tooltip
|
171
|
|
- void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins.
|
172
|
|
- void SetTooltipV(const char* fmt, va_list args);
|
173
|
|
- void BeginTooltip(); // use to create full-featured tooltip windows that aren't just text.
|
174
|
|
- void EndTooltip();
|
|
183
|
+ IMGUI_API void SetTooltip(const char* fmt, ...); // set tooltip under mouse-cursor, typically use with ImGui::IsHovered(). last call wins.
|
|
184
|
+ IMGUI_API void SetTooltipV(const char* fmt, va_list args);
|
|
185
|
+ IMGUI_API void BeginTooltip(); // use to create full-featured tooltip windows that aren't just text.
|
|
186
|
+ IMGUI_API void EndTooltip();
|
175
|
187
|
|
176
|
188
|
// Layout
|
177
|
|
- void Separator(); // horizontal line
|
178
|
|
- void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets to layout them horizontally
|
179
|
|
- void Spacing();
|
180
|
|
- void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns
|
181
|
|
- void NextColumn(); // next column
|
182
|
|
- float GetColumnOffset(int column_index = -1);
|
183
|
|
- void SetColumnOffset(int column_index, float offset);
|
184
|
|
- float GetColumnWidth(int column_index = -1);
|
185
|
|
- ImVec2 GetCursorPos(); // cursor position is relative to window position
|
186
|
|
- void SetCursorPos(const ImVec2& pos); // "
|
187
|
|
- void SetCursorPosX(float x); // "
|
188
|
|
- void SetCursorPosY(float y); // "
|
189
|
|
- ImVec2 GetCursorScreenPos(); // cursor position in screen space
|
190
|
|
- void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets.
|
191
|
|
- float GetTextLineSpacing();
|
192
|
|
- float GetTextLineHeight();
|
|
189
|
+ IMGUI_API void Separator(); // horizontal line
|
|
190
|
+ IMGUI_API void SameLine(int column_x = 0, int spacing_w = -1); // call between widgets to layout them horizontally
|
|
191
|
+ IMGUI_API void Spacing();
|
|
192
|
+ IMGUI_API void Columns(int count = 1, const char* id = NULL, bool border=true); // setup number of columns
|
|
193
|
+ IMGUI_API void NextColumn(); // next column
|
|
194
|
+ IMGUI_API float GetColumnOffset(int column_index = -1);
|
|
195
|
+ IMGUI_API void SetColumnOffset(int column_index, float offset);
|
|
196
|
+ IMGUI_API float GetColumnWidth(int column_index = -1);
|
|
197
|
+ IMGUI_API ImVec2 GetCursorPos(); // cursor position is relative to window position
|
|
198
|
+ IMGUI_API void SetCursorPos(const ImVec2& pos); // "
|
|
199
|
+ IMGUI_API void SetCursorPosX(float x); // "
|
|
200
|
+ IMGUI_API void SetCursorPosY(float y); // "
|
|
201
|
+ IMGUI_API ImVec2 GetCursorScreenPos(); // cursor position in screen space
|
|
202
|
+ IMGUI_API void AlignFirstTextHeightToWidgets(); // call once if the first item on the line is a Text() item and you want to vertically lower it to match subsequent (bigger) widgets.
|
|
203
|
+ IMGUI_API float GetTextLineSpacing();
|
|
204
|
+ IMGUI_API float GetTextLineHeight();
|
193
|
205
|
|
194
|
206
|
// ID scopes
|
195
|
|
- void PushID(const char* str_id);
|
196
|
|
- void PushID(const void* ptr_id);
|
197
|
|
- void PushID(const int int_id);
|
198
|
|
- void PopID();
|
|
207
|
+ IMGUI_API void PushID(const char* str_id);
|
|
208
|
+ IMGUI_API void PushID(const void* ptr_id);
|
|
209
|
+ IMGUI_API void PushID(const int int_id);
|
|
210
|
+ IMGUI_API void PopID();
|
199
|
211
|
|
200
|
212
|
// Widgets
|
201
|
|
- void Text(const char* fmt, ...);
|
202
|
|
- void TextV(const char* fmt, va_list args);
|
203
|
|
- void TextColored(const ImVec4& col, const char* fmt, ...); // shortcut to doing PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
|
204
|
|
- void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
|
205
|
|
- void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, better for long chunks of text.
|
206
|
|
- void LabelText(const char* label, const char* fmt, ...);
|
207
|
|
- void LabelTextV(const char* label, const char* fmt, va_list args);
|
208
|
|
- void BulletText(const char* fmt, ...);
|
209
|
|
- void BulletTextV(const char* fmt, va_list args);
|
210
|
|
- bool Button(const char* label, ImVec2 size = ImVec2(0,0), bool repeat_when_held = false);
|
211
|
|
- bool SmallButton(const char* label);
|
212
|
|
- bool CollapsingHeader(const char* label, const char* str_id = NULL, const bool display_frame = true, const bool default_open = false);
|
213
|
|
- 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.
|
214
|
|
- bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
215
|
|
- bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
216
|
|
- bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
217
|
|
- bool SliderAngle(const char* label, float* v, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); // *v in radians
|
218
|
|
- bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
219
|
|
- 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));
|
220
|
|
- 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));
|
221
|
|
- 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));
|
222
|
|
- 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));
|
223
|
|
- bool Checkbox(const char* label, bool* v);
|
224
|
|
- bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
225
|
|
- bool RadioButton(const char* label, bool active);
|
226
|
|
- bool RadioButton(const char* label, int* v, int v_button);
|
227
|
|
- bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0);
|
228
|
|
- bool InputFloat(const char* label, float* v, float step = 0.0f, float step_fast = 0.0f, int decimal_precision = -1, ImGuiInputTextFlags extra_flags = 0);
|
229
|
|
- bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
|
230
|
|
- bool InputFloat3(const char* label, float v[3], int decimal_precision = -1);
|
231
|
|
- bool InputFloat4(const char* label, float v[4], int decimal_precision = -1);
|
232
|
|
- bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
233
|
|
- bool Combo(const char* label, int* current_item, const char** items, int items_count, int popup_height_items = 7);
|
234
|
|
- bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_height_items = 7); // Separate items with \0, end item-list with \0\0
|
235
|
|
- 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_height_items = 7);
|
236
|
|
- bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
|
237
|
|
- bool ColorEdit3(const char* label, float col[3]);
|
238
|
|
- bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
239
|
|
- void ColorEditMode(ImGuiColorEditMode mode);
|
240
|
|
- bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop
|
241
|
|
- bool TreeNode(const char* str_id, const char* fmt, ...); // "
|
242
|
|
- bool TreeNode(const void* ptr_id, const char* fmt, ...); // "
|
243
|
|
- bool TreeNodeV(const char* str_id, const char* fmt, va_list args); // "
|
244
|
|
- bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args); // "
|
245
|
|
- void TreePush(const char* str_id = NULL); // already called by TreeNode(), but you can call Push/Pop yourself for layouting purpose
|
246
|
|
- void TreePush(const void* ptr_id = NULL); // "
|
247
|
|
- void TreePop();
|
248
|
|
- void OpenNextNode(bool open); // force open/close the next TreeNode or CollapsingHeader
|
|
213
|
+ IMGUI_API void Text(const char* fmt, ...);
|
|
214
|
+ IMGUI_API void TextV(const char* fmt, va_list args);
|
|
215
|
+ IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
|
|
216
|
+ IMGUI_API void TextColoredV(const ImVec4& col, const char* fmt, va_list args);
|
|
217
|
+ IMGUI_API void TextWrapped(const char* fmt, ...); // shortcut for PushTextWrapPos(0.0f); Text(fmt, ...); PopTextWrapPos();
|
|
218
|
+ IMGUI_API void TextWrappedV(const char* fmt, va_list args);
|
|
219
|
+ IMGUI_API void TextUnformatted(const char* text, const char* text_end = NULL); // doesn't require null terminated string if 'text_end' is specified. no copy done to any bounded stack buffer, recommended for long chunks of text.
|
|
220
|
+ IMGUI_API void LabelText(const char* label, const char* fmt, ...); // display text+label aligned the same way as value+label widgets
|
|
221
|
+ IMGUI_API void LabelTextV(const char* label, const char* fmt, va_list args);
|
|
222
|
+ IMGUI_API void BulletText(const char* fmt, ...);
|
|
223
|
+ IMGUI_API void BulletTextV(const char* fmt, va_list args);
|
|
224
|
+ IMGUI_API bool Button(const char* label, ImVec2 size = ImVec2(0,0), bool repeat_when_held = false);
|
|
225
|
+ IMGUI_API bool SmallButton(const char* label);
|
|
226
|
+ IMGUI_API bool CollapsingHeader(const char* label, const char* str_id = NULL, const bool display_frame = true, const bool default_open = false);
|
|
227
|
+ 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.
|
|
228
|
+ 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);
|
|
229
|
+ 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);
|
|
230
|
+ 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);
|
|
231
|
+ IMGUI_API bool SliderAngle(const char* label, float* v, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f); // *v in radians
|
|
232
|
+ IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
|
233
|
+ 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));
|
|
234
|
+ 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));
|
|
235
|
+ 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));
|
|
236
|
+ 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));
|
|
237
|
+ IMGUI_API bool Checkbox(const char* label, bool* v);
|
|
238
|
+ IMGUI_API bool CheckboxFlags(const char* label, unsigned int* flags, unsigned int flags_value);
|
|
239
|
+ IMGUI_API bool RadioButton(const char* label, bool active);
|
|
240
|
+ IMGUI_API bool RadioButton(const char* label, int* v, int v_button);
|
|
241
|
+ IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0);
|
|
242
|
+ 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);
|
|
243
|
+ IMGUI_API bool InputFloat2(const char* label, float v[2], int decimal_precision = -1);
|
|
244
|
+ IMGUI_API bool InputFloat3(const char* label, float v[3], int decimal_precision = -1);
|
|
245
|
+ IMGUI_API bool InputFloat4(const char* label, float v[4], int decimal_precision = -1);
|
|
246
|
+ IMGUI_API bool InputInt(const char* label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags extra_flags = 0);
|
|
247
|
+ IMGUI_API bool Combo(const char* label, int* current_item, const char** items, int items_count, int popup_height_items = 7);
|
|
248
|
+ IMGUI_API bool Combo(const char* label, int* current_item, const char* items_separated_by_zeros, int popup_height_items = 7); // separate items with \0, end item-list with \0\0
|
|
249
|
+ 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_height_items = 7);
|
|
250
|
+ IMGUI_API bool ColorButton(const ImVec4& col, bool small_height = false, bool outline_border = true);
|
|
251
|
+ IMGUI_API bool ColorEdit3(const char* label, float col[3]);
|
|
252
|
+ IMGUI_API bool ColorEdit4(const char* label, float col[4], bool show_alpha = true);
|
|
253
|
+ IMGUI_API void ColorEditMode(ImGuiColorEditMode mode);
|
|
254
|
+ IMGUI_API bool TreeNode(const char* str_label_id); // if returning 'true' the node is open and the user is responsible for calling TreePop
|
|
255
|
+ IMGUI_API bool TreeNode(const char* str_id, const char* fmt, ...); // "
|
|
256
|
+ IMGUI_API bool TreeNode(const void* ptr_id, const char* fmt, ...); // "
|
|
257
|
+ IMGUI_API bool TreeNodeV(const char* str_id, const char* fmt, va_list args); // "
|
|
258
|
+ IMGUI_API bool TreeNodeV(const void* ptr_id, const char* fmt, va_list args); // "
|
|
259
|
+ IMGUI_API void TreePush(const char* str_id = NULL); // already called by TreeNode(), but you can call Push/Pop yourself for layouting purpose
|
|
260
|
+ IMGUI_API void TreePush(const void* ptr_id = NULL); // "
|
|
261
|
+ IMGUI_API void TreePop();
|
|
262
|
+ IMGUI_API void OpenNextNode(bool open); // force open/close the next TreeNode or CollapsingHeader
|
249
|
263
|
|
250
|
264
|
// Value helper output "name: value"
|
251
|
265
|
// Freely declare your own in the ImGui namespace.
|
252
|
|
- void Value(const char* prefix, bool b);
|
253
|
|
- void Value(const char* prefix, int v);
|
254
|
|
- void Value(const char* prefix, unsigned int v);
|
255
|
|
- void Value(const char* prefix, float v, const char* float_format = NULL);
|
256
|
|
- void Color(const char* prefix, const ImVec4& v);
|
257
|
|
- void Color(const char* prefix, unsigned int v);
|
|
266
|
+ IMGUI_API void Value(const char* prefix, bool b);
|
|
267
|
+ IMGUI_API void Value(const char* prefix, int v);
|
|
268
|
+ IMGUI_API void Value(const char* prefix, unsigned int v);
|
|
269
|
+ IMGUI_API void Value(const char* prefix, float v, const char* float_format = NULL);
|
|
270
|
+ IMGUI_API void Color(const char* prefix, const ImVec4& v);
|
|
271
|
+ IMGUI_API void Color(const char* prefix, unsigned int v);
|
258
|
272
|
|
259
|
273
|
// Logging
|
260
|
|
- void LogButtons();
|
261
|
|
- void LogToTTY(int max_depth = -1);
|
262
|
|
- void LogToFile(int max_depth = -1, const char* filename = NULL);
|
263
|
|
- void LogToClipboard(int max_depth = -1);
|
|
274
|
+ IMGUI_API void LogButtons();
|
|
275
|
+ IMGUI_API void LogToTTY(int max_depth = -1);
|
|
276
|
+ IMGUI_API void LogToFile(int max_depth = -1, const char* filename = NULL);
|
|
277
|
+ IMGUI_API void LogToClipboard(int max_depth = -1);
|
264
|
278
|
|
265
|
279
|
// Utilities
|
266
|
|
- void SetNewWindowDefaultPos(const ImVec2& pos); // set position of window that do
|
267
|
|
- bool IsHovered(); // was the last item active area hovered by mouse?
|
268
|
|
- ImVec2 GetItemBoxMin(); // get bounding box of last item
|
269
|
|
- ImVec2 GetItemBoxMax(); // get bounding box of last item
|
270
|
|
- bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimisation)
|
271
|
|
- 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
|
272
|
|
- bool IsMouseClicked(int button, bool repeat = false);
|
273
|
|
- bool IsMouseDoubleClicked(int button);
|
274
|
|
- bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window)
|
275
|
|
- bool IsMouseHoveringAnyWindow(); // is mouse hovering any active imgui window
|
276
|
|
- bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is mouse hovering given bounding box
|
277
|
|
- bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window
|
278
|
|
- ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
279
|
|
- float GetTime();
|
280
|
|
- int GetFrameCount();
|
281
|
|
- const char* GetStyleColorName(ImGuiCol idx);
|
282
|
|
- void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
283
|
|
- ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, const bool hide_text_after_hash = true);
|
|
280
|
+ IMGUI_API void SetNewWindowDefaultPos(const ImVec2& pos); // set position of window that do
|
|
281
|
+ IMGUI_API bool IsItemHovered(); // was the last item active area hovered by mouse?
|
|
282
|
+ IMGUI_API bool IsItemFocused(); // was the last item focused for keyboard input?
|
|
283
|
+ IMGUI_API ImVec2 GetItemBoxMin(); // get bounding box of last item
|
|
284
|
+ IMGUI_API ImVec2 GetItemBoxMax(); // get bounding box of last item
|
|
285
|
+ IMGUI_API bool IsClipped(const ImVec2& item_size); // to perform coarse clipping on user's side (as an optimization)
|
|
286
|
+ 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
|
|
287
|
+ IMGUI_API bool IsMouseClicked(int button, bool repeat = false);
|
|
288
|
+ IMGUI_API bool IsMouseDoubleClicked(int button);
|
|
289
|
+ IMGUI_API bool IsMouseHoveringWindow(); // is mouse hovering current window ("window" in API names always refer to current window)
|
|
290
|
+ IMGUI_API bool IsMouseHoveringAnyWindow(); // is mouse hovering any active imgui window
|
|
291
|
+ IMGUI_API bool IsMouseHoveringBox(const ImVec2& box_min, const ImVec2& box_max); // is mouse hovering given bounding box
|
|
292
|
+ IMGUI_API bool IsPosHoveringAnyWindow(const ImVec2& pos); // is given position hovering any active imgui window
|
|
293
|
+ IMGUI_API ImVec2 GetMousePos(); // shortcut to ImGui::GetIO().MousePos provided by user, to be consistent with other calls
|
|
294
|
+ IMGUI_API float GetTime();
|
|
295
|
+ IMGUI_API int GetFrameCount();
|
|
296
|
+ IMGUI_API const char* GetStyleColorName(ImGuiCol idx);
|
|
297
|
+ IMGUI_API void GetDefaultFontData(const void** fnt_data, unsigned int* fnt_size, const void** png_data, unsigned int* png_size);
|
|
298
|
+ IMGUI_API ImVec2 CalcTextSize(const char* text, const char* text_end = NULL, bool hide_text_after_hash = true, float wrap_width = -1.0f);
|
284
|
299
|
|
285
|
300
|
} // namespace ImGui
|
286
|
301
|
|
|
@@ -297,7 +312,7 @@ enum ImGuiWindowFlags_
|
297
|
312
|
ImGuiWindowFlags_ChildWindowAutoFitX = 1 << 6, // For internal use by BeginChild()
|
298
|
313
|
ImGuiWindowFlags_ChildWindowAutoFitY = 1 << 7, // For internal use by BeginChild()
|
299
|
314
|
ImGuiWindowFlags_ComboBox = 1 << 8, // For internal use by ComboBox()
|
300
|
|
- ImGuiWindowFlags_Tooltip = 1 << 9, // For internal use by Render() when using Tooltip
|
|
315
|
+ ImGuiWindowFlags_Tooltip = 1 << 9 // For internal use by Render() when using Tooltip
|
301
|
316
|
};
|
302
|
317
|
|
303
|
318
|
// Flags for ImGui::InputText()
|
|
@@ -307,7 +322,7 @@ enum ImGuiInputTextFlags_
|
307
|
322
|
ImGuiInputTextFlags_CharsDecimal = 1 << 0, // Allow 0123456789.+-*/
|
308
|
323
|
ImGuiInputTextFlags_CharsHexadecimal = 1 << 1, // Allow 0123456789ABCDEFabcdef
|
309
|
324
|
ImGuiInputTextFlags_AutoSelectAll = 1 << 2, // Select entire text when first taking focus
|
310
|
|
- ImGuiInputTextFlags_EnterReturnsTrue = 1 << 3, // Return 'true' when Enter is pressed (as opposed to when the value was modified)
|
|
325
|
+ ImGuiInputTextFlags_EnterReturnsTrue = 1 << 3 // Return 'true' when Enter is pressed (as opposed to when the value was modified)
|
311
|
326
|
//ImGuiInputTextFlags_AlignCenter = 1 << 3,
|
312
|
327
|
};
|
313
|
328
|
|
|
@@ -331,9 +346,10 @@ enum ImGuiKey_
|
331
|
346
|
ImGuiKey_X, // for CTRL+X: cut
|
332
|
347
|
ImGuiKey_Y, // for CTRL+Y: redo
|
333
|
348
|
ImGuiKey_Z, // for CTRL+Z: undo
|
334
|
|
- ImGuiKey_COUNT,
|
|
349
|
+ ImGuiKey_COUNT
|
335
|
350
|
};
|
336
|
351
|
|
|
352
|
+// Enumeration for PushStyleColor() / PopStyleColor()
|
337
|
353
|
enum ImGuiCol_
|
338
|
354
|
{
|
339
|
355
|
ImGuiCol_Text,
|
|
@@ -373,15 +389,29 @@ enum ImGuiCol_
|
373
|
389
|
ImGuiCol_PlotHistogramHovered,
|
374
|
390
|
ImGuiCol_TextSelectedBg,
|
375
|
391
|
ImGuiCol_TooltipBg,
|
376
|
|
- ImGuiCol_COUNT,
|
|
392
|
+ ImGuiCol_COUNT
|
|
393
|
+};
|
|
394
|
+
|
|
395
|
+// Enumeration for PushStyleVar() / PopStyleVar()
|
|
396
|
+// NB: the enum only refers to fields of ImGuiStyle() which makes sense to be pushed/poped in UI code. Feel free to add others.
|
|
397
|
+enum ImGuiStyleVar_
|
|
398
|
+{
|
|
399
|
+ ImGuiStyleVar_Alpha, // float
|
|
400
|
+ ImGuiStyleVar_WindowPadding, // ImVec2
|
|
401
|
+ ImGuiStyleVar_FramePadding, // ImVec2
|
|
402
|
+ ImGuiStyleVar_ItemSpacing, // ImVec2
|
|
403
|
+ ImGuiStyleVar_ItemInnerSpacing, // ImVec2
|
|
404
|
+ ImGuiStyleVar_TreeNodeSpacing, // float
|
|
405
|
+ ImGuiStyleVar_ColumnsMinSpacing // float
|
377
|
406
|
};
|
378
|
407
|
|
|
408
|
+// Enumeration for ColorEditMode()
|
379
|
409
|
enum ImGuiColorEditMode_
|
380
|
410
|
{
|
381
|
411
|
ImGuiColorEditMode_UserSelect = -1,
|
382
|
412
|
ImGuiColorEditMode_RGB = 0,
|
383
|
413
|
ImGuiColorEditMode_HSV = 1,
|
384
|
|
- ImGuiColorEditMode_HEX = 2,
|
|
414
|
+ ImGuiColorEditMode_HEX = 2
|
385
|
415
|
};
|
386
|
416
|
|
387
|
417
|
struct ImGuiStyle
|
|
@@ -401,7 +431,7 @@ struct ImGuiStyle
|
401
|
431
|
float ScrollBarWidth; // Width of the vertical scroll bar
|
402
|
432
|
ImVec4 Colors[ImGuiCol_COUNT];
|
403
|
433
|
|
404
|
|
- ImGuiStyle();
|
|
434
|
+ IMGUI_API ImGuiStyle();
|
405
|
435
|
};
|
406
|
436
|
|
407
|
437
|
// This is where your app communicate with ImGui. Call ImGui::GetIO() to access.
|
|
@@ -464,7 +494,7 @@ struct ImGuiIO
|
464
|
494
|
ImWchar InputCharacters[16+1]; // List of characters input (translated by user from keypress+keyboard state). Fill using AddInputCharacter() helper.
|
465
|
495
|
|
466
|
496
|
// Function
|
467
|
|
- void AddInputCharacter(ImWchar); // Helper to add a new character into InputCharacters[]
|
|
497
|
+ IMGUI_API void AddInputCharacter(ImWchar c); // Helper to add a new character into InputCharacters[]
|
468
|
498
|
|
469
|
499
|
//------------------------------------------------------------------
|
470
|
500
|
// Output - Retrieve after calling NewFrame(), you can use them to discard inputs or hide them from the rest of your application
|
|
@@ -486,7 +516,7 @@ struct ImGuiIO
|
486
|
516
|
float MouseDownTime[5];
|
487
|
517
|
float KeysDownTime[512];
|
488
|
518
|
|
489
|
|
- ImGuiIO();
|
|
519
|
+ IMGUI_API ImGuiIO();
|
490
|
520
|
};
|
491
|
521
|
|
492
|
522
|
//-----------------------------------------------------------------------------
|
|
@@ -521,7 +551,7 @@ struct ImGuiTextFilter
|
521
|
551
|
char front() const { return *b; }
|
522
|
552
|
static bool isblank(char c) { return c == ' ' || c == '\t'; }
|
523
|
553
|
void trim_blanks() { while (b < e && isblank(*b)) b++; while (e > b && isblank(*(e-1))) e--; }
|
524
|
|
- void split(char separator, ImVector<TextRange>& out);
|
|
554
|
+ IMGUI_API void split(char separator, ImVector<TextRange>& out);
|
525
|
555
|
};
|
526
|
556
|
|
527
|
557
|
char InputBuf[256];
|
|
@@ -533,7 +563,7 @@ struct ImGuiTextFilter
|
533
|
563
|
void Draw(const char* label = "Filter (inc,-exc)", float width = -1.0f); // Helper calling InputText+Build
|
534
|
564
|
bool PassFilter(const char* val) const;
|
535
|
565
|
bool IsActive() const { return !Filters.empty(); }
|
536
|
|
- void Build();
|
|
566
|
+ IMGUI_API void Build();
|
537
|
567
|
};
|
538
|
568
|
|
539
|
569
|
// Helper: Text buffer for logging/accumulating text
|
|
@@ -542,12 +572,13 @@ struct ImGuiTextBuffer
|
542
|
572
|
ImVector<char> Buf;
|
543
|
573
|
|
544
|
574
|
ImGuiTextBuffer() { Buf.push_back(0); }
|
|
575
|
+ ~ImGuiTextBuffer() { clear(); }
|
545
|
576
|
const char* begin() const { return Buf.begin(); }
|
546
|
577
|
const char* end() const { return Buf.end()-1; }
|
547
|
578
|
size_t size() const { return Buf.size()-1; }
|
548
|
579
|
bool empty() { return Buf.empty(); }
|
549
|
580
|
void clear() { Buf.clear(); Buf.push_back(0); }
|
550
|
|
- void append(const char* fmt, ...);
|
|
581
|
+ IMGUI_API void append(const char* fmt, ...);
|
551
|
582
|
};
|
552
|
583
|
|
553
|
584
|
// Helper: Key->value storage
|
|
@@ -560,13 +591,13 @@ struct ImGuiStorage
|
560
|
591
|
struct Pair { ImU32 key; int val; };
|
561
|
592
|
ImVector<Pair> Data;
|
562
|
593
|
|
563
|
|
- void Clear();
|
564
|
|
- int GetInt(ImU32 key, int default_val = 0);
|
565
|
|
- void SetInt(ImU32 key, int val);
|
566
|
|
- void SetAllInt(int val);
|
|
594
|
+ IMGUI_API void Clear();
|
|
595
|
+ IMGUI_API int GetInt(ImU32 key, int default_val = 0);
|
|
596
|
+ IMGUI_API void SetInt(ImU32 key, int val);
|
|
597
|
+ IMGUI_API void SetAllInt(int val);
|
567
|
598
|
|
568
|
|
- int* Find(ImU32 key);
|
569
|
|
- void Insert(ImU32 key, int val);
|
|
599
|
+ IMGUI_API int* Find(ImU32 key);
|
|
600
|
+ IMGUI_API void Insert(ImU32 key, int val);
|
570
|
601
|
};
|
571
|
602
|
|
572
|
603
|
//-----------------------------------------------------------------------------
|
|
@@ -580,12 +611,20 @@ struct ImDrawCmd
|
580
|
611
|
ImVec4 clip_rect;
|
581
|
612
|
};
|
582
|
613
|
|
|
614
|
+#ifndef IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT
|
|
615
|
+// Default vertex layout
|
583
|
616
|
struct ImDrawVert
|
584
|
617
|
{
|
585
|
618
|
ImVec2 pos;
|
586
|
619
|
ImVec2 uv;
|
587
|
620
|
ImU32 col;
|
588
|
621
|
};
|
|
622
|
+#else
|
|
623
|
+// You can change the vertex format layout by defining IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT.
|
|
624
|
+// 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.
|
|
625
|
+// The type has to be described by the #define (you can either declare the struct or use a typedef)
|
|
626
|
+IMGUI_OVERRIDE_DRAWVERT_STRUCT_LAYOUT;
|
|
627
|
+#endif
|
589
|
628
|
|
590
|
629
|
// Draw command list
|
591
|
630
|
// This is the low-level list of polygon that ImGui:: functions are filling. At the end of the frame, all command lists are passed to your ImGuiIO::RenderDrawListFn function for rendering.
|
|
@@ -605,22 +644,22 @@ struct ImDrawList
|
605
|
644
|
|
606
|
645
|
ImDrawList() { Clear(); }
|
607
|
646
|
|
608
|
|
- void Clear();
|
609
|
|
- void PushClipRect(const ImVec4& clip_rect);
|
610
|
|
- void PopClipRect();
|
611
|
|
- void ReserveVertices(unsigned int vtx_count);
|
612
|
|
- void AddVtx(const ImVec2& pos, ImU32 col);
|
613
|
|
- void AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
614
|
|
-
|
615
|
|
- // Primitives
|
616
|
|
- void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
617
|
|
- void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
618
|
|
- void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
619
|
|
- void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
620
|
|
- void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
621
|
|
- void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
622
|
|
- 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));
|
623
|
|
- void AddText(ImFont font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end);
|
|
647
|
+ IMGUI_API void Clear();
|
|
648
|
+ IMGUI_API void PushClipRect(const ImVec4& clip_rect);
|
|
649
|
+ IMGUI_API void PopClipRect();
|
|
650
|
+ IMGUI_API void ReserveVertices(unsigned int vtx_count);
|
|
651
|
+ IMGUI_API void AddVtx(const ImVec2& pos, ImU32 col);
|
|
652
|
+ IMGUI_API void AddVtxLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
|
653
|
+
|
|
654
|
+ // Primitives
|
|
655
|
+ IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col);
|
|
656
|
+ IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
|
657
|
+ IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners=0x0F);
|
|
658
|
+ IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
|
659
|
+ IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
|
660
|
+ IMGUI_API void AddCircleFilled(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
|
661
|
+ 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));
|
|
662
|
+ 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);
|
624
|
663
|
};
|
625
|
664
|
|
626
|
665
|
// Optional bitmap font data loader & renderer into vertices
|
|
@@ -689,18 +728,23 @@ struct ImBitmapFont
|
689
|
728
|
ImVector<const char*> Filenames; // (point into raw data)
|
690
|
729
|
ImVector<int> IndexLookup; // (built)
|
691
|
730
|
|
692
|
|
- ImBitmapFont();
|
693
|
|
- ~ImBitmapFont() { Clear(); }
|
|
731
|
+ IMGUI_API ImBitmapFont();
|
|
732
|
+ IMGUI_API ~ImBitmapFont() { Clear(); }
|
694
|
733
|
|
695
|
|
- bool LoadFromMemory(const void* data, size_t data_size);
|
696
|
|
- bool LoadFromFile(const char* filename);
|
697
|
|
- void Clear();
|
698
|
|
- void BuildLookupTable();
|
699
|
|
- const FntGlyph * FindGlyph(unsigned short c) const;
|
700
|
|
- float GetFontSize() const { return (float)Info->FontSize; }
|
701
|
|
- bool IsLoaded() const { return Info != NULL && Common != NULL && Glyphs != NULL; }
|
|
734
|
+ IMGUI_API bool LoadFromMemory(const void* data, size_t data_size);
|
|
735
|
+ IMGUI_API bool LoadFromFile(const char* filename);
|
|
736
|
+ IMGUI_API void Clear();
|
|
737
|
+ IMGUI_API void BuildLookupTable();
|
|
738
|
+ IMGUI_API const FntGlyph * FindGlyph(unsigned short c, const FntGlyph* fallback = NULL) const;
|
|
739
|
+ IMGUI_API float GetFontSize() const { return (float)Info->FontSize; }
|
|
740
|
+ IMGUI_API bool IsLoaded() const { return Info != NULL && Common != NULL && Glyphs != NULL; }
|
702
|
741
|
|
703
|
|
- ImVec2 CalcTextSizeA(float size, float max_width, const char* text_begin, const char* text_end, const char** remaining = NULL) const; // utf8
|
704
|
|
- ImVec2 CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const; // wchar
|
705
|
|
- void RenderText(float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, ImDrawVert*& out_vertices) const;
|
|
742
|
+ // 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
|
|
743
|
+ // 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
|
744
|
+ 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
|
|
745
|
+ IMGUI_API ImVec2 CalcTextSizeW(float size, float max_width, const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL) const; // wchar
|
|
746
|
+ 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;
|
|
747
|
+
|
|
748
|
+private:
|
|
749
|
+ IMGUI_API const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width, const FntGlyph* fallback_glyph) const;
|
706
|
750
|
};
|