This commit is contained in:
Branimir Karadžić 2015-09-10 10:59:19 -07:00
parent 65e0417c45
commit 96dea0ebfa
2 changed files with 9 additions and 0 deletions

View File

@ -2197,6 +2197,7 @@ static void AddDrawListToRenderList(ImVector<ImDrawList*>& out_render_list, ImDr
// If this assert triggers because you are drawing lots of stuff manually, A) workaround by calling BeginChild()/EndChild() to put your draw commands in multiple draw lists, B) #define ImDrawIdx to a 'unsigned int' in imconfig.h and render accordingly.
const unsigned long long int max_vtx_idx = (unsigned long long int)1L << (sizeof(ImDrawIdx)*8);
IM_ASSERT((unsigned long long int)draw_list->_VtxCurrentIdx <= max_vtx_idx);
(void)max_vtx_idx;
GImGui->IO.MetricsRenderVertices += draw_list->VtxBuffer.Size;
GImGui->IO.MetricsRenderIndices += draw_list->IdxBuffer.Size;

View File

@ -215,6 +215,14 @@ namespace ImGui
Image(texture.ptr, _size, _uv0, _uv1, _tint_col, _border_col);
}
// Helper function for passing bgfx::TextureHandle to ImGui::ImageButton.
inline bool ImageButton(bgfx::TextureHandle _handle, const ImVec2& _size, const ImVec2& _uv0 = ImVec2(0,0), const ImVec2& _uv1 = ImVec2(1,1), int _frame_padding = -1, const ImVec4& _bg_col = ImVec4(0,0,0,0), const ImVec4& _tint_col = ImVec4(1,1,1,1))
{
union { bgfx::TextureHandle handle; ImTextureID ptr; } texture;
texture.handle = _handle;
return ImageButton(texture.ptr, _size, _uv0, _uv1, _frame_padding, _bg_col, _tint_col);
}
} // namespace ImGui
#endif // IMGUI_H_HEADER_GUARD