Rabbyt is a sprite library for Python with game development in mind. It provides fast performance with an easy to use but flexable API.
Sprites are easy! You can create one by just specifying a texture:
car = rabbyt.Sprite("car.png")
Rotating and scaling are hardware accelerated, and easy!
car.rot = 45
car.scale = 0.5
Rabbyt's "lots of sprites" example.
Animating is common need for game graphics, and doing a large number of them in python can get slow. Rabbyt provides a set of Anim (short for animator) classes to calculate common animations in C. For example, you can slowly fade out the car sprite like this:
car.alpha = rabbyt.lerp(1.0, 0.0, dt=1.0)
That will linearly interpolate the sprite's alpha from 1.0 to 0.0 over the next 1 second. This both easy to use, (you just set it and forget it,) and fast (it all happens in C code.)
Take a look at the lotsofsprites.py example in the Rabbyt download. It makes use of anims for the position, rotation, scaling, and color of 2400 sprites. And it runs fast.
Collision detection is another thing that is difficult to do in pure python. Rabbyt can do the tedious part for you. Just pass rabbyt.collisions.collide() a list of anything that has x, y, and bounding_radius attributes (like a sprite) and you'll get back a list of collisions. (Ok, that sounds a little corny after I wrote it, but whatever.)
Check out the collision.py example to see how fast it is. On my machine, it takes an average of 1 millisecond to do a brute force collision check between 400 sprites.
What's New in This Release: [ read full changelog ]
· Fixed Sprite.left (etc.) incorrectly applying independant axis scaling to absolute coords instead of rotated relative to the sprite.
· Sprite.bounding_radius now reflects Sprite.scale. (previously ignored.)
· Fixed a segfault when anims have circular dependencies.
· Optimized swizzle.
· Fixed aabb_collide() not always reporting immediately overlapping rects.
· Fixed a memory leak caused by an extra underscore at the end of __dealloc___