Beep8 logo

Menu Documentation

Menu Documentation Source Code

The Beep8 menu system provide a simple way to create interfaces for your game. No more wrangling with text and positions, just define your menu structure and let Beep8 handle the rest.

Menu Methods

beep8.Menu.display(choices [,options]) async

Displays a menu with the given choices and returns the index of the selected choice.

Displaying a menu will pause the execution of other elements of your game until a choice has been made.

The menu automatically beeps and boops as the player navigates through the choices.

The options object can contain the following properties:

  • options.title - The title of the menu.
  • options.prompt - The prompt to display above the choices.
  • options.selBgColor - The background color of the selected choice. Defaults to the current foreground colour.
  • options.selFgColor - The foreground color of the selected choice. Defaults to the current background colour.
  • options.border - Whether to draw a border around the menu. Defaults to true.
  • options.borderChar - The character to use for the border.
  • options.center - Whether to center the menu horizontally and vertically.
  • options.centerH - Whether to center the menu horizontally.
  • options.centerV - Whether to center the menu vertically.
  • options.padding - The padding around the prompt and choices.
  • options.selIndex - The index of the initially selected choice.
  • options.typewriter - display the prompt as a typewriter effect.

Parameters

  • choices (string[]): The choices to display.
  • [options] (object): Options for the menu.

Returns

  • (Promise<number>): A promise that resolves to the index of the selected choice.

More Beep8 Docs

Actors Documentation

App Intro Documentation

Async Documentation

Cart API

Core Functions

ECS (Entity Component System) Documentation

Game State

Input Documentation

Inventory API

Joystick Documentation

Menu Documentation

Music Documentation

Particle System Documentation

Passcodes Documentation

Public API

Random Numbers Documentation

SFX Documentation

Scene Documentation

Text Renderer

Tilemap Documentation

Utilities Documentation