GuiGameListMenuCtrl

A base class for cross platform menu controls that are gamepad friendly.

Inherit:
GuiControl

Description

A base class for cross platform menu controls that are gamepad friendly.

This class is used to build row-based menu GUIs that can be easily navigated using the keyboard, mouse or gamepad. The desired row can be selected using the mouse, or by navigating using the Up and Down buttons.

Example:

newGuiGameListMenuCtrl()
{
   debugRender = "0";
   callbackOnA = "applyOptions();";
   callbackOnB = "Canvas.setContent(MainMenuGui);";
   callbackOnX = "";
   callbackOnY = "revertOptions();";
   //Properties not specific to this control have been omitted from this example.
};

Methods

void GuiGameListMenuCtrl::activateRow()

Activates the current row. The script callback of the current row will be called (if it has one).

void GuiGameListMenuCtrl::addRow(string label, string callback, int icon, int yPad, bool useHighlightIcon, bool enabled)

Add a row to the list control.

Parameters:
  • label – The text to display on the row as a label.
  • callback – Name of a script function to use as a callback when this row is activated.
  • icon – [optional] Index of the icon to use as a marker.
  • yPad – [optional] An extra amount of height padding before the row. Does nothing on the first row.
  • useHighlightIcon – [optional] Does this row use the highlight icon?.
  • enabled – [optional] If this row is initially enabled.
int GuiGameListMenuCtrl::getRowCount()

Gets the number of rows on the control.

Returns:(int) The number of rows on the control.
string GuiGameListMenuCtrl::getRowLabel(int row)

Gets the label displayed on the specified row.

Parameters:row – Index of the row to get the label of.
Returns:The label for the row.
int GuiGameListMenuCtrl::getSelectedRow()

Gets the index of the currently selected row.

Returns:Index of the selected row.
bool GuiGameListMenuCtrl::isRowEnabled(int row)

Determines if the specified row is enabled or disabled.

Parameters:row – The row to set the enabled status of.
Returns:True if the specified row is enabled. False if the row is not enabled or the given index was not valid.
void GuiGameListMenuCtrl::onChange()

Called when the selected row changes.

void GuiGameListMenuCtrl::setRowEnabled(int row, bool enabled)

Sets a row’s enabled status according to the given parameters.

Parameters:
  • row – The index to check for validity.
  • enabled – Indicate true to enable the row or false to disable it.
void GuiGameListMenuCtrl::setRowLabel(int row, string label)

Sets the label on the given row.

Parameters:
  • row – Index of the row to set the label on.
  • label – Text to set as the label of the row.
void GuiGameListMenuCtrl::setSelected(int row)

Sets the selected row. Only rows that are enabled can be selected.

Parameters:row – Index of the row to set as selected.

Fields

string GuiGameListMenuCtrl::callbackOnA

Script callback when the ‘A’ button is pressed. ‘A’ inputs are Keyboard: A, Return, Space; Gamepad: A, Start.

string GuiGameListMenuCtrl::callbackOnB

Script callback when the ‘B’ button is pressed. ‘B’ inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back.

string GuiGameListMenuCtrl::callbackOnX

Script callback when the ‘X’ button is pressed. ‘X’ inputs are Keyboard: X; Gamepad: X.

string GuiGameListMenuCtrl::callbackOnY

Script callback when the ‘Y’ button is pressed. ‘Y’ inputs are Keyboard: Y; Gamepad: Y.

bool GuiGameListMenuCtrl::debugRender

Enable debug rendering.