Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
This file contains common utility functions to assist in manipulating menus and making menu renderers.
Go to the source code of this file.
Functions | |
const char * | getMenuItemLabelText (char *buffer, int buflen, const menuItem_t *item) |
Write and return the proper text label to use for the given menu item. | |
bool | menuItemIsSetting (const menuItem_t *item) |
Returns whether a menu item is a settings item. | |
bool | menuItemHasOptions (const menuItem_t *item) |
Returns whether this menu item has options. | |
bool | menuItemHasPrev (const menuItem_t *item) |
Returns true if this item has any previous option. | |
bool | menuItemHasNext (const menuItem_t *item) |
Returns true if this item has any next option. | |
bool | menuItemIsBack (const menuItem_t *item) |
Returns true if this item is the "Back" button on a sub-menu. | |
bool | menuItemHasSubMenu (const menuItem_t *item) |
Returns true if this item will enter a sub-menu when selected. | |
void | menuSavePosition (const char **out, int len, const menu_t *menu) |
Stores the current menu position in a buffer. | |
menu_t * | menuRestorePosition (const char **in, int len, menu_t *menu) |
Restores the menu position from the given buffer. | |
const char * getMenuItemLabelText | ( | char * | buffer, |
int | buflen, | ||
const menuItem_t * | item ) |
Write and return the proper text label to use for the given menu item.
If the menu item's label is a simple string, it will be returned directly. If the menu item's label must be constructed from multiple strings, it will be written to buffer
, and a pointer to buffer
will be returned.
buffer | A buffer to use for constructing the label, if needed |
buflen | The size of the buffer |
item | The menu item whose label to return |
bool menuItemIsSetting | ( | const menuItem_t * | item | ) |
Returns whether a menu item is a settings item.
This will return true for items that were added with either addSettingsItemToMenu() or addSettingsOptionsItemToMenu()
item | A pointer to the menu item to check |
bool menuItemHasOptions | ( | const menuItem_t * | item | ) |
Returns whether this menu item has options.
This will return true for items that were added with either addMultiItemToMenu() or addSettingsOptionsItemToMenu()
item | A pointer to the menu item to check |
bool menuItemHasPrev | ( | const menuItem_t * | item | ) |
Returns true if this item has any previous option.
item | A pointer to the menu item to check |
bool menuItemHasNext | ( | const menuItem_t * | item | ) |
Returns true if this item has any next option.
item | A pointer to the menu item to check |
bool menuItemIsBack | ( | const menuItem_t * | item | ) |
Returns true if this item is the "Back" button on a sub-menu.
item | A pointer to the menu item to check |
bool menuItemHasSubMenu | ( | const menuItem_t * | item | ) |
Returns true if this item will enter a sub-menu when selected.
item | A pointer to the menu item to check |
void menuSavePosition | ( | const char ** | out, |
int | len, | ||
const menu_t * | menu ) |
Stores the current menu position in a buffer.
The output array should contain at least as many items as the maximum nesting depth of the menu
out | A pointer to an array of char-pointers that will receive the state |
len | The maximum number of items to write into the out buffer. |
menu | The menu whose state to save |
Restores the menu position from the given buffer.
in | The char-pointer array that was set by menuSavePosition() |
len | The length of the char-poniter array |
menu | The menu |