Stores a 2D floating point coordinate.
示例#1
0
        /// <summary>
        /// Creates a new <code>FlxEmitter</code> object at a specific position.
        /// Does NOT automatically generate or attach particles!
        /// </summary>
        /// <param name="X">The X position of the emitter.</param>
        /// <param name="Y">The Y position of the emitter.</param>
        /// <param name="size">Optional, specifies a maximum capacity for this emitter.</param>
        public FlxEmitter(float X = 0, float Y = 0, uint size = 0) : base(size)
        {
            ((FlxObject)this).X = X;
            ((FlxObject)this).Y = Y;

            Width  = 0;
            Height = 0;

            minParticleSpeed = new FlxPoint(-100, -100);
            maxParticleSpeed = new FlxPoint(100, 100);

            minRotation = -360;
            maxRotation = 360;

            gravity       = 0;
            particleClass = null;
            particleDrag  = new FlxPoint();

            frequency = 0.1f;
            lifespan  = 3;
            bounce    = 0;

            _quantity = 0;
            _counter  = 0;
            _explode  = true;
            on        = false;
            _point    = new FlxPoint();
        }
示例#2
0
        /// <summary>
        /// Calculate the distance between two points.
        /// </summary>
        /// <param name="point1">A <code>FlxPoint</code> object referring to the first location.</param>
        /// <param name="point2">A <code>FlxPoint</code> object referring to the second location.</param>
        /// <returns>The distance between the two points as a floating point <code>Number</code> object.</returns>
        internal static float getDistance(FlxPoint point1, FlxPoint point2)
        {
            float dx = point1.X - point2.X;
            float dy = point1.Y - point2.Y;

            return((float)Math.Sqrt(dx * dx + dy * dy));
        }
示例#3
0
        /// <summary>
        /// Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates.
        /// This also gives you the option of not creating a new node but actually adding that specific
        /// <code>FlxPoint</code> object to the path.  This allows you to do neat things, like dynamic paths.
        /// </summary>
        /// <param name="node">The point in world coordinates you want to add to the path.</param>
        /// <param name="index">Where within the list of path nodes to insert this new point.</param>
        /// <param name="asReference">Whether to add the point as a reference, or to create a new point with the specified values.</param>
        public void AddPointAt(FlxPoint node, int index, bool asReference = false)
        {
            if (index > Nodes.Count)
            {
                index = Nodes.Count;
            }

            Nodes.Insert(index, asReference ? node : new FlxPoint(node.X, node.Y));
        }
示例#4
0
        /// <summary>
        /// Remove a node from the path.
        /// NOTE: only works with points added by reference or with references from <code>nodes</code> itself!
        /// </summary>
        /// <param name="node">The point object you want to remove from the path.</param>
        /// <returns>The node that was excised. Returns null if the node was not found.</returns>
        public FlxPoint Remove(FlxPoint node)
        {
            if (Nodes.Remove(node))
            {
                return(node);
            }

            return(null);
        }
示例#5
0
        /// <summary>
        /// Clean up memory.
        /// </summary>
        override public void destroy()
        {
            minParticleSpeed = null;
            maxParticleSpeed = null;
            particleDrag     = null;
            particleClass    = null;
            _point           = null;

            base.destroy();
        }
示例#6
0
        /// <summary>
        /// Instantiate the basic flixel object.
        /// </summary>
        public FlxBasic()
        {
            ID = -1;
            Exists = true;
            Active = true;
            Visible = true;
            Alive = true;
            IgnoreDrawDebug = false;

            Position = new FlxPoint();
        }
示例#7
0
        /// <summary>
        /// Instantiate the basic flixel object.
        /// </summary>
        public FlxBasic()
        {
            ID              = -1;
            Exists          = true;
            Active          = true;
            Visible         = true;
            Alive           = true;
            IgnoreDrawDebug = false;

            Position = new FlxPoint();
        }
示例#8
0
        /// <summary>
        /// Checks to see if a point in 2D world space overlaps this <code>FlxSprite</code> object's current displayed pixels.
        /// This check is ALWAYS made in screen space, and always takes scroll factors into account.
        /// </summary>
        /// <param name="point">The point in world space you want to check.</param>
        /// <param name="mask">Used in the pixel hit test to determine what counts as solid.</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera.</param>
        /// <returns></returns>
        public bool pixelOverlapPoint(FlxPoint point, uint mask = 0xFF, FlxCamera camera = null)
        {
            throw new NotImplementedException();

            /*
             *          if(Camera == null)
             *                  Camera = FlxG.camera;
             *          getScreenXY(_point,Camera);
             *          _point.x = _point.x - offset.x;
             *          _point.y = _point.y - offset.y;
             *          _flashPoint.x = (Point.x - Camera.scroll.x) - _point.x;
             *          _flashPoint.y = (Point.y - Camera.scroll.y) - _point.y;
             *          return framePixels.hitTest(_flashPointZero,Mask,_flashPoint);
             */
        }
示例#9
0
        /// <summary>
        /// Instantiate a new path object.
        /// </summary>
        /// <param name="nodes">Optional, can specify all the points for the path up front if you want.</param>
        public FlxPath(IEnumerable<FlxPoint> nodes = null)
        {
            Nodes = (nodes == null) ? new List<FlxPoint>() : nodes.ToList();

            _point = new FlxPoint();
            DebugColor = Color.White;
            DebugScrollFactor = new FlxPoint(1, 1);
            IgnoreDrawDebug = false;

            // @TODO
            /*
            var debugPathDisplay:DebugPathDisplay = manager;
            if(debugPathDisplay != null)
                debugPathDisplay.add(this);
            */
        }
示例#10
0
        /// <summary>
        /// Instantiate a new path object.
        /// </summary>
        /// <param name="nodes">Optional, can specify all the points for the path up front if you want.</param>
        public FlxPath(IEnumerable <FlxPoint> nodes = null)
        {
            Nodes = (nodes == null) ? new List <FlxPoint>() : nodes.ToList();

            _point            = new FlxPoint();
            DebugColor        = Color.White;
            DebugScrollFactor = new FlxPoint(1, 1);
            IgnoreDrawDebug   = false;

            // @TODO

            /*
             *          var debugPathDisplay:DebugPathDisplay = manager;
             *          if(debugPathDisplay != null)
             *                  debugPathDisplay.add(this);
             */
        }
