mirror of https://github.com/axmolengine/axmol.git
Fixes ShaderRetroEffect crashes. (#18237)
This commit is contained in:
parent
46e70d3c71
commit
d13c01230f
|
@ -573,13 +573,16 @@ void ShaderRetroEffect::update(float dt)
|
|||
for (int i = 0; i < letterCount; ++i)
|
||||
{
|
||||
auto sprite = _label->getLetter(i);
|
||||
auto oldPosition = sprite->getPosition();
|
||||
sprite->setPosition(Vec2( oldPosition.x, sinf( _accum * 2 + i/2.0) * 20 ));
|
||||
|
||||
// add fabs() to prevent negative scaling
|
||||
float scaleY = ( sinf( _accum * 2 + i/2.0 + 0.707) );
|
||||
|
||||
sprite->setScaleY(scaleY);
|
||||
if (sprite != nullptr)
|
||||
{
|
||||
auto oldPosition = sprite->getPosition();
|
||||
sprite->setPosition(Vec2( oldPosition.x, sinf( _accum * 2 + i/2.0) * 20 ));
|
||||
|
||||
// add fabs() to prevent negative scaling
|
||||
float scaleY = ( sinf( _accum * 2 + i/2.0 + 0.707) );
|
||||
|
||||
sprite->setScaleY(scaleY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -106,8 +106,8 @@ public:
|
|||
ShaderRetroEffect();
|
||||
virtual std::string title() const override;
|
||||
virtual std::string subtitle() const override;
|
||||
bool init() override;
|
||||
void update(float dt) override;
|
||||
virtual bool init() override;
|
||||
virtual void update(float dt) override;
|
||||
protected:
|
||||
cocos2d::Label* _label;
|
||||
float _accum;
|
||||
|
|
Loading…
Reference in New Issue