mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 12:08:47 +02:00
Added InputDouble() function. We use a format string instead of a decimal_precision parameter to also for "%e" and variants. (#1011) May transition the other InputXXX function to use format strings as well.
This commit is contained in:
@ -335,8 +335,8 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
{
|
||||
static char str0[128] = "Hello, world!";
|
||||
static int i0=123;
|
||||
static float f0=0.001f;
|
||||
static int i0 = 123;
|
||||
static float f0 = 0.001f;
|
||||
ImGui::InputText("input text", str0, IM_ARRAYSIZE(str0));
|
||||
ImGui::SameLine(); ShowHelpMarker("Hold SHIFT or use mouse to select text.\n" "CTRL+Left/Right to word jump.\n" "CTRL+A or double-click to select all.\n" "CTRL+X,CTRL+C,CTRL+V clipboard.\n" "CTRL+Z,CTRL+Y undo/redo.\n" "ESCAPE to revert.\n");
|
||||
|
||||
@ -345,12 +345,17 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
ImGui::InputFloat("input float", &f0, 0.01f, 1.0f);
|
||||
|
||||
// NB: You can use the %e notation as well.
|
||||
static double d0 = 999999.000001;
|
||||
ImGui::InputDouble("input double", &d0, 0.01f, 1.0f, "%.6f");
|
||||
ImGui::SameLine(); ShowHelpMarker("You can input value using the scientific notation,\n e.g. \"1e+8\" becomes \"100000000\".\n");
|
||||
|
||||
static float vec4a[4] = { 0.10f, 0.20f, 0.30f, 0.44f };
|
||||
ImGui::InputFloat3("input float3", vec4a);
|
||||
}
|
||||
|
||||
{
|
||||
static int i1=50, i2=42;
|
||||
static int i1 = 50, i2 = 42;
|
||||
ImGui::DragInt("drag int", &i1, 1);
|
||||
ImGui::SameLine(); ShowHelpMarker("Click and drag to edit value.\nHold SHIFT/ALT for faster/slower edit.\nDouble-click or CTRL+click to input value.");
|
||||
|
||||
|
Reference in New Issue
Block a user