示例#11
0
        public override void destroy()
        {
            // flx# - can animations in _animations be null?

            /*
             * if(_animations != null)
             *          {
             *                  FlxAnim a;
             *                  int i = 0;
             *                  int l = _animations.Count;
             *                  while(i < l)
             *                  {
             *                          a = _animations[i++];
             *                          if(a != null)
             *                                  a.destroy();
             *                  }
             *                  _animations = null;
             *          }
             */

            if (_animations != null)
            {
                foreach (FlxAnim animation in _animations)
                {
                    animation.destroy();
                }
            }

            _flashPoint     = null;
            _flashRect      = null;
            _flashRect2     = null;
            _flashPointZero = null;

            Offset = null;
            Origin = null;
            Scale  = null;

            _curAnim = null;
            //_matrix = null; // flx# - matrix is a struct
            _callback = null;
            //_framePixels = null; // flx# - unused
        }
示例#12
0
        /// <summary>
        /// Clean up memory.
        /// </summary>
        public override void destroy()
        {
            screen.destroy();
            screen   = null;
            Target   = null;
            Scroll   = null;
            Deadzone = null;
            Bounds   = null;
            Buffer   = null;
            //_flashBitmap = null;
            //_flashRect = null;
            //_flashPoint = null;
            fxFlashComplete = null;
            fxFadeComplete  = null;
            fxShakeComplete = null;
            fxShakeOffset   = null;
            //_fill = null;

            base.destroy();
        }
示例#13
0
        /// <summary>
        /// Remove a node from the path using the specified position in the list of path nodes.
        /// </summary>
        /// <param name="index">Where within the list of path nodes you want to remove a node.</param>
        /// <returns>The node that was excised. Returns null if there were no nodes in the path.</returns>
        public FlxPoint RemoveAt(int index)
        {
            if (!Nodes.Any())
            {
                return(null);
            }

            // @TODO: if called with wrong arguments this should crash

            /*
             * if (index >= Nodes.Count)
             * {
             *  index = Nodes.Count - 1;
             * }
             */

            FlxPoint removedNode = Nodes[index];

            Nodes.RemoveAt(index);
            return(removedNode);
        }
示例#14
0
        /// <summary>
        /// Calculates the angle between two points. 0 degrees points straight up.
        /// </summary>
        /// <param name="point1">The X coordinate of the point.</param>
        /// <param name="point2">The Y coordinate of the point.</param>
        /// <returns>The angle in degrees, between -180 and 180.</returns>
        internal static float getAngle(FlxPoint point1, FlxPoint point2)
        {
            float x = point2.X - point1.X;
            float y = point2.Y - point1.Y;

            if ((x == 0) && (y == 0))
            {
                return(0);
            }

            float c1    = 3.14159265f * 0.25f;
            float c2    = 3 * c1;
            float ay    = (y < 0) ? -y : y;
            float angle = 0;

            if (x >= 0)
            {
                angle = c1 - c1 * ((x - ay) / (x + ay));
            }
            else
            {
                angle = c2 - c1 * ((x + ay) / (ay - x));
            }

            angle = ((y < 0) ? -angle : angle) * 57.2957796f;

            if (angle > 90)
            {
                angle = angle - 270;
            }
            else
            {
                angle += 90;
            }

            return(angle);
        }
示例#15
0
文件: FlxU.cs 项目: jlorek/flxSharp
        //*** NOTE: THESE LAST THREE FUNCTIONS REQUIRE FLXPOINT ***//
        /// <summary>
        /// Rotates a point in 2D space around another point by the given angle.
        /// </summary>
        /// <param name="x">The X coordinate of the point you want to rotate.</param>
        /// <param name="y">The Y coordinate of the point you want to rotate.</param>
        /// <param name="pivotX">The X coordinate of the point you want to rotate around.</param>
        /// <param name="pivotY">The Y coordinate of the point you want to rotate around.</param>
        /// <param name="angle">Rotate the point by this many degrees.</param>
        /// <param name="point">Optional <code>FlxPoint</code> to store the results in.</param>
        /// <returns>A <code>FlxPoint</code> containing the coordinates of the rotated point.</returns>
        public static FlxPoint rotatePoint(float x, float y, float pivotX, float pivotY, float angle, FlxPoint point = null)
        {
            float sin = 0;
            float cos = 0;
            float radians = angle * -0.017453293f;

            while (radians < -3.14159265)
            {
                radians += 6.28318531f;
            }

            while (radians > 3.14159265)
            {
                radians = radians - 6.28318531f;
            }

            if (radians < 0)
            {
                sin = 1.27323954f * radians + .405284735f * radians * radians;

                if (sin < 0)
                {
                    sin = .225f * (sin * -sin - sin) + sin;
                }
                else
                {
                    sin = .225f * (sin * sin - sin) + sin;
                }
            }
            else
            {
                sin = 1.27323954f * radians - 0.405284735f * radians * radians;

                if (sin < 0)
                {
                    sin = .225f * (sin * -sin - sin) + sin;
                }
                else
                {
                    sin = .225f * (sin * sin - sin) + sin;
                }
            }

            radians += 1.57079632f;
            if (radians > 3.14159265)
            {
                radians = radians - 6.28318531f;
            }

            if (radians < 0)
            {
                cos = 1.27323954f * radians + 0.405284735f * radians * radians;

                if (cos < 0)
                {
                    cos = .225f * (cos * -cos - cos) + cos;
                }
                else
                {
                    cos = .225f * (cos * cos - cos) + cos;
                }
            }
            else
            {
                cos = 1.27323954f * radians - 0.405284735f * radians * radians;

                if (cos < 0)
                {
                    cos = .225f * (cos * -cos - cos) + cos;
                }
                else
                {
                    cos = .225f * (cos * cos - cos) + cos;
                }
            }

            float dx = x - pivotX;
            float dy = pivotY + y; // Y axis is inverted in flash, normally this would be a subtract operation // flx# - Hmmmmm...
            if (point == null)
            {
                point = new FlxPoint();
            }
            point.X = pivotX + cos * dx - sin * dy;
            point.Y = pivotY - sin * dx - cos * dy;
            return point;
        }
