MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / drawMultiComponentWidget

Function drawMultiComponentWidget

src/visualizer/gui/ui_widgets.cpp:247–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246 template <typename DrawComponent>
247 bool drawMultiComponentWidget(const char* label, const int components, DrawComponent&& draw_component) {
248 bool changed = false;
249 ImGui::BeginGroup();
250 ImGui::PushID(label);
251 ImGui::PushMultiItemsWidths(components, ImGui::CalcItemWidth());
252 for (int i = 0; i < components; ++i) {
253 ImGui::PushID(i);
254 changed |= draw_component(i, MULTI_COMPONENT_LABELS[i]);
255 ImGui::PopID();
256 ImGui::PopItemWidth();
257 if (i + 1 < components)
258 ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
259 }
260 ImGui::PopID();
261
262 const char* const label_end = ImGui::FindRenderedTextEnd(label);
263 if (label != label_end) {
264 ImGui::SameLine(0.0f, ImGui::GetStyle().ItemInnerSpacing.x);
265 ImGui::TextEx(label, label_end);
266 }
267 ImGui::EndGroup();
268 return changed;
269 }
270 } // namespace
271
272 bool InputText(const char* label, char* buf, const std::size_t buf_size, const ImGuiInputTextFlags flags,

Callers 8

DragFloat2Function · 0.85
DragFloat3Function · 0.85
DragFloat4Function · 0.85
DragInt2Function · 0.85
DragInt3Function · 0.85
DragInt4Function · 0.85
SliderFloat2Function · 0.85
SliderFloat3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected