Exemple #1
0
    /// <summary>
    /// Constructor of this class
    /// </summary>
    /// <param id="textures">GUITexture of the style</param>
    /// <param id="font">Font of the style</param>
    /// <param id="fontColor">Color of the font of this style</param>
    /// <param id="shadeText">Sets whether the newText is shaded</param>
    /// <param id="centeredText">Sets whether the newText is centered</param>
    public GUISkin(GUITexture textures, SpriteFont font, Color fontColor, bool shadeText, bool centeredText)
    {
      this.Textures = textures;
      this.Font = font;
      this.CenteredText = centeredText;
      this.ShadedText = shadeText;

      this.FontColor = fontColor;
    }
Exemple #2
0
    /// <summary>
    /// Draws a box of specified size (Vector2, Vector2) in specified skin and state
    /// </summary>
    /// <param id="position"></param>
    /// <param id="size"></param>
    /// <param id="skin"></param>
    /// <param id="state"></param>
    public void DrawBox(Vector2 position, Vector2 size, GUITexture skin, UserControlState state)
    {
      int widthBorder = skin.WidthBorder;
      int heightBorder = skin.HeightBorder;

      Vector2 posTopLeft = position;
      Vector2 posTopCenter = position + new Vector2(widthBorder, 0);
      Vector2 sizTopCenter = new Vector2(size.X - 2 * widthBorder, heightBorder);
      Vector2 posTopRight = position + new Vector2(size.X - widthBorder, 0);

      Vector2 posLeft = position + new Vector2(0, heightBorder);
      Vector2 sizLeft = new Vector2(widthBorder, size.Y - 2 * heightBorder);
      Vector2 posCenter = position + new Vector2(widthBorder, heightBorder);
      Vector2 sizCenter = size - new Vector2(2 * widthBorder, 2 * heightBorder);
      Vector2 posRight = position + new Vector2(size.X - widthBorder, heightBorder);
      Vector2 sizRight = new Vector2(widthBorder, size.Y - 2 * heightBorder);

      Vector2 posBottomLeft = position + new Vector2(0, size.Y - heightBorder);
      Vector2 posBottomCenter = position + new Vector2(widthBorder, size.Y - heightBorder);
      Vector2 sizBottomCenter = new Vector2(size.X - 2 * widthBorder, heightBorder);
      Vector2 posBottomRight = position + new Vector2(size.X - widthBorder, size.Y - heightBorder);

      sb.Draw(skin.GetTexture(Direction.TopLeft, state), posTopLeft, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Top, state), UI.MakeRect(posTopCenter, sizTopCenter), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.TopRight, state), posTopRight, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);

      sb.Draw(skin.GetTexture(Direction.Left, state), UI.MakeRect(posLeft, sizLeft), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Center, state), UI.MakeRect(posCenter, sizCenter), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Right, state), UI.MakeRect(posRight, sizRight), null, Color.White, 0f, Vector2.Zero, 0, 1f);

      sb.Draw(skin.GetTexture(Direction.BottomLeft, state), posBottomLeft, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.Bottom, state), UI.MakeRect(posBottomCenter, sizBottomCenter), null, Color.White, 0f, Vector2.Zero, 0, 1f);
      sb.Draw(skin.GetTexture(Direction.BottomRight, state), posBottomRight, null, Color.White, 0f, Vector2.Zero, 1f, 0, 1f);
    }