add float and double support for the scalar range widget

This commit is contained in:
Green Sky 2021-09-14 16:37:53 +02:00
parent 9b53c72826
commit 5ee0b7017f
2 changed files with 16 additions and 1 deletions

View File

@ -44,5 +44,16 @@ namespace MM::ImGuiWidgets {
return DragScalarRange2EXT(label, ImGuiDataType_S64, &range.min(), &range.max(), 0.1f, v_min, v_max);
}
// float, double
template<>
bool DragScalarRange2(const char* label, ScalarRange2<float>& range, float v_min , float v_max) {
return DragScalarRange2EXT(label, ImGuiDataType_Float, &range.min(), &range.max(), 0.1f, v_min, v_max);
}
template<>
bool DragScalarRange2(const char* label, ScalarRange2<double>& range, double v_min , double v_max) {
return DragScalarRange2EXT(label, ImGuiDataType_Double, &range.min(), &range.max(), 0.1f, v_min, v_max);
}
} // MM::ImGuiWidgets

View File

@ -69,7 +69,11 @@ namespace MM::ImGuiWidgets {
template<>
bool DragScalarRange2(const char* label, ScalarRange2<int64_t>& range, int64_t v_min , int64_t v_max);
// TODO: float, double
// float, double
template<>
bool DragScalarRange2(const char* label, ScalarRange2<float>& range, float v_min , float v_max);
template<>
bool DragScalarRange2(const char* label, ScalarRange2<double>& range, double v_min , double v_max);
} // MM::ImGuiWidgets