@ -364,6 +364,7 @@ CODE
When you are not sure about a old symbol or function name , try using the Search / Find function of your IDE to look for comments or references in all imgui files .
You can read releases logs https : //github.com/ocornut/imgui/releases for more details.
- 2019 / 03 / 04 ( 1.69 ) - renamed GetOverlayDrawList ( ) to GetForegroundDrawList ( ) . Kept redirection function ( will obsolete ) .
- 2019 / 02 / 26 ( 1.69 ) - renamed ImGuiColorEditFlags_RGB / ImGuiColorEditFlags_HSV / ImGuiColorEditFlags_HEX to ImGuiColorEditFlags_DisplayRGB / ImGuiColorEditFlags_DisplayHSV / ImGuiColorEditFlags_DisplayHex . Kept redirection enums ( will obsolete ) .
- 2019 / 02 / 14 ( 1.68 ) - made it illegal / assert when io . DisplayTime = = 0.0f ( with an exception for the first frame ) . If for some reason your time step calculation gives you a zero value , replace it with a dummy small value !
- 2019 / 02 / 01 ( 1.68 ) - removed io . DisplayVisibleMin / DisplayVisibleMax ( which were marked obsolete and removed from viewport / docking branch already ) .
@ -874,8 +875,8 @@ CODE
A : - You can create a dummy window . Call Begin ( ) with the NoBackground | NoDecoration | NoSavedSettings | NoInputs flags .
( The ImGuiWindowFlags_NoDecoration flag itself is a shortcut for NoTitleBar | NoResize | NoScrollbar | NoCollapse )
Then you can retrieve the ImDrawList * via GetWindowDrawList ( ) and draw to it in any way you like .
- You can call ImGui : : GetBackgroundDrawList ( ) or ImGui : : GetOverlay DrawList ( ) and use those draw list to display contents
behind or over every other imgui windows .
- You can call ImGui : : GetBackgroundDrawList ( ) or ImGui : : GetForeground DrawList ( ) and use those draw list to display
contents behind or over every other imgui windows .
- You can create your own ImDrawList instance . You ' ll need to initialize them ImGui : : GetDrawListSharedData ( ) , or create
your own ImDrawListSharedData , and then call your rendered code with your own ImDrawList or ImDrawData data .
@ -3073,15 +3074,15 @@ ImDrawList* ImGui::GetBackgroundDrawList()
return & GImGui - > BackgroundDrawList ;
}
static ImDrawList * GetOverlay DrawList ( ImGuiWindow * )
static ImDrawList * GetForeground DrawList ( ImGuiWindow * )
{
// This seemingly unnecessary wrapper simplifies compatibility between the 'master' and 'docking' branches.
return & GImGui - > Overlay DrawList;
return & GImGui - > Foreground DrawList;
}
ImDrawList * ImGui : : GetOverlay DrawList ( )
ImDrawList * ImGui : : GetForeground DrawList ( )
{
return & GImGui - > Overlay DrawList;
return & GImGui - > Foreground DrawList;
}
ImDrawListSharedData * ImGui : : GetDrawListSharedData ( )
@ -3433,10 +3434,10 @@ void ImGui::NewFrame()
g . BackgroundDrawList . PushClipRectFullScreen ( ) ;
g . BackgroundDrawList . Flags = ( g . Style . AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0 ) | ( g . Style . AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0 ) ;
g . Overlay DrawList. Clear ( ) ;
g . Overlay DrawList. PushTextureID ( g . IO . Fonts - > TexID ) ;
g . Overlay DrawList. PushClipRectFullScreen ( ) ;
g . Overlay DrawList. Flags = ( g . Style . AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0 ) | ( g . Style . AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0 ) ;
g . Foreground DrawList. Clear ( ) ;
g . Foreground DrawList. PushTextureID ( g . IO . Fonts - > TexID ) ;
g . Foreground DrawList. PushClipRectFullScreen ( ) ;
g . Foreground DrawList. Flags = ( g . Style . AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0 ) | ( g . Style . AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0 ) ;
// Mark rendering data as invalid to prevent user who may have a handle on it to use it.
g . DrawData . Clear ( ) ;
@ -3615,7 +3616,7 @@ void ImGui::Shutdown(ImGuiContext* context)
g . BeginPopupStack . clear ( ) ;
g . DrawDataBuilder . ClearFreeMemory ( ) ;
g . BackgroundDrawList . ClearFreeMemory ( ) ;
g . Overlay DrawList. ClearFreeMemory ( ) ;
g . Foreground DrawList. ClearFreeMemory ( ) ;
g . PrivateClipboard . clear ( ) ;
g . InputTextState . ClearFreeMemory ( ) ;
@ -3891,10 +3892,10 @@ void ImGui::Render()
// Draw software mouse cursor if requested
if ( g . IO . MouseDrawCursor )
RenderMouseCursor ( & g . Overlay DrawList, g . IO . MousePos , g . Style . MouseCursorScale , g . MouseCursor ) ;
RenderMouseCursor ( & g . Foreground DrawList, g . IO . MousePos , g . Style . MouseCursorScale , g . MouseCursor ) ;
if ( ! g . Overlay DrawList. VtxBuffer . empty ( ) )
AddDrawListToDrawData ( & g . DrawDataBuilder . Layers [ 0 ] , & g . Overlay DrawList) ;
if ( ! g . Foreground DrawList. VtxBuffer . empty ( ) )
AddDrawListToDrawData ( & g . DrawDataBuilder . Layers [ 0 ] , & g . Foreground DrawList) ;
// Setup ImDrawData structure for end-user
SetupDrawData ( & g . DrawDataBuilder . Layers [ 0 ] , & g . DrawData ) ;
@ -4739,7 +4740,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
if ( resize_rect . Min . y > resize_rect . Max . y ) ImSwap ( resize_rect . Min . y , resize_rect . Max . y ) ;
bool hovered , held ;
ButtonBehavior ( resize_rect , window - > GetID ( ( void * ) ( intptr_t ) resize_grip_n ) , & hovered , & held , ImGuiButtonFlags_FlattenChildren | ImGuiButtonFlags_NoNavFocus ) ;
//GetOverlay DrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
//GetForeground DrawList(window)->AddRect(resize_rect.Min, resize_rect.Max, IM_COL32(255, 255, 0, 255));
if ( hovered | | held )
g . MouseCursor = ( resize_grip_n & 1 ) ? ImGuiMouseCursor_ResizeNESW : ImGuiMouseCursor_ResizeNWSE ;
@ -4764,7 +4765,7 @@ static void ImGui::UpdateManualResize(ImGuiWindow* window, const ImVec2& size_au
bool hovered , held ;
ImRect border_rect = GetResizeBorderRect ( window , border_n , grip_hover_inner_size , WINDOWS_RESIZE_FROM_EDGES_HALF_THICKNESS ) ;
ButtonBehavior ( border_rect , window - > GetID ( ( void * ) ( intptr_t ) ( border_n + 4 ) ) , & hovered , & held , ImGuiButtonFlags_FlattenChildren ) ;
//GetOverlayDrawList (window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
//GetForegroundDrawLists (window)->AddRect(border_rect.Min, border_rect.Max, IM_COL32(255, 255, 0, 255));
if ( ( hovered & & g . HoveredIdTimer > WINDOWS_RESIZE_FROM_EDGES_FEEDBACK_TIMER ) | | held )
{
g . MouseCursor = ( border_n & 1 ) ? ImGuiMouseCursor_ResizeEW : ImGuiMouseCursor_ResizeNS ;
@ -7037,8 +7038,8 @@ ImRect ImGui::GetWindowAllowedExtentRect(ImGuiWindow*)
ImVec2 ImGui : : FindBestWindowPosForPopupEx ( const ImVec2 & ref_pos , const ImVec2 & size , ImGuiDir * last_dir , const ImRect & r_outer , const ImRect & r_avoid , ImGuiPopupPositionPolicy policy )
{
ImVec2 base_pos_clamped = ImClamp ( ref_pos , r_outer . Min , r_outer . Max - size ) ;
//GImGui->OverlayDrawList. AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255));
//GImGui->OverlayDrawList. AddRect(r_outer.Min, r_outer.Max, IM_COL32(0,255,0,255));
//GetForegroundDrawList()-> AddRect(r_avoid.Min, r_avoid.Max, IM_COL32(255,0,0,255));
//GetForegroundDrawList()-> AddRect(r_outer.Min, r_outer.Max, IM_COL32(0,255,0,255));
// Combo Box policy (we want a connecting edge)
if ( policy = = ImGuiPopupPositionPolicy_ComboBox )
@ -7237,7 +7238,7 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
if ( ImGui : : IsMouseHoveringRect ( cand . Min , cand . Max ) )
{
ImFormatString ( buf , IM_ARRAYSIZE ( buf ) , " dbox (%.2f,%.2f->%.4f) \n dcen (%.2f,%.2f->%.4f) \n d (%.2f,%.2f->%.4f) \n nav %c, quadrant %c " , dbx , dby , dist_box , dcx , dcy , dist_center , dax , day , dist_axial , " WENS " [ g . NavMoveDir ] , " WENS " [ quadrant ] ) ;
ImDrawList * draw_list = ImGui : : GetOverlay DrawList ( window ) ;
ImDrawList * draw_list = ImGui : : GetForeground DrawList ( window ) ;
draw_list - > AddRect ( curr . Min , curr . Max , IM_COL32 ( 255 , 200 , 0 , 100 ) ) ;
draw_list - > AddRect ( cand . Min , cand . Max , IM_COL32 ( 255 , 255 , 0 , 200 ) ) ;
draw_list - > AddRectFilled ( cand . Max - ImVec2 ( 4 , 4 ) , cand . Max + ImGui : : CalcTextSize ( buf ) + ImVec2 ( 4 , 4 ) , IM_COL32 ( 40 , 0 , 0 , 150 ) ) ;
@ -7249,7 +7250,7 @@ static bool NavScoreItem(ImGuiNavMoveResult* result, ImRect cand)
if ( quadrant = = g . NavMoveDir )
{
ImFormatString ( buf , IM_ARRAYSIZE ( buf ) , " %.0f/%.0f " , dist_box , dist_center ) ;
ImDrawList * draw_list = ImGui : : GetOverlay DrawList ( window ) ;
ImDrawList * draw_list = ImGui : : GetForeground DrawList ( window ) ;
draw_list - > AddRectFilled ( cand . Min , cand . Max , IM_COL32 ( 255 , 0 , 0 , 200 ) ) ;
draw_list - > AddText ( g . IO . FontDefault , 13.0f , cand . Min , IM_COL32 ( 255 , 255 , 255 , 255 ) , buf ) ;
}
@ -7555,7 +7556,7 @@ ImVec2 ImGui::GetNavInputAmount2d(ImGuiNavDirSourceFlags dir_sources, ImGuiInput
static void NavScrollToBringItemIntoView ( ImGuiWindow * window , const ImRect & item_rect )
{
ImRect window_rect ( window - > InnerMainRect . Min - ImVec2 ( 1 , 1 ) , window - > InnerMainRect . Max + ImVec2 ( 1 , 1 ) ) ;
//GetOverlay DrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
//GetForeground DrawList(window)->AddRect(window_rect.Min, window_rect.Max, IM_COL32_WHITE); // [DEBUG]
if ( window_rect . Contains ( item_rect ) )
return ;
@ -7845,11 +7846,15 @@ static void ImGui::NavUpdate()
g . NavScoringRectScreen . Min . x = ImMin ( g . NavScoringRectScreen . Min . x + 1.0f , g . NavScoringRectScreen . Max . x ) ;
g . NavScoringRectScreen . Max . x = g . NavScoringRectScreen . Min . x ;
IM_ASSERT ( ! g . NavScoringRectScreen . IsInverted ( ) ) ; // Ensure if we have a finite, non-inverted bounding box here will allows us to remove extraneous ImFabs() calls in NavScoreItem().
//g.OverlayDrawList. AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG]
//GetForegroundDrawList()-> AddRect(g.NavScoringRectScreen.Min, g.NavScoringRectScreen.Max, IM_COL32(255,200,0,255)); // [DEBUG]
g . NavScoringCount = 0 ;
# if IMGUI_DEBUG_NAV_RECTS
if ( g . NavWindow ) { for ( int layer = 0 ; layer < 2 ; layer + + ) GetOverlayDrawList ( g . NavWindow ) - > AddRect ( g . NavWindow - > Pos + g . NavWindow - > NavRectRel [ layer ] . Min , g . NavWindow - > Pos + g . NavWindow - > NavRectRel [ layer ] . Max , IM_COL32 ( 255 , 200 , 0 , 255 ) ) ; } // [DEBUG]
if ( g . NavWindow ) { ImU32 col = ( ! g . NavWindow - > Hidden ) ? IM_COL32 ( 255 , 0 , 255 , 255 ) : IM_COL32 ( 255 , 0 , 0 , 255 ) ; ImVec2 p = NavCalcPreferredRefPos ( ) ; char buf [ 32 ] ; ImFormatString ( buf , 32 , " %d " , g . NavLayer ) ; GetOverlayDrawList ( g . NavWindow ) - > AddCircleFilled ( p , 3.0f , col ) ; GetOverlayDrawList ( g . NavWindow ) - > AddText ( NULL , 13.0f , p + ImVec2 ( 8 , - 4 ) , col , buf ) ; }
if ( g . NavWindow )
{
ImDrawList * draw_list = GetForegroundDrawList ( g . NavWindow ) ;
if ( 1 ) { for ( int layer = 0 ; layer < 2 ; layer + + ) draw_list - > AddRect ( g . NavWindow - > Pos + g . NavWindow - > NavRectRel [ layer ] . Min , g . NavWindow - > Pos + g . NavWindow - > NavRectRel [ layer ] . Max , IM_COL32 ( 255 , 200 , 0 , 255 ) ) ; } // [DEBUG]
if ( 1 ) { ImU32 col = ( ! g . NavWindow - > Hidden ) ? IM_COL32 ( 255 , 0 , 255 , 255 ) : IM_COL32 ( 255 , 0 , 0 , 255 ) ; ImVec2 p = NavCalcPreferredRefPos ( ) ; char buf [ 32 ] ; ImFormatString ( buf , 32 , " %d " , g . NavLayer ) ; draw_list - > AddCircleFilled ( p , 3.0f , col ) ; draw_list - > AddText ( NULL , 13.0f , p + ImVec2 ( 8 , - 4 ) , col , buf ) ; }
}
# endif
}
@ -9356,9 +9361,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
return ;
}
ImDrawList * overlay_draw_list = GetOverlay DrawList( window ) ; // Render additional visuals into the top-most draw list
ImDrawList * fg_draw_list = GetForeground DrawList( window ) ; // Render additional visuals into the top-most draw list
if ( window & & IsItemHovered ( ) )
overlay _draw_list- > AddRect ( window - > Pos , window - > Pos + window - > Size , IM_COL32 ( 255 , 255 , 0 , 255 ) ) ;
fg _draw_list- > AddRect ( window - > Pos , window - > Pos + window - > Size , IM_COL32 ( 255 , 255 , 0 , 255 ) ) ;
if ( ! node_open )
return ;
@ -9380,8 +9385,8 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImRect vtxs_rect ;
for ( int i = elem_offset ; i < elem_offset + ( int ) pcmd - > ElemCount ; i + + )
vtxs_rect . Add ( draw_list - > VtxBuffer [ idx_buffer ? idx_buffer [ i ] : i ] . pos ) ;
clip_rect . Floor ( ) ; overlay _draw_list- > AddRect ( clip_rect . Min , clip_rect . Max , IM_COL32 ( 255 , 255 , 0 , 255 ) ) ;
vtxs_rect . Floor ( ) ; overlay _draw_list- > AddRect ( vtxs_rect . Min , vtxs_rect . Max , IM_COL32 ( 255 , 0 , 255 , 255 ) ) ;
clip_rect . Floor ( ) ; fg _draw_list- > AddRect ( clip_rect . Min , clip_rect . Max , IM_COL32 ( 255 , 255 , 0 , 255 ) ) ;
vtxs_rect . Floor ( ) ; fg _draw_list- > AddRect ( vtxs_rect . Min , vtxs_rect . Max , IM_COL32 ( 255 , 0 , 255 , 255 ) ) ;
}
if ( ! pcmd_node_open )
continue ;
@ -9405,10 +9410,10 @@ void ImGui::ShowMetricsWindow(bool* p_open)
ImGui : : Selectable ( buf , false ) ;
if ( ImGui : : IsItemHovered ( ) )
{
ImDrawListFlags backup_flags = overlay _draw_list- > Flags ;
overlay _draw_list- > Flags & = ~ ImDrawListFlags_AntiAliasedLines ; // Disable AA on triangle outlines at is more readable for very large and thin triangles.
overlay _draw_list- > AddPolyline ( triangles_pos , 3 , IM_COL32 ( 255 , 255 , 0 , 255 ) , true , 1.0f ) ;
overlay _draw_list- > Flags = backup_flags ;
ImDrawListFlags backup_flags = fg _draw_list- > Flags ;
fg _draw_list- > Flags & = ~ ImDrawListFlags_AntiAliasedLines ; // Disable AA on triangle outlines at is more readable for very large and thin triangles.
fg _draw_list- > AddPolyline ( triangles_pos , 3 , IM_COL32 ( 255 , 255 , 0 , 255 ) , true , 1.0f ) ;
fg _draw_list- > Flags = backup_flags ;
}
}
ImGui : : TreePop ( ) ;
@ -9545,9 +9550,9 @@ void ImGui::ShowMetricsWindow(bool* p_open)
char buf [ 32 ] ;
ImFormatString ( buf , IM_ARRAYSIZE ( buf ) , " %d " , window - > BeginOrderWithinContext ) ;
float font_size = ImGui : : GetFontSize ( ) * 2 ;
ImDrawList * overlay_draw_list = GetOverlay DrawList( window ) ;
overlay _draw_list- > AddRectFilled ( window - > Pos , window - > Pos + ImVec2 ( font_size , font_size ) , IM_COL32 ( 200 , 100 , 100 , 255 ) ) ;
overlay _draw_list- > AddText ( NULL , font_size , window - > Pos , IM_COL32 ( 255 , 255 , 255 , 255 ) , buf ) ;
ImDrawList * fg_draw_list = GetForeground DrawList( window ) ;
fg _draw_list- > AddRectFilled ( window - > Pos , window - > Pos + ImVec2 ( font_size , font_size ) , IM_COL32 ( 200 , 100 , 100 , 255 ) ) ;
fg _draw_list- > AddText ( NULL , font_size , window - > Pos , IM_COL32 ( 255 , 255 , 255 , 255 ) , buf ) ;
}
}
ImGui : : End ( ) ;