Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 4.4

FEATURE

Intro to SSS

A Gentle Introduction To The SuperSpriteSurface for REALbasic

Issue: 4.4 (March/April 2006)
Author: Thomas Cunningham
Author Bio: Beginner
Article Length (in bytes): 17,986
Starting Page Number: 30
Article Number: 4412
Related Web Link(s):

http://www.tinrocket.com/

Excerpt of article text...

SuperSpriteSurface (SSS) is a powerful alternative to the build-in classes for using sprite and sprite animations in your REALbasic applications. The demos that come with SuperSpriteSurface (SSS) are excellent, but may intimidate someone new to programming, so consider this tutorial and associated demo projects as a kinder introduction to SSS.

Platform Supported

As of this writing, the SuperSpriteSurface (SSS) is for the Mac platform only. However, John has a Windows version in the works and should be released by December 2005. I'm using RB 5.5.5 for this project, however, if you are using RB2005, everything should work the same. Just keep in mind, my screenshots will not look like your IDE.

The SuperSpriteSurface class is written by John Balestrieri and is available from John's web site (http://www.tinrocket.com/). It sells for $29.95. A demo version is available for download. And if you end up using these classes, pay the man!

I will assume that you are somewhat familiar with REALbasic (RB), but I do include screenshots to help you.

A Sprite Surface

...End of Excerpt. Please purchase the magazine to read the full article.


Errata (2006-07-16)

From: Dr. Scott Steinman
To: REALbasic Developer Magazine

I have an important tip for users of SuperSpriteSurface that you might want to publish in the next RBD:

I use SuperSpriteSurface for the creation of vision science software. Vision science applications, which make heavy use of animation, require precisely accurate animation frame timing to prevent image shearing and to present stimuli on the screen for exact intervals. On System 9, the Toolbox's VBlank routines could ensure that animation was in sync with the monitor's vertical retrace. OpenGL, which SuperSpriteSurface uses, also provides these capabilities.

However, a design decision was made in writing SuperSpriteSurface to use timer-based frame updates. This improved its applicability for most software, such as games, but limits its usefulness when accurate frame timing is more important.

Fortunately, the solution to the problem is simple, and allows SuperSpriteSurface to be used for research-quality animation. There is a SWAP_INTERVAL flag in OpenGL that allows you to select whether OpenGL updates its frames in sync with the vertical retrace or not. Below is the REALbasic method I wrote to set this flag with SuperSpriteSurface's AGL library interface to openGL:

  Protected Function setSwap( doSwap as Boolean ) As Boolean
   Dim block As MemoryBlock
   Dim swap As Integer
   If doSwap Then
     swap = 1
   Else
     swap = 0
   End If
   block = NewMemoryBlock( 4 )
   block.Long(0) = swap
   Return aglSetInteger( aglGetCurrentContext(), AGL_SWAP_INTERVAL, block )
End Function

-- Scott