mirror of
https://github.com/stenzek/duckstation.git
synced 2026-11-07 09:36:00 -10:00
dep/imgui: Add ImGuiSliderFlags_NoFormat
This commit is contained in:
2 files changed
+14
-2
No files matched your search
@@ -2000,6 +2000,7 @@ enum ImGuiSliderFlags_
|
||||
ImGuiSliderFlags_AlwaysClamp = ImGuiSliderFlags_ClampOnInput | ImGuiSliderFlags_ClampZeroRange,
|
||||
//ImGuiSliderFlags_LiveEditOnInput = 1 << 13, // Shortcut to enable LiveEdit for this field.
|
||||
//ImGuiSliderFlags_NoLiveEditOnInput= 1 << 14, // Shortcut to disable LiveEdit for this field.
|
||||
ImGuiSliderFlags_NoFormat = 1 << 15, // Disable formatting, treat format as the literal value.
|
||||
ImGuiSliderFlags_InvalidMask_ = 0x7000000F, // [Internal] We treat using those bits as being potentially a 'float power' argument from legacy API (obsoleted 2020-08) that has got miscast to this enum, and will trigger an assert if needed.
|
||||
};
|
||||
|
||||
|
||||
@@ -3442,12 +3442,23 @@ bool ImGui::SliderScalar(const char* label, ImGuiDataType data_type, void* p_dat
|
||||
// Display value using user-provided display format so user can add prefix/suffix/decorations to the value.
|
||||
const bool is_mixed = (g.LastItemData.ItemFlags & ImGuiItemFlags_MixedValue) != 0;
|
||||
char value_buf[64];
|
||||
const char* value_buf_end = value_buf + DataTypeFormatString(value_buf, IM_COUNTOF(value_buf), data_type, p_data, (is_mixed && g.MixedValueLabel != NULL) ? g.MixedValueLabel : format);
|
||||
const char* value_buf_start;
|
||||
const char* value_buf_end;
|
||||
if (!(flags & ImGuiSliderFlags_NoFormat))
|
||||
{
|
||||
value_buf_start = value_buf;
|
||||
value_buf_end = (value_buf_start + DataTypeFormatString(value_buf, IM_COUNTOF(value_buf), data_type, p_data, (is_mixed && g.MixedValueLabel != NULL) ? g.MixedValueLabel : format));
|
||||
}
|
||||
else
|
||||
{
|
||||
value_buf_start = format;
|
||||
value_buf_end = value_buf_start + ImStrlen(value_buf_start);
|
||||
}
|
||||
if (g.LogEnabled)
|
||||
LogSetNextTextDecoration("{", "}");
|
||||
if (is_mixed)
|
||||
PushStyleColor(ImGuiCol_Text, g.Style.Colors[ImGuiCol_TextMixedValue]);
|
||||
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf, value_buf_end, NULL, ImVec2(0.5f, 0.5f));
|
||||
RenderTextClipped(frame_bb.Min, frame_bb.Max, value_buf_start, value_buf_end, NULL, ImVec2(0.5f, 0.5f));
|
||||
if (is_mixed)
|
||||
PopStyleColor();
|
||||
|
||||
|
||||
Reference in new issue
Block a user