FuncWorks.XNA.UILibrary.Menu namespace

This namespace contains a set of classes used to create on-screen menus.

The main menu class is Menu, and it can contain a number of different menu items. Menu items must inherit from IMenuItem, and several different types of menu items are provided by default.

Menu class

Constructors

public Menu(Rectangle rectangle, TextStyle unselected, TextStyle selected, TextStyle disabled, int spacing)
Defines a menu positioned within the given rectangle (it will be centered vertically, with the specified number of spacing pixels between each item), with the specified TextStyles for unselected, selected, and disabled items.

Methods

public void MoveUp()
public void MoveDown()
Moves the current selection up or down one item. These classes will not allow you to scroll past the top or bottom of a list, and they handle hidden and disabled items correctly.

public void Activate()
public void MoveLeft()
public void MoveRight()
Handles actions that may affect the currently selected item.

These methods may not be defined for all menu item types. For example, a simple menu item that takes you to another screen should be handled in your code outside of the menu class. But if you have a menu option to turn music off and on, you might want to have it react to the user pressing A, DPadLeft, or DPadRight.

public void Draw(SpriteBatch spriteBatch)
Draws the menu to the screen. Must be called during your game's Draw method.

Fields / Properties

public List<IMenuItem> MenuItems
Gives you access to add, remove, or modify menu items.

public int SelectedIndex
The index of the item that's currently selected.

public TextStyle UnselectedStyle
public TextStyle SelectedStyle
public TextStyle DisabledStyle
Defines the text styles used by menu items. These can be changed dynamically as the menu is running.

Types of Menu Items

BooleanItem

public BooleanItem(string title, Alignment alignment, string truevalue, string falsevalue, bool startValue)

ChoiceItem

ImageSelectItem

IntegerItem

SelectItem

Last edited Oct 24, 2009 at 11:23 PM by dylanwolf, version 1

Comments

No comments yet.