diff --git a/implot_items.cpp b/implot_items.cpp index 8ca84d9..25c3de3 100644 --- a/implot_items.cpp +++ b/implot_items.cpp @@ -56,6 +56,26 @@ namespace ImPlot { +// Calculates maximum index size of ImDrawIdx without integer overflow issues +template +struct MaxIdx { static const unsigned int Value; }; +template <> const unsigned int MaxIdx::Value = 65535; +template <> const unsigned int MaxIdx::Value = 4294967295; + +// Gets ImGuiDataType for T +template +struct ImGuiDataTypeGetter { static const ImGuiDataType Value; }; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_Float; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_Double; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_U8; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_S8; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_U16; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_S16; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_U32; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_S32; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_U64; +template <> const ImGuiDataType ImGuiDataTypeGetter::Value = ImGuiDataType_S64; + //----------------------------------------------------------------------------- // Item Utils //----------------------------------------------------------------------------- @@ -697,12 +717,6 @@ struct ShadedRenderer { static const int VtxConsumed = 5; }; -// Stupid way of calculating maximum index size of ImDrawIdx without integer overflow issues -template -struct MaxIdx { static const unsigned int Value; }; -template <> const unsigned int MaxIdx::Value = 65535; -template <> const unsigned int MaxIdx::Value = 4294967295; - /// Renders primitive shapes in bulk as efficiently as possible. template inline void RenderPrimitives(const Renderer& renderer, ImDrawList& DrawList, const ImRect& cull_rect) {