@@ -62,8 +62,11 @@ void PulseAction::applyToSpriteIn(Sprite* spr, float fadetime)
6262float r1 = static_cast <float >(to.r - (float )(to.r - channelcolor.r ) * (1 .f - fadetime));
6363float g1 = static_cast <float >(to.g - (float )(to.g - channelcolor.g ) * (1 .f - fadetime));
6464float b1 = static_cast <float >(to.b - (float )(to.b - channelcolor.b ) * (1 .f - fadetime));
65- if (spr->getColor () != to)
66- spr->setColor ({r1, g1, b1, 255 .f });
65+
66+ glm::vec4 col = {r1, g1, b1, 255 .f };
67+
68+ if (spr->getColor () != col)
69+ spr->setColor (col);
6770}
6871
6972void PulseAction::applyToSpriteOut (Sprite* spr, float fadetime)
@@ -79,8 +82,11 @@ void PulseAction::applyToSpriteOut(Sprite* spr, float fadetime)
7982float r1 = static_cast <float >(to.r - (float )(to.r - channelcolor.r ) * (fadetime));
8083float g1 = static_cast <float >(to.g - (float )(to.g - channelcolor.g ) * (fadetime));
8184float b1 = static_cast <float >(to.b - (float )(to.b - channelcolor.b ) * (fadetime));
82- if (spr->getColor () != to)
83- spr->setColor ({r1, g1, b1, 255 .f });
85+
86+ glm::vec4 col = {r1, g1, b1, 255 .f };
87+
88+ if (spr->getColor () != col)
89+ spr->setColor (col);
8490}
8591
8692void PulseAction::update (float time)
@@ -141,6 +147,7 @@ void PulseAction::update(float time)
141147else
142148GameLayer::instance->pulsedGroups .insert (target);
143149
150+ // fade in
144151if (time <= fadein)
145152{
146153float fadetime = time / fadein;
@@ -161,7 +168,7 @@ void PulseAction::update(float time)
161168applyToSpriteIn (spr.get (), fadetime);
162169}
163170}
164- }
171+ } // fade out
165172else if (time >= fadein + hold)
166173{
167174float fadetime = (time - hold - fadein) / fadeout;
@@ -181,7 +188,7 @@ void PulseAction::update(float time)
181188applyToSpriteOut (spr.get (), fadetime);
182189}
183190}
184- }
191+ } // hold
185192else
186193{
187194std::shared_ptr<Group> group = GameLayer::instance->groups [target];
0 commit comments