Beispiel #1
0
 /// <summary>
 /// Resets the members of the <see cref="DefaultStyles"/> to their default value.
 /// </summary>
 public static void Reset()
 {
     DefaultStyles.actionStyle = new Style(
         Color.Blue,
         Color.DarkBlue,
         2,
         null,
         null,
         Color.Black,
         null,
         StyleType.Action);
     DefaultStyles.activeStyle = new Style(
         Color.LightBlue,
         Color.DarkBlue,
         2,
         null,
         null,
         Color.Black,
         null,
         StyleType.Active);
     DefaultStyles.defaultStyle = new Style(
         new Color(240, 240, 240),
         Color.Black,
         2,
         null,
         null,
         Color.Black,
         null,
         StyleType.Default);
     DefaultStyles.OnChanged();
 }
Beispiel #2
0
 private static void OnChanged()
 {
     if (DefaultStyles.Changed != null)
     {
         DefaultStyles.Changed(null, EventArgs.Empty);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Initializes the default <see cref="Style"/> with the given objects.
        /// </summary>
        /// <param name="texture">
        /// A <see cref="Texture2D"/> used as default <see cref="Texture2D"/>.
        /// </param>
        /// <param name="font">
        /// A <see cref="SpriteFont"/> used as default <see cref="SpriteFont"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="texture"/> was passed as NULL.
        /// </exception>
        public static void Initialize(Texture2D texture, SpriteFont font)
        {
            if (texture == null)
            {
                throw new ArgumentNullException("texture");
            }

            DefaultStyles.InitializeMembers(font, texture);
        }
Beispiel #4
0
 private void SetDefaultStyle()
 {
     this.ForeColor       = DefaultStyles.Default.ForeColor;
     this.BackColor       = DefaultStyles.Default.BackColor;
     this.BorderColor     = DefaultStyles.Default.BorderColor;
     this.Font            = DefaultStyles.Default.Font;
     this.TextScale       = DefaultStyles.CalculateScale(this.Font, DefaultStyles.DefaultFontSize);
     this.BorderThickness = DefaultStyles.Default.BorderThickness;
     this.Texture         = DefaultStyles.Default.Texture;
 }
Beispiel #5
0
        private void SetFontSize(int?fontSize, StyleType type)
        {
            if (fontSize == null)
            {
                switch (type)
                {
                case StyleType.Action:
                    this.TextScale = DefaultStyles.CalculateScale(this.Font, DefaultStyles.ActionFontSize);
                    break;

                case StyleType.Active:
                    this.TextScale = DefaultStyles.CalculateScale(this.Font, DefaultStyles.ActiveFontSize);
                    break;

                case StyleType.Default:
                    this.TextScale = DefaultStyles.CalculateScale(this.Font, DefaultStyles.DefaultFontSize);
                    break;
                }
            }
            else
            {
                this.TextScale = DefaultStyles.CalculateScale(this.Font, fontSize.Value);
            }
        }