peng3d.peng - Main Engine class

class peng3d.peng.Peng(cfg={})[source]

This Class should only be instatiated once per application, if you want to use multiple windows, see createWindow().

An Instance of this class represents the whole Engine, with all accompanying state and window/world objects.

Be sure to keep your instance accessible, as it will be needed to create most other classes.

createWindow(cls=window.PengWindow, *args, **kwargs)[source]

Creates a new window using the supplied cls.

If cls is not given, peng3d.window.PengWindow() will be used.

Any other positional or keyword arguments are passed to the class constructor.

Note that this method currently does not support using multiple windows.

Todo

Implement having multiple windows.

handleEvent(event_type, args, window=None)[source]

Handles a pyglet event.

This method is called by PengWindow.dispatch_event() and handles all events.

See registerEventHandler() for how to listen to these events.

registerEventHandler(event_type, handler)[source]

Registers an event handler.

The specified callable handler will be called everytime an event with the same event_type is encountered.

All event arguments are passed as positional arguments.

run()[source]

Runs the application main loop.

This method is blocking and needs to be called from the main thread to avoid OpenGL bugs that can occur.