cocos.draw module

class Canvas

Bases: cocos.cocosnode.CocosNode

build_vbo()
draw()

This is the function you will have to override if you want your subclassed CocosNode 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()
endcap(line, cap_type)
free()
line_to(end)
move_to(position)
on_exit()

Called every time just before the node leaves the stage.

Scheduled calls and worker actions are suspended, that is, they 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 meth:on_enter.

Consider to release here openGL resources created by this node, like compiled vertex lists.

pop()
push()
rotate(radians)
set_color(color)
set_endcap(cap)
set_join(join)
set_stroke_width(stroke_width)
translate(vect)
class Context

Bases: object

copy()
set_state()
unset_state()
class Line(start, end, color, stroke_width=1)

Bases: cocos.draw.Canvas

render()
property color
property end
property start
property stroke_width
class Segment(start, end, width)

Bases: object

reversed()
property bl
property br
property direction
property left
property line_width
property points
property right
property tl
property tr
flatten(*args)
parameter(default=None)