From 459e94900d06ea79b7fb215880e336a8cba156ca Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Thu, 7 Dec 2023 09:27:52 +0100 Subject: wipshit --- src/tile-image.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'src/tile-image.cpp') diff --git a/src/tile-image.cpp b/src/tile-image.cpp index b10effe4..7bfea375 100644 --- a/src/tile-image.cpp +++ b/src/tile-image.cpp @@ -2,32 +2,43 @@ namespace floormat { -bool operator==(const tile_image_proto& a, const tile_image_proto& b) noexcept +template bool image_proto_::operator==(const image_proto_& b) const noexcept = default; +template image_proto_::operator bool() const noexcept { return atlas != nullptr; } + +template +image_ref_::operator bool() const noexcept { - return a.atlas == b.atlas && a.variant == b.variant; + return atlas != nullptr; } -tile_image_proto::operator bool() const noexcept { return atlas != nullptr; } +template +image_ref_::image_ref_(const image_ref_& o) noexcept + : atlas{o.atlas}, variant{o.variant} +{} + +template +image_ref_::image_ref_(std::shared_ptr& atlas, variant_t& variant) noexcept + : atlas{atlas}, variant{variant} +{} -tile_image_ref::tile_image_ref(std::shared_ptr& atlas, variant_t& variant) noexcept : - atlas{atlas}, variant{variant} +template +image_ref_::operator Proto() const noexcept { + return { atlas, variant }; } -tile_image_ref& tile_image_ref::operator=(const tile_image_proto& proto) noexcept +template +image_ref_& image_ref_::operator=(const Proto& proto) noexcept { atlas = proto.atlas; variant = proto.variant; return *this; } -tile_image_ref::tile_image_ref(const tile_image_ref&) noexcept = default; - -tile_image_ref::operator tile_image_proto() const noexcept -{ - return { atlas, variant }; -} +template struct image_proto_; +template struct image_ref_; -tile_image_ref::operator bool() const noexcept { return atlas != nullptr; } +template struct image_proto_; +template struct image_ref_; } // namespace floormat -- cgit v1.2.3