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 regular menu item.
  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.

Functions

  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 = font.Text.CENTER
  LEFT = font.Text.LEFT
  RIGHT = font.Text.RIGHT
  TOP = font.Text.TOP
  BOTTOM = font.Text.BOTTOM