gb.gui.menu

Description

// strings:
uint8_t gb.gui.menu( const char* title , const char** items [, uint8_t length] )
// Multilang:
uint8_t gb.gui.menu( const MultiLang* title , const MultiLang** items [, uint8_t length , uint8_t numLang] )

gb.gui.menu provides a nice graphical menu where you can pick items. It returns the index of the item that was picked by the user.

Parameters

  • const char* | const MultiLang* title: Title to display above the menu entries
  • const char** | const MultiLang** items: Array of the items of the menu
  • uint8_t length (optional): amount of entries in the menu. If not specified, it is attempted to autodetermine it
  • uint8_t numLang (optional): number language entries for MultiLang things. If not specified, it is attempted to autodetermine it

Returns

uint8_t: index of the selected entry

Example

#include <Gamebuino-Meta.h>

const char* entries[] = { "Pizza", "Spaghetti", "Noodles", "Ice Cream", };

void setup() { gb.begin();

// display the menu uint8_t entry = gb.gui.menu("Best food?", entries);

gb.display.clear(); gb.display.println("You picked:"); gb.display.print(entries[entry]); }

void loop() { while(!gb.update()); }