File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class Animation : public Core::Drawable {
3737 */
3838 Animation (const std::vector<std::string> &paths, bool play,
3939 std::size_t interval, bool looping = true ,
40- std::size_t cooldown = 100 );
40+ std::size_t cooldown = 100 , bool useAA = true );
4141
4242 /* *
4343 * @brief Get the interval between frames.
@@ -99,6 +99,20 @@ class Animation : public Core::Drawable {
9999 */
100100 void SetCooldown (int cooldown) { m_Cooldown = cooldown; }
101101
102+ /* *
103+ * @brief Sets whether anti-aliasing (AA) should be enabled or disabled.
104+ *
105+ * @param useAA A boolean value indicating whether anti-aliasing should be
106+ * enabled (true) or disabled (false).
107+ *
108+ * @note This function only sets the internal flag for anti-aliasing and
109+ * does not directly affect rendering. The actual effect of anti-aliasing
110+ * depends on the rendering pipeline and the graphics hardware capabilities.
111+ *
112+ * @sa https://en.wikipedia.org/wiki/Spatial_anti-aliasing
113+ */
114+ void UseAntiAliasing (bool useAA);
115+
102116 /* *
103117 * @brief Set the current frame of the animation.
104118 * @param index Index of the frame to set as current.
Original file line number Diff line number Diff line change 44
55namespace Util {
66Animation::Animation (const std::vector<std::string> &paths, bool play,
7- std::size_t interval, bool looping, std::size_t cooldown)
7+ std::size_t interval, bool looping, std::size_t cooldown,
8+ bool useAA)
89 : m_State(play ? State::PLAY : State::PAUSE),
910 m_Interval (interval),
1011 m_Looping(looping),
1112 m_Cooldown(cooldown) {
1213 m_Frames.reserve (paths.size ());
1314 for (const auto &path : paths) {
14- m_Frames.push_back (std::make_shared<Util::Image>(path));
15+ m_Frames.push_back (std::make_shared<Util::Image>(path, useAA));
16+ }
17+ }
18+
19+ void Animation::UseAntiAliasing (bool useAA) {
20+ for (const auto &frame : m_Frames) {
21+ frame->UseAntiAliasing (useAA);
1522 }
1623}
1724
You can’t perform that action at this time.
0 commit comments