Trees | Indices | Toggle frames |
---|
pyglet.event.EventDispatcher --+ | Director
Class that creates and handle the main Window and manages how and when to execute the Scenes
You should not directly instantiate the class, instead you do:
from cocos.director import director
to access the only one Director instance.
pyglet.window.Window |
init(self,
*args,
**kwargs)
Initializes the Director creating the main window.
|
set_show_FPS(self, value) | |
run(self,
scene)
Runs a scene, entering in the Director's main loop.
|
|
set_recorder(self,
framerate,
template=' frame-%d.png ' ,
duration=None)
Will replace the system clock so that now we can ensure a steady
frame rate and save one image per frame
|
|
on_draw(self)
Callback to draw the window.
|
|
push(self,
scene)
Suspends the execution of the running scene, pushing it
on the stack of suspended scenes.
|
|
on_push(self, scene) | |
pop(self)
Pops out a scene from the queue.
|
|
on_pop(self) | |
replace(self,
scene)
Replaces the running scene with a new one.
|
|
(x,y) |
get_window_size(self)
Returns the size of the window when it was created, and not the
actual size of the window.
|
(x,y) |
get_virtual_coordinates(self,
x,
y)
Transforms coordinates that belongs the real window size, to the
coordinates that belongs to the virtual window.
|
scaled_resize_window(self,
width,
height)
One of two possible methods that are called when the main window is resized.
|
|
unscaled_resize_window(self,
width,
height)
One of two possible methods that are called when the main window is resized.
|
|
set_projection(self)
Sets a 3D projection mantaining the aspect ratio of the original window size
|
|
set_alpha_blending(self,
on=True)
Enables/Disables alpha blending in OpenGL
using the GL_ONE_MINUS_SRC_ALPHA algorithm.
|
|
set_depth_test(sefl,
on=True)
Enables z test.
|
|
Inherited from pyglet.event.EventDispatcher :
dispatch_event ,
event ,
pop_handlers ,
push_handlers ,
register_event_type ,
remove_handler ,
remove_handlers ,
set_handler ,
set_handlers
|
show_FPS
whether or not the FPS are displayed
|
interpreter_locals =
a dict with locals for the interactive python interpreter (fill with what you need)
|
|
fps_display = None
|
|
event_types =
|
Initializes the Director creating the main window.
There are a few cocos exclusive parameters, the rest are the standard pyglet parameters for pyglet.window.Window.__init__ This docstring only partially list the pyglet parameteres; a full list is available at pyglet Window API Reference at http://pyglet.org/doc/api/pyglet.window.Window-class.html
'
frame-%d.png
'
,
duration=None)
Will replace the system clock so that now we can ensure a steady frame rate and save one image per frame
framerate
: inttemplate
: strduration
: floatReturns the size of the window when it was created, and not the actual size of the window.
Usually you don't want to know the current window size, because the Director() hides the complexity of rescaling your objects when the Window is resized or if the window is made fullscreen.
If you created a window of 640x480, the you should continue to place your objects in a 640x480 world, no matter if your window is resized or not. Director will do the magic for you.
Transforms coordinates that belongs the real window size, to the coordinates that belongs to the virtual window.
For example, if you created a window of 640x480, and it was resized to 640x1000, then if you move your mouse over that window, it will return the coordinates that belongs to the newly resized window. Probably you are not interested in those coordinates, but in the coordinates that belongs to your virtual window.
One of two possible methods that are called when the main window is resized.
This implementation scales the display such that the initial resolution requested by the programmer (the "logical" resolution) is always retained and the content scaled to fit the physical display.
This implementation also sets up a 3D projection for compatibility with the largest set of Cocos transforms.
The other implementation is unscaled_resize_window.
One of two possible methods that are called when the main window is resized.
This implementation does not scale the display but rather forces the logical resolution to match the physical one.
This implementation sets up a 2D projection, resulting in the best pixel alignment possible. This is good for text and other detailed 2d graphics rendering.
The other implementation is scaled_resize_window.
|
|
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Wed Sep 08 23:50:19 2010 | http://epydoc.sourceforge.net |