AA branch: io.RenderDrawListsFn signature changed to take ImDrawData, neater and future proof breaking of the render API (#133 #254)

This commit is contained in:
ocornut
2015-07-05 22:03:46 -06:00
parent 2633325b9f
commit f3303fa84f
6 changed files with 42 additions and 43 deletions

14
imgui.h
View File

@ -31,6 +31,7 @@
// Forward declarations
struct ImDrawCmd;
struct ImDrawList;
struct ImDrawData;
struct ImFont;
struct ImFontAtlas;
struct ImGuiIO;
@ -670,7 +671,7 @@ struct ImGuiIO
// REQUIRED: rendering function.
// See example code if you are unsure of how to implement this.
void (*RenderDrawListsFn)(ImDrawList** const draw_lists, int count);
void (*RenderDrawListsFn)(ImDrawData* data);
// Optional: access OS clipboard
// (default to use native Win32 clipboard on Windows, otherwise uses a private clipboard. Override to access OS clipboard on other architectures)
@ -981,7 +982,7 @@ struct ImGuiListClipper
//-----------------------------------------------------------------------------
// Draw List
// Hold a series of drawing commands. The user provides a renderer for ImDrawList.
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
//-----------------------------------------------------------------------------
// Draw callbacks for advanced uses.
@ -1087,6 +1088,15 @@ struct ImDrawList
IMGUI_API void UpdateTextureID();
};
// All draw data to render an ImGui frame
struct ImDrawData
{
ImDrawList** cmd_lists;
int cmd_lists_count;
int total_vtx_count; // For convenience, sum of all cmd_lists vtx_buffer.size()
int total_idx_count; // For convenience, sum of all cmd_lists idx_buffer.size()
};
// Load and rasterize multiple TTF fonts into a same texture.
// Sharing a texture for multiple fonts allows us to reduce the number of draw calls during rendering.
// We also add custom graphic data into the texture that serves for ImGui.