public void Draw(View.Decorators.Label element) { var font = AssetLibrary.Instance.RetrieveAsset <SpriteFont>(element.Font); var measuredStringSize = font.MeasureString(element.Text); Vector2 calculatedPosition = new Vector2(element.Bounds.X, element.Bounds.Y); switch ((int)element.Align) { case (int)TextAlign.LEFT: calculatedPosition = new Vector2(element.Bounds.X, element.Bounds.Y); break; case (int)TextAlign.RIGHT: calculatedPosition = new Vector2(element.Bounds.X - measuredStringSize.X, element.Bounds.Y); break; case (int)TextAlign.CENTER: calculatedPosition = new Vector2(element.Bounds.X + element.Bounds.Width / 2 - measuredStringSize.X / 2, element.Bounds.Y); break; case (int)TextAlign.CENTER + (int)TextAlign.MIDDLE: calculatedPosition = new Vector2(element.Bounds.X + element.Bounds.Width / 2 - measuredStringSize.X / 2, element.Bounds.Y + element.Bounds.Height / 2 - measuredStringSize.Y / 2); break; case (int)TextAlign.CENTER + (int)TextAlign.BOTTOM: calculatedPosition = new Vector2(element.Bounds.X + element.Bounds.Width / 2 - measuredStringSize.X / 2, element.Bounds.Y + element.Bounds.Height - measuredStringSize.Y); break; } spriteBatch.DrawString(font, element.Text, calculatedPosition, new Color(element.FontColor.R, element.FontColor.G, element.FontColor.B, element.FontColor.A)); }
public void Draw(View.Decorators.Label element) { // Handle call the draw method from the draw class here throw new NotImplementedException(); }
public void Draw(View.Decorators.Label element) { drawStrategy.Draw(element); }