示例#16
0
文件: FlxU.cs 项目: jlorek/flxSharp
 /// <summary>
 /// Calculate the distance between two points.
 /// </summary>
 /// <param name="point1">A <code>FlxPoint</code> object referring to the first location.</param>
 /// <param name="point2">A <code>FlxPoint</code> object referring to the second location.</param>
 /// <returns>The distance between the two points as a floating point <code>Number</code> object.</returns>
 internal static float getDistance(FlxPoint point1, FlxPoint point2)
 {
     float dx = point1.X - point2.X;
     float dy = point1.Y - point2.Y;
     return (float) Math.Sqrt(dx * dx + dy * dy);
 }
示例#17
0
 /// <summary>
 /// Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates.
 /// This also gives you the option of not creating a new node but actually adding that specific
 /// <code>FlxPoint</code> object to the path. This allows you to do neat things, like dynamic paths.
 /// </summary>
 /// <param name="node">The point in world coordinates you want to add to the path.</param>
 /// <param name="asReference">Whether to add the point as a reference, or to create a new point with the specified values.</param>
 public void AddPoint(FlxPoint node, bool asReference = false)
 {
     Nodes.Add(asReference ? node : new FlxPoint(node.X, node.Y));
 }
示例#18
0
 /// <summary>
 /// Override this function to null out variables or manually call
 /// <code>destroy()</code> on class members if necessary.
 /// Don't forget to call <code>super.destroy()</code>!
 /// </summary>
 public virtual void destroy()
 {
     Position = null;
 }
示例#19
0
 /// <summary>
 /// Helper function, just copies the values from the specified point.
 /// </summary>
 /// <param name="point">Any <code>FlxPoint</code>.</param>
 /// <returns>A reference to itself.</returns>
 public FlxPoint copyFrom(FlxPoint point)
 {
     X = point.X;
     Y = point.Y;
     return(this);
 }
示例#20
0
        /// <summary>
        /// Retrieve the midpoint of this object in world coordinates.
        /// </summary>
        /// <param name="point">Allows you to pass in an existing <code>FlxPoint</code> object if you're so inclined. Otherwise a new one is created.</param>
        /// <returns>A <code>FlxPoint</code> object containing the midpoint of this object in world coordinates.</returns>
        public FlxPoint getMidpoint(FlxPoint point = null)
        {
            if (point == null)
            {
                point = new FlxPoint();
            }

            // flx# - wtf we dont bitshift here but anywhere else?
            point.X = X + (Width / 2);
            point.Y = Y + (Height / 2);
            return point;
        }
示例#21
0
        /**
         * Find a path through the tilemap.  Any tile with any collision flags set is treated as impassable.
         * If no path is discovered then a null reference is returned.
         *
         * @param	Start		The start point in world coordinates.
         * @param	End			The end point in world coordinates.
         * @param	Simplify	Whether to run a basic simplification algorithm over the path data, removing extra points that are on the same line.  Default value is true.
         * @param	RaySimplify	Whether to run an extra raycasting simplification algorithm over the remaining path data.  This can result in some close corners being cut, and should be used with care if at all (yet).  Default value is false.
         *
         * @return	A <code>FlxPath</code> from the start to the end.  If no path could be found, then a null reference is returned.
         */
        public FlxPath findPath(FlxPoint Start, FlxPoint End, bool Simplify=true, bool RaySimplify=false)
        {
            //figure out what tile we are starting and ending on.
            int startIndex = (int)((Start.Y-Y)/_tileHeight) * widthInTiles + (int)((Start.X-X)/_tileWidth);
            int endIndex = (int)((End.Y-Y)/_tileHeight) * widthInTiles + (int)((End.X-X)/_tileWidth);

            //check that the start and end are clear.
            if( ((_tileObjects[_data[startIndex]] as FlxTile).AllowCollisions > 0) ||
                ((_tileObjects[_data[endIndex]] as FlxTile).AllowCollisions > 0) )
                return null;

            //figure out how far each of the tiles is from the starting tile
            List<int> distances = computePathDistance(startIndex,endIndex);
            if(distances == null)
                return null;

            //then count backward to find the shortest path.
            List<FlxPoint> points = new List<FlxPoint>();
            walkPath(distances,endIndex,points);

            //reset the start and end points to be exact
            FlxPoint node;
            node = points[points.Count-1] as FlxPoint;
            node.X = Start.X;
            node.Y = Start.Y;
            node = points[0] as FlxPoint;
            node.X = End.X;
            node.Y = End.Y;

            //some simple path cleanup options
            if(Simplify)
                simplifyPath(points);
            if(RaySimplify)
                raySimplifyPath(points);

            //finally load the remaining points into a new path object and return it
            FlxPath path = new FlxPath();
            int i = points.Count - 1;
            while(i >= 0)
            {
                node = points[i--] as FlxPoint;
                if(node != null)
                    path.AddPoint(node,true);
            }
            return path;
        }
示例#22
0
        // overlapsPoint
        public override Boolean overlapsPoint(FlxPoint point, Boolean inScreenSpace = false, FlxCamera camera = null)
        {
            if (!inScreenSpace)
                return (_tileObjects[_data[(int)(((point.Y - Y) / _tileHeight) * widthInTiles + (point.X - X) / _tileWidth)]] as FlxTile).AllowCollisions > 0;

            if (camera == null)
                camera = FlxG.camera;
            point.X = point.X - camera.Scroll.X;
            point.Y = point.Y - camera.Scroll.Y;
            getScreenXY(_tagPoint, camera);
            return (_tileObjects[_data[(int)(((point.Y - _tagPoint.Y) / _tileHeight) * widthInTiles + (point.X - _tagPoint.X) / _tileWidth)]] as FlxTile).AllowCollisions > 0;
        }
示例#23
0
 /// <summary>
 /// Move the camera focus to this location instantly.
 /// </summary>
 /// <param name="point">Where you want the camera to focus.</param>
 public void focusOn(FlxPoint point)
 {
     point.X += (point.X > 0) ? 0.0000001f : -0.0000001f;
     point.Y += (point.Y > 0) ? 0.0000001f : -0.0000001f;
     Scroll.make(point.X - Width * 0.5f, point.Y - Height * 0.5f);
 }
