Пример #1
0
 /// <summary>
 /// Creates a button with the given properties.
 /// </summary>
 /// <param name="position">Screen position of top-left corner, as well as the size of the button</param>
 /// <param name="spriteSelect">Index in the TextureHolder.ButtonTextures enum to use to create the sprite</param>
 /// <param name="function">Function which the button will trigger when clicked</param>
 /// <param name="bActive">Whether to start the button off as drawn.</param>
 /// <returns>The created button</returns>
 public Button makeButton(Rectangle position, int spriteSelect, Button.ButtonFunction function, bool bActive = true)
 {
     Sprite buttonSprite = textureHolder.ButtonSprites[(int)ConstantHolder.ButtonBackgrounds.Exit].copySprite();
     Button newButton = new Button(position, buttonSprite, function, bActive);
     buttons.Add(newButton);
     return newButton;
 }
Пример #2
0
 /// <summary>
 /// Creates a button with text on it.
 /// </summary>
 /// <param name="position">Top left corner of button screen position, as well as the dimensions of the button.</param>
 /// <param name="spriteSheet">Background sprites for up, down, over.</param>
 /// <param name="function">Function performed when clicked</param>
 /// <param name="font">Font of text on button</param>
 /// <param name="text">Text on button</param>
 /// <param name="bClickable">Sets whether the button will accept input at the start</param>
 /// <param name="bActive">Sets whether the button will appear.</param>
 /// <returns>The button created</returns>
 public TextButton MakeTextButton(Rectangle position, Sprite spriteSheet, Button.ButtonFunction function, SpriteFont font, String text = "", bool bClickable = true, bool bActive = true)
 {
     TextButton newButton = new TextButton(position, spriteSheet, function, font, text, bClickable, bActive);
     buttons.Add(newButton);
     return newButton;
 }
Пример #3
0
 /// <summary>
 /// Removes a button from the GUI
 /// </summary>
 /// <param name="button">The button to be removed.</param>
 public void ClearButton(Button button)
 {
     buttons.Remove(button);
 }