Trees | Indices | Toggle frames |
---|
Cocosnode is the main element. Anything thats gets drawn or contains things that get drawn is a cocosnode. The most popular cocosnodes are scenes, layers and sprites.
Some cocosnodes provide extra functionality for them or their children.
__contains__(self, child) | |
__init__(self) | |
add(self,
child,
z=0,
name=None)
Adds a child to the container
|
|
are_actions_running(self)
Determine whether any actions are running.
|
|
Action instance |
do(self,
action,
target=None)
Executes an action.
|
draw(self,
*args,
**kwargs)
This is the function you will have to override if you want your
subclassed to draw something on screen.
|
|
get(self,
name)
Gets a child from the container given its name
|
|
get_ancestor(self,
klass)
Walks the nodes tree upwards until it finds a node of the class
klass
or returns None |
|
get_children(self) | |
get_local_inverse(self)
returns an euclid.Matrix3 with the local inverse transformation matrix
|
|
get_local_transform(self)
returns an euclid.Matrix3 with the local transformation matrix
|
|
get_world_inverse(self)
returns an euclid.Matrix3 with the world inverse transformation matrix
|
|
get_world_transform(self)
returns an euclid.Matrix3 with the world transformation matrix
|
|
kill(self)
Remove this object from its parent, and thus most likely from
everything.
|
|
on_enter(self)
Called every time just before the node enters the stage.
|
|
on_exit(self)
Called every time just before the node leaves the stage
|
|
pause(self)
Suspends the execution of actions.
|
|
pause_scheduler(self)
Time will stop passing for this node and callbacks will
not be called
|
|
point_to_local(self,
p)
returns an euclid.Vector2 converted to local space
|
|
point_to_world(self,
p)
returns an euclid.Vector2 converted to world space
|
|
remove(self,
obj)
Removes a child from the container given its name or object
|
|
remove_action(self,
action)
Removes an action from the node actions container, potentially calling action.stop()
|
|
resume(self)
Resumes the execution of actions.
|
|
resume_scheduler(self)
Time will continue/start passing for this node and callbacks
will be called.
|
|
schedule(self,
callback,
*args,
**kwargs)
Schedule a function to be called every frame.
|
|
schedule_interval(self,
callback,
interval,
*args,
**kwargs)
Schedule a function to be called every
interval seconds. |
|
stop(self)
Removes all actions from the running action list
|
|
transform(self)
Apply ModelView transformations
you will most likely want to wrap calls to this function with
glPushMatrix/glPopMatrix
|
|
unschedule(self,
callback)
Remove a function from the schedule.
|
|
visit(self)
This function visits it's children in a recursive
way.
|
|
list |
walk(self,
callback,
collect=None)
Executes callback on all the subtree starting at self.
|
(int,int) |
anchor
Anchor point of the object.
|
(int,int) |
anchor_x
Anchor x value for transformations and adding children
|
(int,int) |
anchor_y
Anchor y value for transformations and adding children
|
object |
parent
The parent of this object.
|
(int, int) |
position
The (x, y) coordinates of the object.
|
rotation | |
scale | |
(int,int) |
transform_anchor
Transformation anchor point.
|
x
The x coordinate of the object
|
|
y
The y coordinate of the object
|
actions
list of Action objects that are running
|
|
camera
eye, center and up vector for the Camera.
|
|
children
list of children.
|
|
children_names
dictionary that maps children names with children references
|
|
grid
the grid object for the grid actions.
|
|
is_running
whether of not the object is running
|
|
scheduled_calls
list of scheduled callbacks
|
|
scheduled_interval_calls
list of scheduled interval callbacks
|
|
skip_frame
whether or not the next frame will be skipped
|
|
to_remove
list of Action objects to be removed
|
|
transform_anchor_x
offset from (x,0) from where rotation and scale will be applied.
|
|
transform_anchor_y
offset from (0,y) from where rotation and scale will be applied.
|
|
visible
whether of not the object is visible.
|
This is the function you will have to override if you want your subclassed to draw something on screen.
You must respect the position, scale, rotation and anchor attributes. If you want OpenGL to do the scaling for you, you can:
def draw(self): glPushMatrix() self.transform() # ... draw .. glPopMatrix()
Removes an action from the node actions container, potentially calling action.stop()
If action was running, action.stop is called Mandatory interfase to remove actions in the node actions container. When skipping this there is the posibility to double call the action.stop
Schedule a function to be called every frame.
The function should have a prototype that includes dt as the first argument, which gives the elapsed time, in seconds, since the last clock tick. Any additional arguments given to this function are passed on to the callback:
def callback(dt, *args, **kwargs): pass
This function is a wrapper to pyglet.clock.schedule. It has the additional benefit that all calllbacks are paused and resumed when the node leaves or enters a scene.
You should not have to schedule things using pyglet by yourself.
Schedule a function to be called every interval
seconds.
Specifying an interval of 0 prevents the function from being called again (see schedule to call a function as often as possible).
The callback function prototype is the same as for schedule.
This function is a wrapper to pyglet.clock.schedule_interval. It has the additional benefit that all calllbacks are paused and resumed when the node leaves or enters a scene.
You should not have to schedule things using pyglet by yourself.
Removes all actions from the running action list
For each action running the stop method will be called, and the action will be retired from the actions container.
Remove a function from the schedule.
If the function appears in the schedule more than once, all occurances are removed. If the function was not scheduled, no error is raised.
This function is a wrapper to pyglet.clock.unschedule. It has the additional benefit that all calllbacks are paused and resumed when the node leaves or enters a scene.
You should not unschedule things using pyglet that where scheduled by node.schedule/node.schedule_interface.
This function visits it's children in a recursive way.
It will first visit the children that that have a z-order value less than 0.
Then it will call the draw method to draw itself.
And finally it will visit the rest of the children (the ones with a z-value bigger or equal than 0)
Before visiting any children it will call the transform method to apply any possible transformation.
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Wed Jul 07 22:46:51 2010 | http://epydoc.sourceforge.net |