HasPoint() 공개 메소드

Checks if the given point is within the boundaries of the GUIElement.
public HasPoint ( int x, int y ) : bool
x int The x-coordinate of the point
y int The y-coordinate of the point
리턴 bool
예제 #1
0
        /// <summary>
        /// Draws a visualization of a SurgeAbility on a target GUIElement. By using this method
        /// to draw the SurgeAbility, you're sure it's drawn the same way every time.
        /// </summary>
        /// <param name="target">The GUIElement to draw the SurgeAbility on.</param>
        /// <param name="ability">The SurgeAbility to display.</param>
        /// <param name="xPosition">The top-left x-coordinate to start drawing from.</param>
        /// <param name="yPosition">The top-left y-coordinate to start drawing from.</param>
        /// <param name="small">True if the surge ability should be drawn as compact as possible, else false.</param>
        public static void DrawSurgeAbility(GUIElement target, SurgeAbility ability, int xPosition, int yPosition, bool small)
        {
            Contract.Requires(target != null);
            Contract.Requires(ability != null);
            Contract.Requires(target.HasPoint(target.Bound.X + xPosition, target.Bound.Y + yPosition));

            // icons
            int cost = ability.Cost;
            int costX = target.Bound.X + xPosition;
            while (cost > 0)
            {
                Image img = new Image(target.Game.Content.Load<Texture2D>("Images/Other/surge"));
                target.AddDrawable(target.Name, img, new Vector2(costX, target.Bound.Y + yPosition));
                cost--;
                costX += img.Texture.Width + (small ? -5 : +2);
            }

            // text
            costX += 10;
            string s = ability.Ability.ToString();
            if (small) s = s.Replace("Damage", "Dmg");
            target.AddText(target.Name, ":" + s, new Vector2(costX - target.Bound.X, yPosition));
        }
예제 #2
0
        /// <summary>
        /// Draws a given dice-type to the target GUIElement. By using this method
        /// to draw the EDice, you're sure it's drawn the same way every time.
        /// </summary>
        /// <param name="target">The GUIElement to display the dice in.</param>
        /// <param name="dice">The dice to display.</param>
        /// <param name="x">The top-left x-coordinate to start drawing from.</param>
        /// <param name="y">The top-left y-coordinate to start drawing from.</param>
        /// <param name="size">The width and height in pixels.</param>
        public static void DrawDice(GUIElement target, EDice dice, int x, int y, int size)
        {
            Contract.Requires(target != null);
            Contract.Requires(target.HasPoint(x, y));
            Contract.Requires(size > 0);
            Contract.Requires(x + size < target.Bound.X + target.Bound.Width);

            if (dicetinary == null) LoadDiceTextures(target.Game);

            target.AddDrawable(target.Name, new Image(dicetinary[dice]), new Rectangle(x, y, size, size));
        }