11package flixel .addons .effects ;
22
3- import openfl .geom .Rectangle ;
43import flixel .FlxCamera ;
54import flixel .FlxSprite ;
65import flixel .graphics .FlxGraphic ;
@@ -16,6 +15,7 @@ import flixel.util.FlxSpriteUtil;
1615import openfl .display .BitmapData ;
1716import openfl .display .Graphics ;
1817import openfl .geom .Point ;
18+ import openfl .geom .Rectangle ;
1919
2020/**
2121 * A FlxSprite that draw it's frame in a mesh and behave like a cloth.
@@ -170,10 +170,12 @@ class FlxClothSprite extends FlxSprite
170170 calcImage ();
171171 drawImage ();
172172
173+ getScreenPosition (_point , camera );
174+ _point - = offset ;
173175 if (isPixelPerfectRender (camera ))
174176 _point .floor ();
175177
176- _point . addPoint ( _drawOffset ). copyToFlash ( _flashPoint );
178+ _flashPoint . setTo ( _point . x + _drawOffset . x , _point . y + _drawOffset . y );
177179 camera .copyPixels (_frame , meshPixels , meshPixels .rect , _flashPoint , colorTransform , blend , antialiasing );
178180 }
179181
@@ -194,14 +196,16 @@ class FlxClothSprite extends FlxSprite
194196 _matrix .rotateWithTrig (_cosAngle , _sinAngle );
195197 }
196198
197- getScreenPosition (_point , camera ).subtractPoint (offset );
199+ getScreenPosition (_point , camera );
200+ _point - = offset ;
198201 if (isPixelPerfectRender (camera ))
199202 _point .floor ();
200203
201204 if (_frameGraphic == null )
202205 _frameGraphic = FlxGraphic .fromBitmapData (framePixels , false , null , false );
203206
204- camera .drawTriangles (_frameGraphic , _vertices , _indices , _uvtData , colors , _point .addPoint (_drawOffset ), blend , false , antialiasing );
207+ _point + = _drawOffset ;
208+ camera .drawTriangles (_frameGraphic , _vertices , _indices , _uvtData , colors , _point , blend , false , antialiasing );
205209 }
206210
207211 #if FLX_DEBUG
0 commit comments