/// <summary> /// Creates a new Menu Object /// </summary> /// <param name="position"> The postion of the first item in the menu </param> /// <param name="spacing"> The spacing betweeen each item in the menu </param> /// <param name="isVerticle"> Set to true for Verticle menu, false for Horizontal menu </param> /// <param name="font"> The font to be used in the menu </param> /// <param name="menuColor"> The default color of the menu items </param> /// <param name="scale"> The default scale of the menu items </param> /// <param name="alignment"> The alignment of items in the menu </param> /// <param name="onBack"> The delegate to call when going back from this menu </param> public Menu(Vector2 position, int spacing, bool isVerticle, SpriteFont font, Color menuColor, Vector2 scale, Align alignment, TextSelect onBack) { MenuItems = new List<Text>(); StartPosition = position; Spacing = spacing; VerticalMenu = isVerticle; Font = font; MenuColor = menuColor; Alignment = alignment; Scale = scale; OnBack = onBack; }
public void Initialize(string title, string description, object[] items) { this.Text = title; tableLayoutPanel1.SuspendLayout(); Description.Text = description; TextSelect.BeginUpdate(); TextSelect.Items.Clear(); TextSelect.Items.AddRange(items); if (TextSelect.Items.Count > 0) { TextSelect.SelectedIndex = 0; } TextSelect.EndUpdate(); tableLayoutPanel1.ResumeLayout(); }
/// <summary> /// Constructor for Text object to be used only when creating Text object for Menus as other properties are defined in the menu /// </summary> /// <param name="text"> The text associated with the text object </param> /// <param name="onSelect"> The delegate to run when selected </param> public Text(String text, TextSelect onSelect) { this.text = text; OnSelect = onSelect; }