Internal: Refactored internal RenderMouseCursor so colors can be specified. (#2614)
This commit is contained in:
parent
25849234f6
commit
52deb415e0
@ -4274,7 +4274,7 @@ void ImGui::Render()
|
||||
|
||||
// Draw software mouse cursor if requested
|
||||
if (g.IO.MouseDrawCursor)
|
||||
RenderMouseCursor(&g.ForegroundDrawList, g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor);
|
||||
RenderMouseCursor(&g.ForegroundDrawList, g.IO.MousePos, g.Style.MouseCursorScale, g.MouseCursor, IM_COL32_WHITE, IM_COL32_BLACK, IM_COL32(0, 0, 0, 48));
|
||||
|
||||
if (!g.ForegroundDrawList.VtxBuffer.empty())
|
||||
AddDrawListToDrawData(&g.DrawDataBuilder.Layers[0], &g.ForegroundDrawList);
|
||||
|
@ -3038,16 +3038,12 @@ void ImFont::RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col
|
||||
// - RenderRectFilledRangeH()
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor)
|
||||
void ImGui::RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow)
|
||||
{
|
||||
if (mouse_cursor == ImGuiMouseCursor_None)
|
||||
return;
|
||||
IM_ASSERT(mouse_cursor > ImGuiMouseCursor_None && mouse_cursor < ImGuiMouseCursor_COUNT);
|
||||
|
||||
const ImU32 col_shadow = IM_COL32(0, 0, 0, 48);
|
||||
const ImU32 col_border = IM_COL32(0, 0, 0, 255); // Black
|
||||
const ImU32 col_fill = IM_COL32(255, 255, 255, 255); // White
|
||||
|
||||
ImFontAtlas* font_atlas = draw_list->_Data->Font->ContainerAtlas;
|
||||
ImVec2 offset, size, uv[4];
|
||||
if (font_atlas->GetMouseCursorTexData(mouse_cursor, &offset, &size, &uv[0], &uv[2]))
|
||||
|
@ -1636,7 +1636,7 @@ namespace ImGui
|
||||
// Render helpers (those functions don't access any ImGui state!)
|
||||
IMGUI_API void RenderArrow(ImDrawList* draw_list, ImVec2 pos, ImU32 col, ImGuiDir dir, float scale = 1.0f);
|
||||
IMGUI_API void RenderBullet(ImDrawList* draw_list, ImVec2 pos, ImU32 col);
|
||||
IMGUI_API void RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor = ImGuiMouseCursor_Arrow);
|
||||
IMGUI_API void RenderMouseCursor(ImDrawList* draw_list, ImVec2 pos, float scale, ImGuiMouseCursor mouse_cursor, ImU32 col_fill, ImU32 col_border, ImU32 col_shadow);
|
||||
IMGUI_API void RenderArrowPointingAt(ImDrawList* draw_list, ImVec2 pos, ImVec2 half_sz, ImGuiDir direction, ImU32 col);
|
||||
IMGUI_API void RenderRectFilledRangeH(ImDrawList* draw_list, const ImRect& rect, ImU32 col, float x_start_norm, float x_end_norm, float rounding);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user