peng3d.menu - Flexible menu system

class peng3d.menu.BasicMenu(name, window, peng)[source]

Menu base class without layer support.

Each menu is separated from the other menus and can be switched between at any time.

Actions supported by default:

enter is triggered everytime the on_enter() method has been called.

exit is triggered everytime the on_exit() method has been called.

See also

See Menu() for more information.

addWorld(world)[source]

Adds the given world to the internal list.

Worlds that are registered via this method will get all events that are given to this menu passed through.

This mechanic is mainly used to implement actor controllers.

draw()[source]

This method is called if it is time to render the menu.

Override this method in subclasses to customize behavior and actually draw stuff.

on_enter(old)[source]

This fake event handler will be called every time this menu is entered via the PengWindow.changeMenu() method.

This handler will not be called if this menu is already active.

on_exit(new)[source]

This fake event handler will be called every time this menu is exited via the PengWindow.changeMenu() method.

This handler will not be called if this menu is the same as the new menu.

class peng3d.menu.Menu(name, window, peng)[source]

Subclass of BasicMenu adding support for the Layer class.

This subclass overrides the draw and __init__ method, so be sure to call them if you override them.

addLayer(layer, z=-1)[source]

Adds a new layer to the stack, optionally at the specified z-value.

layer must be an instance of Layer or subclasses.

z can be used to override the index of the layer in the stack. Defaults to -1 for appending.

draw()[source]

Draws the layers in the appropriate order.

Layers that have their enabled attribute set to False are skipped.

on_enter(old)[source]

Same as BasicMenu.on_enter(), but also calls Layer.on_menu_enter() on every layer.

on_exit(new)[source]

Same as BasicMenu.on_exit(), but also calls Layer.on_menu_exit() on every layer.