|
|
|
@ -539,8 +539,19 @@ static void ShowDemoWindowWidgets() |
|
|
|
|
static float f1=0.123f, f2=0.0f; |
|
|
|
|
ImGui::SliderFloat("slider float", &f1, 0.0f, 1.0f, "ratio = %.3f"); |
|
|
|
|
ImGui::SliderFloat("slider float (curve)", &f2, -10.0f, 10.0f, "%.4f", 2.0f); |
|
|
|
|
|
|
|
|
|
static float angle = 0.0f; |
|
|
|
|
ImGui::SliderAngle("slider angle", &angle); |
|
|
|
|
|
|
|
|
|
// Using the format string to display a name instead of an integer.
|
|
|
|
|
// Here we completely omit '%d' from the format string, so it'll only display a name.
|
|
|
|
|
// This technique can also be used with DragInt().
|
|
|
|
|
enum Element { Element_Fire, Element_Earth, Element_Air, Element_Water, Element_COUNT }; |
|
|
|
|
const char* element_names[Element_COUNT] = { "Fire", "Earth", "Air", "Water" }; |
|
|
|
|
static int current_element = Element_Fire; |
|
|
|
|
const char* current_element_name = (current_element >= 0 && current_element < Element_COUNT) ? element_names[current_element] : "Unknown"; |
|
|
|
|
ImGui::SliderInt("slider enum", ¤t_element, 0, Element_COUNT - 1, current_element_name); |
|
|
|
|
ImGui::SameLine(); HelpMarker("Using the format string parameter to display a name instead of the underlying integer."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
@ -1782,9 +1793,9 @@ static void ShowDemoWindowLayout() |
|
|
|
|
ImGui::Text("SetNextItemWidth/PushItemWidth(-1)"); |
|
|
|
|
ImGui::SameLine(); HelpMarker("Align to right edge"); |
|
|
|
|
ImGui::PushItemWidth(-1); |
|
|
|
|
ImGui::DragFloat("float##5a", &f); |
|
|
|
|
ImGui::DragFloat("float##5b", &f); |
|
|
|
|
ImGui::DragFloat("float##5c", &f); |
|
|
|
|
ImGui::DragFloat("##float5a", &f); |
|
|
|
|
ImGui::DragFloat("##float5b", &f); |
|
|
|
|
ImGui::DragFloat("##float5c", &f); |
|
|
|
|
ImGui::PopItemWidth(); |
|
|
|
|
|
|
|
|
|
ImGui::TreePop(); |
|
|
|
|