From 14167171aff17b9bc4b5531fffd3f729e12f8a59 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 4 Mar 2023 11:09:41 +0100 Subject: src: make anim_scale easier to construct --- src/anim.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/anim.hpp b/src/anim.hpp index c2a2d0d1..f21e24ae 100644 --- a/src/anim.hpp +++ b/src/anim.hpp @@ -41,6 +41,11 @@ struct anim_scale final struct empty e = {}; }; anim_scale_type type = anim_scale_type::invalid; + constexpr anim_scale() = default; + constexpr anim_scale(const anim_scale&) = default; + constexpr anim_scale& operator=(const anim_scale&) = default; + constexpr anim_scale(float ratio) : r{ratio}, type{anim_scale_type::ratio} {} + constexpr anim_scale(unsigned width_or_height, bool is_width) : f{is_width, width_or_height}, type{anim_scale_type::ratio} {} Vector2ui scale_to(Vector2ui image_size) const; Vector2 scale_to_(Vector2ui image_size) const; }; @@ -50,7 +55,7 @@ struct anim_def final String object_name, anim_name; std::vector groups; Vector2ui pixel_size; - anim_scale scale; + anim_scale scale = anim_scale{1}; std::size_t nframes = 0, fps = 0, actionframe = 0; }; -- cgit v1.2.3