Warning
This documentation is a little out of date. Nothing in here is wrong, but it doesn't document any of the new APIs that I've created in the last few months. Most notable by its absence is the Sprite class...
PS3 package
This is the fundamental starting point for all the PS3 functionality and is made available with import ps3
PS3 controllers (and also USB joysticks) are automatically detected and made available here as is the screen object which is central to all rendering. The Controller type contains the following attributes:
- screen
- a reference to the PS3's screen
- controllers
- a list of all controllers detected on the system
Screen object
Screen supports the following accessors and methods:
- width
- gives the width of the screen
- height
- gives the height of the screen
- frames
- gives the number of frames supported by the double buffering
- mode
- gives or sets the current screen mode (see ps3videomode)
- clear()
- erases the entire screen to black
- flip()
- flips the screen so that the drawing frame becomes visible
- wait()
- waits for the next frame flyback event
- blit(image, (x,y))
- blits the Blittable image to position (x,y) on the drawing frame
- setPixel( (x,y), (r,g,b))
- sets the pixel at (x,y) on the drawing frame to the specified colour
Blittable object
The Blittable type is used as the base container for all images that can be blitted to the screen and supports the following methods:
- Blittable(width, height, data, size)
- constructor with all parameters optional, although dimensions must be specified either by width and height or by the size parameter. If data is passed then putdata is called immediately
- width
- gives the width of the blittable object
- height
- gives the height of the blittable object
- setPixel( (x,y), (r,g,b))
- sets the pixel at (x,y) to the specified colour
- putdata(sequence)
- sets the pixel data for the entire image from the sequence containing a 3-tuple of RGB colour data for each pixel in the image
Controller object
The Controller type supports the following methods:
- id
- get the controller's id
- axes
- get the controller's axes as a list of values
- buttons
- get the controller's buttons as a list of booleans
Playback object
The Playback object provides a simple playback to ALSA, although behind that simplicity, it has some nice features. A background thread is started which mixes the currently playing samples and so many samples can be playing at once, even samples of different sample rates.
The Playback type supports the following methods:
- Playback([device])
- the constructor optionally takes an ALSA device name
- play(sample[,left[,right]])
- plays the sample, optionally specifying volume in left and right channels
- playing
- returns the number of samples currently playing
Sample object
The Sample type supports the following methods:
- Sample(filename)
- loads the sample specified by the filename
pydoc documentation
If you prefer, you can read the pydoc documentation.