mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-18 18:46:13 +01:00
ImStrv: backtracked for now on supporting ImStrv for format strings.
It's widely incomplete and slow, requires a printf function taking non-zero-terminated format string to work. Might do it eventually but it's much less a problem than labels. Format string are more frequently inlined in code and tend to be small, so existing solutions at call site can work better for now.
This commit is contained in:
parent
2c9419b5be
commit
8c29abb70a
67
imgui.h
67
imgui.h
@ -548,7 +548,6 @@ namespace ImGui
|
|||||||
IMGUI_API ImGuiID GetID(int int_id);
|
IMGUI_API ImGuiID GetID(int int_id);
|
||||||
|
|
||||||
// Widgets: Text
|
// Widgets: Text
|
||||||
// FIXME-IMSTR: Functions taking format should use ImStrv. It breaks IM_FMTARGS() macro however.
|
|
||||||
IMGUI_API void TextUnformatted(ImStrv text); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.
|
IMGUI_API void TextUnformatted(ImStrv text); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.
|
||||||
IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // formatted text
|
IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // formatted text
|
||||||
IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
||||||
@ -610,18 +609,18 @@ namespace ImGui
|
|||||||
// - 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.
|
// - 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.
|
||||||
// - Legacy: Pre-1.78 there are DragXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are DragXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
||||||
IMGUI_API bool DragFloat(ImStrv label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound
|
IMGUI_API bool DragFloat(ImStrv label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound
|
||||||
IMGUI_API bool DragFloat2(ImStrv label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragFloat2(ImStrv label, float v[2], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragFloat3(ImStrv label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragFloat3(ImStrv label, float v[3], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragFloat4(ImStrv label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragFloat4(ImStrv label, float v[4], float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragFloatRange2(ImStrv label, float* v_current_min, float* v_current_max, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f, ImStrv format = "%.3f", ImStrv format_max = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragFloatRange2(ImStrv 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, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragInt(ImStrv label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, ImStrv format = "%d", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound
|
IMGUI_API bool DragInt(ImStrv label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0); // If v_min >= v_max we have no bound
|
||||||
IMGUI_API bool DragInt2(ImStrv label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragInt2(ImStrv label, int v[2], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragInt3(ImStrv label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragInt3(ImStrv label, int v[3], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragInt4(ImStrv label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragInt4(ImStrv label, int v[4], float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragIntRange2(ImStrv label, int* v_current_min, int* v_current_max, float v_speed = 1.0f, int v_min = 0, int v_max = 0, ImStrv format = "%d", ImStrv format_max = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragIntRange2(ImStrv 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 = "%d", const char* format_max = NULL, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragScalar(ImStrv label, ImGuiDataType data_type, void* p_data, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, ImStrv format = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragScalar(ImStrv label, ImGuiDataType data_type, void* p_data, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool DragScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, ImStrv format = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool DragScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, float v_speed = 1.0f, const void* p_min = NULL, const void* p_max = NULL, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Regular Sliders
|
// Widgets: Regular Sliders
|
||||||
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
// - CTRL+Click on any slider to turn them into an input box. Manually input values aren't clamped by default and can go off-bounds. Use ImGuiSliderFlags_AlwaysClamp to always clamp.
|
||||||
@ -629,20 +628,20 @@ namespace ImGui
|
|||||||
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
// - Format string may also be set to NULL or use the default format ("%f" or "%d").
|
||||||
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
// - Legacy: Pre-1.78 there are SliderXXX() function signatures that take a final `float power=1.0f' argument instead of the `ImGuiSliderFlags flags=0' argument.
|
||||||
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
// If you get a warning converting a float to ImGuiSliderFlags, read https://github.com/ocornut/imgui/issues/3361
|
||||||
IMGUI_API bool SliderFloat(ImStrv label, float* v, float v_min, float v_max, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.
|
IMGUI_API bool SliderFloat(ImStrv label, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0); // adjust format to decorate the value with a prefix or a suffix for in-slider labels or unit display.
|
||||||
IMGUI_API bool SliderFloat2(ImStrv label, float v[2], float v_min, float v_max, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderFloat2(ImStrv label, float v[2], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderFloat3(ImStrv label, float v[3], float v_min, float v_max, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderFloat3(ImStrv label, float v[3], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderFloat4(ImStrv label, float v[4], float v_min, float v_max, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderFloat4(ImStrv label, float v[4], float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderAngle(ImStrv label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, ImStrv format = "%.0f deg", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderAngle(ImStrv label, float* v_rad, float v_degrees_min = -360.0f, float v_degrees_max = +360.0f, const char* format = "%.0f deg", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt(ImStrv label, int* v, int v_min, int v_max, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderInt(ImStrv label, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt2(ImStrv label, int v[2], int v_min, int v_max, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderInt2(ImStrv label, int v[2], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt3(ImStrv label, int v[3], int v_min, int v_max, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderInt3(ImStrv label, int v[3], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderInt4(ImStrv label, int v[4], int v_min, int v_max, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderInt4(ImStrv label, int v[4], int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, ImStrv format = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool SliderScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, ImStrv format = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool SliderScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool VSliderFloat(ImStrv label, const ImVec2& size, float* v, float v_min, float v_max, ImStrv format = "%.3f", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool VSliderFloat(ImStrv label, const ImVec2& size, float* v, float v_min, float v_max, const char* format = "%.3f", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool VSliderInt(ImStrv label, const ImVec2& size, int* v, int v_min, int v_max, ImStrv format = "%d", ImGuiSliderFlags flags = 0);
|
IMGUI_API bool VSliderInt(ImStrv label, const ImVec2& size, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
|
||||||
IMGUI_API bool VSliderScalar(ImStrv label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, ImStrv format = ImStrv(), ImGuiSliderFlags flags = 0);
|
IMGUI_API bool VSliderScalar(ImStrv label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format = NULL, ImGuiSliderFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Input with Keyboard
|
// Widgets: Input with Keyboard
|
||||||
// - 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.
|
// - 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.
|
||||||
@ -651,17 +650,17 @@ namespace ImGui
|
|||||||
IMGUI_API bool InputText(ImStrv label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputText(ImStrv label, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputTextMultiline(ImStrv label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextMultiline(ImStrv label, char* buf, size_t buf_size, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputTextWithHint(ImStrv label, ImStrv hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
IMGUI_API bool InputTextWithHint(ImStrv label, ImStrv hint, char* buf, size_t buf_size, ImGuiInputTextFlags flags = 0, ImGuiInputTextCallback callback = NULL, void* user_data = NULL);
|
||||||
IMGUI_API bool InputFloat(ImStrv label, float* v, float step = 0.0f, float step_fast = 0.0f, ImStrv format = "%.3f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputFloat(ImStrv label, float* v, float step = 0.0f, float step_fast = 0.0f, const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputFloat2(ImStrv label, float v[2], ImStrv format = "%.3f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputFloat2(ImStrv label, float v[2], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputFloat3(ImStrv label, float v[3], ImStrv format = "%.3f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputFloat3(ImStrv label, float v[3], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputFloat4(ImStrv label, float v[4], ImStrv format = "%.3f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputFloat4(ImStrv label, float v[4], const char* format = "%.3f", ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputInt(ImStrv label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputInt(ImStrv label, int* v, int step = 1, int step_fast = 100, ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputInt2(ImStrv label, int v[2], ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputInt2(ImStrv label, int v[2], ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputInt3(ImStrv label, int v[3], ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputInt3(ImStrv label, int v[3], ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputInt4(ImStrv label, int v[4], ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputInt4(ImStrv label, int v[4], ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputDouble(ImStrv label, double* v, double step = 0.0, double step_fast = 0.0, ImStrv format = "%.6f", ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputDouble(ImStrv label, double* v, double step = 0.0, double step_fast = 0.0, const char* format = "%.6f", ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_step = NULL, const void* p_step_fast = NULL, ImStrv format = ImStrv(), ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);
|
||||||
IMGUI_API bool InputScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, const void* p_step = NULL, const void* p_step_fast = NULL, ImStrv format = ImStrv(), ImGuiInputTextFlags flags = 0);
|
IMGUI_API bool InputScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, const void* p_step = NULL, const void* p_step_fast = NULL, const char* format = NULL, ImGuiInputTextFlags flags = 0);
|
||||||
|
|
||||||
// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
|
// Widgets: Color Editor/Picker (tip: the ColorEdit* functions have a little color square that can be left-clicked to open a picker, and right-clicked to open an option menu.)
|
||||||
// - Note that in C++ 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.
|
// - Note that in C++ 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.
|
||||||
|
@ -2582,7 +2582,7 @@ bool ImGui::DragBehavior(ImGuiID id, ImGuiDataType data_type, void* p_v, float v
|
|||||||
|
|
||||||
// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a Drag widget, p_min and p_max are optional.
|
// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a Drag widget, p_min and p_max are optional.
|
||||||
// Read code of e.g. DragFloat(), DragInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
// Read code of e.g. DragFloat(), DragInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
||||||
bool ImGui::DragScalar(ImStrv label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, ImStrv format_p, ImGuiSliderFlags flags)
|
bool ImGui::DragScalar(ImStrv label, ImGuiDataType data_type, void* p_data, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -2602,21 +2602,9 @@ bool ImGui::DragScalar(ImStrv label, ImGuiDataType data_type, void* p_data, floa
|
|||||||
if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemFlags_Inputable : 0))
|
if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemFlags_Inputable : 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// FIXME-IMSTR
|
|
||||||
const char* format;
|
|
||||||
char format_buf[64];
|
|
||||||
if (!format_p)
|
|
||||||
{
|
|
||||||
// Default format string when passing NULL
|
// Default format string when passing NULL
|
||||||
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Copy format string (format may not be zero-terminated)
|
|
||||||
format = format_buf;
|
|
||||||
IM_ASSERT(format_p.End - format_p.Begin < IM_ARRAYSIZE(format_buf));
|
|
||||||
ImStrncpy(format_buf, format_p, IM_ARRAYSIZE(format_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
||||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||||
@ -2689,7 +2677,7 @@ bool ImGui::DragScalar(ImStrv label, ImGuiDataType data_type, void* p_data, floa
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, float v_speed, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -2724,28 +2712,28 @@ bool ImGui::DragScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragFloat(ImStrv label, float* v, float v_speed, float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragFloat(ImStrv label, float* v, float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, flags);
|
return DragScalar(label, ImGuiDataType_Float, v, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragFloat2(ImStrv label, float v[2], float v_speed, float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragFloat2(ImStrv label, float v[2], float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, flags);
|
return DragScalarN(label, ImGuiDataType_Float, v, 2, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragFloat3(ImStrv label, float v[3], float v_speed, float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragFloat3(ImStrv label, float v[3], float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, flags);
|
return DragScalarN(label, ImGuiDataType_Float, v, 3, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragFloat4(ImStrv label, float v[4], float v_speed, float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragFloat4(ImStrv label, float v[4], float v_speed, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, flags);
|
return DragScalarN(label, ImGuiDataType_Float, v, 4, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
|
// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
|
||||||
bool ImGui::DragFloatRange2(ImStrv label, float* v_current_min, float* v_current_max, float v_speed, float v_min, float v_max, ImStrv format, ImStrv format_max, ImGuiSliderFlags flags)
|
bool ImGui::DragFloatRange2(ImStrv 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, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -2779,28 +2767,28 @@ bool ImGui::DragFloatRange2(ImStrv label, float* v_current_min, float* v_current
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NB: v_speed is float to allow adjusting the drag speed with more precision
|
// NB: v_speed is float to allow adjusting the drag speed with more precision
|
||||||
bool ImGui::DragInt(ImStrv label, int* v, float v_speed, int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragInt(ImStrv label, int* v, float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalar(label, ImGuiDataType_S32, v, v_speed, &v_min, &v_max, format, flags);
|
return DragScalar(label, ImGuiDataType_S32, v, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragInt2(ImStrv label, int v[2], float v_speed, int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragInt2(ImStrv label, int v[2], float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalarN(label, ImGuiDataType_S32, v, 2, v_speed, &v_min, &v_max, format, flags);
|
return DragScalarN(label, ImGuiDataType_S32, v, 2, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragInt3(ImStrv label, int v[3], float v_speed, int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragInt3(ImStrv label, int v[3], float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalarN(label, ImGuiDataType_S32, v, 3, v_speed, &v_min, &v_max, format, flags);
|
return DragScalarN(label, ImGuiDataType_S32, v, 3, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::DragInt4(ImStrv label, int v[4], float v_speed, int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::DragInt4(ImStrv label, int v[4], float v_speed, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return DragScalarN(label, ImGuiDataType_S32, v, 4, v_speed, &v_min, &v_max, format, flags);
|
return DragScalarN(label, ImGuiDataType_S32, v, 4, v_speed, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
|
// NB: You likely want to specify the ImGuiSliderFlags_AlwaysClamp when using this.
|
||||||
bool ImGui::DragIntRange2(ImStrv label, int* v_current_min, int* v_current_max, float v_speed, int v_min, int v_max, ImStrv format, ImStrv format_max, ImGuiSliderFlags flags)
|
bool ImGui::DragIntRange2(ImStrv 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, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -3196,7 +3184,7 @@ bool ImGui::SliderBehavior(const ImRect& bb, ImGuiID id, ImGuiDataType data_type
|
|||||||
|
|
||||||
// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a slider, they are all required.
|
// Note: p_data, p_min and p_max are _pointers_ to a memory address holding the data. For a slider, they are all required.
|
||||||
// Read code of e.g. SliderFloat(), SliderInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
// Read code of e.g. SliderFloat(), SliderInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
||||||
bool ImGui::SliderScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, ImStrv format_p, ImGuiSliderFlags flags)
|
bool ImGui::SliderScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -3216,21 +3204,9 @@ bool ImGui::SliderScalar(ImStrv label, ImGuiDataType data_type, void* p_data, co
|
|||||||
if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemFlags_Inputable : 0))
|
if (!ItemAdd(total_bb, id, &frame_bb, temp_input_allowed ? ImGuiItemFlags_Inputable : 0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// FIXME-IMSTR
|
|
||||||
const char* format;
|
|
||||||
char format_buf[64];
|
|
||||||
if (!format_p)
|
|
||||||
{
|
|
||||||
// Default format string when passing NULL
|
// Default format string when passing NULL
|
||||||
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Copy format string (format may not be zero-terminated)
|
|
||||||
format = format_buf;
|
|
||||||
IM_ASSERT(format_p.End - format_p.Begin < IM_ARRAYSIZE(format_buf));
|
|
||||||
ImStrncpy(format_buf, format_p, IM_ARRAYSIZE(format_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
||||||
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
bool temp_input_is_active = temp_input_allowed && TempInputIsActive(id);
|
||||||
@ -3291,7 +3267,7 @@ bool ImGui::SliderScalar(ImStrv label, ImGuiDataType data_type, void* p_data, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add multiple sliders on 1 line for compact edition of multiple components
|
// Add multiple sliders on 1 line for compact edition of multiple components
|
||||||
bool ImGui::SliderScalarN(ImStrv label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderScalarN(ImStrv label, ImGuiDataType data_type, void* v, int components, const void* v_min, const void* v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -3326,27 +3302,27 @@ bool ImGui::SliderScalarN(ImStrv label, ImGuiDataType data_type, void* v, int co
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderFloat(ImStrv label, float* v, float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderFloat(ImStrv label, float* v, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);
|
return SliderScalar(label, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderFloat2(ImStrv label, float v[2], float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderFloat2(ImStrv label, float v[2], float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, flags);
|
return SliderScalarN(label, ImGuiDataType_Float, v, 2, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderFloat3(ImStrv label, float v[3], float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderFloat3(ImStrv label, float v[3], float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, flags);
|
return SliderScalarN(label, ImGuiDataType_Float, v, 3, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderFloat4(ImStrv label, float v[4], float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderFloat4(ImStrv label, float v[4], float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, flags);
|
return SliderScalarN(label, ImGuiDataType_Float, v, 4, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderAngle(ImStrv label, float* v_rad, float v_degrees_min, float v_degrees_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderAngle(ImStrv label, float* v_rad, float v_degrees_min, float v_degrees_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
if (!format)
|
if (!format)
|
||||||
format = "%.0f deg";
|
format = "%.0f deg";
|
||||||
@ -3357,27 +3333,27 @@ bool ImGui::SliderAngle(ImStrv label, float* v_rad, float v_degrees_min, float v
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderInt(ImStrv label, int* v, int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderInt(ImStrv label, int* v, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalar(label, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
|
return SliderScalar(label, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderInt2(ImStrv label, int v[2], int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderInt2(ImStrv label, int v[2], int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalarN(label, ImGuiDataType_S32, v, 2, &v_min, &v_max, format, flags);
|
return SliderScalarN(label, ImGuiDataType_S32, v, 2, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderInt3(ImStrv label, int v[3], int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderInt3(ImStrv label, int v[3], int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalarN(label, ImGuiDataType_S32, v, 3, &v_min, &v_max, format, flags);
|
return SliderScalarN(label, ImGuiDataType_S32, v, 3, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::SliderInt4(ImStrv label, int v[4], int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::SliderInt4(ImStrv label, int v[4], int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format, flags);
|
return SliderScalarN(label, ImGuiDataType_S32, v, 4, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::VSliderScalar(ImStrv label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, ImStrv format_p, ImGuiSliderFlags flags)
|
bool ImGui::VSliderScalar(ImStrv label, const ImVec2& size, ImGuiDataType data_type, void* p_data, const void* p_min, const void* p_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -3395,21 +3371,9 @@ bool ImGui::VSliderScalar(ImStrv label, const ImVec2& size, ImGuiDataType data_t
|
|||||||
if (!ItemAdd(frame_bb, id))
|
if (!ItemAdd(frame_bb, id))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// FIXME-IMSTR
|
|
||||||
const char* format;
|
|
||||||
char format_buf[64];
|
|
||||||
if (!format_p)
|
|
||||||
{
|
|
||||||
// Default format string when passing NULL
|
// Default format string when passing NULL
|
||||||
|
if (format == NULL)
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Copy format string (format may not be zero-terminated)
|
|
||||||
format = format_buf;
|
|
||||||
IM_ASSERT(format_p.End - format_p.Begin < IM_ARRAYSIZE(format_buf));
|
|
||||||
ImStrncpy(format_buf, format_p, IM_ARRAYSIZE(format_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
const bool hovered = ItemHoverable(frame_bb, id, g.LastItemData.ItemFlags);
|
||||||
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
const bool clicked = hovered && IsMouseClicked(0, ImGuiInputFlags_None, id);
|
||||||
@ -3449,12 +3413,12 @@ bool ImGui::VSliderScalar(ImStrv label, const ImVec2& size, ImGuiDataType data_t
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::VSliderFloat(ImStrv label, const ImVec2& size, float* v, float v_min, float v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::VSliderFloat(ImStrv label, const ImVec2& size, float* v, float v_min, float v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return VSliderScalar(label, size, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);
|
return VSliderScalar(label, size, ImGuiDataType_Float, v, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::VSliderInt(ImStrv label, const ImVec2& size, int* v, int v_min, int v_max, ImStrv format, ImGuiSliderFlags flags)
|
bool ImGui::VSliderInt(ImStrv label, const ImVec2& size, int* v, int v_min, int v_max, const char* format, ImGuiSliderFlags flags)
|
||||||
{
|
{
|
||||||
return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
|
return VSliderScalar(label, size, ImGuiDataType_S32, v, &v_min, &v_max, format, flags);
|
||||||
}
|
}
|
||||||
@ -3684,7 +3648,7 @@ void ImGui::SetNextItemRefVal(ImGuiDataType data_type, void* p_data)
|
|||||||
|
|
||||||
// Note: p_data, p_step, p_step_fast are _pointers_ to a memory address holding the data. For an Input widget, p_step and p_step_fast are optional.
|
// Note: p_data, p_step, p_step_fast are _pointers_ to a memory address holding the data. For an Input widget, p_step and p_step_fast are optional.
|
||||||
// Read code of e.g. InputFloat(), InputInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
// Read code of e.g. InputFloat(), InputInt() etc. or examples in 'Demo->Widgets->Data Types' to understand how to use this function directly.
|
||||||
bool ImGui::InputScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_step, const void* p_step_fast, ImStrv format_p, ImGuiInputTextFlags flags)
|
bool ImGui::InputScalar(ImStrv label, ImGuiDataType data_type, void* p_data, const void* p_step, const void* p_step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -3694,21 +3658,8 @@ bool ImGui::InputScalar(ImStrv label, ImGuiDataType data_type, void* p_data, con
|
|||||||
ImGuiStyle& style = g.Style;
|
ImGuiStyle& style = g.Style;
|
||||||
IM_ASSERT((flags & ImGuiInputTextFlags_EnterReturnsTrue) == 0); // Not supported by InputScalar(). Please open an issue if you this would be useful to you. Otherwise use IsItemDeactivatedAfterEdit()!
|
IM_ASSERT((flags & ImGuiInputTextFlags_EnterReturnsTrue) == 0); // Not supported by InputScalar(). Please open an issue if you this would be useful to you. Otherwise use IsItemDeactivatedAfterEdit()!
|
||||||
|
|
||||||
// FIXME-IMSTR
|
if (format == NULL)
|
||||||
const char* format;
|
|
||||||
char format_buf[64];
|
|
||||||
if (!format_p)
|
|
||||||
{
|
|
||||||
// Default format string when passing NULL
|
|
||||||
format = DataTypeGetInfo(data_type)->PrintFmt;
|
format = DataTypeGetInfo(data_type)->PrintFmt;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Copy format string (format may not be zero-terminated)
|
|
||||||
format = format_buf;
|
|
||||||
IM_ASSERT(format_p.End - format_p.Begin < IM_ARRAYSIZE(format_buf));
|
|
||||||
ImStrncpy(format_buf, format_p, IM_ARRAYSIZE(format_buf));
|
|
||||||
}
|
|
||||||
|
|
||||||
void* p_data_default = (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasRefVal) ? &g.NextItemData.RefVal : &g.DataTypeZeroValue;
|
void* p_data_default = (g.NextItemData.HasFlags & ImGuiNextItemDataFlags_HasRefVal) ? &g.NextItemData.RefVal : &g.DataTypeZeroValue;
|
||||||
|
|
||||||
@ -3781,7 +3732,7 @@ bool ImGui::InputScalar(ImStrv label, ImGuiDataType data_type, void* p_data, con
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, const void* p_step, const void* p_step_fast, ImStrv format, ImGuiInputTextFlags flags)
|
bool ImGui::InputScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, int components, const void* p_step, const void* p_step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
if (window->SkipItems)
|
if (window->SkipItems)
|
||||||
@ -3816,22 +3767,22 @@ bool ImGui::InputScalarN(ImStrv label, ImGuiDataType data_type, void* p_data, in
|
|||||||
return value_changed;
|
return value_changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputFloat(ImStrv label, float* v, float step, float step_fast, ImStrv format, ImGuiInputTextFlags flags)
|
bool ImGui::InputFloat(ImStrv label, float* v, float step, float step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step > 0.0f ? &step : NULL), (void*)(step_fast > 0.0f ? &step_fast : NULL), format, flags);
|
return InputScalar(label, ImGuiDataType_Float, (void*)v, (void*)(step > 0.0f ? &step : NULL), (void*)(step_fast > 0.0f ? &step_fast : NULL), format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputFloat2(ImStrv label, float v[2], ImStrv format, ImGuiInputTextFlags flags)
|
bool ImGui::InputFloat2(ImStrv label, float v[2], const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, flags);
|
return InputScalarN(label, ImGuiDataType_Float, v, 2, NULL, NULL, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputFloat3(ImStrv label, float v[3], ImStrv format, ImGuiInputTextFlags flags)
|
bool ImGui::InputFloat3(ImStrv label, float v[3], const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, flags);
|
return InputScalarN(label, ImGuiDataType_Float, v, 3, NULL, NULL, format, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputFloat4(ImStrv label, float v[4], ImStrv format, ImGuiInputTextFlags flags)
|
bool ImGui::InputFloat4(ImStrv label, float v[4], const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, flags);
|
return InputScalarN(label, ImGuiDataType_Float, v, 4, NULL, NULL, format, flags);
|
||||||
}
|
}
|
||||||
@ -3858,7 +3809,7 @@ bool ImGui::InputInt4(ImStrv label, int v[4], ImGuiInputTextFlags flags)
|
|||||||
return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, "%d", flags);
|
return InputScalarN(label, ImGuiDataType_S32, v, 4, NULL, NULL, "%d", flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::InputDouble(ImStrv label, double* v, double step, double step_fast, ImStrv format, ImGuiInputTextFlags flags)
|
bool ImGui::InputDouble(ImStrv label, double* v, double step, double step_fast, const char* format, ImGuiInputTextFlags flags)
|
||||||
{
|
{
|
||||||
return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step > 0.0 ? &step : NULL), (void*)(step_fast > 0.0 ? &step_fast : NULL), format, flags);
|
return InputScalar(label, ImGuiDataType_Double, (void*)v, (void*)(step > 0.0 ? &step : NULL), (void*)(step_fast > 0.0 ? &step_fast : NULL), format, flags);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user