peng3d.menu
- Flexible menu system¶
-
class
peng3d.menu.
BasicMenu
(name: str, window: peng3d.window.PengWindow, peng: Any = None)[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 theon_enter()
method has been called.exit
is triggered everytime theon_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.
-
-
class
peng3d.menu.
Menu
(name: str, window: peng3d.window.PengWindow, peng: Any = None)[source]¶ Subclass of
BasicMenu
adding support for theLayer
class.This subclass overrides the draw and __init__ method, so be sure to call them if you override them.
-
addLayer
(layer: peng3d.layer.Layer, z: int = -1) → None[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
() → None[source]¶ Draws the layers in the appropriate order.
Layers that have their
enabled
attribute set toFalse
are skipped.
-
on_enter
(old)[source]¶ Same as
BasicMenu.on_enter()
, but also callsLayer.on_menu_enter()
on every layer.
-
on_exit
(new)[source]¶ Same as
BasicMenu.on_exit()
, but also callsLayer.on_menu_exit()
on every layer.
-