From 366754fc5718fc62f28fc7cfe0610d6c791bc573 Mon Sep 17 00:00:00 2001 From: nucular Date: Tue, 30 May 2017 07:02:05 +0200 Subject: [PATCH] Expose ImGuiListClipper and its members (#19) * Provide access to ImGuiListClipper members * Added ImGuiListClipper_GetDisplayStart and ImGuiListClipper_GetDisplayEnd to cimgui.h --- cimgui/Makefile | 3 ++- cimgui/cimgui.h | 8 ++++++++ cimgui/listClipper.cpp | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 cimgui/listClipper.cpp diff --git a/cimgui/Makefile b/cimgui/Makefile index 349cb40..807a2c5 100644 --- a/cimgui/Makefile +++ b/cimgui/Makefile @@ -3,8 +3,9 @@ # Compatible with Ubuntu 14.04.1 and Mac OS X OBJS = cimgui.o -OBJS += fontAtlas.o +OBJS += fontAtlas.o OBJS += drawList.o +OBJS += listClipper.o #OBJS += test.o OBJS += ../imgui/imgui.o OBJS += ../imgui/imgui_draw.o diff --git a/cimgui/cimgui.h b/cimgui/cimgui.h index 4dad982..6a54d1d 100644 --- a/cimgui/cimgui.h +++ b/cimgui/cimgui.h @@ -34,6 +34,7 @@ struct ImFont; struct ImFontConfig; struct ImFontAtlas; struct ImDrawCmd; +struct ImGuiListClipper; typedef unsigned short ImDrawIdx; typedef unsigned int ImU32; @@ -491,3 +492,10 @@ CIMGUI_API void ImDrawList_PrimWriteIdx(struct ImDrawList* list, ImD CIMGUI_API void ImDrawList_PrimVtx(struct ImDrawList* list, CONST struct ImVec2 pos, CONST struct ImVec2 uv, ImU32 col); CIMGUI_API void ImDrawList_UpdateClipRect(struct ImDrawList* list); CIMGUI_API void ImDrawList_UpdateTextureID(struct ImDrawList* list); + +// ImGuiListClipper +CIMGUI_API void ImGuiListClipper_Begin(ImGuiListClipper* clipper, int count, float items_height); +CIMGUI_API void ImGuiListClipper_End(ImGuiListClipper* clipper); +CIMGUI_API bool ImGuiListClipper_Step(ImGuiListClipper* clipper); +CIMGUI_API int ImGuiListClipper_GetDisplayStart(ImGuiListClipper* clipper); +CIMGUI_API int ImGuiListClipper_GetDisplayEnd(ImGuiListClipper* clipper); diff --git a/cimgui/listClipper.cpp b/cimgui/listClipper.cpp new file mode 100644 index 0000000..aea0a21 --- /dev/null +++ b/cimgui/listClipper.cpp @@ -0,0 +1,27 @@ +#include "../imgui/imgui.h" +#include "cimgui.h" + +CIMGUI_API void ImGuiListClipper_Begin(ImGuiListClipper* clipper, int count, float items_height) +{ + clipper->Begin(count, items_height); +} + +CIMGUI_API void ImGuiListClipper_End(ImGuiListClipper* clipper) +{ + clipper->End(); +} + +CIMGUI_API bool ImGuiListClipper_Step(ImGuiListClipper* clipper) +{ + return clipper->Step(); +} + +CIMGUI_API int ImGuiListClipper_GetDisplayStart(ImGuiListClipper* clipper) +{ + return clipper->DisplayStart; +} + +CIMGUI_API int ImGuiListClipper_GetDisplayEnd(ImGuiListClipper* clipper) +{ + return clipper->DisplayEnd; +}