Spine.SkeletonBounds.ContainsPoint C# (CSharp) Method

ContainsPoint() public method

Returns the first bounding box attachment that contains the point, or null. When doing many checks, it is usually more efficient to only call this method if {@link #aabbContainsPoint(float, float)} returns true.
public ContainsPoint ( float x, float y ) : BoundingBoxAttachment
x float
y float
return BoundingBoxAttachment
		public BoundingBoxAttachment ContainsPoint (float x, float y) {
			ExposedList<Polygon> polygons = Polygons;
			for (int i = 0, n = polygons.Count; i < n; i++)
				if (ContainsPoint(polygons.Items[i], x, y)) return BoundingBoxes.Items[i];
			return null;
		}

Same methods

SkeletonBounds::ContainsPoint ( Polygon polygon, float x, float y ) : bool

Usage Example

Example #1
0
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            state.Update(gameTime.ElapsedGameTime.Milliseconds / 1000f);
            state.Apply(skeleton);
            skeleton.UpdateWorldTransform();
            skeletonRenderer.Begin();
            skeletonRenderer.Draw(skeleton);
            skeletonRenderer.End();

            bounds.Update(skeleton, true);
            MouseState mouse = Mouse.GetState();

            if (headSlot != null)
            {
                headSlot.G = 1;
                headSlot.B = 1;
                if (bounds.AabbContainsPoint(mouse.X, mouse.Y))
                {
                    BoundingBoxAttachment hit = bounds.ContainsPoint(mouse.X, mouse.Y);
                    if (hit != null)
                    {
                        headSlot.G = 0;
                        headSlot.B = 0;
                    }
                }
            }

            base.Draw(gameTime);
        }
All Usage Examples Of Spine.SkeletonBounds::ContainsPoint