summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-17 20:13:06 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-17 20:13:06 +0200
commit7204fc84110b43bee15c5f5d037e4cc30786add1 (patch)
treed9fcd7af2e5479cb78f7ea3d64dcbc43c20dd63e /src
parent2df079d68aca2b06fab4b24f678ea58b70a1c79d (diff)
a
Diffstat (limited to 'src')
-rw-r--r--src/camera-offset.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/camera-offset.cpp b/src/camera-offset.cpp
index 2595d1d8..3087cf13 100644
--- a/src/camera-offset.cpp
+++ b/src/camera-offset.cpp
@@ -1,6 +1,7 @@
#include "camera-offset.hpp"
#include "tile-defs.hpp"
#include "shaders/tile-shader.hpp"
+#include "compat/assert.hpp"
#include <Magnum/Math/Vector2.h>
namespace floormat {
@@ -11,10 +12,11 @@ with_shifted_camera_offset::with_shifted_camera_offset(tile_shader& shader, shor
_shader{shader},
_offset{shader.camera_offset()}
{
- const auto offset = tile_shader::project({float(x)*TILE_MAX_DIM*TILE_SIZE[0],
- float(y)*TILE_MAX_DIM*TILE_SIZE[1],
- 0});
- _shader.set_camera_offset(_offset + offset);
+ const auto offset = _offset + tile_shader::project({float(x)*TILE_MAX_DIM*TILE_SIZE[0],
+ float(y)*TILE_MAX_DIM*TILE_SIZE[1],
+ 0});
+ _shader.set_camera_offset(offset);
+ ASSERT(std::abs(offset[0]) < 1 << 24 && std::abs(offset[1]) < 1 << 24);
}
with_shifted_camera_offset::~with_shifted_camera_offset()