示例#24
0
        // overlapsWithCallBack
        public Boolean overlapsWithCallback(FlxObject Object, Func<FlxObject, FlxObject, Boolean> Callback=null, Boolean FlipCallbackParams=false, FlxPoint Position=null)
        {
            Boolean results = false;

            float X = base.X;
            float Y = base.Y;
            if (Position != null)
            {
                X = Position.X;
                Y = Position.X;
            }

            //Figure out what tiles we need to check against
            int selectionX = (int)FlxU.floor((Object.X - X) / _tileWidth);
            int selectionY = (int)FlxU.floor((Object.Y - Y) / _tileHeight);
            uint selectionWidth = (uint)(selectionX + (FlxU.ceil((int)Object.Width / _tileWidth)) + 2);
            uint selectionHeight = (uint)(selectionY + (FlxU.ceil((int)Object.Height / _tileHeight)) + 2);

            //Then bound these coordinates by the map edges
            if (selectionX < 0)
                selectionX = 0;
            if (selectionY < 0)
                selectionY = 0;
            if (selectionWidth > widthInTiles)
                selectionWidth = (uint)widthInTiles;
            if (selectionHeight > heightInTiles)
                selectionHeight = (uint)heightInTiles;

            //Then loop through this selection of tiles and call FlxObject.separate() accordingly
            uint rowStart = (uint)selectionY * (uint)widthInTiles;
            uint row = (uint)selectionY;
            uint column;
            FlxTile tile;
            Boolean overlapFound;
            float deltaX = X - Last.X;
            float deltaY = Y - Last.Y;

            while (row < selectionHeight)
            {
                column = (uint)selectionX;
                while (column < selectionWidth)
                {
                    overlapFound = false;
                    tile = _tileObjects[(int)_data[(int)(rowStart+column)]] as FlxTile;
                    if ( Convert.ToBoolean(tile.AllowCollisions) )
                    {
                        tile.X = X + (int)column * _tileWidth;
                        tile.Y = Y + (int)row * _tileHeight;
                        tile.Last.X = tile.X - deltaX;
                        tile.Last.Y = tile.Y - deltaY;
                        if (Callback != null)
                        {
                            if (FlipCallbackParams)
                                overlapFound = Callback(Object, tile);
                            else
                                overlapFound = Callback(tile, Object);
                        }
                        else
                        {
                            overlapFound = (Object.X + Object.Width > tile.X) && (Object.X < tile.X + tile.Width) && (Object.Y + Object.Height > tile.Y) && (Object.Y < tile.Y + tile.Height);
                        }
                        if (overlapFound)
                        {
                            if ((tile.callback != null))
                            {
                                tile.mapIndex = (uint)rowStart + column;
                                tile.callback(tile, Object);
                            }
                            results = true;
                        }
                    }
                    else if ((tile.callback != null))
                    {
                        tile.mapIndex = (uint)rowStart + (uint)column;
                        tile.callback(tile, Object);
                    }
                    column++;
                }
                rowStart += (uint)widthInTiles;
                row++;
            }
            return results;
        }
