public static ButtonGroup Create(IFont font, Vector2 position, Size buttonSize, string[] texts, ITexture2D textureAtlas, ContentManager content, ButtonGroupDirection direction) { var control = new ButtonGroup(font, position, buttonSize, texts, textureAtlas, content, direction); return(control); }
private ButtonGroup(IFont font, Vector2 position, Size buttonSize, string[] texts, ITexture2D textureAtlas, ContentManager content, ButtonGroupDirection direction) { _buttons = new Dictionary <string, Button>(); foreach (string item in texts) { var button = Button.Create(font, VerticalAlignment.Middle, HorizontalAlignment.Center, position, buttonSize, item, Color.Yellow, 1.0f, textureAtlas, content); _buttons.Add(item, button); if (direction == ButtonGroupDirection.Horizontal) { position.X += buttonSize.Width; } else { position.Y += buttonSize.Height; } } }