summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-03-04 11:09:41 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-03-04 21:36:58 +0100
commit14167171aff17b9bc4b5531fffd3f729e12f8a59 (patch)
treec15e56a4ec716f6cb83419cea37dc63f484859ab /src
parentb16ab0038a0ec70c59a3bbfef4aa4dee0b04cf15 (diff)
src: make anim_scale easier to construct
Diffstat (limited to 'src')
-rw-r--r--src/anim.hpp7
1 files changed, 6 insertions, 1 deletions
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<anim_group> groups;
Vector2ui pixel_size;
- anim_scale scale;
+ anim_scale scale = anim_scale{1};
std::size_t nframes = 0, fps = 0, actionframe = 0;
};