From dc5e66b5a29fd7de8ddf59852ceefd982289b7c3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 14 Mar 2023 07:33:47 +0100 Subject: a --- main/clickable.hpp | 9 +++++---- main/draw.cpp | 8 ++------ 2 files changed, 7 insertions(+), 10 deletions(-) (limited to 'main') 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 #include #include namespace floormat { +struct entity; + struct clickable final { Math::Range2D src; Math::Range2D dest; BitArrayView bitmask; - float depth = 0; - std::uint32_t stride; - chunk_coords chunk; - local_coords pos; + std::shared_ptr 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); } } -- cgit v1.2.3