示例#25
0
        /// <summary>
        /// Instantiates a new camera at the specified location, with the specified size and zoom level.
        /// </summary>
        /// <param name="x">X location of the camera's display in pixels. Uses native, 1:1 resolution, ignores zoom.</param>
        /// <param name="y">Y location of the camera's display in pixels. Uses native, 1:1 resolution, ignores zoom.</param>
        /// <param name="width">The width of the camera display in pixels.</param>
        /// <param name="height">The height of the camera display in pixels.</param>
        /// <param name="zoom">The initial zoom level of the camera. A zoom level of 2 will make all pixels display at 2x resolution.</param>
        public FlxCamera(float x, float y, int width, int height, float zoom = 0)
            : base()
        {
            X        = x;
            Y        = y;
            Width    = width;
            Height   = height;
            Target   = null;
            Deadzone = null;
            Scroll   = new FlxPoint();
            _point   = new FlxPoint();
            Bounds   = null;
            screen   = new FlxSprite();
            screen.makeGraphic((uint)width, (uint)height, new Color(0, 0, 0, 0));
            screen.setOriginToCorner();
            //Buffer = screen.Pixels;
            BgColor = FlxG.bgColor;

            _color = Color.White;
            //_color = 0xffffffff;

            /*
             *          _flashBitmap = new Bitmap(buffer);
             *          _flashBitmap.x = -width*0.5;
             *          _flashBitmap.y = -height*0.5;
             *          _flashSprite = new Sprite();
             */

            // flx# - ?
            // zoom = Zoom; //sets the scale of flash sprite, which in turn loads flashoffset values

            /*
             * _flashOffsetX = width*0.5*zoom;
             *          _flashOffsetY = height*0.5*zoom;
             *          _flashSprite.x = x + _flashOffsetX;
             *          _flashSprite.y = y + _flashOffsetY;
             *          _flashSprite.addChild(_flashBitmap);
             *          _flashRect = new Rectangle(0,0,width,height);
             *          _flashPoint = new Point();
             */

            fxFlashColor    = Color.Black;
            fxFlashDuration = 0.0f;
            fxFlashComplete = null;
            fxFlashAlpha    = 0.0f;

            fxFadeColor    = Color.Black;
            fxFadeDuration = 0.0f;
            fxFadeComplete = null;
            fxFadeAlpha    = 0.0f;

            fxShakeIntensity = 0.0f;
            fxShakeDuration  = 0.0f;
            fxShakeComplete  = null;
            fxShakeOffset    = new FlxPoint();
            fxShakeDirection = 0;

            //_fill = new BitmapData(width,height,true,0);

            // flx#
            //DefaultZoom = 1.0f;
            rotating    = 0.0f;
            Zoom        = zoom;
            FlashSprite = new FlxObject();
            //BgColor = Color.Black;

            _fxHelperTexture = new Texture2D(FlxS.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _fxHelperTexture.SetData(new[] { Color.White });

            _fillTexture = new Texture2D(FlxS.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _fillTexture.SetData(new[] { Color.White });

            UpdateHelpers();
        }
示例#26
0
        /// <summary>
        /// Remove a node from the path.
        /// NOTE: only works with points added by reference or with references from <code>nodes</code> itself!
        /// </summary>
        /// <param name="node">The point object you want to remove from the path.</param>
        /// <returns>The node that was excised. Returns null if the node was not found.</returns>
        public FlxPoint Remove(FlxPoint node)
        {
            if (Nodes.Remove(node))
            {
                return node;
            }

            return null;
        }
示例#27
0
 public void destroy()
 {
     DebugScrollFactor = null;
     _point = null;
     Nodes = null;
 }
示例#28
0
        /// <summary>
        /// Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates.
        /// This also gives you the option of not creating a new node but actually adding that specific
        /// <code>FlxPoint</code> object to the path.  This allows you to do neat things, like dynamic paths.
        /// </summary>
        /// <param name="node">The point in world coordinates you want to add to the path.</param>
        /// <param name="index">Where within the list of path nodes to insert this new point.</param>
        /// <param name="asReference">Whether to add the point as a reference, or to create a new point with the specified values.</param>
        public void AddPointAt(FlxPoint node, int index, bool asReference = false)
        {
            if (index > Nodes.Count)
            {
                index = Nodes.Count;
            }

            Nodes.Insert(index, asReference ? node : new FlxPoint(node.X, node.Y));
        }
示例#29
0
 /// <summary>
 /// Move the camera focus to this location instantly.
 /// </summary>
 /// <param name="point">Where you want the camera to focus.</param>
 public void focusOn(FlxPoint point)
 {
     point.X += (point.X > 0) ? 0.0000001f : -0.0000001f;
     point.Y += (point.Y > 0) ? 0.0000001f : -0.0000001f;
     Scroll.make(point.X - Width * 0.5f, point.Y - Height * 0.5f);
 }
示例#30
0
        //*** NOTE: THESE LAST THREE FUNCTIONS REQUIRE FLXPOINT ***//

        /// <summary>
        /// Rotates a point in 2D space around another point by the given angle.
        /// </summary>
        /// <param name="x">The X coordinate of the point you want to rotate.</param>
        /// <param name="y">The Y coordinate of the point you want to rotate.</param>
        /// <param name="pivotX">The X coordinate of the point you want to rotate around.</param>
        /// <param name="pivotY">The Y coordinate of the point you want to rotate around.</param>
        /// <param name="angle">Rotate the point by this many degrees.</param>
        /// <param name="point">Optional <code>FlxPoint</code> to store the results in.</param>
        /// <returns>A <code>FlxPoint</code> containing the coordinates of the rotated point.</returns>
        static public FlxPoint rotatePoint(float x, float y, float pivotX, float pivotY, float angle, FlxPoint point = null)
        {
            float sin     = 0;
            float cos     = 0;
            float radians = angle * -0.017453293f;

            while (radians < -3.14159265)
            {
                radians += 6.28318531f;
            }

            while (radians > 3.14159265)
            {
                radians = radians - 6.28318531f;
            }

            if (radians < 0)
            {
                sin = 1.27323954f * radians + .405284735f * radians * radians;

                if (sin < 0)
                {
                    sin = .225f * (sin * -sin - sin) + sin;
                }
                else
                {
                    sin = .225f * (sin * sin - sin) + sin;
                }
            }
            else
            {
                sin = 1.27323954f * radians - 0.405284735f * radians * radians;

                if (sin < 0)
                {
                    sin = .225f * (sin * -sin - sin) + sin;
                }
                else
                {
                    sin = .225f * (sin * sin - sin) + sin;
                }
            }

            radians += 1.57079632f;
            if (radians > 3.14159265)
            {
                radians = radians - 6.28318531f;
            }

            if (radians < 0)
            {
                cos = 1.27323954f * radians + 0.405284735f * radians * radians;

                if (cos < 0)
                {
                    cos = .225f * (cos * -cos - cos) + cos;
                }
                else
                {
                    cos = .225f * (cos * cos - cos) + cos;
                }
            }
            else
            {
                cos = 1.27323954f * radians - 0.405284735f * radians * radians;

                if (cos < 0)
                {
                    cos = .225f * (cos * -cos - cos) + cos;
                }
                else
                {
                    cos = .225f * (cos * cos - cos) + cos;
                }
            }

            float dx = x - pivotX;
            float dy = pivotY + y; // Y axis is inverted in flash, normally this would be a subtract operation // flx# - Hmmmmm...

            if (point == null)
            {
                point = new FlxPoint();
            }
            point.X = pivotX + cos * dx - sin * dy;
            point.Y = pivotY - sin * dx - cos * dy;
            return(point);
        }
示例#31
0
 /// <summary>
 /// Sometimes its easier or faster to just pass a point object instead of separate X and Y coordinates.
 /// This also gives you the option of not creating a new node but actually adding that specific
 /// <code>FlxPoint</code> object to the path. This allows you to do neat things, like dynamic paths.
 /// </summary>
 /// <param name="node">The point in world coordinates you want to add to the path.</param>
 /// <param name="asReference">Whether to add the point as a reference, or to create a new point with the specified values.</param>
 public void AddPoint(FlxPoint node, bool asReference = false)
 {
     Nodes.Add(asReference ? node : new FlxPoint(node.X, node.Y));
 }
示例#32
0
        /// <summary>
        /// Creates a new <code>FlxEmitter</code> object at a specific position.
        /// Does NOT automatically generate or attach particles!
        /// </summary>
        /// <param name="X">The X position of the emitter.</param>
        /// <param name="Y">The Y position of the emitter.</param>
        /// <param name="size">Optional, specifies a maximum capacity for this emitter.</param>
        public FlxEmitter(float X=0, float Y=0, uint size=0)
            : base(size)
        {
            ((FlxObject) this).X = X;
            ((FlxObject) this).Y = Y;

            Width = 0;
            Height = 0;

            minParticleSpeed = new FlxPoint(-100,-100);
            maxParticleSpeed = new FlxPoint(100,100);

            minRotation = -360;
            maxRotation = 360;

            gravity = 0;
            particleClass = null;
            particleDrag = new FlxPoint();

            frequency = 0.1f;
            lifespan = 3;
            bounce = 0;

            _quantity = 0;
            _counter = 0;
            _explode = true;
            on = false;
            _point = new FlxPoint();
        }
示例#33
0
        /// <summary>
        /// Call this function to figure out the on-screen position of the object.
        /// </summary>
        /// <param name="point">Takes a <code>FlxPoint</code> object and assigns the post-scrolled X and Y values of this object to it.</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera.</param>
        /// <returns></returns>
        public FlxPoint getScreenXY(FlxPoint point = null, FlxCamera camera = null)
        {
            if (point == null)
            {
                point = new FlxPoint();
            }

            if (camera == null)
            {
                camera = FlxG.camera;
            }

            point.X = X - (camera.Scroll.X * ScrollFactor.X);
            point.Y = Y - (camera.Scroll.Y * ScrollFactor.Y);
            point.X += (point.X > 0) ? 0.0000001f : -0.0000001f;
            point.Y += (point.Y > 0) ? 0.0000001f : -0.0000001f;
            return point;
        }
示例#34
0
        /// <summary>
        /// Clean up memory.
        /// </summary>
        public override void destroy()
        {
            screen.destroy();
            screen = null;
            Target = null;
            Scroll = null;
            Deadzone = null;
            Bounds = null;
            Buffer = null;
            //_flashBitmap = null;
            //_flashRect = null;
            //_flashPoint = null;
            fxFlashComplete = null;
            fxFadeComplete = null;
            fxShakeComplete = null;
            fxShakeOffset = null;
            //_fill = null;

            base.destroy();
        }
示例#35
0
 /// <summary>
 /// Helper function, just copies the values to the specified point.
 /// </summary>
 /// <param name="point">Any <code>FlxPoint</code>.</param>
 /// <returns>A reference to itself.</returns>
 public FlxPoint copyTo(FlxPoint point)
 {
     point.X = X;
     point.Y = Y;
     return point;
 }
示例#36
0
        /// <summary>
        /// Checks to see if a point in 2D world space overlaps this <code>FlxSprite</code> object's current displayed pixels.
        /// This check is ALWAYS made in screen space, and always takes scroll factors into account.
        /// </summary>
        /// <param name="point">The point in world space you want to check.</param>
        /// <param name="mask">Used in the pixel hit test to determine what counts as solid.</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera.</param>
        /// <returns></returns>
        public bool pixelOverlapPoint(FlxPoint point, uint mask = 0xFF, FlxCamera camera = null)
        {
            throw new NotImplementedException();

            /*
            if(Camera == null)
                Camera = FlxG.camera;
            getScreenXY(_point,Camera);
            _point.x = _point.x - offset.x;
            _point.y = _point.y - offset.y;
            _flashPoint.x = (Point.x - Camera.scroll.x) - _point.x;
            _flashPoint.y = (Point.y - Camera.scroll.y) - _point.y;
            return framePixels.hitTest(_flashPointZero,Mask,_flashPoint);
            */
        }
示例#37
0
 /// <summary>
 /// Helper function, just copies the values from the specified point.
 /// </summary>
 /// <param name="point">Any <code>FlxPoint</code>.</param>
 /// <returns>A reference to itself.</returns>
 public FlxPoint copyFrom(FlxPoint point)
 {
     X = point.X;
     Y = point.Y;
     return this;
 }
示例#38
0
        /// <summary>
        /// Creates a white 8x8 square <code>FlxSprite</code> at the specified position.
        /// Optionally can load a simple, one-frame graphic instead.
        /// </summary>
        /// <param name="x">The initial X position of the sprite.</param>
        /// <param name="y">The initial Y position of the sprite.</param>
        /// <param name="graphic">The graphic you want to display (OPTIONAL - for simple stuff only, do NOT use for animated images!).</param>
        public FlxSprite(float x = 0, float y = 0, Texture2D graphic = null)
            : base(x, y)
        {
            Health = 1;

            _flashPoint = new FlxPoint();
            _flashRect = new FlxRect();
            _flashRect2 = new FlxRect();
            _flashPointZero = new FlxPoint(0, 0);
            Offset = new FlxPoint();
            Origin = new FlxPoint();

            Scale = new FlxPoint(1, 1);
            Alpha = 1;
            Color = Color.White;
            Blend = null;
            AntiAliasing = false;
            Cameras = null;

            Finished = false;
            _facing = Right;
            _animations = new List<FlxAnim>();
            _flipped = 0;
            _curAnim = null;
            _curFrame = 0;
            _curIndex = 0;
            _frameTimer = 0;

            _matrix = new Matrix();
            _callback = null;

            if (graphic == null)
            {
                graphic = ImgDefault;
            }

            loadGraphic(graphic);

            // flx# stuff
            Angle = 0f;
            camX = camY = 0;
            oX = x;
            oY = y;
            moving = false;

            /*
            Scale = new FlxPoint(1.0f, 1.0f);
            Offset = new FlxPoint();
            Origin = new FlxPoint();
            alpha = 1.0f;
            _color = Color.White * alpha;

            _animations = new List<FlxAnim>();
            _animated = false;

            Finished = false;
            _facing = Right;
            _flipped = 0;
            _curAnim = null;
            _curFrame = 0;
            _curIndex = 0;
            _frameTimer = 0;

            _callback = null;
            _matrix = new Matrix();

            if (graphic == null)
                graphic = ImgDefault;
            loadGraphic(graphic);

            Angle = 0f;

            camX = camY = 0;
            oX = x;
            oY = y;

            moving = false;
            */
        }
示例#39
0
 /// <summary>
 /// Helper function, just copies the values to the specified point.
 /// </summary>
 /// <param name="point">Any <code>FlxPoint</code>.</param>
 /// <returns>A reference to itself.</returns>
 public FlxPoint copyTo(FlxPoint point)
 {
     point.X = X;
     point.Y = Y;
     return(point);
 }
示例#40
0
        public override void destroy()
        {
            // flx# - can animations in _animations be null?
            /*
            if(_animations != null)
            {
                FlxAnim a;
                int i = 0;
                int l = _animations.Count;
                while(i < l)
                {
                    a = _animations[i++];
                    if(a != null)
                        a.destroy();
                }
                _animations = null;
            }
            */

            if (_animations != null)
            {
                foreach (FlxAnim animation in _animations)
                {
                    animation.destroy();
                }
            }

            _flashPoint = null;
            _flashRect = null;
            _flashRect2 = null;
            _flashPointZero = null;

            Offset = null;
            Origin = null;
            Scale = null;

            _curAnim = null;
            //_matrix = null; // flx# - matrix is a struct
            _callback = null;
            //_framePixels = null; // flx# - unused
        }
示例#41
0
 /// <summary>
 /// Override this function to null out variables or manually call
 /// <code>destroy()</code> on class members if necessary.
 /// Don't forget to call <code>super.destroy()</code>!
 /// </summary>
 public virtual void destroy()
 {
     Position = null;
 }
示例#42
0
        /// <summary>
        /// Checks to see if a point in 2D world space overlaps this <code>FlxObject</code> object.
        /// </summary>
        /// <param name="point">The point in world space you want to check.</param>
        /// <param name="inScreenSpace">Whether to take scroll factors into account when checking for overlap.</param>
        /// <param name="camera">Specify which game camera you want.  If null getScreenXY() will just grab the first global camera. flx# - currently only one exists</param>
        /// <returns></returns>
        public virtual bool overlapsPoint(FlxPoint point, bool inScreenSpace = false, FlxCamera camera = null)
        {
            if (!inScreenSpace)
            {
                return (point.X > this.X) && (point.X < this.X + Width) && (point.Y > this.Y) && (point.Y < this.Y + Height);
            }

            if (camera == null)
            {
                camera = FlxG.camera;
            }

            float x = point.X - camera.Scroll.X;
            float y = point.Y - camera.Scroll.Y;
            getScreenXY(_tagPoint, camera);
            return (x > _tagPoint.X) && (x < _tagPoint.X + Width) && (y > _tagPoint.Y) && (y < _tagPoint.Y + Height);
        }
示例#43
0
文件: FlxU.cs 项目: jlorek/flxSharp
        /// <summary>
        /// Calculates the angle between two points. 0 degrees points straight up.
        /// </summary>
        /// <param name="point1">The X coordinate of the point.</param>
        /// <param name="point2">The Y coordinate of the point.</param>
        /// <returns>The angle in degrees, between -180 and 180.</returns>
        internal static float getAngle(FlxPoint point1, FlxPoint point2)
        {
            float x = point2.X - point1.X;
            float y = point2.Y - point1.Y;

            if ((x == 0) && (y == 0))
            {
                return 0;
            }

            float c1 = 3.14159265f * 0.25f;
            float c2 = 3 * c1;
            float ay = (y < 0) ? -y : y;
            float angle = 0;

            if (x >= 0)
            {
                angle = c1 - c1 * ((x - ay) / (x + ay));
            }
            else
            {
                angle = c2 - c1 * ((x + ay) / (ay - x));
            }

            angle = ((y < 0) ? -angle : angle) * 57.2957796f;

            if (angle > 90)
            {
                angle = angle - 270;
            }
            else
            {
                angle += 90;
            }

            return angle;
        }
示例#44
0
        /// <summary>
        /// Instantiates a <code>FlxObject</code>.
        /// </summary>
        /// <param name="x">X-coordinate of the object in space.</param>
        /// <param name="y">y-coordinate of the object in space.</param>
        /// <param name="width">Desired width of the rectangle.</param>
        /// <param name="height">Desired height of the rectangle.</param>
        public FlxObject(float x = 0, float y = 0, float width = 0, float height = 0)
            : base()
        {
            X = x;
            Y = y;
            Last = new FlxPoint(x, y);
            Width = width;
            Height = height;
            Mass = 1.0f;
            Elasticity = 0.0f;

            Immovable = false;
            Moves = true;

            Touching = None;
            WasTouching = None;
            AllowCollisions = Any;

            Velocity = new FlxPoint();
            Acceleration = new FlxPoint();
            Drag = new FlxPoint();
            MaxVelocity = new FlxPoint(10000, 10000);

            Angle = 0;
            AngularVelocity = 0;
            AngularAcceleration = 0;
            AngularDrag = 0;
            MaxAngular = 10000;

            ScrollFactor = new FlxPoint(1, 1);
            _flicker = false;
            _flickerTimer = 0;

            _tagPoint = new FlxPoint();
            _tagRect = new FlxRect();

            Path = null;
            PathSpeed = 0;
            PathAngle = 0;

            // flx# - ?
            //Health = 1;
        }
示例#45
0
        /// <summary>
        /// Creates a white 8x8 square <code>FlxSprite</code> at the specified position.
        /// Optionally can load a simple, one-frame graphic instead.
        /// </summary>
        /// <param name="x">The initial X position of the sprite.</param>
        /// <param name="y">The initial Y position of the sprite.</param>
        /// <param name="graphic">The graphic you want to display (OPTIONAL - for simple stuff only, do NOT use for animated images!).</param>
        public FlxSprite(float x = 0, float y = 0, Texture2D graphic = null)
            : base(x, y)
        {
            Health = 1;

            _flashPoint     = new FlxPoint();
            _flashRect      = new FlxRect();
            _flashRect2     = new FlxRect();
            _flashPointZero = new FlxPoint(0, 0);
            Offset          = new FlxPoint();
            Origin          = new FlxPoint();

            Scale        = new FlxPoint(1, 1);
            Alpha        = 1;
            Color        = Color.White;
            Blend        = null;
            AntiAliasing = false;
            Cameras      = null;

            Finished    = false;
            _facing     = Right;
            _animations = new List <FlxAnim>();
            _flipped    = 0;
            _curAnim    = null;
            _curFrame   = 0;
            _curIndex   = 0;
            _frameTimer = 0;

            _matrix   = new Matrix();
            _callback = null;

            if (graphic == null)
            {
                graphic = ImgDefault;
            }

            loadGraphic(graphic);

            // flx# stuff
            Angle  = 0f;
            camX   = camY = 0;
            oX     = x;
            oY     = y;
            moving = false;

            /*
             * Scale = new FlxPoint(1.0f, 1.0f);
             * Offset = new FlxPoint();
             * Origin = new FlxPoint();
             * alpha = 1.0f;
             * _color = Color.White * alpha;
             *
             * _animations = new List<FlxAnim>();
             * _animated = false;
             *
             * Finished = false;
             * _facing = Right;
             * _flipped = 0;
             * _curAnim = null;
             * _curFrame = 0;
             * _curIndex = 0;
             * _frameTimer = 0;
             *
             * _callback = null;
             * _matrix = new Matrix();
             *
             * if (graphic == null)
             *  graphic = ImgDefault;
             * loadGraphic(graphic);
             *
             * Angle = 0f;
             *
             * camX = camY = 0;
             * oX = x;
             * oY = y;
             *
             * moving = false;
             */
        }
示例#46
0
        /// <summary>
        /// Override this function to null out variables or
        /// manually call destroy() on class members if necessary.
        /// Don't forget to call super.destroy()!
        /// </summary>
        public override void destroy()
        {
            Velocity = null;
            Acceleration = null;
            Drag = null;
            MaxVelocity = null;
            ScrollFactor = null;
            _tagPoint = null;
            _tagRect = null;
            Last = null;

            // flx# - ?
            //cameras = null;

            if (Path != null)
            {
                Path.destroy();
                Path = null;
            }

            base.destroy();
        }
示例#47
0
 public void destroy()
 {
     DebugScrollFactor = null;
     _point            = null;
     Nodes             = null;
 }
示例#48
0
        /**
         * Shoots a ray from the start point to the end point.
         * If/when it passes through a tile, it stores that point and returns false.
         *
         * @param	Start		The world coordinates of the start of the ray.
         * @param	End			The world coordinates of the end of the ray.
         * @param	Result		A <code>Point</code> object containing the first wall impact.
         * @param	Resolution	Defaults to 1, meaning check every tile or so.  Higher means more checks!
         * @return	Returns true if the ray made it from Start to End without hitting anything.  Returns false and fills Result if a tile was hit.
         */
        public bool ray(FlxPoint Start, FlxPoint End, FlxPoint Result=null, float Resolution=1f)
        {
            float step = _tileWidth;
            if(_tileHeight < _tileWidth)
                step = _tileHeight;
            step /= Resolution;
            float deltaX = End.X - Start.X;
            float deltaY = End.Y - Start.Y;
            float distance = (float)Math.Sqrt(deltaX*deltaX + deltaY*deltaY);
            int steps = (int)FlxU.ceil(distance/step);
            float stepX = deltaX/steps;
            float stepY = deltaY/steps;
            float curX = Start.X - stepX - X;
            float curY = Start.Y - stepY - Y;
            int tileX;
            int tileY;
            int i = 0;
            while(i < steps)
            {
                curX += stepX;
                curY += stepY;

                if((curX < 0) || (curX > Width) || (curY < 0) || (curY > Height))
                {
                    i++;
                    continue;
                }

                tileX = (int)curX/_tileWidth;
                tileY = (int)curY/_tileHeight;
                if( Convert.ToBoolean((_tileObjects[_data[tileY*widthInTiles+tileX]] as FlxTile).AllowCollisions))
                {
                    //Some basic helper stuff
                    tileX *= _tileWidth;
                    tileY *= _tileHeight;
                    float rx = 0;
                    float ry = 0;
                    float q;
                    float lx = curX-stepX;
                    float ly = curY-stepY;

                    //Figure out if it crosses the X boundary
                    q = tileX;
                    if(deltaX < 0)
                        q += _tileWidth;
                    rx = q;
                    ry = ly + stepY*((q-lx)/stepX);
                    if((ry > tileY) && (ry < tileY + _tileHeight))
                    {
                        if(Result == null)
                            Result = new FlxPoint();
                        Result.X = rx;
                        Result.Y = ry;
                        return false;
                    }

                    //Else, figure out if it crosses the Y boundary
                    q = tileY;
                    if(deltaY < 0)
                        q += _tileHeight;
                    rx = lx + stepX*((q-ly)/stepY);
                    ry = q;
                    if((rx > tileX) && (rx < tileX + _tileWidth))
                    {
                        if(Result == null)
                            Result = new FlxPoint();
                        Result.X = rx;
                        Result.Y = ry;
                        return false;
                    }
                    return true;
                }
                i++;
            }
            return true;
        }
示例#49
0
        /// <summary>
        /// Clean up memory.
        /// </summary>
        public override void destroy()
        {
            minParticleSpeed = null;
            maxParticleSpeed = null;
            particleDrag = null;
            particleClass = null;
            _point = null;

            base.destroy();
        }
示例#50
0
        /// <summary>
        /// Instantiates a new camera at the specified location, with the specified size and zoom level.
        /// </summary>
        /// <param name="x">X location of the camera's display in pixels. Uses native, 1:1 resolution, ignores zoom.</param>
        /// <param name="y">Y location of the camera's display in pixels. Uses native, 1:1 resolution, ignores zoom.</param>
        /// <param name="width">The width of the camera display in pixels.</param>
        /// <param name="height">The height of the camera display in pixels.</param>
        /// <param name="zoom">The initial zoom level of the camera. A zoom level of 2 will make all pixels display at 2x resolution.</param>
        public FlxCamera(float x, float y, int width, int height, float zoom = 0)
            : base()
        {
            X = x;
            Y = y;
            Width = width;
            Height = height;
            Target = null;
            Deadzone = null;
            Scroll = new FlxPoint();
            _point = new FlxPoint();
            Bounds = null;
            screen = new FlxSprite();
            screen.makeGraphic((uint) width, (uint) height, new Color(0, 0, 0, 0));
            screen.setOriginToCorner();
            //Buffer = screen.Pixels;
            BgColor = FlxG.bgColor;

            _color = Color.White;
            //_color = 0xffffffff;

            /*
            _flashBitmap = new Bitmap(buffer);
            _flashBitmap.x = -width*0.5;
            _flashBitmap.y = -height*0.5;
            _flashSprite = new Sprite();
            */

            // flx# - ?
            // zoom = Zoom; //sets the scale of flash sprite, which in turn loads flashoffset values

            /*
            _flashOffsetX = width*0.5*zoom;
            _flashOffsetY = height*0.5*zoom;
            _flashSprite.x = x + _flashOffsetX;
            _flashSprite.y = y + _flashOffsetY;
            _flashSprite.addChild(_flashBitmap);
            _flashRect = new Rectangle(0,0,width,height);
            _flashPoint = new Point();
            */

            fxFlashColor = Color.Black;
            fxFlashDuration = 0.0f;
            fxFlashComplete = null;
            fxFlashAlpha = 0.0f;

            fxFadeColor = Color.Black;
            fxFadeDuration = 0.0f;
            fxFadeComplete = null;
            fxFadeAlpha = 0.0f;

            fxShakeIntensity = 0.0f;
            fxShakeDuration = 0.0f;
            fxShakeComplete = null;
            fxShakeOffset = new FlxPoint();
            fxShakeDirection = 0;

            //_fill = new BitmapData(width,height,true,0);

            // flx#
            //DefaultZoom = 1.0f;
            rotating = 0.0f;
            Zoom = zoom;
            FlashSprite = new FlxObject();
            //BgColor = Color.Black;

            _fxHelperTexture = new Texture2D(FlxS.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _fxHelperTexture.SetData(new[] { Color.White });

            _fillTexture = new Texture2D(FlxS.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
            _fillTexture.SetData(new[] { Color.White });

            UpdateHelpers();
        }