summaryrefslogtreecommitdiffhomepage
path: root/src/scenery.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-11-07 10:29:56 +0100
committerStanislaw Halik <sthalik@misaki.pl>2022-11-07 10:29:56 +0100
commit672f67c61f275dea196d4c3fbc5ffe7405dc43d3 (patch)
tree22559814268d289245d26f363708678b02c396c9 /src/scenery.hpp
parent411164f34aeea4987dae101cf92beb5dfa8c0cd9 (diff)
wip
Diffstat (limited to 'src/scenery.hpp')
-rw-r--r--src/scenery.hpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/scenery.hpp b/src/scenery.hpp
index 04c54c22..a59d6990 100644
--- a/src/scenery.hpp
+++ b/src/scenery.hpp
@@ -4,6 +4,8 @@
namespace floormat {
+struct anim_atlas;
+
enum class rotation : std::uint16_t {
N, NE, E, SE, S, SW, W, NW,
COUNT,
@@ -17,15 +19,26 @@ struct scenery final
frame_t frame : 12 = NO_FRAME;
rotation r : 4 = rotation::N;
-
- constexpr operator bool() const noexcept;
};
static_assert(sizeof(scenery) == sizeof(std::uint16_t));
-constexpr scenery::operator bool() const noexcept
-{
- return frame == NO_FRAME;
-}
+struct scenery_proto final {
+ std::shared_ptr<anim_atlas> atlas;
+ scenery frame;
+ operator bool() const noexcept;
+};
+
+struct scenery_ref final {
+ std::shared_ptr<anim_atlas>& atlas;
+ scenery& frame;
+
+ scenery_ref(std::shared_ptr<anim_atlas>& atlas, scenery& frame) noexcept;
+ scenery_ref(const scenery_ref&) noexcept;
+ scenery_ref(scenery_ref&&) noexcept;
+ scenery_ref& operator=(const scenery_proto& proto) noexcept;
+ operator scenery_proto() const noexcept;
+ operator bool() const noexcept;
+};
} // namespace floormat