Module cocos.menu

A Layer that implements a simple menu

Menu

This module provides a Menu class. Menus can contain regular items (which trigger a function when selected), toggle items (which toggle a flag when selected), or entry items (which lets you enter alphanumeric data).

To use a menu in your code, just subclass Menu and add the menu to an Scene or another Layer.

Classes

  Menu
Abstract base class for menu layers.
  MenuItem
A menu item that shows a label.
  ImageMenuItem
A menu item that shows a selectable Image
  MultipleMenuItem
A menu item for switching between multiple values.
  ToggleMenuItem
A menu item for a boolean toggle option.
  EntryMenuItem
A menu item for entering a value.
  ColorMenuItem
A menu item for selecting a color.

Functions

  verticalMenuLayout(menu)
  fixedPositionMenuLayout(positions)
  shake()
Predefined action that performs a slight rotation and then goes back to the original rotation position.
  shake_back()
Predefined action that rotates to 0 degrees in 0.1 seconds
  zoom_in()
Predefined action that scales to 1.5 factor in 0.2 seconds
  zoom_out()
Predefined action that scales to 1.0 factor in 0.2 seconds

Constants

  CENTER = 'center'
  LEFT = 'left'
  RIGHT = 'right'
  TOP = 'top'
  BOTTOM = 'bottom'