Trees | Indices | Toggle frames |
---|
cocosnode.CocosNode --+ | scene.EventHandlerMixin --+ | base_layers.Layer --+ | ColorLayer
Creates a layer of a certain color. The color shall be specified in the format (r,g,b,a).
For example, to create green layer:
l = ColorLayer(0, 255, 0, 0 )
The size and position can be changed, for example:
l = ColorLayer( 0, 255,0,0, width=200, height=400) l.position = (50,50)
__init__(self, r, g, b, a, width=None, height=None) | |
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
|
|
draw(self)
This is the function you will have to override if you want your
subclassed to draw something on screen.
|
|
__contains__(self, child) (Inherited from cocos.cocosnode.CocosNode) | |
CocosNode instance |
add(self,
child,
z=0,
name=None)
Adds a child and if it becomes part of the active scene calls its on_enter method
(Inherited from cocos.cocosnode.CocosNode)
|
are_actions_running(self)
Determine whether any actions are running.
(Inherited from cocos.cocosnode.CocosNode)
|
|
Action instance |
do(self,
action,
target=None)
Executes an action.
(Inherited from cocos.cocosnode.CocosNode)
|
CocosNode |
get(self,
name)
Gets a child given its name
(Inherited from cocos.cocosnode.CocosNode)
|
CocosNode or None |
get_ancestor(self,
klass)
Walks the nodes tree upwards until it finds a node of the class
(Inherited from cocos.cocosnode.CocosNode)
klass
or returns None |
list of CocosNode |
get_children(self)
Return a list with the node's childs, order is back to front
(Inherited from cocos.cocosnode.CocosNode)
|
euclid.Matrix3 |
get_local_inverse(self)
returns an euclid.Matrix3 with the local inverse transformation matrix
(Inherited from cocos.cocosnode.CocosNode)
|
euclid.Matrix3 |
get_local_transform(self)
returns an euclid.Matrix3 with the local transformation matrix
(Inherited from cocos.cocosnode.CocosNode)
|
euclid.Matrix3 |
get_world_inverse(self)
returns an euclid.Matrix3 with the world inverse transformation matrix
(Inherited from cocos.cocosnode.CocosNode)
|
euclid.Matrix3 |
get_world_transform(self)
returns an euclid.Matrix3 with the world transformation matrix
(Inherited from cocos.cocosnode.CocosNode)
|
kill(self)
Remove this object from its parent, and thus most likely from
everything.
(Inherited from cocos.cocosnode.CocosNode)
|
|
pause(self)
Suspends the execution of actions.
(Inherited from cocos.cocosnode.CocosNode)
|
|
pause_scheduler(self)
Time will stop passing for this node: scheduled callbacks will
not be called, worker actions will not be called
(Inherited from cocos.cocosnode.CocosNode)
|
|
euclid.Vector2 |
point_to_local(self,
p)
returns an euclid.Vector2 converted to local space
(Inherited from cocos.cocosnode.CocosNode)
|
euclid.Vector2 |
point_to_world(self,
p)
returns an euclid.Vector2 converted to world space
(Inherited from cocos.cocosnode.CocosNode)
|
push_all_handlers(self)
registers itself to receive director.window events and propagates
the call to childs that are layers.
(Inherited from cocos.layer.base_layers.Layer)
|
|
remove(self,
obj)
Removes a child given its name or object
(Inherited from cocos.cocosnode.CocosNode)
|
|
remove_action(self,
action)
Removes an action from the node actions container, potentially calling action.stop()
(Inherited from cocos.cocosnode.CocosNode)
|
|
remove_all_handlers(self)
de-registers itself to receive director.window events and propagates
the call to childs that are layers.
(Inherited from cocos.layer.base_layers.Layer)
|
|
resume(self)
Resumes the execution of actions.
(Inherited from cocos.cocosnode.CocosNode)
|
|
resume_scheduler(self)
Time will continue/start passing for this node and callbacks
will be called, worker actions will be called
(Inherited from cocos.cocosnode.CocosNode)
|
|
schedule(self,
callback,
*args,
**kwargs)
Schedule a function to be called every frame.
(Inherited from cocos.cocosnode.CocosNode)
|
|
schedule_interval(self,
callback,
interval,
*args,
**kwargs)
Schedule a function to be called every
(Inherited from cocos.cocosnode.CocosNode)
interval seconds. |
|
stop(self)
Removes all actions from the running action list
(Inherited from cocos.cocosnode.CocosNode)
|
|
transform(self)
Apply ModelView transformations
(Inherited from cocos.cocosnode.CocosNode)
|
|
unschedule(self,
callback)
Remove a function from the schedule.
(Inherited from cocos.cocosnode.CocosNode)
|
|
visit(self)
This function visits it's children in a recursive
way.
(Inherited from cocos.cocosnode.CocosNode)
|
|
list |
walk(self,
callback,
collect=None)
Executes callback on all the subtree starting at self.
(Inherited from cocos.cocosnode.CocosNode)
|
int |
opacity
Blend opacity.
|
(int, int, int) |
color
Blend color.
|
(int,int) |
anchor
Anchor point of the object.
(Inherited from cocos.cocosnode.CocosNode)
|
(int,int) |
anchor_x
Anchor x value for transformations and adding children
(Inherited from cocos.cocosnode.CocosNode)
|
(int,int) |
anchor_y
Anchor y value for transformations and adding children
(Inherited from cocos.cocosnode.CocosNode)
|
object |
parent
The parent of this object.
(Inherited from cocos.cocosnode.CocosNode)
|
(int, int) |
position
The (x, y) coordinates of the object.
(Inherited from cocos.cocosnode.CocosNode)
|
rotation (Inherited from cocos.cocosnode.CocosNode) | |
scale (Inherited from cocos.cocosnode.CocosNode) | |
(int,int) |
transform_anchor
Transformation anchor point.
(Inherited from cocos.cocosnode.CocosNode)
|
x
The x coordinate of the object
(Inherited from cocos.cocosnode.CocosNode)
|
|
y
The y coordinate of the object
(Inherited from cocos.cocosnode.CocosNode)
|
actions
list of Action objects that are running
(Inherited from cocos.cocosnode.CocosNode)
|
|
camera
eye, center and up vector for the Camera.
(Inherited from cocos.cocosnode.CocosNode)
|
|
children
list of (int, child-reference) where int is the z-order, sorted by ascending z (back to front order)
(Inherited from cocos.cocosnode.CocosNode)
|
|
children_names
dictionary that maps children names with children references
(Inherited from cocos.cocosnode.CocosNode)
|
|
grid
the grid object for the grid actions.
(Inherited from cocos.cocosnode.CocosNode)
|
|
is_running
whether of not the object is running
(Inherited from cocos.cocosnode.CocosNode)
|
|
scheduled_calls
list of scheduled callbacks
(Inherited from cocos.cocosnode.CocosNode)
|
|
scheduled_interval_calls
list of scheduled interval callbacks
(Inherited from cocos.cocosnode.CocosNode)
|
|
skip_frame
whether or not the next frame will be skipped
(Inherited from cocos.cocosnode.CocosNode)
|
|
to_remove
list of Action objects to be removed
(Inherited from cocos.cocosnode.CocosNode)
|
|
transform_anchor_x
offset from (x,0) from where rotation and scale will be applied.
(Inherited from cocos.cocosnode.CocosNode)
|
|
transform_anchor_y
offset from (0,y) from where rotation and scale will be applied.
(Inherited from cocos.cocosnode.CocosNode)
|
|
visible
whether of not the object is visible.
(Inherited from cocos.cocosnode.CocosNode)
|
is_event_handler = False
if True the layer will listen to director.window events
Default: False
if true, the event handlers of this layer will be registered.
(Inherited from cocos.layer.base_layers.Layer)
|
Called every time just before the node enters the stage.
scheduled calls and worker actions begins or continues to perform
Good point to do .push_handlers if you have custom ones Rule: a handler pushed there is near certain to require a .pop_handlers in the .on_exit method (else it will be called even after removed from the active scene, or, if going on stage again will be called multiple times for each event ocurrence)
Called every time just before the node leaves the stage
scheduled calls and worker actions are suspended, that is, will not be called until an on_enter event happens.
Most of the time you will want to .pop_handlers for all explicit .push_handlers found in on_enter
Consider to release here openGL resources created by this node, like compiled vertex lists
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()
Blend opacity.
This property sets the alpha component of the colour of the layer's vertices. This allows the layer to be drawn with fractional opacity, blending with the background.
An opacity of 255 (the default) has no effect. An opacity of 128 will make the sprite appear translucent.
Blend color.
This property sets the color of the layer's vertices. This allows the layer to be drawn with a color tint.
The color is specified as an RGB tuple of integers (red, green, blue). Each color component must be in the range 0 (dark) to 255 (saturated).
Trees | Indices | Toggle frames |
---|
Generated by Epydoc 3.0beta1 on Wed Oct 26 10:00:14 2011 | http://epydoc.sourceforge.net |