persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
UIAnimationHandle.hpp
Go to the documentation of this file.
1
6
7#pragma once
8
10
11#include <memory>
12
17{
18 public:
19 UIAnimationHandle() = default;
20
21 explicit UIAnimationHandle(std::shared_ptr<UIAnimation> ptr) : anim(ptr)
22 {
23 }
24
25 void cancel()
26 {
27 if (auto a = anim.lock())
28 {
29 a->cancel();
30 }
31 }
32
33 void pause()
34 {
35 if (auto a = anim.lock())
36 {
37 a->pause();
38 }
39 }
40
41 void resume()
42 {
43 if (auto a = anim.lock())
44 {
45 a->resume();
46 }
47 }
48
49 void reverse()
50 {
51 if (auto a = anim.lock())
52 {
53 a->reverse();
54 }
55 }
56
57 bool isValid() const
58 {
59 return !anim.expired();
60 }
61
62 bool isPlaying() const
63 {
64 auto a = anim.lock();
65 return a && !a->isCancelled() && !a->isPaused() && !a->isDone();
66 }
67
68 private:
69 std::weak_ptr<UIAnimation> anim;
70};
Base class for one UI animation step (property, delay, callback, sequence).
UIAnimationHandle()=default
UIAnimationHandle(std::shared_ptr< UIAnimation > ptr)
std::weak_ptr< UIAnimation > anim