summaryrefslogtreecommitdiffhomepage
path: root/main
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-01 12:32:37 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-01 12:32:37 +0100
commit7ebee3863c061b1d0b64839b56bbc70ff4e5d924 (patch)
treeac0356bdcbf9f77864cb2cb2a6b5f2798c6fb3db /main
parent078c376b6255fb6fd24362b27862819444327265 (diff)
move scenery modify logic to scenery_ref
Diffstat (limited to 'main')
-rw-r--r--main/clickable.hpp7
-rw-r--r--main/draw.cpp4
-rw-r--r--main/main-impl.hpp8
3 files changed, 8 insertions, 11 deletions
diff --git a/main/clickable.hpp b/main/clickable.hpp
index 3eee243f..92b8dd49 100644
--- a/main/clickable.hpp
+++ b/main/clickable.hpp
@@ -5,17 +5,14 @@
namespace floormat {
-template<typename Atlas, typename T>
struct clickable final {
-
- Atlas& atlas;
- T& item;
Math::Range2D<UnsignedInt> src, dest;
BitArrayView bitmask;
float depth = 0;
+ std::uint32_t stride;
chunk_coords chunk;
local_coords pos;
- bool mirrored = false;
+ bool mirrored;
};
} // namespace floormat
diff --git a/main/draw.cpp b/main/draw.cpp
index 957d3217..28bd1fdd 100644
--- a/main/draw.cpp
+++ b/main/draw.cpp
@@ -215,12 +215,12 @@ void main_impl::drawEvent()
timeline.nextFrame();
}
-ArrayView<const clickable<anim_atlas, scenery>> main_impl::clickable_scenery() const noexcept
+ArrayView<const clickable> main_impl::clickable_scenery() const noexcept
{
return { _clickable_scenery.data(), _clickable_scenery.size() };
}
-ArrayView<clickable<anim_atlas, scenery>> main_impl::clickable_scenery() noexcept
+ArrayView<clickable> main_impl::clickable_scenery() noexcept
{
return { _clickable_scenery.data(), _clickable_scenery.size() };
}
diff --git a/main/main-impl.hpp b/main/main-impl.hpp
index 3ec6b8a5..deb5d73e 100644
--- a/main/main-impl.hpp
+++ b/main/main-impl.hpp
@@ -19,7 +19,7 @@ namespace floormat {
struct floormat_app;
struct scenery;
struct anim_atlas;
-template<typename Atlas, typename T> struct clickable;
+struct clickable;
struct main_impl final : Platform::Sdl2Application, floormat_main
{
@@ -41,8 +41,8 @@ struct main_impl final : Platform::Sdl2Application, floormat_main
global_coords pixel_to_tile(Vector2d position) const noexcept override;
Vector2d pixel_to_tile_(Vector2d position) const noexcept override;
- ArrayView<const clickable<anim_atlas, scenery>> clickable_scenery() const noexcept override;
- ArrayView<clickable<anim_atlas, scenery>> clickable_scenery() noexcept override;
+ ArrayView<const clickable> clickable_scenery() const noexcept override;
+ ArrayView<clickable> clickable_scenery() noexcept override;
Platform::Sdl2Application& application() noexcept override;
const Platform::Sdl2Application& application() const noexcept override;
@@ -77,7 +77,7 @@ private:
[[maybe_unused]] char _dummy = maybe_register_debug_callback(s.gpu_debug);
floormat_app& app; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
tile_shader _shader;
- std::vector<clickable<anim_atlas, scenery>> _clickable_scenery;
+ std::vector<clickable> _clickable_scenery;
struct world _world{};
Magnum::Timeline timeline;
floor_mesh _floor_mesh;