Created
December 30, 2016 00:02
-
-
Save ongamex/155c8b64186a4f5f41353dbfccbb018e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool MyImGui::DragFloats(const char* label, float* floats, int numFloats, bool* pJustReleased, float v_speed, float v_min, float v_max, const char* display_format, float power) | |
{ | |
ImGuiWindow* window = ImGui::GetCurrentWindow(); | |
if(window->SkipItems) | |
return false; | |
if(pJustReleased) { | |
*pJustReleased = false; | |
} | |
ImGuiContext& g = *GImGui; | |
bool value_changed = false; | |
ImGui::BeginGroup(); | |
ImGui::PushID(label); | |
PushMultiItemsWidths(numFloats); // Duplicate from ImGui | |
for(int i = 0; i < numFloats; i++) | |
{ | |
ImGui::PushID(i); | |
value_changed |= ImGui::DragFloat("##v", &floats[i], v_speed, v_min, v_max, display_format, power); | |
if(pJustReleased) { | |
*pJustReleased |= IsItemJustReleased(); // IsItemJustReleased is a hack from issue #820 in ImGui | |
} | |
ImGui::PopID(); | |
ImGui::SameLine(0, g.Style.ItemInnerSpacing.x); | |
ImGui::PopItemWidth(); | |
} | |
ImGui::PopID(); | |
ImGui::TextUnformatted(label, ImGui::FindRenderedTextEnd(label)); | |
ImGui::EndGroup(); | |
return value_changed; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment