diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-08 09:01:43 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-10-08 09:01:43 +0200 |
commit | bfe9becfca9e789bf653c4bb8e92917acac04218 (patch) | |
tree | c96d69127a058db737164ed4bb88d5a4d96163ea /src/object.cpp | |
parent | 05f426b934baa641cd847fd3fc06d7ac446cf8e9 (diff) |
a
Diffstat (limited to 'src/object.cpp')
-rw-r--r-- | src/object.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/object.cpp b/src/object.cpp index 1d089bf6..bed5ef88 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -7,6 +7,7 @@ #include "shaders/shader.hpp" #include <cmath> #include <algorithm> +#include <Magnum/Math/Functions.h> namespace floormat { @@ -110,8 +111,6 @@ void object::rotate(size_t, rotation new_r) const_cast<rotation&>(r) = new_r; } -template <typename T> constexpr T sgn(T val) { return T(T(0) < val) - T(val < T(0)); } - point object::normalize_coords(global_coords coord, Vector2b cur_offset, Vector2i new_offset) { auto off_tmp = Vector2i(cur_offset) + new_offset; @@ -119,7 +118,7 @@ point object::normalize_coords(global_coords coord, Vector2b cur_offset, Vector2 constexpr auto half_tile = iTILE_SIZE2/2; for (auto i = 0uz; i < 2; i++) { - auto sign = sgn(off_new[i]); + auto sign = Math::sign(off_new[i]); auto absval = std::abs(off_new[i]); if (absval > half_tile[i]) { |