lxgui
utils_maths.hpp
1 #ifndef LXGUI_UTILS_MATHS_HPP
2 #define LXGUI_UTILS_MATHS_HPP
3 
4 #include "lxgui/lxgui.hpp"
5 #include "lxgui/utils.hpp"
6 
7 namespace lxgui::utils {
8 
10 enum class rounding_method {
12  nearest,
16  up,
18  down
19 };
20 
28 float round(float value, float unit, rounding_method method);
29 
30 } // namespace lxgui::utils
31 
32 #endif
float round(float value, float unit, rounding_method method)
Round a floating point value to a specific unit and using a specific rounding method.
Definition: utils_maths.cpp:8
rounding_method
Rounding method for points to pixels conversions.
Definition: utils_maths.hpp:10
@ up
Equivalent to ceil()
@ down
Equivalent to floor()
@ nearest
Equivalent to round()
@ nearest_not_zero
Equivalent to round() but only returns 0 if input is exactly 0.