mirror of
https://github.com/shadps4-emu/ext-imgui.git
synced 2024-11-23 18:29:42 +00:00
Renamed all "display_format" arguments to "format" to emphasis that they also affect rounding of values. (#648, #642)
This commit is contained in:
parent
8a38271a7c
commit
73445ff248
156
imgui.cpp
156
imgui.cpp
@ -746,10 +746,10 @@ static bool InputTextFilterCharacter(unsigned int* p_char, ImGuiInpu
|
||||
static int InputTextCalcTextLenAndLineCount(const char* text_begin, const char** out_text_end);
|
||||
static ImVec2 InputTextCalcTextSizeW(const ImWchar* text_begin, const ImWchar* text_end, const ImWchar** remaining = NULL, ImVec2* out_offset = NULL, bool stop_on_new_line = false);
|
||||
|
||||
static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* display_format);
|
||||
static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* format);
|
||||
static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, int decimal_precision);
|
||||
static void DataTypeApplyOp(ImGuiDataType data_type, int op, void* output, void* arg_1, const void* arg_2);
|
||||
static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* scalar_format);
|
||||
static bool DataTypeApplyOpFromText(const char* buf, const char* initial_value_buf, ImGuiDataType data_type, void* data_ptr, const char* format);
|
||||
|
||||
namespace ImGui
|
||||
{
|
||||
@ -8441,14 +8441,14 @@ void ImGui::BulletText(const char* fmt, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* display_format)
|
||||
static inline int DataTypeFormatString(char* buf, int buf_size, ImGuiDataType data_type, const void* data_ptr, const char* format)
|
||||
{
|
||||
if (data_type == ImGuiDataType_Int)
|
||||
return ImFormatString(buf, buf_size, display_format, *(const int*)data_ptr);
|
||||
return ImFormatString(buf, buf_size, format, *(const int*)data_ptr);
|
||||
if (data_type == ImGuiDataType_Float)
|
||||
return ImFormatString(buf, buf_size, display_format, *(const float*)data_ptr);
|
||||
return ImFormatString(buf, buf_size, format, *(const float*)data_ptr);
|
||||
if (data_type == ImGuiDataType_Double)
|
||||
return ImFormatString(buf, buf_size, display_format, *(const double*)data_ptr);
|
||||
return ImFormatString(buf, buf_size, format, *(const double*)data_ptr);
|
||||
IM_ASSERT(0);
|
||||
return 0;
|
||||
}
|
||||
@ -8832,11 +8832,11 @@ bool ImGui::SliderBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v
|
||||
}
|
||||
|
||||
// Use power!=1.0 for logarithmic sliders.
|
||||
// Adjust display_format to decorate the value with a prefix or a suffix.
|
||||
// Adjust format to decorate the value with a prefix or a suffix.
|
||||
// "%.3f" 1.234
|
||||
// "%5.2f secs" 01.23 secs
|
||||
// "Gold: %.0f" Gold: 1
|
||||
bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -8859,9 +8859,9 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
||||
}
|
||||
const bool hovered = ItemHoverable(frame_bb, id);
|
||||
|
||||
if (!display_format)
|
||||
display_format = "%.3f";
|
||||
int decimal_precision = ParseFormatPrecision(display_format, 3);
|
||||
if (!format)
|
||||
format = "%.3f";
|
||||
int decimal_precision = ParseFormatPrecision(format, 3);
|
||||
|
||||
// Tabbing or CTRL-clicking on Slider turns it into an input box
|
||||
bool start_text_input = false;
|
||||
@ -8887,7 +8887,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
||||
|
||||
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
||||
char value_buf[64];
|
||||
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
||||
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), format, *v);
|
||||
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f));
|
||||
|
||||
if (label_size.x > 0.0f)
|
||||
@ -8896,7 +8896,7 @@ bool ImGui::SliderFloat(const char* label, float* v, float v_min, float v_max, c
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -8915,9 +8915,9 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
|
||||
return false;
|
||||
const bool hovered = ItemHoverable(frame_bb, id);
|
||||
|
||||
if (!display_format)
|
||||
display_format = "%.3f";
|
||||
int decimal_precision = ParseFormatPrecision(display_format, 3);
|
||||
if (!format)
|
||||
format = "%.3f";
|
||||
int decimal_precision = ParseFormatPrecision(format, 3);
|
||||
|
||||
if ((hovered && g.IO.MouseClicked[0]) || g.NavActivateId == id || g.NavInputId == id)
|
||||
{
|
||||
@ -8933,7 +8933,7 @@ bool ImGui::VSliderFloat(const char* label, const ImVec2& size, float* v, float
|
||||
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
||||
// For the vertical slider we allow centered text to overlap the frame padding
|
||||
char value_buf[64];
|
||||
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
||||
char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), format, *v);
|
||||
RenderTextClipped(ImVec2(frame_bb.Min.x, frame_bb.Min.y + style.FramePadding.y), frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.0f));
|
||||
if (label_size.x > 0.0f)
|
||||
RenderText(ImVec2(frame_bb.Max.x + style.ItemInnerSpacing.x, frame_bb.Min.y + style.FramePadding.y), label);
|
||||
@ -8949,28 +8949,28 @@ bool ImGui::SliderAngle(const char* label, float* v_rad, float v_degrees_min, fl
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::SliderInt(const char* label, int* v, int v_min, int v_max, const char* format)
|
||||
{
|
||||
if (!display_format)
|
||||
display_format = "%.0f";
|
||||
if (!format)
|
||||
format = "%.0f";
|
||||
float v_f = (float)*v;
|
||||
bool value_changed = SliderFloat(label, &v_f, (float)v_min, (float)v_max, display_format, 1.0f);
|
||||
bool value_changed = SliderFloat(label, &v_f, (float)v_min, (float)v_max, format, 1.0f);
|
||||
*v = (int)v_f;
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format)
|
||||
{
|
||||
if (!display_format)
|
||||
display_format = "%.0f";
|
||||
if (!format)
|
||||
format = "%.0f";
|
||||
float v_f = (float)*v;
|
||||
bool value_changed = VSliderFloat(label, size, &v_f, (float)v_min, (float)v_max, display_format, 1.0f);
|
||||
bool value_changed = VSliderFloat(label, size, &v_f, (float)v_min, (float)v_max, format, 1.0f);
|
||||
*v = (int)v_f;
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
// Add multiple sliders on 1 line for compact edition of multiple components
|
||||
bool ImGui::SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::SliderFloatN(const char* label, float* v, int components, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -8984,7 +8984,7 @@ bool ImGui::SliderFloatN(const char* label, float* v, int components, float v_mi
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
value_changed |= SliderFloat("##v", &v[i], v_min, v_max, display_format, power);
|
||||
value_changed |= SliderFloat("##v", &v[i], v_min, v_max, format, power);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
@ -8997,22 +8997,22 @@ bool ImGui::SliderFloatN(const char* label, float* v, int components, float v_mi
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
return SliderFloatN(label, v, 2, v_min, v_max, display_format, power);
|
||||
return SliderFloatN(label, v, 2, v_min, v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
return SliderFloatN(label, v, 3, v_min, v_max, display_format, power);
|
||||
return SliderFloatN(label, v, 3, v_min, v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
return SliderFloatN(label, v, 4, v_min, v_max, display_format, power);
|
||||
return SliderFloatN(label, v, 4, v_min, v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::SliderIntN(const char* label, int* v, int components, int v_min, int v_max, const char* format)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -9026,7 +9026,7 @@ bool ImGui::SliderIntN(const char* label, int* v, int components, int v_min, int
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
value_changed |= SliderInt("##v", &v[i], v_min, v_max, display_format);
|
||||
value_changed |= SliderInt("##v", &v[i], v_min, v_max, format);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
@ -9039,19 +9039,19 @@ bool ImGui::SliderIntN(const char* label, int* v, int components, int v_min, int
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format)
|
||||
{
|
||||
return SliderIntN(label, v, 2, v_min, v_max, display_format);
|
||||
return SliderIntN(label, v, 2, v_min, v_max, format);
|
||||
}
|
||||
|
||||
bool ImGui::SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format)
|
||||
{
|
||||
return SliderIntN(label, v, 3, v_min, v_max, display_format);
|
||||
return SliderIntN(label, v, 3, v_min, v_max, format);
|
||||
}
|
||||
|
||||
bool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format)
|
||||
{
|
||||
return SliderIntN(label, v, 4, v_min, v_max, display_format);
|
||||
return SliderIntN(label, v, 4, v_min, v_max, format);
|
||||
}
|
||||
|
||||
bool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_speed, float v_min, float v_max, int decimal_precision, float power)
|
||||
@ -9144,7 +9144,7 @@ bool ImGui::DragBehavior(const ImRect& frame_bb, ImGuiID id, float* v, float v_s
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -9168,9 +9168,9 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
|
||||
}
|
||||
const bool hovered = ItemHoverable(frame_bb, id);
|
||||
|
||||
if (!display_format)
|
||||
display_format = "%.3f";
|
||||
int decimal_precision = ParseFormatPrecision(display_format, 3);
|
||||
if (!format)
|
||||
format = "%.3f";
|
||||
int decimal_precision = ParseFormatPrecision(format, 3);
|
||||
|
||||
// Tabbing or CTRL-clicking on Drag turns it into an input box
|
||||
bool start_text_input = false;
|
||||
@ -9196,7 +9196,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
|
||||
|
||||
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
||||
char value_buf[64];
|
||||
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), display_format, *v);
|
||||
const char* value_buf_end = value_buf + ImFormatString(value_buf, IM_ARRAYSIZE(value_buf), format, *v);
|
||||
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f,0.5f));
|
||||
|
||||
if (label_size.x > 0.0f)
|
||||
@ -9205,7 +9205,7 @@ bool ImGui::DragFloat(const char* label, float* v, float v_speed, float v_min, f
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::DragFloatN(const char* label, float* v, int components, float v_speed, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -9219,7 +9219,7 @@ bool ImGui::DragFloatN(const char* label, float* v, int components, float v_spee
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
value_changed |= DragFloat("##v", &v[i], v_speed, v_min, v_max, display_format, power);
|
||||
value_changed |= DragFloat("##v", &v[i], v_speed, v_min, v_max, format, power);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
@ -9232,22 +9232,22 @@ bool ImGui::DragFloatN(const char* label, float* v, int components, float v_spee
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::DragFloat2(const char* label, float v[2], float v_speed, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
return DragFloatN(label, v, 2, v_speed, v_min, v_max, display_format, power);
|
||||
return DragFloatN(label, v, 2, v_speed, v_min, v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::DragFloat3(const char* label, float v[3], float v_speed, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
return DragFloatN(label, v, 3, v_speed, v_min, v_max, display_format, power);
|
||||
return DragFloatN(label, v, 3, v_speed, v_min, v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* display_format, float power)
|
||||
bool ImGui::DragFloat4(const char* label, float v[4], float v_speed, float v_min, float v_max, const char* format, float power)
|
||||
{
|
||||
return DragFloatN(label, v, 4, v_speed, v_min, v_max, display_format, power);
|
||||
return DragFloatN(label, v, 4, v_speed, v_min, v_max, format, power);
|
||||
}
|
||||
|
||||
bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* display_format, const char* display_format_max, float power)
|
||||
bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, const char* format, const char* format_max, float power)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -9258,10 +9258,10 @@ bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_cu
|
||||
BeginGroup();
|
||||
PushMultiItemsWidths(2);
|
||||
|
||||
bool value_changed = DragFloat("##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format, power);
|
||||
bool value_changed = DragFloat("##min", v_current_min, v_speed, (v_min >= v_max) ? -FLT_MAX : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), format, power);
|
||||
PopItemWidth();
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
value_changed |= DragFloat("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, display_format_max ? display_format_max : display_format, power);
|
||||
value_changed |= DragFloat("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? FLT_MAX : v_max, format_max ? format_max : format, power);
|
||||
PopItemWidth();
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
|
||||
@ -9273,17 +9273,17 @@ bool ImGui::DragFloatRange2(const char* label, float* v_current_min, float* v_cu
|
||||
}
|
||||
|
||||
// NB: v_speed is float to allow adjusting the drag speed with more precision
|
||||
bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::DragInt(const char* label, int* v, float v_speed, int v_min, int v_max, const char* format)
|
||||
{
|
||||
if (!display_format)
|
||||
display_format = "%.0f";
|
||||
if (!format)
|
||||
format = "%.0f";
|
||||
float v_f = (float)*v;
|
||||
bool value_changed = DragFloat(label, &v_f, v_speed, (float)v_min, (float)v_max, display_format);
|
||||
bool value_changed = DragFloat(label, &v_f, v_speed, (float)v_min, (float)v_max, format);
|
||||
*v = (int)v_f;
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::DragIntN(const char* label, int* v, int components, float v_speed, int v_min, int v_max, const char* format)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -9297,7 +9297,7 @@ bool ImGui::DragIntN(const char* label, int* v, int components, float v_speed, i
|
||||
for (int i = 0; i < components; i++)
|
||||
{
|
||||
PushID(i);
|
||||
value_changed |= DragInt("##v", &v[i], v_speed, v_min, v_max, display_format);
|
||||
value_changed |= DragInt("##v", &v[i], v_speed, v_min, v_max, format);
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
PopID();
|
||||
PopItemWidth();
|
||||
@ -9310,22 +9310,22 @@ bool ImGui::DragIntN(const char* label, int* v, int components, float v_speed, i
|
||||
return value_changed;
|
||||
}
|
||||
|
||||
bool ImGui::DragInt2(const char* label, int v[2], float v_speed, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::DragInt2(const char* label, int v[2], float v_speed, int v_min, int v_max, const char* format)
|
||||
{
|
||||
return DragIntN(label, v, 2, v_speed, v_min, v_max, display_format);
|
||||
return DragIntN(label, v, 2, v_speed, v_min, v_max, format);
|
||||
}
|
||||
|
||||
bool ImGui::DragInt3(const char* label, int v[3], float v_speed, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::DragInt3(const char* label, int v[3], float v_speed, int v_min, int v_max, const char* format)
|
||||
{
|
||||
return DragIntN(label, v, 3, v_speed, v_min, v_max, display_format);
|
||||
return DragIntN(label, v, 3, v_speed, v_min, v_max, format);
|
||||
}
|
||||
|
||||
bool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int v_max, const char* display_format)
|
||||
bool ImGui::DragInt4(const char* label, int v[4], float v_speed, int v_min, int v_max, const char* format)
|
||||
{
|
||||
return DragIntN(label, v, 4, v_speed, v_min, v_max, display_format);
|
||||
return DragIntN(label, v, 4, v_speed, v_min, v_max, format);
|
||||
}
|
||||
|
||||
bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* display_format, const char* display_format_max)
|
||||
bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, const char* format, const char* format_max)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (window->SkipItems)
|
||||
@ -9336,10 +9336,10 @@ bool ImGui::DragIntRange2(const char* label, int* v_current_min, int* v_current_
|
||||
BeginGroup();
|
||||
PushMultiItemsWidths(2);
|
||||
|
||||
bool value_changed = DragInt("##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), display_format);
|
||||
bool value_changed = DragInt("##min", v_current_min, v_speed, (v_min >= v_max) ? INT_MIN : v_min, (v_min >= v_max) ? *v_current_max : ImMin(v_max, *v_current_max), format);
|
||||
PopItemWidth();
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
value_changed |= DragInt("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, display_format_max ? display_format_max : display_format);
|
||||
value_changed |= DragInt("##max", v_current_max, v_speed, (v_min >= v_max) ? *v_current_min : ImMax(v_min, *v_current_min), (v_min >= v_max) ? INT_MAX : v_max, format_max ? format_max : format);
|
||||
PopItemWidth();
|
||||
SameLine(0, g.Style.ItemInnerSpacing.x);
|
||||
|
||||
@ -10543,7 +10543,7 @@ bool ImGui::InputTextMultiline(const char* label, char* buf, size_t buf_size, co
|
||||
return InputTextEx(label, buf, (int)buf_size, size, flags | ImGuiInputTextFlags_Multiline, callback, user_data);
|
||||
}
|
||||
|
||||
// NB: scalar_format here must be a simple "%xx" format string with no prefix/suffix (unlike the Drag/Slider functions "display_format" argument)
|
||||
// NB: scalar_format here must be a simple "%xx" format string with no prefix/suffix (unlike the Drag/Slider functions "format" argument)
|
||||
bool ImGui::InputScalarEx(const char* label, ImGuiDataType data_type, void* data_ptr, void* step_ptr, void* step_fast_ptr, const char* scalar_format, ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
@ -10610,16 +10610,16 @@ bool ImGui::InputFloat(const char* label, float* v, float step, float step_fast,
|
||||
}
|
||||
else
|
||||
{
|
||||
char display_format[16];
|
||||
ImFormatString(display_format, IM_ARRAYSIZE(display_format), "%%.%df", decimal_precision);
|
||||
return InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), display_format, extra_flags);
|
||||
char format[16];
|
||||
ImFormatString(format, IM_ARRAYSIZE(format), "%%.%df", decimal_precision);
|
||||
return InputScalarEx(label, ImGuiDataType_Float, (void*)v, (void*)(step>0.0f ? &step : NULL), (void*)(step_fast>0.0f ? &step_fast : NULL), format, extra_flags);
|
||||
}
|
||||
}
|
||||
|
||||
bool ImGui::InputDouble(const char* label, double* v, double step, double step_fast, const char* display_format, ImGuiInputTextFlags extra_flags)
|
||||
bool ImGui::InputDouble(const char* label, double* v, double step, double step_fast, const char* format, ImGuiInputTextFlags extra_flags)
|
||||
{
|
||||
extra_flags |= ImGuiInputTextFlags_CharsScientific;
|
||||
return InputScalarEx(label, ImGuiDataType_Double, (void*)v, (void*)(step>0.0 ? &step : NULL), (void*)(step_fast>0.0 ? &step_fast : NULL), display_format, extra_flags);
|
||||
return InputScalarEx(label, ImGuiDataType_Double, (void*)v, (void*)(step>0.0 ? &step : NULL), (void*)(step_fast>0.0 ? &step_fast : NULL), format, extra_flags);
|
||||
}
|
||||
|
||||
bool ImGui::InputInt(const char* label, int* v, int step, int step_fast, ImGuiInputTextFlags extra_flags)
|
||||
|
42
imgui.h
42
imgui.h
@ -336,16 +336,16 @@ namespace ImGui
|
||||
// Widgets: Drags (tip: ctrl+click on a drag box to input with keyboard. manually input values aren't clamped, can go off-bounds)
|
||||
// For all the Float2/Float3/Float4/Int2/Int3/Int4 versions of every functions, note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can pass address of your first element out of a contiguous set, e.g. &myvector.x
|
||||
// Speed are per-pixel of mouse movement (v_speed=0.2f: mouse needs to move by 5 pixels to increase value by 1). For gamepad/keyboard navigation, minimum speed is Max(v_speed, minimum_step_at_given_precision).
|
||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* display_format = "%.3f", const char* display_format_max = NULL, float power = 1.0f);
|
||||
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f"); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f");
|
||||
IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* display_format = "%.0f", const char* display_format_max = NULL);
|
||||
IMGUI_API bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragFloat2(const char* label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloat3(const char* label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloat4(const char* label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool DragFloatRange2(const char* label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", const char* format_max = NULL, float power = 1.0f);
|
||||
IMGUI_API bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%.0f"); // If v_min >= v_max we have no bound
|
||||
IMGUI_API bool DragInt2(const char* label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%.0f");
|
||||
IMGUI_API bool DragInt3(const char* label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%.0f");
|
||||
IMGUI_API bool DragInt4(const char* label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%.0f");
|
||||
IMGUI_API bool DragIntRange2(const char* label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%.0f", const char* format_max = NULL);
|
||||
|
||||
// Widgets: Input with Keyboard
|
||||
IMGUI_API bool InputText(const char* label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiTextEditCallback callback = NULL, void* user_data = NULL);
|
||||
@ -358,20 +358,20 @@ namespace ImGui
|
||||
IMGUI_API bool InputInt2(const char* label, int v[2], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt3(const char* label, int v[3], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputInt4(const char* label, int v[4], ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* display_format = "%.6f", ImGuiInputTextFlags extra_flags = 0);
|
||||
IMGUI_API bool InputDouble(const char* label, double* v, double step = 0.0f, double step_fast = 0.0f, const char* format = "%.6f", ImGuiInputTextFlags extra_flags = 0);
|
||||
|
||||
// Widgets: Sliders (tip: ctrl+click on a slider to input with keyboard. manually input values aren't clamped, can go off-bounds)
|
||||
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 for in-slider labels or unit display. Use power!=1.0 for logarithmic sliders
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
IMGUI_API bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display. Use power!=1.0 for logarithmic sliders
|
||||
IMGUI_API bool SliderFloat2(const char* label, float v[2], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat3(const char* label, float v[3], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderFloat4(const char* label, float v[4], float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool SliderAngle(const char* label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f);
|
||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* display_format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* display_format = "%.0f");
|
||||
IMGUI_API bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%.0f");
|
||||
IMGUI_API bool SliderInt2(const char* label, int v[2], int v_min, int v_max, const char* format = "%.0f");
|
||||
IMGUI_API bool SliderInt3(const char* label, int v[3], int v_min, int v_max, const char* format = "%.0f");
|
||||
IMGUI_API bool SliderInt4(const char* label, int v[4], int v_min, int v_max, const char* format = "%.0f");
|
||||
IMGUI_API bool VSliderFloat(const char* label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", float power = 1.0f);
|
||||
IMGUI_API bool VSliderInt(const char* label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%.0f");
|
||||
|
||||
// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little colored preview square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
|
||||
// Note that a 'float v[X]' function argument is the same as 'float* v', the array syntax is just a way to document the number of elements that are expected to be accessible. You can the pass the address of a first float element out of a contiguous structure, e.g. &myvector.x
|
||||
|
Loading…
Reference in New Issue
Block a user