ブランチなのでゴミさくじょ
@@ -1,291 +0,0 @@ | ||
1 | -#ifndef __SFJP_MYU__AGH_EffectControl_H__ | |
2 | -#define __SFJP_MYU__AGH_EffectControl_H__ | |
3 | - | |
4 | -namespace math{ | |
5 | - | |
6 | - // ???E?g?̊??N???X | |
7 | - template <typename Ty> | |
8 | - class TLineBase | |
9 | - { | |
10 | - protected: | |
11 | - Ty m_rangeMin, m_rangeMax; | |
12 | - | |
13 | - inline Ty _Sub(){ | |
14 | - return m_rangeMax - m_rangeMin; } | |
15 | - public: | |
16 | - // ?R???X?g???N?^?E?f?X?g???N?^ | |
17 | - TLineBase(){ | |
18 | - m_rangeMin = m_rangeMax = 0; | |
19 | - } | |
20 | - virtual ~TLineBase(){} | |
21 | - | |
22 | - // ?ŏ??l?ƍő?l??ݒ肷??B | |
23 | - void SetRange(Ty rangeMin, Ty rangeMax){ | |
24 | - m_rangeMin = rangeMin; | |
25 | - m_rangeMax = rangeMax; | |
26 | - } | |
27 | - | |
28 | - // 0.0f?`1.0f?̊ԂŎw?肷?鎖?ɂ?蒆?Ԓl???擾????B?E?E?E?܂??}?C?i?X?Ƃ?1.0f?ȏ?̎w????\??????ǁE?E?E | |
29 | - virtual Ty Get(float fIntermediate)=0; | |
30 | - }; | |
31 | - | |
32 | - typedef TLineBase<int> CIntLineBase; | |
33 | - typedef TLineBase<float> CFloatLineBase; | |
34 | - | |
35 | - //typedef CLineBase CWaveBase; | |
36 | - | |
37 | - ////////////////////////////////////////////////// | |
38 | - | |
39 | - // ?????N???X | |
40 | - template <typename Ty> | |
41 | - class TStraightLine : public TLineBase<Ty> | |
42 | - { | |
43 | - public: | |
44 | - TStraightLine(){} | |
45 | - virtual ~TStraightLine(){} | |
46 | - | |
47 | - Ty Get(float fIntermediate){ | |
48 | - return (Ty)(m_rangeMin + _Sub() * fIntermediate); | |
49 | - } | |
50 | - }; | |
51 | - typedef TStraightLine<int> CStraightLine, CStraight, CLinear, CLine; | |
52 | - typedef TStraightLine<int> CIntStraightLine, CIntStraight, CIntLinear, CIntLine; | |
53 | - typedef TStraightLine<float> CFloatStraightLine, CFloatStraight, CFloatLinear, CFloatLine; | |
54 | - | |
55 | - //typedef CStraightLine CStraight, CLinear, CLine; | |
56 | - | |
57 | -}//end of math namespace | |
58 | - | |
59 | - | |
60 | - | |
61 | -/* | |
62 | -class CEffectControlBase : public CControlBase { | |
63 | -protected | |
64 | - int m_frameCounter; | |
65 | - int m_nowTimeMs; | |
66 | - | |
67 | -_AGH_EVENT_ACCESS_MODIFIER: | |
68 | - virtual bool OnFrame(){ | |
69 | - m_frameCounter++; | |
70 | - return true; | |
71 | - } | |
72 | - | |
73 | -public: | |
74 | - CEffectControlBase(){ | |
75 | - //ResetTime(); | |
76 | - } | |
77 | - virtual ~CEffectControlBase(){} | |
78 | - | |
79 | - void ResetTime(){ | |
80 | - if ( m_nowTimeMs == -1 ) | |
81 | - SetTimeUnitInFrame(); | |
82 | - else | |
83 | - SetTimeUnitInMs(); | |
84 | - } | |
85 | - | |
86 | - void SetTimeUnitInFrame(){ m_frameCounter=0; m_nowTimeMs=-1; } | |
87 | - void SetTimeUnitInMs(){ m_frameCounter=-1; m_nowTimeMs=0; } | |
88 | -};*/ | |
89 | - | |
90 | -#define AGH_EFFECT_MODE_TIME (1) | |
91 | -#define AGH_EFFECT_MODE_FRAME (2) | |
92 | - | |
93 | -class CEffectControlBase : public CControlBase { | |
94 | -private: | |
95 | - bool m_bAvailable; | |
96 | -protected: | |
97 | - int m_nCounter; | |
98 | - int m_mode; | |
99 | - | |
100 | -_AGH_EVENT_ACCESS_MODIFIER: | |
101 | - virtual bool OnFrame(){ | |
102 | - if ( m_bAvailable ){ | |
103 | - if ( m_mode == AGH_EFFECT_MODE_FRAME ) | |
104 | - m_nCounter++; | |
105 | - else | |
106 | - throw 0;// TODO: ?Ƃ肠???????Ԏ擾?͊??ˑ??̕??????ʓ|?Ȃ̂Ō?i????MXP?Ƃ??g???E?E?E?j | |
107 | - } | |
108 | - return true; | |
109 | - } | |
110 | - | |
111 | -public: | |
112 | - CEffectControlBase(){ | |
113 | - ResetTime(); | |
114 | - SetCountInFrame(); | |
115 | - //m_bAvailable = false; | |
116 | - Stop(); | |
117 | - } | |
118 | - virtual ~CEffectControlBase(){} | |
119 | - | |
120 | - void ResetTime(){ m_nCounter = 0; } | |
121 | - | |
122 | - void Start(){ m_bAvailable = true; } | |
123 | - void Stop(){ m_bAvailable = false; ResetTime(); } | |
124 | - void Pause(){ m_bAvailable = m_bAvailable ? false : true; } | |
125 | - bool IsAvailable(){ return m_bAvailable; } | |
126 | - | |
127 | - void SetCountInFrame(){ m_mode = AGH_EFFECT_MODE_FRAME; } | |
128 | - void SetCountInTime(){ m_mode = AGH_EFFECT_MODE_TIME; } | |
129 | -}; | |
130 | - | |
131 | -//////////////////////////////////////////////////////////////////////////////////////////////////// | |
132 | - | |
133 | -/* | |
134 | -// ?F?̃t?F?[?h | |
135 | -class CColorFadeController : public CEffectControlBase | |
136 | -{ | |
137 | -protected: | |
138 | - AGHCOLOR m_startColor; | |
139 | - AGHCOLOR m_endColor; | |
140 | - int m_nTargetTime; | |
141 | - AGHCOLOR *m_pTarget; | |
142 | - | |
143 | - // ?C?x???g?n???h?? | |
144 | -_AGH_EVENT_ACCESS_MODIFIER: | |
145 | - virtual bool OnFrame(){ | |
146 | - if ( m_timeInFrame != 0 ){ | |
147 | - if ( m_timeInFrame <= m_frameCounter ){ | |
148 | - if ( pTargetColor == NULL ) | |
149 | - throw CAghException("CColorFadeController::OnFrame() Target color not setted. " | |
150 | - "Please call SetParentControl() or SetTargetColorPtr()"); | |
151 | - | |
152 | - CEffectControlBase::OnFrame(); | |
153 | - } | |
154 | - else | |
155 | - m_timeInFrame = 0; | |
156 | - } | |
157 | - return true; | |
158 | - } | |
159 | - | |
160 | -public: | |
161 | - // ?R???X?g???N?^ | |
162 | - CColorFadeController(){ | |
163 | - m_startColor = 0xffffffff; | |
164 | - m_endColor = 0xffffffff; | |
165 | - m_nTargetTime = 0; | |
166 | - m_pTarget = NULL; | |
167 | - } | |
168 | - | |
169 | - void Fade(AGHCOLOR startColor, AGHCOLOR endColor, int nTime){ | |
170 | - m_startColor = startColor; | |
171 | - m_endColor = endColor; | |
172 | - m_nTargetTime = nTime; | |
173 | - ResetTime(); | |
174 | - } | |
175 | - void FadeIn(int nTime){ Fade( 0x00ffffff, 0xffffffff, nTime); } | |
176 | - void FadeOut(int nTime){ Fade( 0xffffffff, 0x00ffffff, nTime); } | |
177 | - | |
178 | - virtual void SetParentControl(CVisualControlBase* pParentControl){ | |
179 | - //TODO: m_pTarget = pParentControl-> | |
180 | - CControlBase::SetParentControl(pParentControl); | |
181 | - } | |
182 | - void SetTargetColorPtr(AGHCOLOR *pTargetColor){ | |
183 | - m_pTarget = pTargetColor; | |
184 | - } | |
185 | -}; | |
186 | -*/ | |
187 | - | |
188 | -template <typename LINE_CLASS=CIntStraightLine> | |
189 | -class CColorLine | |
190 | -{ | |
191 | -protected: | |
192 | - LINE_CLASS m_la, m_lr, m_lg, m_lb; | |
193 | -}; | |
194 | - | |
195 | -//#################### | |
196 | - | |
197 | -// ?F?̃t?F?[?h | |
198 | -template <typename LINE_CLASS = math::CIntStraightLine> | |
199 | -class TColorFadeEffect : public CEffectControlBase | |
200 | -{ | |
201 | -private: | |
202 | - typedef CEffectControlBase _BASE; | |
203 | -protected: | |
204 | - //AGHCOLOR m_startColor; | |
205 | - //AGHCOLOR m_endColor; | |
206 | - int m_nGoalTime; // Term?Ȃ?Ă̂??l???? | |
207 | - CVisualControlBase *m_pTarget; | |
208 | - | |
209 | - //LINE_CLASS m_lineA, m_lineR, m_lineG, m_lineB; | |
210 | - //LINE_CLASS _la, _lr, _lg, _lb; | |
211 | - LINE_CLASS m_la, m_lr, m_lg, m_lb; | |
212 | - | |
213 | - // ?C?x???g?n???h?? | |
214 | -_AGH_EVENT_ACCESS_MODIFIER: | |
215 | - virtual bool OnFrame(){ | |
216 | - _BASE::OnFrame(); | |
217 | - | |
218 | - /*if ( m_timeInFrame != 0 ){ | |
219 | - if ( m_timeInFrame <= m_frameCounter ){ | |
220 | - if ( pTargetColor == NULL ) | |
221 | - throw CAghException("CColorFadeController::OnFrame() Target color not setted. " | |
222 | - "Please call SetParentControl() or SetTargetColorPtr()"); | |
223 | - | |
224 | - CEffectControlBase::OnFrame(); | |
225 | - } | |
226 | - else | |
227 | - m_timeInFrame = 0; | |
228 | - }*/ | |
229 | - if ( IsAvailable() ){ | |
230 | - float f = m_nCounter / (float)m_nGoalTime; | |
231 | - m_pTarget->SetColor(AGHCOLOR_ARGB(m_la.Get(f), m_lr.Get(f), m_lg.Get(f), m_lb.Get(f))); | |
232 | - } | |
233 | - return true; | |
234 | - } | |
235 | - | |
236 | -public: | |
237 | - // ?R???X?g???N?^ | |
238 | - TColorFadeEffect(){ | |
239 | - //m_startColor = 0xffffffff; | |
240 | - //m_startColor = 0; | |
241 | - //m_endColor = 0xffffffff; | |
242 | - m_nGoalTime = 0; | |
243 | - m_pTarget = NULL; | |
244 | - | |
245 | - /*m_la.SetRange(0,255); | |
246 | - m_lr.SetRange(0,255); | |
247 | - m_lg.SetRange(0,255); | |
248 | - m_lb.SetRange(0,255);*/ | |
249 | - } | |
250 | - virtual ~TColorFadeEffect(){} | |
251 | - | |
252 | - /////////////////////////////////////////////////////////// | |
253 | - | |
254 | - void SetTargetControl(CVisualControlBase* pControl){ | |
255 | - m_pTarget = pControl; | |
256 | - } | |
257 | - | |
258 | - void Setup(CVisualControlBase* pControl, AGHCOLOR startColor, AGHCOLOR endColor, int nGoalTime){ | |
259 | - SetTargetControl(pControl); | |
260 | - Fade(startColor, endColor, nGoalTime); | |
261 | - } | |
262 | - | |
263 | - ////////////////////// | |
264 | - | |
265 | - void Fade(AGHCOLOR startColor, AGHCOLOR endColor, int nGoalTime){ | |
266 | - //m_startColor = startColor; | |
267 | - //m_endColor = endColor; | |
268 | - m_nGoalTime = nGoalTime; | |
269 | - | |
270 | - unsigned char* pbStartColor = (unsigned char*)&startColor; | |
271 | - unsigned char* pbEndColor = (unsigned char*)&endColor; | |
272 | - m_lb.SetRange( pbStartColor[0], pbEndColor[0] ); | |
273 | - m_lg.SetRange( pbStartColor[1], pbEndColor[1] ); | |
274 | - m_lr.SetRange( pbStartColor[2], pbEndColor[2] ); | |
275 | - m_la.SetRange( pbStartColor[3], pbEndColor[3] ); | |
276 | - | |
277 | - Start(); | |
278 | - } | |
279 | - void FadeIn(int nGoalTime){ Fade( 0x00ffffff, 0xffffffff, nGoalTime); } | |
280 | - void FadeOut(int nGoalTime){ Fade( 0xffffffff, 0x00ffffff, nGoalTime); } | |
281 | - void FadeIn(CVisualControlBase* pControl, int nGoalTime){ Setup( pControl, 0x00ffffff, 0xffffffff, nGoalTime); } | |
282 | - void FadeOut(CVisualControlBase* pControl, int nGoalTime){ Setup( pControl, 0xffffffff, 0x00ffffff, nGoalTime); } | |
283 | - | |
284 | -}; | |
285 | -typedef TColorFadeEffect<> CColorFadeEffect, CFadeEffect; | |
286 | - | |
287 | -// ?_?? | |
288 | -class CBlinkController : public CEffectControlBase { | |
289 | -}; | |
290 | - | |
291 | -#endif//__SFJP_MYU__AGH_EffectControl_H__ | |
\ No newline at end of file |