hyprlock/src/core/AnimationManager.hpp
Maximilian Seidler 9f37c1c8e9
core: more hyprutils smart pointer usage and safe references to widgets (#686)
* core: move to UP and make widgets use SPs

* widgets: make widgets have a self ref to avoid UB

* fix shadows and let them have a WP to widgets
2025-03-05 08:35:43 +01:00

33 lines
1.1 KiB
C++

#pragma once
#include <hyprutils/animation/AnimationManager.hpp>
#include <hyprutils/animation/AnimatedVariable.hpp>
#include "../helpers/AnimatedVariable.hpp"
#include "../defines.hpp"
class CHyprlockAnimationManager : public Hyprutils::Animation::CAnimationManager {
public:
CHyprlockAnimationManager();
void tick();
virtual void scheduleTick();
virtual void onTicked();
using SAnimationPropertyConfig = Hyprutils::Animation::SAnimationPropertyConfig;
template <Animable VarType>
void createAnimation(const VarType& v, PHLANIMVAR<VarType>& pav, SP<SAnimationPropertyConfig> pConfig) {
constexpr const eAnimatedVarType EAVTYPE = typeToeAnimatedVarType<VarType>;
const auto PAV = makeShared<CAnimatedVariable<VarType>>();
PAV->create(EAVTYPE, static_cast<Hyprutils::Animation::CAnimationManager*>(this), PAV, v);
PAV->setConfig(pConfig);
pav = std::move(PAV);
}
bool m_bTickScheduled = false;
};
inline UP<CHyprlockAnimationManager> g_pAnimationManager;