FlixelCommunity / flixel

Community fork of Adam “Atomic” Saltsman's popular game engine Flixel. Distilled from a variety of Flash games he worked on over the last couple years, including Gravity Hook, Fathom and Canabalt, its primary function is to provide some useful base classes that you can extend to make your own game objects.
http://flixelcommunity.org/
Other
84 stars 17 forks source link

[GPU build] calcFrame() wrong order #232

Open DigiEggz opened 8 years ago

DigiEggz commented 8 years ago

In calcFrame(), the isBlitting() check sets the flashRect dimensions to zero in the incorrect order:

if (FlxG.render.isBlitting())
            {
                calcFramePixels();
                _flashRect.x = _flashRect.y = 0;
            }

In the blitting render this causes some alpha effects to not work correctly depending on a few factors. This can be resolved by moving the flashRect assignment to within the calcFramePixels() function.

protected function calcFramePixels():void
        {
            framePixels.copyPixels(_pixels, _flashRect, _flashPointZero);
            _flashRect.x = _flashRect.y = 0;//Reset rectangle before setting colorTransform

            if (_colorTransform != null)
            {
                framePixels.colorTransform(_flashRect, _colorTransform);
            }
        }
Dovyski commented 8 years ago

Have you tried to run this same fix with the GPU render as well? I remember I had some problems making _flashRect to work properly with both blitting and GPU render.

DigiEggz commented 8 years ago

I've run this fix with the GPU render as well and luckily no problems have arose.