SpiecsEngine
 
Loading...
Searching...
No Matches

◆ S_DragScalarN()

bool Spices::ImGuiH::S_DragScalarN ( const char * 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 )
static

Draw Drag Scale with different p_min p_max.

Parameters
[in]labelName.
[in]data_typeImGuiDataType.
[in]p_data.
[in]components.
[in]v_speed.
[in]p_min.
[in]p_max.
[in]format.
[in]flags.
Returns
Returns true if draged.

Definition at line 535 of file ImguiHelper.cpp.

546 {
547 using namespace ImGui;
548
549 ImGuiWindow* window = GetCurrentWindow();
550 if (window->SkipItems)
551 return false;
552
553 ImGuiContext& g = *GImGui;
554 bool value_changed = false;
555 BeginGroup();
556 PushID(label);
557 PushMultiItemsWidths(components, CalcItemWidth());
558 size_t type_size = GDataTypeInfo[data_type].Size;
559 for (int i = 0; i < components; i++)
560 {
561 PushID(i);
562 if (i > 0)
563 SameLine(0, g.Style.ItemInnerSpacing.x);
564 const void* cp_min = (float*)p_min + i;
565 const void* cp_mmx = (float*)p_max + i;
566 value_changed |= DragScalar("", data_type, p_data, v_speed, cp_min, cp_mmx, format, flags);
567 PopID();
568 PopItemWidth();
569 p_data = (void*)((char*)p_data + type_size);
570 }
571 PopID();
572
573 const char* label_end = FindRenderedTextEnd(label);
574 if (label != label_end)
575 {
576 SameLine(0, g.Style.ItemInnerSpacing.x);
577 TextEx(label, label_end);
578 }
579
580 EndGroup();
581 return value_changed;
582 }