Package pype :: Module sprite :: Class PolySprite
[frames] | no frames]

Class PolySprite

source code

object --+
         |
        PolySprite

Sprite-like Polygon.

This is a like a sprite, but instead of image data, has a vector of points that define a polygon. Could be easily extended into a SplineSprite() class etc.

Instance Methods
 
__init__(self, points, color, fb, closed=0, width=1, joins=1, line=0, contig=1, on=1, depth=0, name=None, x=0, y=0)
PolySprite instantiation method
source code
 
__repr__(self)
repr(x)
source code
 
clone(self) source code
 
moveto(self, x, y)
Absolute move.
source code
 
rmove(self, dx, dy)
Relative move.
source code
 
blit(self, flip=None, force=None)
Draw PolySprite.
source code
 
on(self)
Turn PolySprite on.
source code
 
off(self)
Turn PolySprite off.
source code
 
toggle(self)
Toggle PolySprite (off->on or on->off)
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, points, color, fb, closed=0, width=1, joins=1, line=0, contig=1, on=1, depth=0, name=None, x=0, y=0)
(Constructor)

source code 
PolySprite instantiation method
Parameters:
  • points - (pixels) polygon vertices. List of (x,y) pairs, where (0,0) is screen center, positive y is up, positive x is to the right.
  • color - line color
  • fb - framebuffer
  • closed - (boolean) open or closed polygon?
  • width - (pixels) line width
  • line - (bool) if true, draw lines, else filled polygon
  • contig - (bool) if true (default), contiguous sequence of lines. Otherwise, each pair of points as interpreted as single broken line.
  • joins - (boolean) join lines and use end-caps
  • on - (boolean) just like regular Sprite class
  • depth - depth of sprite (for DisplayList below). The DisplayList class draws sprites in depth order, with large depths being draw first (ie, 0 is the top-most layer of sprites)
  • name - debugging name (string) of the sprite; if not set, then either the filename or a unique random name is used instead.
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)