summaryrefslogtreecommitdiff
path: root/src/Window.hpp
diff options
context:
space:
mode:
authorGartoxFR <ewan.chorynski@insa-lyon.fr>2024-03-02 01:35:17 +0100
committerGitHub <noreply@github.com>2024-03-02 00:35:17 +0000
commitb2c34404777ea0850f90f4c38f64484f03599d14 (patch)
tree60f42773d2d606ae2072884cb537c751a7ab4b0f /src/Window.hpp
parentf115ba94d2ec6e093c94f425535b027bc570185e (diff)
animations: Refactor AnimatedVariable (#4911)
* animation: Refactor AnimatedVariable This commit decomposes the AnimatedVariable class into a base class with the common attribute to all variable types and a templated derived type containing strongly typed info on the type being animated. Access to the typed version is perfomed using the visitor pattern. A utility is provided to build a visitor on the fly using lambdas. Adding a new type to be animated should just be a matter of adding the typed in the list defined by the ANIMABLE_TYPES macro The size of the commit is justified by the API change in the AnimatedVariable class. No more vec(), fl() or col() method but a unified value() method. * animation: Remove visitor pattern * animation: Fix coding style * animation: Fix coding style
Diffstat (limited to 'src/Window.hpp')
-rw-r--r--src/Window.hpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Window.hpp b/src/Window.hpp
index 620ae06d..aeb674d1 100644
--- a/src/Window.hpp
+++ b/src/Window.hpp
@@ -221,8 +221,8 @@ class CWindow {
Vector2D m_vSize = Vector2D(0, 0);
// this is the real position and size used to draw the thing
- CAnimatedVariable m_vRealPosition;
- CAnimatedVariable m_vRealSize;
+ CAnimatedVariable<Vector2D> m_vRealPosition;
+ CAnimatedVariable<Vector2D> m_vRealSize;
// for not spamming the protocols
Vector2D m_vReportedPosition;
@@ -282,13 +282,13 @@ class CWindow {
std::unique_ptr<CPopup> m_pPopupHead;
// Animated border
- CGradientValueData m_cRealBorderColor = {0};
- CGradientValueData m_cRealBorderColorPrevious = {0};
- CAnimatedVariable m_fBorderFadeAnimationProgress;
- CAnimatedVariable m_fBorderAngleAnimationProgress;
+ CGradientValueData m_cRealBorderColor = {0};
+ CGradientValueData m_cRealBorderColorPrevious = {0};
+ CAnimatedVariable<float> m_fBorderFadeAnimationProgress;
+ CAnimatedVariable<float> m_fBorderAngleAnimationProgress;
// Fade in-out
- CAnimatedVariable m_fAlpha;
+ CAnimatedVariable<float> m_fAlpha;
bool m_bFadingOut = false;
bool m_bReadyToDelete = false;
Vector2D m_vOriginalClosedPos; // these will be used for calculations later on in
@@ -322,13 +322,13 @@ class CWindow {
std::vector<std::unique_ptr<IWindowTransformer>> m_vTransformers;
// for alpha
- CAnimatedVariable m_fActiveInactiveAlpha;
+ CAnimatedVariable<float> m_fActiveInactiveAlpha;
// animated shadow color
- CAnimatedVariable m_cRealShadowColor;
+ CAnimatedVariable<CColor> m_cRealShadowColor;
// animated tint
- CAnimatedVariable m_fDimPercent;
+ CAnimatedVariable<float> m_fDimPercent;
// swallowing
CWindow* m_pSwallowed = nullptr;