1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-22 18:28:53 -05:00

add ImGuiDataTypeGetter

This commit is contained in:
Evan Pezent 2021-07-03 11:46:29 -07:00
parent aa1918ff16
commit 11a7084b90

View File

@ -56,6 +56,26 @@
namespace ImPlot { namespace ImPlot {
// Calculates maximum index size of ImDrawIdx without integer overflow issues
template <typename T>
struct MaxIdx { static const unsigned int Value; };
template <> const unsigned int MaxIdx<unsigned short>::Value = 65535;
template <> const unsigned int MaxIdx<unsigned int>::Value = 4294967295;
// Gets ImGuiDataType for T
template <typename T>
struct ImGuiDataTypeGetter { static const ImGuiDataType Value; };
template <> const ImGuiDataType ImGuiDataTypeGetter<float>::Value = ImGuiDataType_Float;
template <> const ImGuiDataType ImGuiDataTypeGetter<double>::Value = ImGuiDataType_Double;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImU8>::Value = ImGuiDataType_U8;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImS8>::Value = ImGuiDataType_S8;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImU16>::Value = ImGuiDataType_U16;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImS16>::Value = ImGuiDataType_S16;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImU32>::Value = ImGuiDataType_U32;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImS32>::Value = ImGuiDataType_S32;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImU64>::Value = ImGuiDataType_U64;
template <> const ImGuiDataType ImGuiDataTypeGetter<ImS64>::Value = ImGuiDataType_S64;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// Item Utils // Item Utils
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -697,12 +717,6 @@ struct ShadedRenderer {
static const int VtxConsumed = 5; static const int VtxConsumed = 5;
}; };
// Stupid way of calculating maximum index size of ImDrawIdx without integer overflow issues
template <typename T>
struct MaxIdx { static const unsigned int Value; };
template <> const unsigned int MaxIdx<unsigned short>::Value = 65535;
template <> const unsigned int MaxIdx<unsigned int>::Value = 4294967295;
/// Renders primitive shapes in bulk as efficiently as possible. /// Renders primitive shapes in bulk as efficiently as possible.
template <typename Renderer> template <typename Renderer>
inline void RenderPrimitives(const Renderer& renderer, ImDrawList& DrawList, const ImRect& cull_rect) { inline void RenderPrimitives(const Renderer& renderer, ImDrawList& DrawList, const ImRect& cull_rect) {