mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
Updated ImGui.
This commit is contained in:
parent
a1f198bfac
commit
38d25942d8
5 changed files with 112 additions and 78 deletions
27
3rdparty/ocornut-imgui/imgui.cpp
vendored
27
3rdparty/ocornut-imgui/imgui.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.47
|
// dear imgui, v1.48 WIP
|
||||||
// (main code and documentation)
|
// (main code and documentation)
|
||||||
|
|
||||||
// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code.
|
// See ImGui::ShowTestWindow() in imgui_demo.cpp for demo code.
|
||||||
|
@ -148,6 +148,7 @@
|
||||||
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
Here is a change-log of API breaking changes, if you are using one of the functions listed, expect to have to fix some code.
|
||||||
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
Also read releases logs https://github.com/ocornut/imgui/releases for more details.
|
||||||
|
|
||||||
|
- 2015/12/27 (1.48) - fixed ImDrawList::AddRect() which used to render a rectangle 1 px too large on each axis.
|
||||||
- 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.
|
- 2015/12/04 (1.47) - renamed Color() helpers to ValueColor() - dangerously named, rarely used and probably to be made obsolete.
|
||||||
- 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.
|
- 2015/08/29 (1.45) - with the addition of horizontal scrollbar we made various fixes to inconsistencies with dealing with cursor position.
|
||||||
GetCursorPos()/SetCursorPos() functions now include the scrolled amount. It shouldn't affect the majority of users, but take note that SetCursorPosX(100.0f) puts you at +100 from the starting x position which may include scrolling, not at +100 from the window left side.
|
GetCursorPos()/SetCursorPos() functions now include the scrolled amount. It shouldn't affect the majority of users, but take note that SetCursorPosX(100.0f) puts you at +100 from the starting x position which may include scrolling, not at +100 from the window left side.
|
||||||
|
@ -2665,8 +2666,8 @@ void ImGui::RenderFrame(ImVec2 p_min, ImVec2 p_max, ImU32 fill_col, bool border,
|
||||||
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
window->DrawList->AddRectFilled(p_min, p_max, fill_col, rounding);
|
||||||
if (border && (window->Flags & ImGuiWindowFlags_ShowBorders))
|
if (border && (window->Flags & ImGuiWindowFlags_ShowBorders))
|
||||||
{
|
{
|
||||||
window->DrawList->AddRect(p_min+ImVec2(1,1), p_max, GetColorU32(ImGuiCol_BorderShadow), rounding);
|
window->DrawList->AddRect(p_min+ImVec2(1,1), p_max+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), rounding);
|
||||||
window->DrawList->AddRect(p_min, p_max-ImVec2(1,1), GetColorU32(ImGuiCol_Border), rounding);
|
window->DrawList->AddRect(p_min, p_max, GetColorU32(ImGuiCol_Border), rounding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3658,13 +3659,11 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||||
|
|
||||||
// Setup texture, outer clipping rectangle
|
// Setup texture, outer clipping rectangle
|
||||||
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
window->DrawList->PushTextureID(g.Font->ContainerAtlas->TexID);
|
||||||
{
|
ImRect fullscreen_rect(GetVisibleRect());
|
||||||
ImRect fullscreen_rect(GetVisibleRect());
|
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_ComboBox|ImGuiWindowFlags_Popup)))
|
||||||
if ((flags & ImGuiWindowFlags_ChildWindow) && !(flags & (ImGuiWindowFlags_ComboBox|ImGuiWindowFlags_Popup)))
|
PushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true);
|
||||||
PushClipRect(parent_window->ClipRect.Min, parent_window->ClipRect.Max, true);
|
else
|
||||||
else
|
PushClipRect(fullscreen_rect.Min, fullscreen_rect.Max, true);
|
||||||
PushClipRect(fullscreen_rect.Min, fullscreen_rect.Max, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// New windows appears in front
|
// New windows appears in front
|
||||||
if (!window_was_active)
|
if (!window_was_active)
|
||||||
|
@ -3795,7 +3794,6 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||||
if (window_pos_center)
|
if (window_pos_center)
|
||||||
{
|
{
|
||||||
// Center (any sort of window)
|
// Center (any sort of window)
|
||||||
ImRect fullscreen_rect(GetVisibleRect());
|
|
||||||
SetWindowPos(ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f));
|
SetWindowPos(ImMax(style.DisplaySafeAreaPadding, fullscreen_rect.GetCenter() - window->SizeFull * 0.5f));
|
||||||
}
|
}
|
||||||
else if (flags & ImGuiWindowFlags_ChildMenu)
|
else if (flags & ImGuiWindowFlags_ChildMenu)
|
||||||
|
@ -3885,10 +3883,7 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||||
|
|
||||||
// Modal window darkens what is behind them
|
// Modal window darkens what is behind them
|
||||||
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
|
if ((flags & ImGuiWindowFlags_Modal) != 0 && window == GetFrontMostModalRootWindow())
|
||||||
{
|
|
||||||
ImRect fullscreen_rect(GetVisibleRect());
|
|
||||||
window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
window->DrawList->AddRectFilled(fullscreen_rect.Min, fullscreen_rect.Max, GetColorU32(ImGuiCol_ModalWindowDarkening, g.ModalWindowDarkeningRatio));
|
||||||
}
|
|
||||||
|
|
||||||
// Draw window + handle manual resize
|
// Draw window + handle manual resize
|
||||||
ImRect title_bar_rect = window->TitleBarRect();
|
ImRect title_bar_rect = window->TitleBarRect();
|
||||||
|
@ -3988,8 +3983,8 @@ bool ImGui::Begin(const char* name, bool* p_opened, const ImVec2& size_on_first_
|
||||||
// Borders
|
// Borders
|
||||||
if (flags & ImGuiWindowFlags_ShowBorders)
|
if (flags & ImGuiWindowFlags_ShowBorders)
|
||||||
{
|
{
|
||||||
window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size, GetColorU32(ImGuiCol_BorderShadow), window_rounding);
|
window->DrawList->AddRect(window->Pos+ImVec2(1,1), window->Pos+window->Size+ImVec2(1,1), GetColorU32(ImGuiCol_BorderShadow), window_rounding);
|
||||||
window->DrawList->AddRect(window->Pos, window->Pos+window->Size-ImVec2(1,1), GetColorU32(ImGuiCol_Border), window_rounding);
|
window->DrawList->AddRect(window->Pos, window->Pos+window->Size, GetColorU32(ImGuiCol_Border), window_rounding);
|
||||||
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
if (!(flags & ImGuiWindowFlags_NoTitleBar))
|
||||||
window->DrawList->AddLine(title_bar_rect.GetBL()+ImVec2(1,0), title_bar_rect.GetBR()-ImVec2(1,0), GetColorU32(ImGuiCol_Border));
|
window->DrawList->AddLine(title_bar_rect.GetBL()+ImVec2(1,0), title_bar_rect.GetBR()-ImVec2(1,0), GetColorU32(ImGuiCol_Border));
|
||||||
}
|
}
|
||||||
|
|
8
3rdparty/ocornut-imgui/imgui.h
vendored
8
3rdparty/ocornut-imgui/imgui.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.47
|
// dear imgui, v1.48 WIP
|
||||||
// (headers)
|
// (headers)
|
||||||
|
|
||||||
// See imgui.cpp file for documentation.
|
// See imgui.cpp file for documentation.
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
#include <stddef.h> // ptrdiff_t, NULL
|
#include <stddef.h> // ptrdiff_t, NULL
|
||||||
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
#include <string.h> // memset, memmove, memcpy, strlen, strchr, strcpy, strcmp
|
||||||
|
|
||||||
#define IMGUI_VERSION "1.47"
|
#define IMGUI_VERSION "1.48 WIP"
|
||||||
|
|
||||||
// Define assertion handler.
|
// Define assertion handler.
|
||||||
#ifndef IM_ASSERT
|
#ifndef IM_ASSERT
|
||||||
|
@ -1116,8 +1116,8 @@ struct ImDrawList
|
||||||
|
|
||||||
// Primitives
|
// Primitives
|
||||||
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
IMGUI_API void AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thickness = 1.0f);
|
||||||
IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
|
IMGUI_API void AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F); // a: upper-left, b: lower-right
|
||||||
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F);
|
IMGUI_API void AddRectFilled(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding = 0.0f, int rounding_corners = 0x0F); // a: upper-left, b: lower-right
|
||||||
IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left);
|
IMGUI_API void AddRectFilledMultiColor(const ImVec2& a, const ImVec2& b, ImU32 col_upr_left, ImU32 col_upr_right, ImU32 col_bot_right, ImU32 col_bot_left);
|
||||||
IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
IMGUI_API void AddTriangleFilled(const ImVec2& a, const ImVec2& b, const ImVec2& c, ImU32 col);
|
||||||
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
IMGUI_API void AddCircle(const ImVec2& centre, float radius, ImU32 col, int num_segments = 12);
|
||||||
|
|
133
3rdparty/ocornut-imgui/imgui_demo.cpp
vendored
133
3rdparty/ocornut-imgui/imgui_demo.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.47
|
// dear imgui, v1.48 WIP
|
||||||
// (demo code)
|
// (demo code)
|
||||||
|
|
||||||
// Don't remove this file from your project! It is useful reference code that you can execute.
|
// Don't remove this file from your project! It is useful reference code that you can execute.
|
||||||
|
@ -1763,7 +1763,7 @@ static void ShowExampleAppManipulatingWindowTitle(bool* opened)
|
||||||
|
|
||||||
static void ShowExampleAppCustomRendering(bool* opened)
|
static void ShowExampleAppCustomRendering(bool* opened)
|
||||||
{
|
{
|
||||||
ImGui::SetNextWindowSize(ImVec2(300,350), ImGuiSetCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(350,560), ImGuiSetCond_FirstUseEver);
|
||||||
if (!ImGui::Begin("Example: Custom rendering", opened))
|
if (!ImGui::Begin("Example: Custom rendering", opened))
|
||||||
{
|
{
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
|
@ -1773,59 +1773,88 @@ static void ShowExampleAppCustomRendering(bool* opened)
|
||||||
// Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of overloaded operators, etc.
|
// Tip: If you do a lot of custom rendering, you probably want to use your own geometrical types and benefit of overloaded operators, etc.
|
||||||
// Define IM_VEC2_CLASS_EXTRA in imconfig.h to create implicit conversions between your types and ImVec2/ImVec4.
|
// Define IM_VEC2_CLASS_EXTRA in imconfig.h to create implicit conversions between your types and ImVec2/ImVec4.
|
||||||
// ImGui defines overloaded operators but they are internal to imgui.cpp and not exposed outside (to avoid messing with your types)
|
// ImGui defines overloaded operators but they are internal to imgui.cpp and not exposed outside (to avoid messing with your types)
|
||||||
// In this example we aren't using the operators.
|
// In this example we are not using the maths operators!
|
||||||
|
|
||||||
static ImVector<ImVec2> points;
|
|
||||||
static bool adding_line = false;
|
|
||||||
if (ImGui::Button("Clear")) points.clear();
|
|
||||||
if (points.Size >= 2) { ImGui::SameLine(); if (ImGui::Button("Undo")) { points.pop_back(); points.pop_back(); } }
|
|
||||||
ImGui::Text("Left-click and drag to add lines");
|
|
||||||
ImGui::Text("Right-click to undo");
|
|
||||||
|
|
||||||
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
ImDrawList* draw_list = ImGui::GetWindowDrawList();
|
||||||
|
|
||||||
// Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
|
// Primitives
|
||||||
// However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
|
ImGui::Text("Primitives");
|
||||||
// If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
|
static float sz = 36.0f;
|
||||||
ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates!
|
static ImVec4 col = ImVec4(1.0f,1.0f,0.4f,1.0f);
|
||||||
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
|
ImGui::DragFloat("Size", &sz, 0.2f, 2.0f, 72.0f, "%.0f");
|
||||||
if (canvas_size.x < 50.0f) canvas_size.x = 50.0f;
|
ImGui::ColorEdit3("Color", &col.x);
|
||||||
if (canvas_size.y < 50.0f) canvas_size.y = 50.0f;
|
|
||||||
draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(0,0,0), ImColor(255,0,0), ImColor(255,255,0), ImColor(0,255,0));
|
|
||||||
draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(255,255,255));
|
|
||||||
|
|
||||||
draw_list->AddBezierCurve(ImVec2(canvas_pos.x+20,canvas_pos.y+20), ImVec2(canvas_pos.x+100,canvas_pos.y+20), ImVec2(canvas_pos.x+canvas_size.x-100,canvas_pos.y+canvas_size.y-20), ImVec2(canvas_pos.x+canvas_size.x-20,canvas_pos.y+canvas_size.y-20), ImColor(255,200,0), 5.0f);
|
|
||||||
|
|
||||||
bool adding_preview = false;
|
|
||||||
ImGui::InvisibleButton("canvas", canvas_size);
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
{
|
{
|
||||||
ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y);
|
const ImVec2 p = ImGui::GetCursorScreenPos();
|
||||||
if (!adding_line && ImGui::IsMouseClicked(0))
|
const ImU32 col32 = ImColor(col);
|
||||||
{
|
float x = p.x + 4.0f, y = p.y + 4.0f, spacing = 8.0f;
|
||||||
points.push_back(mouse_pos_in_canvas);
|
draw_list->AddCircle(ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 32); x += sz+spacing;
|
||||||
adding_line = true;
|
draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32); x += sz+spacing;
|
||||||
}
|
draw_list->AddRect(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f); x += sz+spacing;
|
||||||
if (adding_line)
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y ), col32); x += sz+spacing;
|
||||||
{
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y+sz), col32); x += sz+spacing;
|
||||||
adding_preview = true;
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y+sz), col32); x += spacing;
|
||||||
points.push_back(mouse_pos_in_canvas);
|
draw_list->AddBezierCurve(ImVec2(x, y), ImVec2(x+sz*1.3f,y+sz*0.3f), ImVec2(x+sz-sz*1.3f,y+sz-sz*0.3f), ImVec2(x+sz, y+sz), col32, 1.0f);
|
||||||
if (!ImGui::GetIO().MouseDown[0])
|
x = p.x + 4;
|
||||||
adding_line = adding_preview = false;
|
y += sz+spacing;
|
||||||
}
|
draw_list->AddCircleFilled(ImVec2(x+sz*0.5f, y+sz*0.5f), sz*0.5f, col32, 32); x += sz+spacing;
|
||||||
if (ImGui::IsMouseClicked(1) && !points.empty())
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32); x += sz+spacing;
|
||||||
{
|
draw_list->AddRectFilled(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 10.0f); x += sz+spacing;
|
||||||
adding_line = adding_preview = false;
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y ), col32, 4.0f); x += sz+spacing;
|
||||||
points.pop_back();
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x+sz, y+sz), col32, 4.0f); x += sz+spacing;
|
||||||
points.pop_back();
|
draw_list->AddLine(ImVec2(x, y), ImVec2(x, y+sz), col32, 4.0f); x += spacing;
|
||||||
}
|
draw_list->AddBezierCurve(ImVec2(x, y), ImVec2(x+sz*1.3f,y+sz*0.3f), ImVec2(x+sz-sz*1.3f,y+sz-sz*0.3f), ImVec2(x+sz, y+sz), col32, 4.0f); x += sz+spacing;
|
||||||
|
draw_list->AddRectFilledMultiColor(ImVec2(x, y), ImVec2(x+sz, y+sz), ImColor(0,0,0), ImColor(255,0,0), ImColor(255,255,0), ImColor(0,255,0));
|
||||||
|
ImGui::Dummy(ImVec2((sz+spacing)*8, (sz+spacing)*2));
|
||||||
|
}
|
||||||
|
ImGui::Separator();
|
||||||
|
{
|
||||||
|
static ImVector<ImVec2> points;
|
||||||
|
static bool adding_line = false;
|
||||||
|
ImGui::Text("Canvas example");
|
||||||
|
if (ImGui::Button("Clear")) points.clear();
|
||||||
|
if (points.Size >= 2) { ImGui::SameLine(); if (ImGui::Button("Undo")) { points.pop_back(); points.pop_back(); } }
|
||||||
|
ImGui::Text("Left-click and drag to add lines,\nRight-click to undo");
|
||||||
|
|
||||||
|
// Here we are using InvisibleButton() as a convenience to 1) advance the cursor and 2) allows us to use IsItemHovered()
|
||||||
|
// However you can draw directly and poll mouse/keyboard by yourself. You can manipulate the cursor using GetCursorPos() and SetCursorPos().
|
||||||
|
// If you only use the ImDrawList API, you can notify the owner window of its extends by using SetCursorPos(max).
|
||||||
|
ImVec2 canvas_pos = ImGui::GetCursorScreenPos(); // ImDrawList API uses screen coordinates!
|
||||||
|
ImVec2 canvas_size = ImGui::GetContentRegionAvail(); // Resize canvas to what's available
|
||||||
|
if (canvas_size.x < 50.0f) canvas_size.x = 50.0f;
|
||||||
|
if (canvas_size.y < 50.0f) canvas_size.y = 50.0f;
|
||||||
|
draw_list->AddRectFilledMultiColor(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(50,50,50), ImColor(50,50,60), ImColor(60,60,70), ImColor(50,50,60));
|
||||||
|
draw_list->AddRect(canvas_pos, ImVec2(canvas_pos.x + canvas_size.x, canvas_pos.y + canvas_size.y), ImColor(255,255,255));
|
||||||
|
|
||||||
|
bool adding_preview = false;
|
||||||
|
ImGui::InvisibleButton("canvas", canvas_size);
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
{
|
||||||
|
ImVec2 mouse_pos_in_canvas = ImVec2(ImGui::GetIO().MousePos.x - canvas_pos.x, ImGui::GetIO().MousePos.y - canvas_pos.y);
|
||||||
|
if (!adding_line && ImGui::IsMouseClicked(0))
|
||||||
|
{
|
||||||
|
points.push_back(mouse_pos_in_canvas);
|
||||||
|
adding_line = true;
|
||||||
|
}
|
||||||
|
if (adding_line)
|
||||||
|
{
|
||||||
|
adding_preview = true;
|
||||||
|
points.push_back(mouse_pos_in_canvas);
|
||||||
|
if (!ImGui::GetIO().MouseDown[0])
|
||||||
|
adding_line = adding_preview = false;
|
||||||
|
}
|
||||||
|
if (ImGui::IsMouseClicked(1) && !points.empty())
|
||||||
|
{
|
||||||
|
adding_line = adding_preview = false;
|
||||||
|
points.pop_back();
|
||||||
|
points.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
draw_list->PushClipRect(ImVec4(canvas_pos.x, canvas_pos.y, canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.)
|
||||||
|
for (int i = 0; i < points.Size - 1; i += 2)
|
||||||
|
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), 0xFF00FFFF, 2.0f);
|
||||||
|
draw_list->PopClipRect();
|
||||||
|
if (adding_preview)
|
||||||
|
points.pop_back();
|
||||||
}
|
}
|
||||||
draw_list->PushClipRect(ImVec4(canvas_pos.x, canvas_pos.y, canvas_pos.x+canvas_size.x, canvas_pos.y+canvas_size.y)); // clip lines within the canvas (if we resize it, etc.)
|
|
||||||
for (int i = 0; i < points.Size - 1; i += 2)
|
|
||||||
draw_list->AddLine(ImVec2(canvas_pos.x + points[i].x, canvas_pos.y + points[i].y), ImVec2(canvas_pos.x + points[i+1].x, canvas_pos.y + points[i+1].y), 0xFF00FFFF, 2.0f);
|
|
||||||
draw_list->PopClipRect();
|
|
||||||
if (adding_preview)
|
|
||||||
points.pop_back();
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1943,7 +1972,7 @@ struct ExampleAppConsole
|
||||||
|
|
||||||
// Demonstrate keeping auto focus on the input box
|
// Demonstrate keeping auto focus on the input box
|
||||||
if (ImGui::IsItemHovered() || (ImGui::IsRootWindowOrAnyChildFocused() && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0)))
|
if (ImGui::IsItemHovered() || (ImGui::IsRootWindowOrAnyChildFocused() && !ImGui::IsAnyItemActive() && !ImGui::IsMouseClicked(0)))
|
||||||
ImGui::SetKeyboardFocusHere(-1); // Auto focus
|
ImGui::SetKeyboardFocusHere(-1); // Auto focus previous widget
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
18
3rdparty/ocornut-imgui/imgui_draw.cpp
vendored
18
3rdparty/ocornut-imgui/imgui_draw.cpp
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.47
|
// dear imgui, v1.48 WIP
|
||||||
// (drawing and font code)
|
// (drawing and font code)
|
||||||
|
|
||||||
// Contains implementation for
|
// Contains implementation for
|
||||||
|
@ -31,6 +31,14 @@
|
||||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse.
|
||||||
|
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
||||||
|
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
|
||||||
|
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||||
|
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
||||||
|
#endif
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,6 +63,7 @@ namespace IMGUI_STB_NAMESPACE
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse.
|
||||||
#pragma clang diagnostic ignored "-Wunused-function"
|
#pragma clang diagnostic ignored "-Wunused-function"
|
||||||
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
#pragma clang diagnostic ignored "-Wmissing-prototypes"
|
||||||
#endif
|
#endif
|
||||||
|
@ -764,11 +773,12 @@ void ImDrawList::AddLine(const ImVec2& a, const ImVec2& b, ImU32 col, float thic
|
||||||
PathStroke(col, false, thickness);
|
PathStroke(col, false, thickness);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// a: upper-left, b: lower-right. we don't render 1 px sized rectangles properly.
|
||||||
void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners)
|
void ImDrawList::AddRect(const ImVec2& a, const ImVec2& b, ImU32 col, float rounding, int rounding_corners)
|
||||||
{
|
{
|
||||||
if ((col >> 24) == 0)
|
if ((col >> 24) == 0)
|
||||||
return;
|
return;
|
||||||
PathRect(a + ImVec2(0.5f,0.5f), b + ImVec2(0.5f,0.5f), rounding, rounding_corners);
|
PathRect(a + ImVec2(0.5f,0.5f), b - ImVec2(0.5f,0.5f), rounding, rounding_corners);
|
||||||
PathStroke(col, true);
|
PathStroke(col, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -820,7 +830,7 @@ void ImDrawList::AddCircle(const ImVec2& centre, float radius, ImU32 col, int nu
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
|
const float a_max = IM_PI*2.0f * ((float)num_segments - 1.0f) / (float)num_segments;
|
||||||
PathArcTo(centre, radius, 0.0f, a_max, num_segments);
|
PathArcTo(centre, radius-0.5f, 0.0f, a_max, num_segments);
|
||||||
PathStroke(col, true);
|
PathStroke(col, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1176,7 +1186,7 @@ ImFont* ImFontAtlas::AddFontFromMemoryCompressedTTF(const void* compressed_ttf_d
|
||||||
ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)
|
ImFont* ImFontAtlas::AddFontFromMemoryCompressedBase85TTF(const char* compressed_ttf_data_base85, float size_pixels, const ImFontConfig* font_cfg, const ImWchar* glyph_ranges)
|
||||||
{
|
{
|
||||||
int compressed_ttf_size = (((int)strlen(compressed_ttf_data_base85) + 4) / 5) * 4;
|
int compressed_ttf_size = (((int)strlen(compressed_ttf_data_base85) + 4) / 5) * 4;
|
||||||
void* compressed_ttf = ImGui::MemAlloc(compressed_ttf_size);
|
void* compressed_ttf = ImGui::MemAlloc((size_t)compressed_ttf_size);
|
||||||
Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf);
|
Decode85((const unsigned char*)compressed_ttf_data_base85, (unsigned char*)compressed_ttf);
|
||||||
ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);
|
ImFont* font = AddFontFromMemoryCompressedTTF(compressed_ttf, compressed_ttf_size, size_pixels, font_cfg, glyph_ranges);
|
||||||
ImGui::MemFree(compressed_ttf);
|
ImGui::MemFree(compressed_ttf);
|
||||||
|
|
4
3rdparty/ocornut-imgui/imgui_internal.h
vendored
4
3rdparty/ocornut-imgui/imgui_internal.h
vendored
|
@ -1,4 +1,4 @@
|
||||||
// dear imgui, v1.47
|
// dear imgui, v1.48 WIP
|
||||||
// (internals)
|
// (internals)
|
||||||
|
|
||||||
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
// You may use this file to debug, understand or extend ImGui features but we don't provide any guarantee of forward compatibility!
|
||||||
|
@ -161,7 +161,7 @@ enum ImGuiTreeNodeFlags_
|
||||||
|
|
||||||
enum ImGuiSliderFlags_
|
enum ImGuiSliderFlags_
|
||||||
{
|
{
|
||||||
ImGuiSliderFlags_Vertical = 1 << 0,
|
ImGuiSliderFlags_Vertical = 1 << 0
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ImGuiSelectableFlagsPrivate_
|
enum ImGuiSelectableFlagsPrivate_
|
||||||
|
|
Loading…
Reference in a new issue