SpriteWorld Pascal
Anthony Hubble, Pascal Developer

SpriteWorld Pascal v2.3
by Anthony Hubble

Comments regarding SpriteWorld Pascal

I think some really great Pascal games can be made with this!!


I've done the Pascal conversion (C libraries and Pascal interfaces) for SpriteWorld 2.3. The fully Pascalized demos demonstrate the following features of SpriteWorld: sprites (of course), scrolling, tiling, lighting, translucency, particles, starfield animation and line drawing.

The Pascal package is available here at Pascal Central as well as at the main SpriteWorld website at

Download SpriteWorld Pascal (Pascal Central mirror) v2.3 - Includes libraries and Pascal interfaces, PDF documentation, and several Pascal demo projects.

For a detailed description about SpriteWorld, including SpriteWorld news and updates, jump over to the
SpriteWorld web site.

What's In It?

This package contains the Pascal version of SpriteWorld 2.3. The SpriteWorld source code has been compiled into 2 libraries: SpriteWorldLib68K(CW4) for the 68K version, and SpriteWorldLibPPC(CW4) for the PPC version. The project file to make these libraries is located in Projects:SpriteWorldLib (CW4). You need the original C source files (available with the standard C distribution of SpriteWorld) to remake the libraries.

I've also included the libraries
SpriteWorldLib68K(CW4) Debug and SpriteWorldLibPPC(CW4) Debug. These libraries make use of SpriteWorld's assertion error checking code. So, for the most common SpriteWorld errors (e.g. out of range errors etc), you will get a dialog box stating the source file line, and source file name. You can then look in the C source code to figure out what the problem is (you'll need the source code of course). Using the debug libraries will be slower than the final non-debug libraries, since the final libraries don't check for these errors at runtime.

The interfaces for the Pascal version have been condensed into one file called SWInterfaces.p (in
SpriteWorld Files). Everything is in here. I found it best to put everything here (including all the basic SpriteWorld, BlitPixie, and SWUtils files) to simplify the porting to Pascal (and to solve the horrible cyclic dependency problems inherent in a straight C to Pascal conversion of SpriteWorld). As opposed to a previous Pascal port of SpriteWorld, you don't need the SpriteWorldPeek type anymore (just access the SpriteWorldPtr directly).

The following demos (in
SpriteWorld Examples) have been ported to pascal from the standard C distribution:

They all work, though with minor changes here and there. I ported these demos because they show mostly all the features of SpriteWorld 2.3, such as sprites (of course), scrolling, tiling, lighting, translucency, particles, starfield animation and line drawing. Any of the other demos can be easily ported from the original C versions.

I've also included a project file for making precompiled interfaces for the MacOS Pascal interfaces (UPI).

How to Get Started

To compile and run the demos, you must:

  1. Open the project MacOSInterfaces.p and make the precompiled interfaces. The 68K demos use MacOSInterfaces68K, and the PPC demos use MacOSInterfacesPPC. You can put these files anywhere (e.g. in the Libraries folder in the SpriteWorld 2.3 (Pascal) folder, or the Precompiled Interfaces folder in the CodeWarrior:MacOS Support directories).

    NOTE: This is optional. Precompiling the MacOS interfaces will make compiling the demos much faster. If you don't want to do this, just change the prefix file (Pascal Language panel in Project Settings) to UPI.prefix.

  2. Open one of the projects in the SpriteWorld Examples folder, make either the PPC or 68K target, and run it.

What do I need?

The project files are in CodeWarrior Pro 4 format. So are the libraries. If you have an earlier version of CodeWarrior (or you don't use CodeWarrior), then, well, I guess you'll have to build the project files from scratch. I'm not sure if the CodeWarrior Pro 4 library format is compatible with earlier versions of CodeWarrior or other compilers. If not, then you'll have to build the libraries from scratch using the C source files in the standard C distribution of SpriteWorld.

Users of Think Pascal might be a little disappointed. Something to look at in the near (or not so near) future? Some things in the Pascal interfaces are CodeWarrior Pascal-specific, such as variable initialization (e.g. const x: integer = 0) and macros (e.g. {$DEFINEC AddOne(x) x+1}). It probably wouldn't be that hard to make it Think Pascal compatible (just leave out all the fiddly bits- SpriteWorld can work fine without them). If the library can be read by Think Pascal, then it wouldn't be hard at all.


Yes, there is one known bug:

  1. The SWFastline routines work fine for the PPC Fastline Demo- a coloured square moves around, but this square is white (not coloured) when running the 68K version. This is only a problem for the Pascal demos- the C demos for PPC and 68K work fine. This is a weird problem. I can't begin to imagine what could be going wrong here (the code is exactly the same, except one uses the PPC library, and the other the 68K library).

Suggestions anyone?


If there are bugs in the libraries or Pascal interfaces, or you have any comments, just drop me an email. Better yet, post a message with the SpriteWorld Mailing List, where you'll get friendly help within a day or two from SpriteWorld experts everywhere. For more information, head over to http://www.spriteworld.org.

Anthony Hubble

Copyright © 2000 Anthony Hubble. All Rights Reserved.