SuperSpriteSurface is a class framework for REALbasic that provides a savvy, modern alternative to REALbasic’s built-in SpriteSurface control. SuperSpriteSurface improves upon REALbasic’s built in SpriteSurface control (or ad hoc 2D solutions created with REALbasic’s Rb3D system) in many ways.


SuperSpriteSurface uses OpenGL 2D functions to offload the graphics processing to the computer’s video card, resulting in the following benefits:

  • Fast compositing of both small and huge images (i.e., 1×1 to 2048×2048).
  • Storage of images in dedicated texture memory.
  • Images can have 24-bit color depths (millions of colors) with 8 bits of alpha (256 levels of grey).
  • On-the-fly rotation, scaling, and blending of images.

Hundreds of sprites, at various sizes, animated.

Collision Detection

Slick graphics aren’t worth much if you can’t create a world that interacts with itself. That’s why extraordinary effort has gone into SuperSpriteSurface for the implementation of a fast and robust collision detection system based on geometric bounding shapes. Multiple bounding shapes can be attached to your sprites at the same time, defining multiple “hit” regions. The types of bounding shapes that can be assigned include:

  • Point
  • Circle
  • Line
  • Rectangle
  • Convex Polygon

The collision system supports on-the-fly creation of collision sets (to limit the total number of shapes it has to cross-check for collision). The system also caches pre-calculation collision results to further speed things up. Finally, when a collision occurs, the appropriate SuperSprite objects receive a collision event with details of the collision.

SuperSpriteSurface even supports a special debug mode that overlay-draws your sprite’s collision shapes on top of your sprites—for faster fine tuning!

The collision tests demo running. Red shapes indicate a collision in progress.

Time-based Animation Controller

SuperSpriteSurface offers another important improvement over the built-in SpriteSurface: the animation controller is time based, as opposed to frame based.

This time-based animation controller will ensure that motion in your game or animation appears constant, no matter the speed of the target machine, the refresh rate of its monitor, the number of frames-per-second, or the number of sprites that are on screen at once.

SuperSpriteSurface’s animation controller runs in hard-looped (speed) and threaded (cooperative) modes.

Multiple Sprite Types

SuperSpriteSurface includes two subclasses to the default SuperSprite sprite class: SuperSpriteGroup and SuperSpriteTile.

SuperSpriteGroup lets you create a hierarchy of sprite objects, similar to REALbasic’s built-in Group2D class.

SuperSpriteTile offers similar functionality to the PaintTile event in the REALbasic SpriteSurface control: it lets you seamlessly tile small images, which allows you to create huge backdrops from a few source images. Because SuperSpriteTile is a SuperSprite subclass it may be transformed—moved, scaled, and rotated—like any other SuperSprite object. You can also layer multiple SuperSpriteTile objects to create parallax scrolling effects!

SuperSpriteTile is fast. The class performs on-the-fly culling of off-screen tiles and then draws only those tiles that are potentially visible.

The knights are are formed from a hierarchy of simpler sprites.

The dungeon background is a SuperSpriteTile object made from thousands of tiles, but is optimized to draw only the visible portion — even under scaling and rotation transforms!

Text and Fonts

SuperSpriteSurface contains an OpenGL-based text rendering engine. This text rendering engine is implemented as a subclass to the SuperSprite class, making it easy to use and integrate into your software. Since it’s a subclass of SuperSprite, it also supports rotation and scaling effects.

The text engine supports variable-width fonts and font kerning for high quality text rendering. To give your text a bit of flair, the text engine supports three methods of coloring your text: simple color, gradient color, and full bit-mapped color.

SuperSpriteSurface includes an OS X-based font map creation tool, allowing developers to create SuperSpriteSurface Font Files that work and look identical cross-platform. Font Files are a combination of OpenGL texture maps and font glyph metrics data.

The Font Map Creation Tool determines an optimal packing for the font image data, maximizing the texture space used. This tool allows you to export image templates to add texture or a 3D appearance to your font in an image editing program, if you so choose. When you’re done customizing the look of your font, the font creation tool will export the font images and font metrics in a single file that’s easy to use within SuperSpriteSurface.

Many of the thousands of free fonts that are available on the internet are just perfect for games!

The Designer window of the Font Texture Creation Tool.

An Editing window from the Font Map Creation Tool. Edit the alpha and color data of your font file here, or export an image template for use in bit-mapped editing programs.

Sprite Behaviors and Mouse Interactivity

Among the new features added to version 2.0 are mouse events for SuperSprite objects and the SuperSpriteSurface control. This includes MouseDown, MouseDrag, and MouseUp, and built-in double-click support.

SuperSpriteSurface also supports the concept of behavior objects: reusable objects that you can attach to any SuperSprite. Behaviors receive copies of the same events that SuperSprite objects receive; they alter the SuperSprite object they are attached to in some way. Example behavior could be motion- or physics-based, such as calculating the trajectory of a mass and handling collision with other masses, or even mouse-event based, such as controlling the behavior of an object when it’s clicked or dragged.

Behaviors can be called automatically by the SuperSpriteSurface engine or you can explicitly control when they are executed, swapping or enabling behaviors on the fly.

The most powerful aspect of this system is that you can apply a behavior to any SuperSprite object, instantly giving any of your sprites added functionality while maintaining a single class encapsulating the behavior!

The movie below shows mouse interactivity and behaviors in action: cards are dragged around the window; double-clicking “flips” the card over. The drag behavior of the card is controlled by a reusable drag behavior that rotates the card to follow the cursor’s direction. In this example, the rotation caused by the generic drag behavior is override-able by the parent SuperSprite when the shift key is held down.
YouTube Preview Image

Platform Support

SuperSpriteSurface supports Macintosh and Windows.

Documentation and Examples

SuperSpriteSurface includes API documentation* of the main control and classes, as well as an example project that contains several well-commented demos.

*The API documentation is current as of version 1.0; I’d love it if a volunteer could help prepare an updated API reference!

Pricing and Availability

As of version 2.0, SuperSpriteSurface is now free. The full project source is available for download and modification.

zip SuperSpriteSurface 2
(5234 downloads since 2011-02-11)