|
|
@@ -1,4 +1,4 @@
|
|
|
-// dear imgui, v1.69
|
|
|
+// dear imgui, v1.70 WIP
|
|
|
// (demo code)
|
|
|
|
|
|
// Message to the person tempted to delete this file when integrating Dear ImGui into their code base:
|
|
|
@@ -2565,9 +2565,9 @@ static void ShowDemoWindowMisc()
|
|
|
ImGui::Text("Mouse released:"); for (int i = 0; i < IM_ARRAYSIZE(io.MouseDown); i++) if (ImGui::IsMouseReleased(i)) { ImGui::SameLine(); ImGui::Text("b%d", i); }
|
|
|
ImGui::Text("Mouse wheel: %.1f", io.MouseWheel);
|
|
|
|
|
|
- ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (io.KeysDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("%d (%.02f secs)", i, io.KeysDownDuration[i]); }
|
|
|
- ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
|
|
- ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d", i); }
|
|
|
+ ImGui::Text("Keys down:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (io.KeysDownDuration[i] >= 0.0f) { ImGui::SameLine(); ImGui::Text("%d (0x%X) (%.02f secs)", i, i, io.KeysDownDuration[i]); }
|
|
|
+ ImGui::Text("Keys pressed:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyPressed(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); }
|
|
|
+ ImGui::Text("Keys release:"); for (int i = 0; i < IM_ARRAYSIZE(io.KeysDown); i++) if (ImGui::IsKeyReleased(i)) { ImGui::SameLine(); ImGui::Text("%d (0x%X)", i, i); }
|
|
|
ImGui::Text("Keys mods: %s%s%s%s", io.KeyCtrl ? "CTRL " : "", io.KeyShift ? "SHIFT " : "", io.KeyAlt ? "ALT " : "", io.KeySuper ? "SUPER " : "");
|
|
|
|
|
|
ImGui::Text("NavInputs down:"); for (int i = 0; i < IM_ARRAYSIZE(io.NavInputs); i++) if (io.NavInputs[i] > 0.0f) { ImGui::SameLine(); ImGui::Text("[%d] %.2f", i, io.NavInputs[i]); }
|
|
|
@@ -2646,22 +2646,17 @@ static void ShowDemoWindowMisc()
|
|
|
for (int button = 0; button < 3; button++)
|
|
|
ImGui::Text("IsMouseDragging(%d):\n w/ default threshold: %d,\n w/ zero threshold: %d\n w/ large threshold: %d",
|
|
|
button, ImGui::IsMouseDragging(button), ImGui::IsMouseDragging(button, 0.0f), ImGui::IsMouseDragging(button, 20.0f));
|
|
|
+
|
|
|
ImGui::Button("Drag Me");
|
|
|
if (ImGui::IsItemActive())
|
|
|
- {
|
|
|
- // Draw a line between the button and the mouse cursor
|
|
|
- ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
|
|
- draw_list->PushClipRectFullScreen();
|
|
|
- draw_list->AddLine(io.MouseClickedPos[0], io.MousePos, ImGui::GetColorU32(ImGuiCol_Button), 4.0f);
|
|
|
- draw_list->PopClipRect();
|
|
|
-
|
|
|
- // Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
|
|
- // You can request a lower or higher threshold using the second parameter of IsMouseDragging() and GetMouseDragDelta()
|
|
|
- ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f);
|
|
|
- ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0);
|
|
|
- ImVec2 mouse_delta = io.MouseDelta;
|
|
|
- ImGui::SameLine(); ImGui::Text("Raw (%.1f, %.1f), WithLockThresold (%.1f, %.1f), MouseDelta (%.1f, %.1f)", value_raw.x, value_raw.y, value_with_lock_threshold.x, value_with_lock_threshold.y, mouse_delta.x, mouse_delta.y);
|
|
|
- }
|
|
|
+ ImGui::GetForegroundDrawList()->AddLine(io.MouseClickedPos[0], io.MousePos, ImGui::GetColorU32(ImGuiCol_Button), 4.0f); // Draw a line between the button and the mouse cursor
|
|
|
+
|
|
|
+ // Drag operations gets "unlocked" when the mouse has moved past a certain threshold (the default threshold is stored in io.MouseDragThreshold)
|
|
|
+ // You can request a lower or higher threshold using the second parameter of IsMouseDragging() and GetMouseDragDelta()
|
|
|
+ ImVec2 value_raw = ImGui::GetMouseDragDelta(0, 0.0f);
|
|
|
+ ImVec2 value_with_lock_threshold = ImGui::GetMouseDragDelta(0);
|
|
|
+ ImVec2 mouse_delta = io.MouseDelta;
|
|
|
+ ImGui::Text("GetMouseDragDelta(0):\n w/ default threshold: (%.1f, %.1f),\n w/ zero threshold: (%.1f, %.1f)\nMouseDelta: (%.1f, %.1f)", value_with_lock_threshold.x, value_with_lock_threshold.y, value_raw.x, value_raw.y, mouse_delta.x, mouse_delta.y);
|
|
|
ImGui::TreePop();
|
|
|
}
|
|
|
|