peng3d.window - Windowing with batteries included

class peng3d.window.PengWindow(peng, *args, **kwargs)[source]

Main window class for peng3d and subclass of pyglet.window.Window().

This class should not be instantiated directly, use the Peng.createWindow() method.

addMenu(menu)[source]

Adds a menu to the list of menus.

changeMenu(menu)[source]

Changes to the given menu.

menu must be a valid menu name that is currently known.

Changed in version 1.2a1: The push/pop handlers have been deprecated in favor of the new Menu.on_enter(), Menu.on_exit(), etc. events.

dispatch_event(event_type, *args)[source]

Internal event handling method.

This method extends the behaviour inherited from pyglet.window.Window.dispatch_event() by calling the various handleEvent() methods.

By default, Peng.handleEvent(), handleEvent() and Menu.handleEvent() are called in this order to handle events.

Note that some events may not be handled by all handlers during early startup.

menu

Property for accessing the currently active menu.

Always equals self.menus[self.activeMenu].

This property is read-only.

on_draw()[source]

Clears the screen and draws the currently active menu.

run()[source]

Runs the application in the current thread.

This method should not be called directly, especially when using multiple windows, use Peng.run() instead.

Note that this method is blocking as rendering needs to happen in the main thread. It is thus recommendable to run your game logic in another thread that should be started before calling this method.

set2d()[source]

Configures OpenGL to draw in 2D.

Note that wireframe mode is always disabled in 2D-Mode, but can be re-enabled by calling glPolygonMode(GL_FRONT_AND_BACK, GL_LINE).

set3d(cam)[source]

Configures OpenGL to draw in 3D.

This method also applies the correct rotation and translation as set in the supplied camera cam. It is discouraged to use glTranslatef() or glRotatef() directly as this may cause visual glitches.

If you need to configure any of the standard parameters, see the docs about Configuration Options for peng3d.

The graphics.wireframe config value can be used to enable a wireframe mode, useful for debugging visual glitches.

setup()[source]

Sets up the OpenGL state.

This method should be called once after the config has been created and before the main loop is started. You should not need to manually call this method, as it is automatically called by run().

Repeatedly calling this method has no effects.

toggle_exclusivity(override=None)[source]

Toggles mouse exclusivity via pyglet’s set_exclusive_mouse() method.

If override is given, it will be used instead.

You may also read the current exclusivity state via exclusive.