mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Updated ImGui.
This commit is contained in:
10
3rdparty/dear-imgui/imgui.cpp
vendored
10
3rdparty/dear-imgui/imgui.cpp
vendored
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (main code and documentation)
|
||||
|
||||
// Call and read ImGui::ShowDemoWindow() in imgui_demo.cpp for demo code.
|
||||
@@ -5267,9 +5267,9 @@ bool ImGui::Begin(const char* name, bool* p_open, ImGuiWindowFlags flags)
|
||||
|
||||
// Scrollbars
|
||||
if (window->ScrollbarX)
|
||||
Scrollbar(ImGuiLayoutType_Horizontal);
|
||||
Scrollbar(ImGuiAxis_X);
|
||||
if (window->ScrollbarY)
|
||||
Scrollbar(ImGuiLayoutType_Vertical);
|
||||
Scrollbar(ImGuiAxis_Y);
|
||||
|
||||
// Render resize grips (after their input handling so we don't have a frame of latency)
|
||||
if (!(flags & ImGuiWindowFlags_NoResize))
|
||||
@@ -6530,13 +6530,13 @@ ImGuiID ImGui::GetID(const void* ptr_id)
|
||||
|
||||
bool ImGui::IsRectVisible(const ImVec2& size)
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;;
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
return window->ClipRect.Overlaps(ImRect(window->DC.CursorPos, window->DC.CursorPos + size));
|
||||
}
|
||||
|
||||
bool ImGui::IsRectVisible(const ImVec2& rect_min, const ImVec2& rect_max)
|
||||
{
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;;
|
||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||
return window->ClipRect.Overlaps(ImRect(rect_min, rect_max));
|
||||
}
|
||||
|
||||
|
||||
6
3rdparty/dear-imgui/imgui.h
vendored
6
3rdparty/dear-imgui/imgui.h
vendored
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (headers)
|
||||
|
||||
// See imgui.cpp file for documentation.
|
||||
@@ -45,8 +45,8 @@ Index of this file:
|
||||
|
||||
// Version
|
||||
// (Integer encoded as XYYZZ for use in #if preprocessor conditionals. Work in progress versions typically starts at XYY00 then bounced up to XYY01 when release tagging happens)
|
||||
#define IMGUI_VERSION "1.68"
|
||||
#define IMGUI_VERSION_NUM 16801
|
||||
#define IMGUI_VERSION "1.69 WIP"
|
||||
#define IMGUI_VERSION_NUM 16899
|
||||
#define IMGUI_CHECKVERSION() ImGui::DebugCheckVersionAndDataLayout(IMGUI_VERSION, sizeof(ImGuiIO), sizeof(ImGuiStyle), sizeof(ImVec2), sizeof(ImVec4), sizeof(ImDrawVert))
|
||||
|
||||
// Define attributes of all API symbols declarations (e.g. for DLL under Windows)
|
||||
|
||||
2
3rdparty/dear-imgui/imgui_demo.cpp
vendored
2
3rdparty/dear-imgui/imgui_demo.cpp
vendored
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (demo code)
|
||||
|
||||
// Message to the person tempted to delete this file when integrating Dear ImGui into their code base:
|
||||
|
||||
2
3rdparty/dear-imgui/imgui_draw.cpp
vendored
2
3rdparty/dear-imgui/imgui_draw.cpp
vendored
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (drawing and font code)
|
||||
|
||||
/*
|
||||
|
||||
6
3rdparty/dear-imgui/imgui_internal.h
vendored
6
3rdparty/dear-imgui/imgui_internal.h
vendored
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (internal structures/api)
|
||||
|
||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||
@@ -1463,8 +1463,8 @@ namespace ImGui
|
||||
IMGUI_API bool CloseButton(ImGuiID id, const ImVec2& pos, float radius);
|
||||
IMGUI_API bool CollapseButton(ImGuiID id, const ImVec2& pos);
|
||||
IMGUI_API bool ArrowButtonEx(const char* str_id, ImGuiDir dir, ImVec2 size_arg, ImGuiButtonFlags flags);
|
||||
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
||||
IMGUI_API ImGuiID GetScrollbarID(ImGuiLayoutType direction);
|
||||
IMGUI_API void Scrollbar(ImGuiAxis axis);
|
||||
IMGUI_API ImGuiID GetScrollbarID(ImGuiWindow* window, ImGuiAxis axis);
|
||||
IMGUI_API void VerticalSeparator(); // Vertical separator, for menu bars (use current line height). Not exposed because it is misleading and it doesn't have an effect on regular layout.
|
||||
|
||||
// Widgets low-level behaviors
|
||||
|
||||
34
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
34
3rdparty/dear-imgui/imgui_widgets.cpp
vendored
@@ -1,4 +1,4 @@
|
||||
// dear imgui, v1.68
|
||||
// dear imgui, v1.69 WIP
|
||||
// (widgets code)
|
||||
|
||||
/*
|
||||
@@ -710,11 +710,9 @@ bool ImGui::CollapseButton(ImGuiID id, const ImVec2& pos)
|
||||
return pressed;
|
||||
}
|
||||
|
||||
ImGuiID ImGui::GetScrollbarID(ImGuiLayoutType direction)
|
||||
ImGuiID ImGui::GetScrollbarID(ImGuiWindow* window, ImGuiAxis axis)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
return window->GetID((direction == ImGuiLayoutType_Horizontal) ? "#SCROLLX" : "#SCROLLY");
|
||||
return window->GetIDNoKeepAlive(axis == ImGuiAxis_X ? "#SCROLLX" : "#SCROLLY");
|
||||
}
|
||||
|
||||
// Vertical/Horizontal scrollbar
|
||||
@@ -722,14 +720,15 @@ ImGuiID ImGui::GetScrollbarID(ImGuiLayoutType direction)
|
||||
// - We handle absolute seeking (when first clicking outside the grab) and relative manipulation (afterward or when clicking inside the grab)
|
||||
// - We store values as normalized ratio and in a form that allows the window content to change while we are holding on a scrollbar
|
||||
// - We handle both horizontal and vertical scrollbars, which makes the terminology not ideal.
|
||||
void ImGui::Scrollbar(ImGuiLayoutType direction)
|
||||
void ImGui::Scrollbar(ImGuiAxis axis)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
const bool horizontal = (direction == ImGuiLayoutType_Horizontal);
|
||||
const bool horizontal = (axis == ImGuiAxis_X);
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const ImGuiID id = GetScrollbarID(direction);
|
||||
const ImGuiID id = GetScrollbarID(window, axis);
|
||||
KeepAliveID(id);
|
||||
|
||||
// Render background
|
||||
bool other_scrollbar = (horizontal ? window->ScrollbarY : window->ScrollbarX);
|
||||
@@ -748,7 +747,7 @@ void ImGui::Scrollbar(ImGuiLayoutType direction)
|
||||
|
||||
// When we are too small, start hiding and disabling the grab (this reduce visual noise on very small window and facilitate using the resize grab)
|
||||
float alpha = 1.0f;
|
||||
if ((direction == ImGuiLayoutType_Vertical) && bb_height < g.FontSize + g.Style.FramePadding.y * 2.0f)
|
||||
if ((axis == ImGuiAxis_Y) && bb_height < g.FontSize + g.Style.FramePadding.y * 2.0f)
|
||||
{
|
||||
alpha = ImSaturate((bb_height - g.FontSize) / (g.Style.FramePadding.y * 2.0f));
|
||||
if (alpha <= 0.0f)
|
||||
@@ -2664,7 +2663,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
return false;
|
||||
|
||||
ImGuiContext& g = *GImGui;
|
||||
const ImGuiStyle& style = g.Style;
|
||||
ImGuiStyle& style = g.Style;
|
||||
|
||||
IM_ASSERT(data_type >= 0 && data_type < ImGuiDataType_COUNT);
|
||||
if (format == NULL)
|
||||
@@ -2690,6 +2689,8 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
PopItemWidth();
|
||||
|
||||
// Step buttons
|
||||
const ImVec2 backup_frame_padding = style.FramePadding;
|
||||
style.FramePadding.x = style.FramePadding.y;
|
||||
ImGuiButtonFlags button_flags = ImGuiButtonFlags_Repeat | ImGuiButtonFlags_DontClosePopups;
|
||||
if (flags & ImGuiInputTextFlags_ReadOnly)
|
||||
button_flags |= ImGuiButtonFlags_Disabled;
|
||||
@@ -2707,6 +2708,7 @@ bool ImGui::InputScalar(const char* label, ImGuiDataType data_type, void* data_p
|
||||
}
|
||||
SameLine(0, style.ItemInnerSpacing.x);
|
||||
TextUnformatted(label, FindRenderedTextEnd(label));
|
||||
style.FramePadding = backup_frame_padding;
|
||||
|
||||
PopID();
|
||||
EndGroup();
|
||||
@@ -3225,13 +3227,14 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
const bool focus_requested_by_tab = focus_requested && !focus_requested_by_code;
|
||||
|
||||
const bool user_clicked = hovered && io.MouseClicked[0];
|
||||
const bool user_scrolled = is_multiline && g.ActiveId == 0 && edit_state.ID == id && g.ActiveIdPreviousFrame == draw_window->GetIDNoKeepAlive("#SCROLLY");
|
||||
const bool user_nav_input_start = (g.ActiveId != id) && ((g.NavInputId == id) || (g.NavActivateId == id && g.NavInputSource == ImGuiInputSource_NavKeyboard));
|
||||
const bool user_scroll_finish = is_multiline && edit_state.ID == id && g.ActiveId == 0 && g.ActiveIdPreviousFrame == GetScrollbarID(draw_window, ImGuiAxis_Y);
|
||||
const bool user_scroll_active = is_multiline && edit_state.ID == id && g.ActiveId == GetScrollbarID(draw_window, ImGuiAxis_Y);
|
||||
|
||||
bool clear_active_id = false;
|
||||
|
||||
bool select_all = (g.ActiveId != id) && ((flags & ImGuiInputTextFlags_AutoSelectAll) != 0 || user_nav_input_start) && (!is_multiline);
|
||||
if (focus_requested || user_clicked || user_scrolled || user_nav_input_start)
|
||||
if (focus_requested || user_clicked || user_scroll_finish || user_nav_input_start)
|
||||
{
|
||||
if (g.ActiveId != id)
|
||||
{
|
||||
@@ -3637,9 +3640,9 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
const ImVec4 clip_rect(frame_bb.Min.x, frame_bb.Min.y, frame_bb.Min.x + size.x, frame_bb.Min.y + size.y); // Not using frame_bb.Max because we have adjusted size
|
||||
ImVec2 render_pos = is_multiline ? draw_window->DC.CursorPos : frame_bb.Min + style.FramePadding;
|
||||
ImVec2 text_size(0.f, 0.f);
|
||||
const bool is_currently_scrolling = (edit_state.ID == id && is_multiline && g.ActiveId == draw_window->GetIDNoKeepAlive("#SCROLLY"));
|
||||
if (g.ActiveId == id || is_currently_scrolling)
|
||||
if (g.ActiveId == id || user_scroll_active)
|
||||
{
|
||||
// Animate cursor
|
||||
edit_state.CursorAnim += io.DeltaTime;
|
||||
|
||||
// This is going to be messy. We need to:
|
||||
@@ -3720,7 +3723,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
scroll_y = ImMax(0.0f, cursor_offset.y - g.FontSize);
|
||||
else if (cursor_offset.y - size.y >= scroll_y)
|
||||
scroll_y = cursor_offset.y - size.y;
|
||||
draw_window->DC.CursorPos.y += (draw_window->Scroll.y - scroll_y); // To avoid a frame of lag
|
||||
draw_window->DC.CursorPos.y += (draw_window->Scroll.y - scroll_y); // Manipulate cursor pos immediately avoid a frame of lag
|
||||
draw_window->Scroll.y = scroll_y;
|
||||
render_pos.y = draw_window->DC.CursorPos.y;
|
||||
}
|
||||
@@ -3764,6 +3767,7 @@ bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2
|
||||
}
|
||||
}
|
||||
|
||||
// We test for 'buf_display_max_length' as a way to avoid some pathological cases (e.g. single-line 1 MB string) which would make ImDrawList crash.
|
||||
const int buf_display_len = edit_state.CurLenA;
|
||||
if (is_multiline || buf_display_len < buf_display_max_length)
|
||||
draw_window->DrawList->AddText(g.Font, g.FontSize, render_pos - render_scroll, GetColorU32(ImGuiCol_Text), buf_display, buf_display + buf_display_len, 0.0f, is_multiline ? NULL : &clip_rect);
|
||||
|
||||
Reference in New Issue
Block a user