Skylicht Engine
Loading...
Searching...
No Matches
CTween.h
1#pragma once
2
3#include "easing.h"
4#include <functional>
5
6#define MAX_TWEEN_VALUE 16
7
8namespace Skylicht
9{
10 class SKYLICHT_API CTween
11 {
12 protected:
13 bool m_useScaledTime;
14 float m_time;
15 float m_delay;
16 float m_endDelay;
17 float m_duration;
18
19 float m_percentTime;
20 float m_percentValue;
21
22 EEasingFunctions m_ease;
23 EasingFunction m_function;
24
25 float m_fromValue[MAX_TWEEN_VALUE];
26 float m_toValue[MAX_TWEEN_VALUE];
27 float m_value[MAX_TWEEN_VALUE];
28
29 int m_numValue;
30
31 bool m_start;
32 public:
33 std::function<void(CTween*)> OnUpdate;
34 std::function<void(CTween*)> OnFinish;
35 std::function<void(CTween*)> OnStart;
36 std::function<void(CTween*)> OnStop;
37 std::function<void(CTween*)> OnDelay;
38 std::function<void(CTween*)> OnEndDelay;
39
40 public:
41 CTween();
42
43 virtual ~CTween();
44
45 void update();
46
47 void run();
48
49 void stop();
50
51 virtual void updateValue() = 0;
52
53 protected:
54 void setBeginValue(int index, float value);
55
56 void setEndValue(int index, float value);
57
58 inline void setNumValue(int num)
59 {
60 m_numValue = num;
61 }
62
63 float getValueByIndex(int index)
64 {
65 return m_value[index];
66 }
67
68 public:
69 inline void setEase(EEasingFunctions ease)
70 {
71 m_ease = ease;
72 m_function = getEasingFunction(ease);
73 }
74
75 inline EEasingFunctions getEase()
76 {
77 return m_ease;
78 }
79
80 inline void setDelay(float delay)
81 {
82 m_delay = delay;
83 }
84
85 inline float getDelay()
86 {
87 return m_delay;
88 }
89
90 inline void setEndDelay(float delay)
91 {
92 m_endDelay = delay;
93 }
94
95 inline float getEndDelay()
96 {
97 return m_endDelay;
98 }
99
100 inline void setTime(float time)
101 {
102 m_time = time;
103 }
104
105 inline float getTime()
106 {
107 return m_time;
108 }
109
110 inline void setDuration(float duration)
111 {
112 m_duration = duration;
113 }
114
115 inline float getDuration()
116 {
117 return m_duration;
118 }
119
120 inline float getPercentTime()
121 {
122 return m_percentTime;
123 }
124
125 inline float getPercentValue()
126 {
127 return m_percentValue;
128 }
129
130 inline void setUseScaledTime(bool b)
131 {
132 m_useScaledTime = b;
133 }
134
135 inline bool isUseScaledTime()
136 {
137 return m_useScaledTime;
138 }
139 };
140}
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition AudioDebugLog.h:29