Updated ImGui.
This commit is contained in:
parent
67eedc1b84
commit
4ef0ebbe6a
8
3rdparty/ocornut-imgui/imgui.cpp
vendored
8
3rdparty/ocornut-imgui/imgui.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53 WIP
|
||||
// dear imgui, v1.53
|
||||
// (main code and documentation)
|
||||
|
||||
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
||||
@ -2382,9 +2382,10 @@ void ImGui::NewFrame()
|
||||
IM_ASSERT(g.MovingWindow->MoveId == g.MovingWindowMoveId);
|
||||
if (g.IO.MouseDown[0])
|
||||
{
|
||||
g.MovingWindow->RootWindow->PosFloat += g.IO.MouseDelta;
|
||||
if (g.IO.MouseDelta.x != 0.0f || g.IO.MouseDelta.y != 0.0f)
|
||||
ImVec2 pos = g.IO.MousePos - g.ActiveIdClickOffset;
|
||||
if (g.MovingWindow->RootWindow->PosFloat.x != pos.x || g.MovingWindow->RootWindow->PosFloat.y != pos.y)
|
||||
MarkIniSettingsDirty(g.MovingWindow->RootWindow);
|
||||
g.MovingWindow->RootWindow->PosFloat = pos;
|
||||
FocusWindow(g.MovingWindow);
|
||||
}
|
||||
else
|
||||
@ -2933,6 +2934,7 @@ void ImGui::EndFrame()
|
||||
g.MovingWindow = g.HoveredWindow;
|
||||
g.MovingWindowMoveId = g.MovingWindow->MoveId;
|
||||
SetActiveID(g.MovingWindowMoveId, g.HoveredRootWindow);
|
||||
g.ActiveIdClickOffset = g.IO.MousePos - g.MovingWindow->RootWindow->Pos;
|
||||
}
|
||||
}
|
||||
else if (g.NavWindow != NULL && GetFrontMostModalRootWindow() == NULL)
|
||||
|
5
3rdparty/ocornut-imgui/imgui.h
vendored
5
3rdparty/ocornut-imgui/imgui.h
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53 WIP
|
||||
// dear imgui, v1.53
|
||||
// (headers)
|
||||
|
||||
// See imgui.cpp file for documentation.
|
||||
@ -16,7 +16,7 @@
|
||||
#include <stddef.h> // ptrdiff_t, NULL
|
||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||
|
||||
#define IMGUI_VERSION "1.53 WIP"
|
||||
#define IMGUI_VERSION "1.53"
|
||||
|
||||
// Define attributes of all API symbols declarations, e.g. for DLL under Windows.
|
||||
#ifndef IMGUI_API
|
||||
@ -300,6 +300,7 @@ namespace ImGui
|
||||
|
||||
// Widgets: Combo Box
|
||||
// The new BeginCombo()/EndCombo() api allows you to manage your contents and selection state however you want it.
|
||||
// The old Combo() api are helpers over BeginCombo()/EndCombo() which are kept available for convenience purpose.
|
||||
IMGUI_API bool BeginCombo(const char* label, const char* preview_value, ImGuiComboFlags flags = 0);
|
||||
IMGUI_API void EndCombo();
|
||||
IMGUI_API bool Combo(const char* label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1);
|
||||
|
29
3rdparty/ocornut-imgui/imgui_demo.cpp
vendored
29
3rdparty/ocornut-imgui/imgui_demo.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53 WIP
|
||||
// dear imgui, v1.53
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating ImGui into their code base:
|
||||
@ -322,12 +322,28 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
|
||||
ImGui::LabelText("label", "Value");
|
||||
|
||||
static int item = 1;
|
||||
ImGui::Combo("combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0"); // Combo using values packed in a single constant string (for really quick combo)
|
||||
{
|
||||
// Simplified one-liner Combo() API, using values packed in a single constant string
|
||||
static int current_item_1 = 1;
|
||||
ImGui::Combo("combo", ¤t_item_1, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
|
||||
//ImGui::Combo("combo w/ array of char*", ¤t_item_2_idx, items, IM_ARRAYSIZE(items)); // Combo using proper array. You can also pass a callback to retrieve array value, no need to create/copy an array just for that.
|
||||
|
||||
// General BeginCombo() API, you have full control over your selection data and display type
|
||||
const char* items[] = { "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII", "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO", "PPPP", "QQQQQQQQQQ", "RRR", "SSSS" };
|
||||
static int item2 = -1;
|
||||
ImGui::Combo("combo scroll", &item2, items, IM_ARRAYSIZE(items)); // Combo using proper array. You can also pass a callback to retrieve array value, no need to create/copy an array just for that.
|
||||
static const char* current_item_2 = NULL;
|
||||
if (ImGui::BeginCombo("combo 2", current_item_2)) // The second parameter is the label previewed before opening the combo.
|
||||
{
|
||||
for (int n = 0; n < IM_ARRAYSIZE(items); n++)
|
||||
{
|
||||
bool is_selected = (current_item_2 == items[n]); // You can store your selection however you want, outside or inside your objects
|
||||
if (ImGui::Selectable(items[n], is_selected))
|
||||
current_item_2 = items[n];
|
||||
if (is_selected)
|
||||
ImGui::SetItemDefaultFocus(); // Set the initial focus when opening the combo (scrolling + for keyboard navigation support in the upcoming navigation branch)
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
static char str0[128] = "Hello, world!";
|
||||
@ -2600,12 +2616,13 @@ struct ExampleAppConsole
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4,1)); // Tighten spacing
|
||||
if (copy_to_clipboard)
|
||||
ImGui::LogToClipboard();
|
||||
ImVec4 col_default_text = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||
for (int i = 0; i < Items.Size; i++)
|
||||
{
|
||||
const char* item = Items[i];
|
||||
if (!filter.PassFilter(item))
|
||||
continue;
|
||||
ImVec4 col = ImVec4(1.0f,1.0f,1.0f,1.0f); // A better implementation may store a type per-item. For the sample let's just parse the text.
|
||||
ImVec4 col = col_default_text;
|
||||
if (strstr(item, "[error]")) col = ImColor(1.0f,0.4f,0.4f,1.0f);
|
||||
else if (strncmp(item, "# ", 2) == 0) col = ImColor(1.0f,0.78f,0.58f,1.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, col);
|
||||
|
2
3rdparty/ocornut-imgui/imgui_draw.cpp
vendored
2
3rdparty/ocornut-imgui/imgui_draw.cpp
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53 WIP
|
||||
// dear imgui, v1.53
|
||||
// (drawing and font code)
|
||||
|
||||
// Contains implementation for
|
||||
|
2
3rdparty/ocornut-imgui/imgui_internal.h
vendored
2
3rdparty/ocornut-imgui/imgui_internal.h
vendored
@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.53 WIP
|
||||
// dear imgui, v1.53
|
||||
// (internals)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
|
Loading…
Reference in New Issue
Block a user