0.4.1
Loading...
Searching...
No Matches
imgui_ex.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9/// @file imgui_ex.hpp
10/// @brief ImGui extensions
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2021-09-14
13
14#pragma once
15
16#include <imgui.h>
17
18#include <limits>
19#include <string>
20#include <cstdint>
21
22namespace ImGui
23{
24// Widgets: Drag Sliders
25// - CTRL+Click on any drag box to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
26// - For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function
27// argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are
28// expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
29// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision
30// e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
31// - Format string may also be set to NULL or use the default format ("%f" or "%d").
32// - Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1).
33// For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
34// - Use v_min < v_max to clamp edits to given limits. Note that CTRL+Click manual input can override those limits.
35// - Use v_max = FLT_MAX / INT_MAX etc to avoid clamping to a maximum, same with v_min = -FLT_MAX / INT_MIN to avoid clamping to a minimum.
36// - We use the same sets of flags for DragXXX() and SliderXXX() functions as the features are the same and it makes it easier to swap them.
37// - Legacy: Pre-1.78 there are DragXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
38// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
39// - If v_min >= v_max we have no bound
40
41/// @brief Shows a Drag GUI element for 'double'
42/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
43/// @param[in, out] v Pointer to the value to modify
44/// @param[in] v_speed Speed to drag the value
45/// @param[in] v_min Minimum value allowed
46/// @param[in] v_max Maximum value allowed
47/// @param[in] format Printf format to display the value with
48/// @param[in] flags Slider flags to modify the behavior
49/// @return True if the value was changed
50bool DragDouble(const char* label, double* v, float v_speed = 1.0F, double v_min = 0.0, double v_max = 0.0, const char* format = "%.6f", ImGuiSliderFlags flags = 0);
51
52/// @brief Shows a Drag GUI element for an array of 'double[2]'
53/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
54/// @param[in, out] v Pointer to the value to modify
55/// @param[in] v_speed Speed to drag the value
56/// @param[in] v_min Minimum value allowed
57/// @param[in] v_max Maximum value allowed
58/// @param[in] format Printf format to display the value with
59/// @param[in] flags Slider flags to modify the behavior
60/// @return True if the value was changed
61bool DragDouble2(const char* label, double v[2], float v_speed = 1.0F, double v_min = 0.0, double v_max = 0.0, const char* format = "%.6f", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
62
63/// @brief Shows a Drag GUI element for an array of 'double[3]'
64/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
65/// @param[in, out] v Pointer to the value to modify
66/// @param[in] v_speed Speed to drag the value
67/// @param[in] v_min Minimum value allowed
68/// @param[in] v_max Maximum value allowed
69/// @param[in] format Printf format to display the value with
70/// @param[in] flags Slider flags to modify the behavior
71/// @return True if the value was changed
72bool DragDouble3(const char* label, double v[3], float v_speed = 1.0F, double v_min = 0.0, double v_max = 0.0, const char* format = "%.6f", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
73
74/// @brief Shows a Drag GUI element for an array of 'double[4]'
75/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
76/// @param[in, out] v Pointer to the value to modify
77/// @param[in] v_speed Speed to drag the value
78/// @param[in] v_min Minimum value allowed
79/// @param[in] v_max Maximum value allowed
80/// @param[in] format Printf format to display the value with
81/// @param[in] flags Slider flags to modify the behavior
82/// @return True if the value was changed
83bool DragDouble4(const char* label, double v[4], float v_speed = 1.0F, double v_min = 0.0, double v_max = 0.0, const char* format = "%.6f", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
84
85// #####################################################################################################################
86
87/// @brief Shows a Drag GUI element for 'int64'
88/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
89/// @param[in, out] v Pointer to the value to modify
90/// @param[in] v_speed Speed to drag the value
91/// @param[in] v_min Minimum value allowed
92/// @param[in] v_max Maximum value allowed
93/// @param[in] format Printf format to display the value with
94/// @param[in] flags Slider flags to modify the behavior
95/// @return True if the value was changed
96bool DragLong(const char* label, int64_t* v, float v_speed = 1.0F, int64_t v_min = 0.0, int64_t v_max = 0.0, const char* format = "%ld", ImGuiSliderFlags flags = 0);
97
98/// @brief Shows a Drag GUI element for an array of 'int64[2]'
99/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
100/// @param[in, out] v Pointer to the value to modify
101/// @param[in] v_speed Speed to drag the value
102/// @param[in] v_min Minimum value allowed
103/// @param[in] v_max Maximum value allowed
104/// @param[in] format Printf format to display the value with
105/// @param[in] flags Slider flags to modify the behavior
106/// @return True if the value was changed
107bool DragLong2(const char* label, int64_t v[2], float v_speed = 1.0F, int64_t v_min = 0.0, int64_t v_max = 0.0, const char* format = "%ld", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
108
109/// @brief Shows a Drag GUI element for an array of 'int64[3]'
110/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
111/// @param[in, out] v Pointer to the value to modify
112/// @param[in] v_speed Speed to drag the value
113/// @param[in] v_min Minimum value allowed
114/// @param[in] v_max Maximum value allowed
115/// @param[in] format Printf format to display the value with
116/// @param[in] flags Slider flags to modify the behavior
117/// @return True if the value was changed
118bool DragLong3(const char* label, int64_t v[3], float v_speed = 1.0F, int64_t v_min = 0.0, int64_t v_max = 0.0, const char* format = "%ld", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
119
120/// @brief Shows a Drag GUI element for an array of 'int64[4]'
121/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
122/// @param[in, out] v Pointer to the value to modify
123/// @param[in] v_speed Speed to drag the value
124/// @param[in] v_min Minimum value allowed
125/// @param[in] v_max Maximum value allowed
126/// @param[in] format Printf format to display the value with
127/// @param[in] flags Slider flags to modify the behavior
128/// @return True if the value was changed
129bool DragLong4(const char* label, int64_t v[4], float v_speed = 1.0F, int64_t v_min = 0.0, int64_t v_max = 0.0, const char* format = "%ld", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
130
131// #####################################################################################################################
132
133/// @brief Shows a Drag GUI element for 'uint64'
134/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
135/// @param[in, out] v Pointer to the value to modify
136/// @param[in] v_speed Speed to drag the value
137/// @param[in] v_min Minimum value allowed
138/// @param[in] v_max Maximum value allowed
139/// @param[in] format Printf format to display the value with
140/// @param[in] flags Slider flags to modify the behavior
141/// @return True if the value was changed
142bool DragULong(const char* label, uint64_t* v, float v_speed = 1.0F, uint64_t v_min = 0.0, uint64_t v_max = 0.0, const char* format = "%lu", ImGuiSliderFlags flags = 0);
143
144/// @brief Shows a Drag GUI element for an array of 'uint64[2]'
145/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
146/// @param[in, out] v Pointer to the value to modify
147/// @param[in] v_speed Speed to drag the value
148/// @param[in] v_min Minimum value allowed
149/// @param[in] v_max Maximum value allowed
150/// @param[in] format Printf format to display the value with
151/// @param[in] flags Slider flags to modify the behavior
152/// @return True if the value was changed
153bool DragULong2(const char* label, uint64_t v[2], float v_speed = 1.0F, uint64_t v_min = 0.0, uint64_t v_max = 0.0, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
154
155/// @brief Shows a Drag GUI element for an array of 'uint64[3]'
156/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
157/// @param[in, out] v Pointer to the value to modify
158/// @param[in] v_speed Speed to drag the value
159/// @param[in] v_min Minimum value allowed
160/// @param[in] v_max Maximum value allowed
161/// @param[in] format Printf format to display the value with
162/// @param[in] flags Slider flags to modify the behavior
163/// @return True if the value was changed
164bool DragULong3(const char* label, uint64_t v[3], float v_speed = 1.0F, uint64_t v_min = 0.0, uint64_t v_max = 0.0, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
165
166/// @brief Shows a Drag GUI element for an array of 'uint64[4]'
167/// @param[in] label Label to display beside the drag. Has to be unique (use # to hide text afterwards to append an uid)
168/// @param[in, out] v Pointer to the value to modify
169/// @param[in] v_speed Speed to drag the value
170/// @param[in] v_min Minimum value allowed
171/// @param[in] v_max Maximum value allowed
172/// @param[in] format Printf format to display the value with
173/// @param[in] flags Slider flags to modify the behavior
174/// @return True if the value was changed
175bool DragULong4(const char* label, uint64_t v[4], float v_speed = 1.0F, uint64_t v_min = 0.0, uint64_t v_max = 0.0, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
176
177// #####################################################################################################################
178
179// Widgets: Regular Sliders
180// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped and can go off-bounds.
181// - Adjust format string to decorate the value with a prefix, a suffix, or adapt the editing and display precision e.g. "%.3f" -> 1.234; "%5.2f secs" -> 01.23 secs; "Biscuit: %.0f" -> Biscuit: 1; etc.
182// - Format string may also be set to NULL or use the default format ("%f" or "%d").
183// - Legacy: Pre-1.78 there are SliderXXX() function signatures that takes a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
184// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
185
186/// @brief Shows a Slider GUI element for 'double'
187/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
188/// @param[in, out] v Pointer to the value to modify
189/// @param[in] v_min Minimum value allowed
190/// @param[in] v_max Maximum value allowed
191/// @param[in] format Printf format to display the value with
192/// @param[in] flags Slider flags to modify the behavior
193/// @return True if the value was changed
194bool SliderDouble(const char* label, double* v, double v_min, double v_max, const char* format = "%.6f", ImGuiSliderFlags flags = 0);
195
196/// @brief Shows a Slider GUI element for an array of 'double[2]'
197/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
198/// @param[in, out] v Pointer to the value to modify
199/// @param[in] v_min Minimum value allowed
200/// @param[in] v_max Maximum value allowed
201/// @param[in] format Printf format to display the value with
202/// @param[in] flags Slider flags to modify the behavior
203/// @return True if the value was changed
204bool SliderDouble2(const char* label, double v[2], double v_min, double v_max, const char* format = "%.6f", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
205
206/// @brief Shows a Slider GUI element for an array of 'double[3]'
207/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
208/// @param[in, out] v Pointer to the value to modify
209/// @param[in] v_min Minimum value allowed
210/// @param[in] v_max Maximum value allowed
211/// @param[in] format Printf format to display the value with
212/// @param[in] flags Slider flags to modify the behavior
213/// @return True if the value was changed
214bool SliderDouble3(const char* label, double v[3], double v_min, double v_max, const char* format = "%.6f", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
215
216/// @brief Shows a Slider GUI element for an array of 'double[4]'
217/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
218/// @param[in, out] v Pointer to the value to modify
219/// @param[in] v_min Minimum value allowed
220/// @param[in] v_max Maximum value allowed
221/// @param[in] format Printf format to display the value with
222/// @param[in] flags Slider flags to modify the behavior
223/// @return True if the value was changed
224bool SliderDouble4(const char* label, double v[4], double v_min, double v_max, const char* format = "%.6f", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
225
226// #####################################################################################################################
227
228/// @brief Shows a Slider GUI element for 'int64'
229/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
230/// @param[in, out] v Pointer to the value to modify
231/// @param[in] v_min Minimum value allowed
232/// @param[in] v_max Maximum value allowed
233/// @param[in] format Printf format to display the value with
234/// @param[in] flags Slider flags to modify the behavior
235/// @return True if the value was changed
236bool SliderLong(const char* label, int64_t* v, int64_t v_min, int64_t v_max, const char* format = "%ld", ImGuiSliderFlags flags = 0);
237
238/// @brief Shows a Slider GUI element for an array of 'int64[2]'
239/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
240/// @param[in, out] v Pointer to the value to modify
241/// @param[in] v_min Minimum value allowed
242/// @param[in] v_max Maximum value allowed
243/// @param[in] format Printf format to display the value with
244/// @param[in] flags Slider flags to modify the behavior
245/// @return True if the value was changed
246bool SliderLong2(const char* label, int64_t v[2], int64_t v_min, int64_t v_max, const char* format = "%ld", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
247
248/// @brief Shows a Slider GUI element for an array of 'int64[3]'
249/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
250/// @param[in, out] v Pointer to the value to modify
251/// @param[in] v_min Minimum value allowed
252/// @param[in] v_max Maximum value allowed
253/// @param[in] format Printf format to display the value with
254/// @param[in] flags Slider flags to modify the behavior
255/// @return True if the value was changed
256bool SliderLong3(const char* label, int64_t v[3], int64_t v_min, int64_t v_max, const char* format = "%ld", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
257
258/// @brief Shows a Slider GUI element for an array of 'int64[4]'
259/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
260/// @param[in, out] v Pointer to the value to modify
261/// @param[in] v_min Minimum value allowed
262/// @param[in] v_max Maximum value allowed
263/// @param[in] format Printf format to display the value with
264/// @param[in] flags Slider flags to modify the behavior
265/// @return True if the value was changed
266bool SliderLong4(const char* label, int64_t v[4], int64_t v_min, int64_t v_max, const char* format = "%ld", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
267
268// #####################################################################################################################
269
270/// @brief Shows a Slider GUI element for 'uint64'
271/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
272/// @param[in, out] v Pointer to the value to modify
273/// @param[in] v_min Minimum value allowed
274/// @param[in] v_max Maximum value allowed
275/// @param[in] format Printf format to display the value with
276/// @param[in] flags Slider flags to modify the behavior
277/// @return True if the value was changed
278bool SliderULong(const char* label, uint64_t* v, uint64_t v_min, uint64_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0);
279
280/// @brief Shows a Slider GUI element for an array of 'uint64[2]'
281/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
282/// @param[in, out] v Pointer to the value to modify
283/// @param[in] v_min Minimum value allowed
284/// @param[in] v_max Maximum value allowed
285/// @param[in] format Printf format to display the value with
286/// @param[in] flags Slider flags to modify the behavior
287/// @return True if the value was changed
288bool SliderULong2(const char* label, uint64_t v[2], uint64_t v_min, uint64_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
289
290/// @brief Shows a Slider GUI element for an array of 'uint64[3]'
291/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
292/// @param[in, out] v Pointer to the value to modify
293/// @param[in] v_min Minimum value allowed
294/// @param[in] v_max Maximum value allowed
295/// @param[in] format Printf format to display the value with
296/// @param[in] flags Slider flags to modify the behavior
297/// @return True if the value was changed
298bool SliderULong3(const char* label, uint64_t v[3], uint64_t v_min, uint64_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
299
300/// @brief Shows a Slider GUI element for an array of 'uint64[4]'
301/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
302/// @param[in, out] v Pointer to the value to modify
303/// @param[in] v_min Minimum value allowed
304/// @param[in] v_max Maximum value allowed
305/// @param[in] format Printf format to display the value with
306/// @param[in] flags Slider flags to modify the behavior
307/// @return True if the value was changed
308bool SliderULong4(const char* label, uint64_t v[4], uint64_t v_min, uint64_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
309
310// #####################################################################################################################
311
312/// @brief Shows a Slider GUI element for 'uint32'
313/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
314/// @param[in, out] v Pointer to the value to modify
315/// @param[in] v_min Minimum value allowed
316/// @param[in] v_max Maximum value allowed
317/// @param[in] format Printf format to display the value with
318/// @param[in] flags Slider flags to modify the behavior
319/// @return True if the value was changed
320bool SliderUInt(const char* label, uint32_t* v, uint32_t v_min, uint32_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0);
321
322/// @brief Shows a Slider GUI element for an array of 'uint32[2]'
323/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
324/// @param[in, out] v Pointer to the value to modify
325/// @param[in] v_min Minimum value allowed
326/// @param[in] v_max Maximum value allowed
327/// @param[in] format Printf format to display the value with
328/// @param[in] flags Slider flags to modify the behavior
329/// @return True if the value was changed
330bool SliderUInt2(const char* label, uint32_t v[2], uint32_t v_min, uint32_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
331
332/// @brief Shows a Slider GUI element for an array of 'uint32[3]'
333/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
334/// @param[in, out] v Pointer to the value to modify
335/// @param[in] v_min Minimum value allowed
336/// @param[in] v_max Maximum value allowed
337/// @param[in] format Printf format to display the value with
338/// @param[in] flags Slider flags to modify the behavior
339/// @return True if the value was changed
340bool SliderUInt3(const char* label, uint32_t v[3], uint32_t v_min, uint32_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
341
342/// @brief Shows a Slider GUI element for an array of 'uint32[4]'
343/// @param[in] label Label to display beside the slider. Has to be unique (use # to hide text afterwards to append an uid)
344/// @param[in, out] v Pointer to the value to modify
345/// @param[in] v_min Minimum value allowed
346/// @param[in] v_max Maximum value allowed
347/// @param[in] format Printf format to display the value with
348/// @param[in] flags Slider flags to modify the behavior
349/// @return True if the value was changed
350bool SliderUInt4(const char* label, uint32_t v[4], uint32_t v_min, uint32_t v_max, const char* format = "%lu", ImGuiSliderFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
351
352// #####################################################################################################################
353
354// Widgets: Input with Keyboard
355// - If you want to use InputText() with std::string or any custom dynamic string type, see misc/cpp/imgui_stdlib.h and comments in imgui_demo.cpp.
356// - Most of the ImGuiInputTextFlags flags are only useful for InputText() and not for InputFloatX, InputIntX, InputDouble etc.
357
358/// @brief Shows an InputText GUI element for an array of 'double[2]'
359/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
360/// @param[in, out] v Pointer to the value to modify
361/// @param[in] format Printf format to display the value with
362/// @param[in] flags InputText flags to modify the behavior
363/// @return True if the value was changed
364bool InputDouble2(const char* label, double v[2], const char* format = "%.6f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
365
366/// @brief Shows an InputText GUI element for an array of 'double[3]'
367/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
368/// @param[in, out] v Pointer to the value to modify
369/// @param[in] format Printf format to display the value with
370/// @param[in] flags InputText flags to modify the behavior
371/// @return True if the value was changed
372bool InputDouble3(const char* label, double v[3], const char* format = "%.6f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
373
374/// @brief Shows an InputText GUI element for an array of 'double[4]'
375/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
376/// @param[in, out] v Pointer to the value to modify
377/// @param[in] format Printf format to display the value with
378/// @param[in] flags InputText flags to modify the behavior
379/// @return True if the value was changed
380bool InputDouble4(const char* label, double v[4], const char* format = "%.6f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
381
382// ###########################################################################################################
383
384/// @brief Shows a value limited InputText GUI element for 'float'
385/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
386/// @param[in, out] v Pointer to the value to modify
387/// @param[in] v_min Minimum to clamp the value to
388/// @param[in] v_max Maximum to clamp the value to
389/// @param[in] step If greater than 0, this will show buttons to increase/decrease the value
390/// @param[in] step_fast If greater than 0, this will show buttons to increase/decrease the value
391/// @param[in] format Printf format to display the value with
392/// @param[in] flags InputText flags to modify the behavior
393/// @return True if the value was changed
394bool InputFloatL(const char* label, float* v, float v_min = std::numeric_limits<float>::lowest(), float v_max = std::numeric_limits<float>::max(), float step = 0.0F, float step_fast = 0.0F, const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
395
396/// @brief Shows a value limited InputText GUI element for an array of 'float[2]'
397/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
398/// @param[in, out] v Pointer to the value to modify
399/// @param[in] v_min Minimum to clamp the value to
400/// @param[in] v_max Maximum to clamp the value to
401/// @param[in] format Printf format to display the value with
402/// @param[in] flags InputText flags to modify the behavior
403/// @return True if the value was changed
404bool InputFloat2L(const char* label, float v[2], float v_min = std::numeric_limits<float>::lowest(), float v_max = std::numeric_limits<float>::max(), const char* format = "%.3f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
405
406/// @brief Shows a value limited InputText GUI element for an array of 'float[3]'
407/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
408/// @param[in, out] v Pointer to the value to modify
409/// @param[in] v_min Minimum to clamp the value to
410/// @param[in] v_max Maximum to clamp the value to
411/// @param[in] format Printf format to display the value with
412/// @param[in] flags InputText flags to modify the behavior
413/// @return True if the value was changed
414bool InputFloat3L(const char* label, float v[3], float v_min = std::numeric_limits<float>::lowest(), float v_max = std::numeric_limits<float>::max(), const char* format = "%.3f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
415
416/// @brief Shows a value limited InputText GUI element for an array of 'float[4]'
417/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
418/// @param[in, out] v Pointer to the value to modify
419/// @param[in] v_min Minimum to clamp the value to
420/// @param[in] v_max Maximum to clamp the value to
421/// @param[in] format Printf format to display the value with
422/// @param[in] flags InputText flags to modify the behavior
423/// @return True if the value was changed
424bool InputFloat4L(const char* label, float v[4], float v_min = std::numeric_limits<float>::lowest(), float v_max = std::numeric_limits<float>::max(), const char* format = "%.3f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
425
426/// @brief Shows a value limited InputText GUI element for 'int'
427/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
428/// @param[in, out] v Pointer to the value to modify
429/// @param[in] v_min Minimum to clamp the value to
430/// @param[in] v_max Maximum to clamp the value to
431/// @param[in] step If greater than 0, this will show buttons to increase/decrease the value
432/// @param[in] step_fast If greater than 0, this will show buttons to increase/decrease the value
433/// @param[in] flags InputText flags to modify the behavior
434/// @return True if the value was changed
435bool InputIntL(const char* label, int* v, int v_min = std::numeric_limits<int>::lowest(), int v_max = std::numeric_limits<int>::max(), int step = 1, int step_fast = 100, ImGuiInputTextFlags flags = 0);
436
437/// @brief Shows a value limited InputText GUI element for an array of 'int[2]'
438/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
439/// @param[in, out] v Pointer to the value to modify
440/// @param[in] v_min Minimum to clamp the value to
441/// @param[in] v_max Maximum to clamp the value to
442/// @param[in] flags InputText flags to modify the behavior
443/// @return True if the value was changed
444bool InputInt2L(const char* label, int v[2], int v_min = std::numeric_limits<int>::lowest(), int v_max = std::numeric_limits<int>::max(), ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
445
446/// @brief Shows a value limited InputText GUI element for an array of 'int[3]'
447/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
448/// @param[in, out] v Pointer to the value to modify
449/// @param[in] v_min Minimum to clamp the value to
450/// @param[in] v_max Maximum to clamp the value to
451/// @param[in] flags InputText flags to modify the behavior
452/// @return True if the value was changed
453bool InputInt3L(const char* label, int v[3], int v_min = std::numeric_limits<int>::lowest(), int v_max = std::numeric_limits<int>::max(), ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
454
455/// @brief Shows a value limited InputText GUI element for an array of 'int[4]'
456/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
457/// @param[in, out] v Pointer to the value to modify
458/// @param[in] v_min Minimum to clamp the value to
459/// @param[in] v_max Maximum to clamp the value to
460/// @param[in] flags InputText flags to modify the behavior
461/// @return True if the value was changed
462bool InputInt4L(const char* label, int v[4], int v_min = std::numeric_limits<int>::lowest(), int v_max = std::numeric_limits<int>::max(), ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
463
464/// @brief Shows a value limited InputText GUI element for 'double'
465/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
466/// @param[in, out] v Pointer to the value to modify
467/// @param[in] v_min Minimum to clamp the value to
468/// @param[in] v_max Maximum to clamp the value to
469/// @param[in] step If greater than 0, this will show buttons to increase/decrease the value
470/// @param[in] step_fast If greater than 0, this will show buttons to increase/decrease the value
471/// @param[in] format Printf format to display the value with
472/// @param[in] flags InputText flags to modify the behavior
473/// @return True if the value was changed
474bool InputDoubleL(const char* label, double* v, double v_min = std::numeric_limits<double>::lowest(), double v_max = std::numeric_limits<double>::max(), double step = 0.0, double step_fast = 0.0, const char* format = "%.6f", ImGuiInputTextFlags flags = 0);
475
476/// @brief Shows a value limited InputText GUI element for an array of 'double[2]'
477/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
478/// @param[in, out] v Pointer to the value to modify
479/// @param[in] v_min Minimum to clamp the value to
480/// @param[in] v_max Maximum to clamp the value to
481/// @param[in] format Printf format to display the value with
482/// @param[in] flags InputText flags to modify the behavior
483/// @return True if the value was changed
484bool InputDouble2L(const char* label, double v[2], double v_min = std::numeric_limits<double>::lowest(), double v_max = std::numeric_limits<double>::max(), const char* format = "%.3f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
485
486/// @brief Shows a value limited InputText GUI element for an array of 'double[3]'
487/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
488/// @param[in, out] v Pointer to the value to modify
489/// @param[in] v_min Minimum to clamp the value to
490/// @param[in] v_max Maximum to clamp the value to
491/// @param[in] format Printf format to display the value with
492/// @param[in] flags InputText flags to modify the behavior
493/// @return True if the value was changed
494bool InputDouble3L(const char* label, double v[3], double v_min = std::numeric_limits<double>::lowest(), double v_max = std::numeric_limits<double>::max(), const char* format = "%.3f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
495
496/// @brief Shows a value limited InputText GUI element for an array of 'double[4]'
497/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
498/// @param[in, out] v Pointer to the value to modify
499/// @param[in] v_min Minimum to clamp the value to
500/// @param[in] v_max Maximum to clamp the value to
501/// @param[in] format Printf format to display the value with
502/// @param[in] flags InputText flags to modify the behavior
503/// @return True if the value was changed
504bool InputDouble4L(const char* label, double v[4], double v_min = std::numeric_limits<double>::lowest(), double v_max = std::numeric_limits<double>::max(), const char* format = "%.3f", ImGuiInputTextFlags flags = 0); // NOLINT(hicpp-avoid-c-arrays,modernize-avoid-c-arrays,cppcoreguidelines-avoid-c-arrays)
505
506/// @brief Shows a InputText GUI element with limited amount of characters
507/// @param[in] label Label to display beside the input. Has to be unique (use # to hide text afterwards to append an uid)
508/// @param[in, out] str String to modify
509/// @param[in] limit Amount of characters to limit
510/// @param[in] flags InputText flags to modify the behavior
511/// @return True if the value was changed
512bool InputTextL(const char* label, std::string* str, size_t limit, ImGuiInputTextFlags flags = 0);
513
514} // namespace ImGui
515
516/// @brief Equal comparison operator
517/// @param[in] lhs Left-hand side
518/// @param[in] rhs Right-hand-side
519/// @return True if the elements are equal
520bool operator==(const ImVec4& lhs, const ImVec4& rhs);
521
522/// @brief Unequal comparison operator
523/// @param[in] lhs Left-hand side
524/// @param[in] rhs Right-hand-side
525/// @return True if the elements are unequal
526bool operator!=(const ImVec4& lhs, const ImVec4& rhs);
bool operator==(const ImVec4 &lhs, const ImVec4 &rhs)
Equal comparison operator.
Definition imgui_ex.cpp:370
bool operator!=(const ImVec4 &lhs, const ImVec4 &rhs)
Unequal comparison operator.
Definition imgui_ex.cpp:375
bool InputFloat3L(const char *label, float v[3], float v_min, float v_max, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'float[3]'.
Definition imgui_ex.cpp:214
bool DragLong2(const char *label, int64_t v[2], float v_speed, int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'int64[2]'.
Definition imgui_ex.cpp:46
bool SliderLong3(const char *label, int64_t v[3], int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'int64[3]'.
Definition imgui_ex.cpp:117
bool DragULong3(const char *label, uint64_t v[3], float v_speed, uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'uint64[3]'.
Definition imgui_ex.cpp:73
bool SliderUInt4(const char *label, uint32_t v[4], uint32_t v_min, uint32_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'uint32[4]'.
Definition imgui_ex.cpp:166
bool SliderDouble4(const char *label, double v[4], double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'double[4]'.
Definition imgui_ex.cpp:100
bool InputTextL(const char *label, std::string *str, size_t limit, ImGuiInputTextFlags flags)
Shows a InputText GUI element with limited amount of characters.
Definition imgui_ex.cpp:346
bool SliderLong2(const char *label, int64_t v[2], int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'int64[2]'.
Definition imgui_ex.cpp:112
bool SliderDouble3(const char *label, double v[3], double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'double[3]'.
Definition imgui_ex.cpp:95
bool InputIntL(const char *label, int *v, int v_min, int v_max, int step, int step_fast, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for 'int'.
Definition imgui_ex.cpp:242
bool InputDouble4(const char *label, double v[4], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[4]'.
Definition imgui_ex.cpp:183
bool DragLong3(const char *label, int64_t v[3], float v_speed, int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'int64[3]'.
Definition imgui_ex.cpp:51
bool InputFloat2L(const char *label, float v[2], float v_min, float v_max, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'float[2]'.
Definition imgui_ex.cpp:200
bool SliderULong4(const char *label, uint64_t v[4], uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'uint64[4]'.
Definition imgui_ex.cpp:144
bool InputInt2L(const char *label, int v[2], int v_min, int v_max, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'int[2]'.
Definition imgui_ex.cpp:252
bool SliderLong4(const char *label, int64_t v[4], int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'int64[4]'.
Definition imgui_ex.cpp:122
bool DragDouble4(const char *label, double v[4], float v_speed, double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'double[4]'.
Definition imgui_ex.cpp:34
bool DragLong4(const char *label, int64_t v[4], float v_speed, int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'int64[4]'.
Definition imgui_ex.cpp:56
bool InputDouble4L(const char *label, double v[4], double v_min, double v_max, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'double[4]'.
Definition imgui_ex.cpp:332
bool InputInt3L(const char *label, int v[3], int v_min, int v_max, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'int[3]'.
Definition imgui_ex.cpp:266
bool DragULong2(const char *label, uint64_t v[2], float v_speed, uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'uint64[2]'.
Definition imgui_ex.cpp:68
bool SliderUInt(const char *label, uint32_t *v, uint32_t v_min, uint32_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for 'uint32'.
Definition imgui_ex.cpp:151
bool DragDouble2(const char *label, double v[2], float v_speed, double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'double[2]'.
Definition imgui_ex.cpp:24
bool InputDouble3L(const char *label, double v[3], double v_min, double v_max, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'double[3]'.
Definition imgui_ex.cpp:318
bool InputFloat4L(const char *label, float v[4], float v_min, float v_max, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'float[4]'.
Definition imgui_ex.cpp:228
bool InputInt4L(const char *label, int v[4], int v_min, int v_max, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'int[4]'.
Definition imgui_ex.cpp:280
bool DragDouble(const char *label, double *v, float v_speed, double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for 'double'.
Definition imgui_ex.cpp:19
bool DragULong4(const char *label, uint64_t v[4], float v_speed, uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'uint64[4]'.
Definition imgui_ex.cpp:78
bool DragULong(const char *label, uint64_t *v, float v_speed, uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for 'uint64'.
Definition imgui_ex.cpp:63
bool InputFloatL(const char *label, float *v, float v_min, float v_max, float step, float step_fast, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for 'float'.
Definition imgui_ex.cpp:190
bool InputDouble2(const char *label, double v[2], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[2]'.
Definition imgui_ex.cpp:173
bool DragDouble3(const char *label, double v[3], float v_speed, double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for an array of 'double[3]'.
Definition imgui_ex.cpp:29
bool SliderULong(const char *label, uint64_t *v, uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for 'uint64'.
Definition imgui_ex.cpp:129
bool InputDouble3(const char *label, double v[3], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[3]'.
Definition imgui_ex.cpp:178
bool SliderLong(const char *label, int64_t *v, int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for 'int64'.
Definition imgui_ex.cpp:107
bool SliderUInt2(const char *label, uint32_t v[2], uint32_t v_min, uint32_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'uint32[2]'.
Definition imgui_ex.cpp:156
bool SliderDouble2(const char *label, double v[2], double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'double[2]'.
Definition imgui_ex.cpp:90
bool DragLong(const char *label, int64_t *v, float v_speed, int64_t v_min, int64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Drag GUI element for 'int64'.
Definition imgui_ex.cpp:41
bool SliderUInt3(const char *label, uint32_t v[3], uint32_t v_min, uint32_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'uint32[3]'.
Definition imgui_ex.cpp:161
bool SliderULong3(const char *label, uint64_t v[3], uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'uint64[3]'.
Definition imgui_ex.cpp:139
bool InputDoubleL(const char *label, double *v, double v_min, double v_max, double step, double step_fast, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for 'double'.
Definition imgui_ex.cpp:294
bool InputDouble2L(const char *label, double v[2], double v_min, double v_max, const char *format, ImGuiInputTextFlags flags)
Shows a value limited InputText GUI element for an array of 'double[2]'.
Definition imgui_ex.cpp:304
bool SliderDouble(const char *label, double *v, double v_min, double v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for 'double'.
Definition imgui_ex.cpp:85
bool SliderULong2(const char *label, uint64_t v[2], uint64_t v_min, uint64_t v_max, const char *format, ImGuiSliderFlags flags)
Shows a Slider GUI element for an array of 'uint64[2]'.
Definition imgui_ex.cpp:134