11#include <imgui_stdlib.h>
19bool DragDouble(
const char* label,
double* v,
float v_speed,
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
21 return DragScalar(label, ImGuiDataType_Double, v, v_speed, &v_min, &v_max, format, flags);
24bool DragDouble2(
const char* label,
double v[2],
float v_speed,
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
26 return DragScalarN(label, ImGuiDataType_Double, v, 2, v_speed, &v_min, &v_max, format, flags);
29bool DragDouble3(
const char* label,
double v[3],
float v_speed,
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
31 return DragScalarN(label, ImGuiDataType_Double, v, 3, v_speed, &v_min, &v_max, format, flags);
34bool DragDouble4(
const char* label,
double v[4],
float v_speed,
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
36 return DragScalarN(label, ImGuiDataType_Double, v, 4, v_speed, &v_min, &v_max, format, flags);
41bool DragLong(
const char* label, int64_t* v,
float v_speed, int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
43 return DragScalar(label, ImGuiDataType_S64, v, v_speed, &v_min, &v_max, format, flags);
46bool DragLong2(
const char* label, int64_t v[2],
float v_speed, int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
48 return DragScalarN(label, ImGuiDataType_S64, v, 2, v_speed, &v_min, &v_max, format, flags);
51bool DragLong3(
const char* label, int64_t v[3],
float v_speed, int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
53 return DragScalarN(label, ImGuiDataType_S64, v, 3, v_speed, &v_min, &v_max, format, flags);
56bool DragLong4(
const char* label, int64_t v[4],
float v_speed, int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
58 return DragScalarN(label, ImGuiDataType_S64, v, 4, v_speed, &v_min, &v_max, format, flags);
63bool DragULong(
const char* label, uint64_t* v,
float v_speed, uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
65 return DragScalar(label, ImGuiDataType_U64, v, v_speed, &v_min, &v_max, format, flags);
68bool DragULong2(
const char* label, uint64_t v[2],
float v_speed, uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
70 return DragScalarN(label, ImGuiDataType_U64, v, 2, v_speed, &v_min, &v_max, format, flags);
73bool DragULong3(
const char* label, uint64_t v[3],
float v_speed, uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
75 return DragScalarN(label, ImGuiDataType_U64, v, 3, v_speed, &v_min, &v_max, format, flags);
78bool DragULong4(
const char* label, uint64_t v[4],
float v_speed, uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
80 return DragScalarN(label, ImGuiDataType_U64, v, 4, v_speed, &v_min, &v_max, format, flags);
85bool SliderDouble(
const char* label,
double* v,
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
87 return SliderScalar(label, ImGuiDataType_Double, v, &v_min, &v_max, format, flags);
90bool SliderDouble2(
const char* label,
double v[2],
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
92 return SliderScalarN(label, ImGuiDataType_Double, v, 2, &v_min, &v_max, format, flags);
95bool SliderDouble3(
const char* label,
double v[3],
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
97 return SliderScalarN(label, ImGuiDataType_Double, v, 3, &v_min, &v_max, format, flags);
100bool SliderDouble4(
const char* label,
double v[4],
double v_min,
double v_max,
const char* format, ImGuiSliderFlags flags)
102 return SliderScalarN(label, ImGuiDataType_Double, v, 4, &v_min, &v_max, format, flags);
107bool SliderLong(
const char* label, int64_t* v, int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
109 return SliderScalar(label, ImGuiDataType_S64, v, &v_min, &v_max, format, flags);
112bool SliderLong2(
const char* label, int64_t v[2], int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
114 return SliderScalarN(label, ImGuiDataType_S64, v, 2, &v_min, &v_max, format, flags);
117bool SliderLong3(
const char* label, int64_t v[3], int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
119 return SliderScalarN(label, ImGuiDataType_S64, v, 3, &v_min, &v_max, format, flags);
122bool SliderLong4(
const char* label, int64_t v[4], int64_t v_min, int64_t v_max,
const char* format, ImGuiSliderFlags flags)
124 return SliderScalarN(label, ImGuiDataType_S64, v, 4, &v_min, &v_max, format, flags);
129bool SliderULong(
const char* label, uint64_t* v, uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
131 return SliderScalar(label, ImGuiDataType_U64, v, &v_min, &v_max, format, flags);
134bool SliderULong2(
const char* label, uint64_t v[2], uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
136 return SliderScalarN(label, ImGuiDataType_U64, v, 2, &v_min, &v_max, format, flags);
139bool SliderULong3(
const char* label, uint64_t v[3], uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
141 return SliderScalarN(label, ImGuiDataType_U64, v, 3, &v_min, &v_max, format, flags);
144bool SliderULong4(
const char* label, uint64_t v[4], uint64_t v_min, uint64_t v_max,
const char* format, ImGuiSliderFlags flags)
146 return SliderScalarN(label, ImGuiDataType_U64, v, 4, &v_min, &v_max, format, flags);
151bool SliderUInt(
const char* label, uint32_t* v, uint32_t v_min, uint32_t v_max,
const char* format, ImGuiSliderFlags flags)
153 return SliderScalar(label, ImGuiDataType_U32, v, &v_min, &v_max, format, flags);
156bool SliderUInt2(
const char* label, uint32_t v[2], uint32_t v_min, uint32_t v_max,
const char* format, ImGuiSliderFlags flags)
158 return SliderScalarN(label, ImGuiDataType_U32, v, 2, &v_min, &v_max, format, flags);
161bool SliderUInt3(
const char* label, uint32_t v[3], uint32_t v_min, uint32_t v_max,
const char* format, ImGuiSliderFlags flags)
163 return SliderScalarN(label, ImGuiDataType_U32, v, 3, &v_min, &v_max, format, flags);
166bool SliderUInt4(
const char* label, uint32_t v[4], uint32_t v_min, uint32_t v_max,
const char* format, ImGuiSliderFlags flags)
168 return SliderScalarN(label, ImGuiDataType_U32, v, 4, &v_min, &v_max, format, flags);
173bool InputDouble2(
const char* label,
double v[2],
const char* format, ImGuiInputTextFlags flags)
175 return InputScalarN(label, ImGuiDataType_Double, v, 2,
nullptr,
nullptr, format, flags);
178bool InputDouble3(
const char* label,
double v[3],
const char* format, ImGuiInputTextFlags flags)
180 return InputScalarN(label, ImGuiDataType_Double, v, 3,
nullptr,
nullptr, format, flags);
183bool InputDouble4(
const char* label,
double v[4],
const char* format, ImGuiInputTextFlags flags)
185 return InputScalarN(label, ImGuiDataType_Double, v, 4,
nullptr,
nullptr, format, flags);
190bool InputFloatL(
const char* label,
float* v,
float v_min,
float v_max,
float step,
float step_fast,
const char* format, ImGuiInputTextFlags flags)
192 if (InputFloat(label, v, step, step_fast, format, flags))
194 *v = std::clamp(*v, v_min, v_max);
200bool InputFloat2L(
const char* label,
float v[2],
float v_min,
float v_max,
const char* format, ImGuiInputTextFlags flags)
202 if (InputFloat2(label, v, format, flags))
204 for (
size_t i = 0; i < 2; i++)
206 v[i] = std::clamp(v[i], v_min, v_max);
214bool InputFloat3L(
const char* label,
float v[3],
float v_min,
float v_max,
const char* format, ImGuiInputTextFlags flags)
216 if (InputFloat3(label, v, format, flags))
218 for (
size_t i = 0; i < 3; i++)
220 v[i] = std::clamp(v[i], v_min, v_max);
228bool InputFloat4L(
const char* label,
float v[4],
float v_min,
float v_max,
const char* format, ImGuiInputTextFlags flags)
230 if (InputFloat4(label, v, format, flags))
232 for (
size_t i = 0; i < 4; i++)
234 v[i] = std::clamp(v[i], v_min, v_max);
242bool InputIntL(
const char* label,
int* v,
int v_min,
int v_max,
int step,
int step_fast, ImGuiInputTextFlags flags)
244 if (InputInt(label, v, step, step_fast, flags))
246 *v = std::clamp(*v, v_min, v_max);
252bool InputInt2L(
const char* label,
int v[2],
int v_min,
int v_max, ImGuiInputTextFlags flags)
254 if (InputInt2(label, v, flags))
256 for (
size_t i = 0; i < 2; i++)
258 v[i] = std::clamp(v[i], v_min, v_max);
266bool InputInt3L(
const char* label,
int v[3],
int v_min,
int v_max, ImGuiInputTextFlags flags)
268 if (InputInt3(label, v, flags))
270 for (
size_t i = 0; i < 3; i++)
272 v[i] = std::clamp(v[i], v_min, v_max);
280bool InputInt4L(
const char* label,
int v[4],
int v_min,
int v_max, ImGuiInputTextFlags flags)
282 if (InputInt4(label, v, flags))
284 for (
size_t i = 0; i < 4; i++)
286 v[i] = std::clamp(v[i], v_min, v_max);
294bool InputDoubleL(
const char* label,
double* v,
double v_min,
double v_max,
double step,
double step_fast,
const char* format, ImGuiInputTextFlags flags)
296 if (InputDouble(label, v, step, step_fast, format, flags))
298 *v = std::clamp(*v, v_min, v_max);
304bool InputDouble2L(
const char* label,
double v[2],
double v_min,
double v_max,
const char* format, ImGuiInputTextFlags flags)
308 for (
size_t i = 0; i < 2; i++)
310 v[i] = std::clamp(v[i], v_min, v_max);
318bool InputDouble3L(
const char* label,
double v[3],
double v_min,
double v_max,
const char* format, ImGuiInputTextFlags flags)
322 for (
size_t i = 0; i < 3; i++)
324 v[i] = std::clamp(v[i], v_min, v_max);
332bool InputDouble4L(
const char* label,
double v[4],
double v_min,
double v_max,
const char* format, ImGuiInputTextFlags flags)
336 for (
size_t i = 0; i < 4; i++)
338 v[i] = std::clamp(v[i], v_min, v_max);
346bool InputTextL(
const char* label, std::string* str,
size_t limit, ImGuiInputTextFlags flags)
348 std::pair<std::string, size_t> oldTextLimit = std::make_pair(*str, limit);
349 auto callback = [](ImGuiInputTextCallbackData* data) ->
int {
350 if (data->EventFlag == ImGuiInputTextFlags_CallbackEdit)
352 auto* oldTextLimit =
static_cast<std::pair<std::string, size_t>*
>(data->UserData);
353 int limit =
static_cast<int>(oldTextLimit->second);
354 if (data->BufTextLen > limit)
356 strncpy(data->Buf, oldTextLimit->first.data(), oldTextLimit->first.length() + 1);
357 data->BufTextLen =
static_cast<int>(oldTextLimit->first.length());
358 data->BufDirty =
true;
359 if (data->CursorPos != limit) { data->CursorPos--; }
365 return InputText(label, str, flags | ImGuiInputTextFlags_CallbackEdit, callback, &oldTextLimit);
372 return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z && lhs.w == rhs.w;
377 return lhs.x != rhs.x || lhs.y != rhs.y || lhs.z != rhs.z || lhs.w != rhs.w;
bool operator==(const ImVec4 &lhs, const ImVec4 &rhs)
Equal comparison operator.
bool operator!=(const ImVec4 &lhs, const ImVec4 &rhs)
Unequal comparison operator.
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]'.
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]'.
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]'.
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]'.
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]'.
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]'.
bool InputTextL(const char *label, std::string *str, size_t limit, ImGuiInputTextFlags flags)
Shows a InputText GUI element with limited amount of characters.
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]'.
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]'.
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'.
bool InputDouble4(const char *label, double v[4], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[4]'.
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]'.
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]'.
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]'.
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]'.
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]'.
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]'.
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]'.
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]'.
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]'.
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]'.
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'.
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]'.
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]'.
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]'.
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]'.
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'.
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]'.
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'.
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'.
bool InputDouble2(const char *label, double v[2], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[2]'.
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]'.
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'.
bool InputDouble3(const char *label, double v[3], const char *format, ImGuiInputTextFlags flags)
Shows an InputText GUI element for an array of 'double[3]'.
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'.
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]'.
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]'.
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'.
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]'.
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]'.
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'.
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]'.
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'.
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]'.