mirror of https://github.com/bkaradzic/bgfx
Updated ImGui.
This commit is contained in:
parent
630ec6c1de
commit
666d729539
|
@ -611,7 +611,6 @@ static ImGuiWindow* FindHoveredWindow(ImVec2 pos, bool excluding_childs);
|
|||
static ImGuiWindow* CreateNewWindow(const char* name, ImVec2 size, ImGuiWindowFlags flags);
|
||||
static void ClearSetNextWindowData();
|
||||
static void CheckStacksSize(ImGuiWindow* window, bool write);
|
||||
static void Scrollbar(ImGuiWindow* window, bool horizontal);
|
||||
static ImVec2 CalcNextScrollFromScrollTargetAndClamp(ImGuiWindow* window);
|
||||
|
||||
static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDrawList* draw_list);
|
||||
|
@ -4397,9 +4396,9 @@ bool ImGui::Begin(const char* name, bool* p_open, const ImVec2& size_on_first_us
|
|||
|
||||
// Scrollbars
|
||||
if (window->ScrollbarX)
|
||||
Scrollbar(window, true);
|
||||
Scrollbar(ImGuiLayoutType_Horizontal);
|
||||
if (window->ScrollbarY)
|
||||
Scrollbar(window, false);
|
||||
Scrollbar(ImGuiLayoutType_Vertical);
|
||||
|
||||
// Render resize grip
|
||||
// (after the input handling so we don't have a frame of latency)
|
||||
|
@ -4591,9 +4590,12 @@ void ImGui::End()
|
|||
// - 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.
|
||||
static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
||||
void ImGui::Scrollbar(ImGuiLayoutType direction)
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImGuiWindow* window = g.CurrentWindow;
|
||||
|
||||
const bool horizontal = (direction == ImGuiLayoutType_Horizontal);
|
||||
const ImGuiStyle& style = g.Style;
|
||||
const ImGuiID id = window->GetID(horizontal ? "#SCROLLX" : "#SCROLLY");
|
||||
|
||||
|
@ -4616,7 +4618,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|||
window_rounding_corners = ImGuiCorner_BotLeft | (other_scrollbar ? 0 : ImGuiCorner_BotRight);
|
||||
else
|
||||
window_rounding_corners = (((window->Flags & ImGuiWindowFlags_NoTitleBar) && !(window->Flags & ImGuiWindowFlags_MenuBar)) ? ImGuiCorner_TopRight : 0) | (other_scrollbar ? 0 : ImGuiCorner_BotRight);
|
||||
window->DrawList->AddRectFilled(bb.Min, bb.Max, ImGui::GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
|
||||
window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ScrollbarBg), window_rounding, window_rounding_corners);
|
||||
bb.Expand(ImVec2(-ImClamp((float)(int)((bb.Max.x - bb.Min.x - 2.0f) * 0.5f), 0.0f, 3.0f), -ImClamp((float)(int)((bb.Max.y - bb.Min.y - 2.0f) * 0.5f), 0.0f, 3.0f)));
|
||||
|
||||
// V denote the main, longer axis of the scrollbar (= height for a vertical scrollbar)
|
||||
|
@ -4636,7 +4638,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|||
bool held = false;
|
||||
bool hovered = false;
|
||||
const bool previously_held = (g.ActiveId == id);
|
||||
ImGui::ButtonBehavior(bb, id, &hovered, &held);
|
||||
ButtonBehavior(bb, id, &hovered, &held);
|
||||
|
||||
float scroll_max = ImMax(1.0f, win_size_contents_v - win_size_avail_v);
|
||||
float scroll_ratio = ImSaturate(scroll_v / scroll_max);
|
||||
|
@ -4649,7 +4651,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|||
|
||||
// Click position in scrollbar normalized space (0.0f->1.0f)
|
||||
const float clicked_v_norm = ImSaturate((mouse_pos_v - scrollbar_pos_v) / scrollbar_size_v);
|
||||
ImGui::SetHoveredID(id);
|
||||
SetHoveredID(id);
|
||||
|
||||
bool seek_absolute = false;
|
||||
if (!previously_held)
|
||||
|
@ -4685,7 +4687,7 @@ static void Scrollbar(ImGuiWindow* window, bool horizontal)
|
|||
}
|
||||
|
||||
// Render
|
||||
const ImU32 grab_col = ImGui::GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
|
||||
const ImU32 grab_col = GetColorU32(held ? ImGuiCol_ScrollbarGrabActive : hovered ? ImGuiCol_ScrollbarGrabHovered : ImGuiCol_ScrollbarGrab);
|
||||
if (horizontal)
|
||||
window->DrawList->AddRectFilled(ImVec2(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm), bb.Min.y), ImVec2(ImLerp(bb.Min.x, bb.Max.x, grab_v_norm) + grab_h_pixels, bb.Max.y), grab_col, style.ScrollbarRounding);
|
||||
else
|
||||
|
@ -8535,7 +8537,6 @@ bool ImGui::InputFloatN(const char* label, float* v, int components, int decimal
|
|||
}
|
||||
PopID();
|
||||
|
||||
window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y);
|
||||
TextUnformatted(label, FindRenderedTextEnd(label));
|
||||
EndGroup();
|
||||
|
||||
|
@ -8578,7 +8579,6 @@ bool ImGui::InputIntN(const char* label, int* v, int components, ImGuiInputTextF
|
|||
}
|
||||
PopID();
|
||||
|
||||
window->DC.CurrentLineTextBaseOffset = ImMax(window->DC.CurrentLineTextBaseOffset, g.Style.FramePadding.y);
|
||||
TextUnformatted(label, FindRenderedTextEnd(label));
|
||||
EndGroup();
|
||||
|
||||
|
|
|
@ -789,6 +789,7 @@ namespace ImGui
|
|||
|
||||
IMGUI_API int CalcTypematicPressedRepeatAmount(float t, float t_prev, float repeat_delay, float repeat_rate);
|
||||
|
||||
IMGUI_API void Scrollbar(ImGuiLayoutType direction);
|
||||
IMGUI_API void VerticalSeparator(); // Vertical separator, for menu bars (use current line height). not exposed because it is misleading what it doesn't have an effect on regular layout.
|
||||
|
||||
// FIXME-WIP: New Columns API
|
||||
|
|
|
@ -508,7 +508,7 @@ BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4505); // error C4505: '' : unreferenced local
|
|||
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-function"); // warning: ‘int rect_width_compare(const void*, const void*)’ defined but not used
|
||||
BX_PRAGMA_DIAGNOSTIC_PUSH();
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wunknown-pragmas")
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-but-set-variable"); // warning: variable ‘L1’ set but not used
|
||||
//BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wunused-but-set-variable"); // warning: variable ‘L1’ set but not used
|
||||
BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG_GCC("-Wtype-limits"); // warning: comparison is always true due to limited range of data type
|
||||
#define STBTT_malloc(_size, _userData) memAlloc(_size)
|
||||
#define STBTT_free(_ptr, _userData) memFree(_ptr)
|
||||
|
|
Loading…
Reference in New Issue