Updated ImGui.
This commit is contained in:
parent
ee8989e416
commit
983908bf93
2
3rdparty/dear-imgui/imgui.h
vendored
2
3rdparty/dear-imgui/imgui.h
vendored
@ -1277,7 +1277,7 @@ struct ImVector
|
||||
inline const T* find(const T& v) const { const T* data = Data; const T* data_end = Data + Size; while (data < data_end) if (*data == v) break; else ++data; return data; }
|
||||
inline bool find_erase(const T& v) { const T* it = find(v); if (it < Data + Size) { erase(it); return true; } return false; }
|
||||
inline bool find_erase_unsorted(const T& v) { const T* it = find(v); if (it < Data + Size) { erase_unsorted(it); return true; } return false; }
|
||||
inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it <= Data+Size); const ptrdiff_t off = it - Data; return (int)off; }
|
||||
inline int index_from_ptr(const T* it) const { IM_ASSERT(it >= Data && it < Data + Size); const ptrdiff_t off = it - Data; return (int)off; }
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
47
3rdparty/dear-imgui/imgui_demo.cpp
vendored
47
3rdparty/dear-imgui/imgui_demo.cpp
vendored
@ -1506,24 +1506,21 @@ static void ShowDemoWindowWidgets()
|
||||
|
||||
if (ImGui::TreeNode("Drag and Drop"))
|
||||
{
|
||||
if (ImGui::TreeNode("Drag and drop in standard widgets"))
|
||||
{
|
||||
// ColorEdit widgets automatically act as drag source and drag target.
|
||||
// They are using standardized payload strings IMGUI_PAYLOAD_TYPE_COLOR_3F and IMGUI_PAYLOAD_TYPE_COLOR_4F to allow your own widgets
|
||||
// to use colors in their drag and drop interaction. Also see the demo in Color Picker -> Palette demo.
|
||||
ImGui::BulletText("Drag and drop in standard widgets");
|
||||
ImGui::SameLine();
|
||||
HelpMarker("You can drag from the colored squares.");
|
||||
ImGui::Indent();
|
||||
static float col1[3] = { 1.0f,0.0f,0.2f };
|
||||
static float col2[4] = { 0.4f,0.7f,0.0f,0.5f };
|
||||
static float col1[3] = { 1.0f, 0.0f, 0.2f };
|
||||
static float col2[4] = { 0.4f, 0.7f, 0.0f, 0.5f };
|
||||
ImGui::ColorEdit3("color 1", col1);
|
||||
ImGui::ColorEdit4("color 2", col2);
|
||||
ImGui::Unindent();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Drag and drop to copy/swap items"))
|
||||
{
|
||||
ImGui::BulletText("Drag and drop to copy/swap items");
|
||||
ImGui::Indent();
|
||||
enum Mode
|
||||
{
|
||||
Mode_Copy,
|
||||
@ -1577,7 +1574,31 @@ static void ShowDemoWindowWidgets()
|
||||
}
|
||||
ImGui::PopID();
|
||||
}
|
||||
ImGui::Unindent();
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
if (ImGui::TreeNode("Drag to reorder items (simple)"))
|
||||
{
|
||||
// Simple reordering
|
||||
HelpMarker("We don't use the drag and drop api at all here! Instead we query when the item is held but not hovered, and order items accordingly.");
|
||||
static const char* item_names[] = { "Item One", "Item Two", "Item Three", "Item Four", "Item Five" };
|
||||
for (int n = 0; n < IM_ARRAYSIZE(item_names); n++)
|
||||
{
|
||||
const char* item = item_names[n];
|
||||
ImGui::Selectable(item);
|
||||
|
||||
if (ImGui::IsItemActive() && !ImGui::IsItemHovered())
|
||||
{
|
||||
int n_next = n + (ImGui::GetMouseDragDelta(0).y < 0.f ? -1 : 1);
|
||||
if (n_next >= 0 && n_next < IM_ARRAYSIZE(item_names))
|
||||
{
|
||||
item_names[n] = item_names[n_next];
|
||||
item_names[n_next] = item;
|
||||
ImGui::ResetMouseDragDelta();
|
||||
}
|
||||
}
|
||||
}
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
@ -1607,10 +1628,10 @@ static void ShowDemoWindowWidgets()
|
||||
if (item_type == 10){ ret = ImGui::TreeNodeEx("ITEM: TreeNode w/ ImGuiTreeNodeFlags_OpenOnDoubleClick", ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_NoTreePushOnOpen); } // Testing tree node with ImGuiButtonFlags_PressedOnDoubleClick button policy.
|
||||
if (item_type == 11){ const char* items[] = { "Apple", "Banana", "Cherry", "Kiwi" }; static int current = 1; ret = ImGui::ListBox("ITEM: ListBox", ¤t, items, IM_ARRAYSIZE(items), IM_ARRAYSIZE(items)); }
|
||||
|
||||
// Display the value of IsItemHovered() and other common item state functions.
|
||||
// Display the value of IsItemHovered() and other common item state functions.
|
||||
// Note that the ImGuiHoveredFlags_XXX flags can be combined.
|
||||
// Because BulletText is an item itself and that would affect the output of IsItemXXX functions,
|
||||
// we query every state in a single call to avoid storing them and to simplify the code
|
||||
// Because BulletText is an item itself and that would affect the output of IsItemXXX functions,
|
||||
// we query every state in a single call to avoid storing them and to simplify the code
|
||||
ImGui::BulletText(
|
||||
"Return value = %d\n"
|
||||
"IsItemFocused() = %d\n"
|
||||
@ -1653,7 +1674,7 @@ static void ShowDemoWindowWidgets()
|
||||
if (embed_all_inside_a_child_window)
|
||||
ImGui::BeginChild("outer_child", ImVec2(0, ImGui::GetFontSize() * 20), true);
|
||||
|
||||
// Testing IsWindowFocused() function with its various flags.
|
||||
// Testing IsWindowFocused() function with its various flags.
|
||||
// Note that the ImGuiFocusedFlags_XXX flags can be combined.
|
||||
ImGui::BulletText(
|
||||
"IsWindowFocused() = %d\n"
|
||||
|
4
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
4
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
@ -1505,8 +1505,10 @@ bool ImGui::BeginCombo(const char* label, const char* preview_value, ImGuiComboF
|
||||
SetNextWindowPos(pos);
|
||||
}
|
||||
|
||||
// We don't use BeginPopupEx() solely because we have a custom name string, which we could make an argument to BeginPopupEx()
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoMove;
|
||||
|
||||
// Horizontally align ourselves with the framed text
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_Popup | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings;
|
||||
PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(style.FramePadding.x, style.WindowPadding.y));
|
||||
bool ret = Begin(name, NULL, window_flags);
|
||||
PopStyleVar();
|
||||
|
Loading…
Reference in New Issue
Block a user