summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-14 07:33:47 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-14 07:33:47 +0100
commitdc5e66b5a29fd7de8ddf59852ceefd982289b7c3 (patch)
tree18bf0a274f1595d6d2d6cfb32a3b3825d843e315 /main
parent29bdd5f2170b9d46a8b3b0973c4c0845d6a2b61e (diff)
a
Diffstat (limited to 'main')
-rw-r--r--main/clickable.hpp9
-rw-r--r--main/draw.cpp8
2 files changed, 7 insertions, 10 deletions
diff --git a/main/clickable.hpp b/main/clickable.hpp
index 3ca8ccb6..c7502f33 100644
--- a/main/clickable.hpp
+++ b/main/clickable.hpp
@@ -1,18 +1,19 @@
#pragma once
#include "src/global-coords.hpp"
+#include <memory>
#include <Corrade/Containers/BitArrayView.h>
#include <Magnum/Math/Range.h>
namespace floormat {
+struct entity;
+
struct clickable final {
Math::Range2D<unsigned> src;
Math::Range2D<int> dest;
BitArrayView bitmask;
- float depth = 0;
- std::uint32_t stride;
- chunk_coords chunk;
- local_coords pos;
+ std::shared_ptr<entity> e;
+ std::uint32_t depth, stride;
bool mirrored;
};
diff --git a/main/draw.cpp b/main/draw.cpp
index 57623eef..84d90f65 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -136,12 +136,8 @@ void main_impl::draw_world() noexcept
if (check_chunk_visible(_shader.camera_offset(), sz))
{
_anim_mesh.draw(_shader, c);
- for (auto i = 0_uz; i < TILE_COUNT; i++)
- {
- const local_coords xy{i};
- if (auto [atlas, s] = c[xy].scenery(); atlas)
- _anim_mesh.add_clickable(_shader, window_size(), pos, std::uint8_t(i), atlas, s, _clickable_scenery);
- }
+ for (const auto& e : c.entities())
+ _anim_mesh.add_clickable(_shader, window_size(), e, _clickable_scenery);
}
}