|
A base class for cross platform menu controls that are gamepad friendly. More...
Public Member Functions | |
void | activateRow () |
Activates the current row. The script callback of the current row will be called (if it has one). | |
void | addRow (string label, string callback, int icon=-1, int yPad=0, bool useHighlightIcon=true, bool enabled=true) |
Add a row to the list control. | |
int | getRowCount () |
Gets the number of rows on the control. | |
string | getRowLabel (int row) |
Gets the label displayed on the specified row. | |
int | getSelectedRow () |
Gets the index of the currently selected row. | |
bool | isRowEnabled (int row) |
Determines if the specified row is enabled or disabled. | |
void | setRowEnabled (int row, bool enabled) |
Sets a row's enabled status according to the given parameters. | |
void | setRowLabel (int row, string label) |
Sets the label on the given row. | |
void | setSelected (int row) |
Sets the selected row. Only rows that are enabled can be selected. | |
Callbacks | |
void | onChange () |
Called when the selected row changes. | |
Public Attributes | |
string | callbackOnA |
Script callback when the 'A' button is pressed. 'A' inputs are Keyboard: A, Return, Space; Gamepad: A, Start. | |
string | callbackOnB |
Script callback when the 'B' button is pressed. 'B' inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back. | |
string | callbackOnX |
Script callback when the 'X' button is pressed. 'X' inputs are Keyboard: X; Gamepad: X. | |
string | callbackOnY |
Script callback when the 'Y' button is pressed. 'Y' inputs are Keyboard: Y; Gamepad: Y. | |
bool | debugRender |
Enable debug rendering. |
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.
new GuiGameListMenuCtrl() { debugRender = "0"; callbackOnA = "applyOptions();"; callbackOnB = "Canvas.setContent(MainMenuGui);"; callbackOnX = ""; callbackOnY = "revertOptions();"; //Properties not specific to this control have been omitted from this example. };
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 = -1 , |
|||
int | yPad = 0 , |
|||
bool | useHighlightIcon = true , |
|||
bool | enabled = true | |||
) |
Add a row to the list control.
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.
string GuiGameListMenuCtrl::getRowLabel | ( | int | row | ) |
Gets the label displayed on the specified row.
row | Index of the row to get the label of. |
int GuiGameListMenuCtrl::getSelectedRow | ( | ) |
Gets the index of the currently selected row.
bool GuiGameListMenuCtrl::isRowEnabled | ( | int | row | ) |
Determines if the specified row is enabled or disabled.
row | The row to set the enabled status of. |
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.
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.
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.
row | Index of the row to set as selected. |
Script callback when the 'A' button is pressed. 'A' inputs are Keyboard: A, Return, Space; Gamepad: A, Start.
Script callback when the 'B' button is pressed. 'B' inputs are Keyboard: B, Esc, Backspace, Delete; Gamepad: B, Back.
Script callback when the 'X' button is pressed. 'X' inputs are Keyboard: X; Gamepad: X.
Script callback when the 'Y' button is pressed. 'Y' inputs are Keyboard: Y; Gamepad: Y.
Enable debug rendering.