Ejemplo n.º 1
0
 /// <summary>
 /// Creates a new MeterBar with the specified simple string, min value, and max value. The string is used
 /// to determine the size and location fo the bar.
 /// </summary>
 /// <param name="text">The simple string to be paired with</param>
 /// <param name="min">Min value. Represents 0% fill</param>
 /// <param name="max">Max value. Represents 100% fill.</param>
 public MeterBar(SimpleString text, float min, float max) : this(text,
                                                                 new Rectangle(
                                                                     text.Position.ToPoint(),
                                                                     text.spriteFont.MeasureString(text.Message).ToPoint()),
                                                                 min, max)
 {
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new MeterBar with the specified simple string, min value, and max value.
 /// </summary>
 /// <param name="text">The simple string to be paired with</param>
 /// <param name="drawSize">The size and location of the bar when full</param>
 /// <param name="min">Min value. Represents 0% fill</param>
 /// <param name="max">Max value. Represents 100% fill.</param>
 public MeterBar(SimpleString text, Rectangle drawSize, float min, float max) : base(text.Game)
 {
     resources        = ((UfoLander)text.Game).Resources;
     this.spriteBatch = text.spriteBatch;
     initialMessage   = text.Message;
     this.text        = text;
     this.min         = current = min;
     this.max         = max;
     text.Message     = initialMessage + current;
     this.drawSize    = drawSize;
 }