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.-
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 varioushandleEvent()
methods.By default,
Peng.handleEvent()
,handleEvent()
andMenu.handleEvent()
are called in this order to handle events.Note that some events may not be handled by all handlers during early startup.
Property for accessing the currently active menu.
Always equals
self.menus[self.activeMenu]
.This property is read-only.
-
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 useglTranslatef()
orglRotatef()
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.
-