Ingemar's Corner
Ingemar Ragnemalm, Macintosh Shareware Author



Updated: 25-Dec-2002

Ingemar's Corner

At ftp://ftp.lysator.liu.se/pub/mac/source/, I keep an archive with many source-code demos that I have written or modified. Most of it is in Pascal, since that's where the efficient programming is: readable, superior string handling, very fast compilation, just as fast resulting code as any high-level language and even as fast as a certain glorified assembler that some people like. Those who like write-only languages are free to use them, but I support what I believe is best.

There are plenty of demos in the Lysator archive. Near the source folder, you will find the SAT (Sprite Animation Toolkit) archive, which also holds tons of useful source. However, all that depends (more or less) on the SAT library. What you find in the source folder is stand-alone stuff.

Some demos are good, some not quite so good. Some are well documented while others are rather quick hacks. Most of all, some are very useful while others are at best nostalgic or curiosities.

DISCLAIMER: If you run into trouble, don't demand support and lots of help from me. My time is often limited. Writing this is just about as much support I can give. Most problems are problems that any Mac hacker can solve for you, so turn to the nearby hackers first, please.


Guide to the Descriptions

COMPILER:
With what compilers does the demo run without modifications? Note that the CodeWarrior projects are usually for old versions. If no CodeWarrior project is included, the source probably won't run without at least adding a couple of Toolbox units in the "uses" clause and adding "qd" before all QuickDraw globals (e.g. screenBits), but it generally isn't much more than that.

USEFULNESS:
Why would you want it? A rating from one to five stars is given in two classifications: beginners and experienced users (people who know the common methods but can use some help with certain problems). If I would put it in the hands of a beginner that I want to teach programming, it gets a high "beginner" rating, and if I feel that I might look it up myself some time to see how I did it, I give it a high "experienced" rating.

SOURCE:
Where did I get it and what did I do (if I remember right, that is)? This isn't extremely interesting for you as a user of the demos, but i feel that if I modify someone else's code, the original author should always get credit for the work.

Notes on Think Pascal versions:

Most demos come with Think Pascal projects (and often also CodeWarrior). Note that the code is written for Think Pascal 4.0.2 with old interfaces, not the newer UPI interfaces (which are available as a separate download, and also come with Think Pascal 4.5d4)! These new UPI interfaces are, sadly, NOT easy to use. They have unnecessary declarations that conflict with the built-in ones, have lots of unnecessary dependencies that forces you to include tons of interface units that you really shouldn't need. There is hope for a better version (I am working on it), but my recommendation for now is to use the old interfaces, possibly with glue code like InterfacesUI.p to ease portability to CodeWarrior (so that you can use CW to compile a PPC version).

Latest additions:


Source Code

3DGPL.hqx

A 3D library with full C code, written by Sergei Savchenko. Well, it is really rather a polygon rendering demo, with portability being the strongest point. Unlike most other source here, it is in C.

Shall we port it to Pascal? Can we do that and keep it portable? Or build a Pascal interface... but that would have the same problem.

COMPILER: Think C and CW C (recommended).
USEFULNESS: For drawing textured polygons, possibly for building a simple 3D engine on.
Novice: *
Experienced: ***

SOURCE: Downloaded from Savchenko's web page, added Mac support



3D-Maze-p.hqx

Black-and-white 3D maze like they used to be in the 80's. You move one step at a time, not smooth like in modern games.

COMPILER: Think and CW.
USEFULNESS: Limited. Possibly useful for novice programmers to learn some QuickDraw and user interface.
Novice: **
Experienced: *

SOURCE: Converted from a C demo



AEtest.hqx

Apple Event demo. Sends/receives the Appletalk user name as a custom apple event.

COMPILER: Think.
USEFULNESS: For AE programmers. Requires TransSkel.
Novice: **
Experienced: ****

SOURCE: Original code.



antialias-ii.hqx

This demo shows how you can use CopyBits with ditherCopy to antialias text and pictures.

COMPILER: Think and CW.
USEFULNESS: Might be what you want if you want to save some space by online anti-aliasing.
Novice: **
Experienced: ***

SOURCE: Converted from a C snippet - that didn't work



ArraySpeed.hqx

Speed test. I asked myself whether pointer arithmetics or array indexing was fastest. The result was rather interesting. It showed that Think Pascal is by far faster than CW Pascal (68k) for thse kind of problems, and if you use CW, you should use arrays.

COMPILER: Think and CW.
USEFULNESS: Help you decide which method to use to optimize your time-critical 68k Pascal code.
Novice: *
Experienced: ***

SOURCE: Original code.



BetterShuttle.cpt.hqx

A B/W 3D animation of a shuttle. Not as hot as it sounds.

COMPILER: Think.
USEFULNESS: Well...
Novice: **
Experienced: *

SOURCE: Improved version of old demo.



BillHex.hqx

A BinHexing unit. There was no BinHex code that was easy to plug into other programs, so I took the best code I could find - DropBin - and made a nice stand-alone unit.

COMPILER: Think, but the BinHex unit should be usable from CW.
USEFULNESS: For plugging in BinHexing capability in your program.
Novice: **
Experienced: ***

SOURCE: Modified version of Bill's code.



billiards.hqx

A simple B/W billiards game written in Object Pascal by Tim Budd.

COMPILER: Think.
USEFULNESS: Not much. Perhaps a start when getting into Object Pascal? Simple graphics?
Novice: **
Experienced: *

SOURCE: Found on a web page somewhere.



Bond-FBA.cpt.hqx

A faceless background application that plays a sound asynchronously.

COMPILER: Think.
USEFULNESS: Shows how to write FBA's and how to play asynchronous sound.
Novice: ***
Experienced: **

SOURCE: Original code.



brain-damage.hqx

Who wants Brain Damage? No, this program was made by someone who would rather like to avoid it, by avoiding a certain brand of computers. He also used Pascal, which I see as a second point in his favor. It is useless; I like it! Fun!

COMPILER: Think.
USEFULNESS: None.
Novice: **
Experienced: *

SOURCE: Old code I downloaded long ago.



C-Pong.cpt.hqx

A very simple B/W "Pong" game. The name refers to its C origins.

COMPILER: Think.
USEFULNESS: Simple event and QuickDraw.
Novice: **
Experienced: *

SOURCE: Converted from C.



Caitlin.hqx

Animation demo. It uses off-screen buffers and mark regions to make an object pass behind other objects. Pretty neat, though not quitethe way you make animations in the colorful 90's.

COMPILER: Think.
USEFULNESS: Demonstrates off-screen animation with regions.
Novice: ***
Experienced: ***

SOURCE: Based on a Pascal snipped posted to the net long ago.



campfire-pascal.hqx

This demo makes an animation of a fire, completely artificial, and with an impressing frame-rate. Of course it is just as fast as the C version that it is based on!

COMPILER: Think and CW.
USEFULNESS: Shows how to make fast pixel operations.
Novice: **
Experienced: ****

SOURCE: Converted from a C demo.



carl-o-term.hqx

Terminal emulator. It is primitive, but it works, and is even a bit elegant with those small buttons in the corner. It uses the low-level serial driver, which I wholeheartedly recommend over the buggy and unreliable Communications Toolbox. (You should use the latter only for reaching othr ports than the standard two.)

COMPILER: Think.
USEFULNESS: Serial communications.
Novice: **
Experienced: ***

SOURCE: Refurbished Turbo Pascal code.



Cellusoft-Demo-plus.hqx

My improved version of Tony Small's "Eyeballs" sprite demo. Not exactly an easy start to sprites, but his way may be interesting to see. The big difference to Micro Animation and Offscreen Toys is that it loads its sprite faces from a few PICTs rather than "cicn"s. This speeds up loading a lot (see also FastLoad.p in SAT), but is much harder to handle. This demo uses hardcoded constants for the positions in the PICTs, which I'd say is the worst way to do it. (Sorry, Tony!)

This code is shareware, according to Tony's comments. My minor changes does not change that. However, don't blame Tony for the changes I made!

COMPILER: Think and CW.
USEFULNESS: Offscreen techniques, sprites from multi-face PICTs.
Novice: **
Experienced: **

SOURCE: Somewhat improved demo originally by Tony Small.



CollectPictColors.hqx

Demonstrates two ways to extract the colos from a PICT. This is very useful if you want your program to adapt the 256 color palette to graphics. I used it in my game Christmas'95.

COMPILER: Think and CW.
USEFULNESS: Great for making paletted adapted to your graphics!
Novice: **
Experienced: ****

SOURCE: Converted Apple demo.



ColorIcosahedron.hqx

Animation of a 3D icosahedron. This isn't real-time 3D; the icosahedron is pregenerated in a couple of positions. The most interesting parts are the offscreen drawing and the custom palette. I don't think I'd use the 3D parts for anything else.

COMPILER: Think.
USEFULNESS: Shows how to use your own palette, and how to do offscreen drawing. Some reusable code included in sepaate units.
Novice: *
Experienced: ***

SOURCE: Modernized version of an old Pascal demo.



CopybitsSpeedPalette.cpt.hqx

A demo showing how ctSeed slamming affects CopyBits speed. The ctSeed gives the "identity" of a color lookup table. When CopyBits copies between two PixMaps with the same ctSeed, it can skip all color conversion problems, which makes it a lot faster.

COMPILER: Think.
USEFULNESS: Good for insights in CopyBits and when it is fast.
Novice: *
Experienced: ***

SOURCE: Modernized version of an old Pascal demo.



control-strip-shell-p.hqx

A shell for writing control strips in Pascal, written/converted by Des Courtney. Original C code included. (Note: I can't validate the usefulness and quality of this code, since I don't use control strips myself, mostly for compatibility reasons. The stars I put below are my wild guesses. /Ingemar)

COMPILER: Think
USEFULNESS: For writing control strip tools.
Novice: **
Experienced: ***

SOURCE: Based on a similar shell in C.



depth-lib-11p.hqx

Pascal version of the Depth Lib. There is at least one other Pascal conversion of this lib. I think both are as good, but if you want to use it with Think Pascal, this is the one you want. If you use CW, get either one.

COMPILER: Think and CW.
USEFULNESS: To change depth and color/gray mode.
Novice: **
Experienced: ***

SOURCE: Converted from a PD lib.



DimText.hqx

Shows how to dim dialog items.

COMPILER: Think.
USEFULNESS: Good when making dialogs.
Novice: **
Experienced: ***

SOURCE: Converted Apple demo.



Dungeon.hqx

Two demos from "Tricks Of The Mac Game Programming Gurus" that by mistake was not included in Pascal verisons. This is uploaded as a service to owners of the book.

COMPILER: Think.
USEFULNESS: Beginner-level game programming.
Novice: ****
Experienced: *

SOURCE: Original code.



Event-speed.hqx

A speed test, putting some facts behind my claim that GetOSEvent is a perfectly fine way to do user interaction in many games.

COMPILER: Think and CW.
USEFULNESS: Event processing, especially for games.
Novice: ***
Experienced: ***

SOURCE: Original code.



Floating.p

Routines for making floating windows, by F. Pottier. I have NOT used this myself, but if it does what it claims, it can be very valuable when making palette-using programs.

COMPILER: Think. (No project included.)
USEFULNESS: For making floating palettes.
Novice: *
Experienced: ***

SOURCE: Downloaded from the net somewhere.



FreqForEverChange.hqx

A sound snippet from DTS, converted to Pascal. The original looked pretty buggy. This is better, but I would prefer code that would change the pitch without restarting the sound.

COMPILER: Think.
USEFULNESS: For playing sounds in different pitch.
Novice: *
Experienced: **

SOURCE: Converted DTS demo.



gamma-fade.hqx

Gamma fading in Pascal. I believe I restored Think Pascal compatibility after Bill C had ported it to CW. You will find other versions in other archives.

COMPILER: Think and CW.
USEFULNESS: For making screen fades.
Novice: ***
Experienced: *****

SOURCE: Ported from C by Matt Mora, tampered with by Bill and me.



Graphical-Truffles-temp.hqx

Fast graphics code in Pascal and C. This has been uploaded before, and this upload is not thoroughly checked, so use the old one if you have it.

COMPILER: Think and CW.
USEFULNESS: For learning how to make fast blitters in Pascal ­ and to see that Pascal doesn't have to be slower at that.
Novice: **
Experienced: ****

SOURCE: Converted from C. (C source included.)



Guy-Smiley-Pascal.hqx

A very simple game, written by Reid Priedhorsky, that I converted from C to Pascal. TransSkel Pascal 2.6 required.

COMPILER: Think.
USEFULNESS: Basic Mac Toolbox programming.
Novice: ***
Experienced: *

SOURCE: Converted from C. (C source included.)



HugeInts.hqx

A lib for using VERY large integers - much larger than a Longint can handle. I have so far failed to make it run under CodeWarrior, which reduces my enthusiasm for it a bit.

COMPILER: Think.
USEFULNESS: Useful if you need to work with big numbers in high precision. In other words, you only need it in some very special cases.
Novice: *
Experienced: **

SOURCE: Based on a Turbo Pascal source for PC.



Info.cpt.hqx

A simple "PICT" player for slide shows.

COMPILER: Think.
USEFULNESS: For learning basic QuickDraw, including primitive menu bar hiding. The application itself can be used for building simple presentations.
Novice: ***
Experienced: *

SOURCE: Converted from C.



IngisWDEF-13.hqx

If you asked me to pick the best gem in the collection, this is the one I'd choose. Ingis WDEF is a package for making custom window definitions (WDEFs) with arbitrary shape. I have used it myself for making the hexagonal window in the games Hexmines and HexReversi, for making the circular window in the NewWatch demo, and for making the special "document" and "baloon" windows in my 3D puzzle game. What is so great about it is that it is so easy to make a new one! You can make windows with holes, windows that aren't in one piece, anything!

The ease of use is achieved by isolating "stubs" for just about anything you would like to change in a separate stubs file, and keeping all the reusable code in files that you almost never change. You just duplicate a demo and hack the stubs file.

I don't claim that it is 100% perfect, though! It has the same limitations as all code resources. I don't use any global variables, for example. The coloring rules for other windows are not applied to Ingis WDEF. It doesn't adapt when overlapping several screens.

I believe I used so much sweat in making this work and making it useful, that I deserve credits in case you use it. (That holds for all source demos out there, mine and others, but this was more trouble than most.)

HIGHLY RECOMMENDED!

COMPILER: Think or CW.
USEFULNESS: For making arbitrarily shaped windows.
Novice: **
Experienced: *****

SOURCE: Original code.



InterfacesUI.p

A compatibility file for Think Pascal, to let us TP4 users use the new routine names without using the real UPI. The problem with the "real" UPI is that the interface files have more dependencies, so you tend to include tons of them where you previously just needed a few. For example, try including QDOffscreen.p and see how much you need to add. I prefer just using this file, with the differences. It covers most cases, and what it doesn't cover, I can {$IFC}.

COMPILER: Think.
USEFULNESS: If you use Think Pascal without UPI, but want that same code to run with UPI (for example when building the PPC version in CW).
Novice: *
Experienced: ****

SOURCE: Original code.



KbdLts.hqx

Animates the extended keyboard lights - and does it correctly, so that it works even if you don't have US layout. It isn't extremely useful, but as far as I know, it is the ONLY demo that does it right!

COMPILER: Think.
USEFULNESS: If you really need to mess with those LEDs, you should check this out... but do you?
Novice: *
Experienced: **

SOURCE: Based on code from Inside Mac - but corrected!



LabMouse.hqx

Source code to an unfinished first-person... sorry, first-rodent 3D game I was working on a few years ago. I gave up since the engine got too old-fashioned and I wanted to move on to more modern techniques. I didn't even bother to make any serious graphics for it, as you can tell when playing it.

Pity on a neat idea. It is a lot of source in this archive, and you can find many useful sub-parts. You can use the game engine to make simple 3D mazes. It is possible to make a shooter like Wolf3D with it, but I'm not sure if it is worth doing today.

Note: Not available by ftp, only by http!

COMPILER: Think and CodeWarrior.
USEFULNESS: To make 3D mazes or Wolf3D-style games. Also includes various game-related snippets, like pixel doubling, player score keeping, scalable sprites, etc.
Novice: ***
Experienced: ***

SOURCE: Original code.



LifeEdit.hqx

Snap-shot Life program. You edit one frame and can study its effects a few frames.

COMPILER: Think.
USEFULNESS: Limited, possibly of some interest for novices.
Novice: ***
Experienced: *

SOURCE: Converted from a C demo.



listdemo.hqx

A demo of List Manager.

COMPILER: Think.
USEFULNESS: Learn the List Mgr!
Novice: **
Experienced: ***

SOURCE: Pascal demo downloaded from somewhere.



LoopSndDemo.cpt.hqx

A demo that shows how to do continuous asynchronous sound.

COMPILER: Think and CW.
USEFULNESS: To learn fairly advances Sound Manager usage, starting sounds from callbacks.
Novice: ***
Experienced: ***

SOURCE: Original code, partially based on sndDemo.



madf-lib-35-pascaltp.hqx MADH-Library-42-Pascal.hqx MADH-45-Pascal.hqx

Pascal interface to the MADF/MADH music drivers, version 3.5 to 4.5. I ported 3.0, but consider that obsolete. Matthias ported 3.5, and I added Think Pascal compatibility. Federico Filipponi made the Pascal interfaces for MADH 4.2 and 4.5, but there is no Think Pascal option since there is no Think C version of the libraries. You may also want to consider MIDI, using QuickTime. See Piggy.

COMPILER: Think or CW.
USEFULNESS: Play music.
Novice: ***
Experienced: ****

SOURCE: Coverted from C headers. Some glue for Think Pascal added (3.5).



Map.hqx

A 3D voxel landscape renderer that I wrote long ago and never had time to finish.

COMPILER: Think and CW. (PowerMac recommended.)
USEFULNESS: To learn how a voxel renderer can work.
Novice: *
Experienced: ***

SOURCE: Original code.



Marquee.hqx

Shows how to make a rectangular "lasso" marquee as in the Finder.

COMPILER: Think and CW.
USEFULNESS: May be of some help if you need a marquee like this for some reason.
Novice: ***
Experienced: **

SOURCE: Based on a demo that Bill C posted. Some bugs fixed.



Maze-generation.hqx

There maze generators we have seen lately have had stack problems, due to using recursion. I wrote Maze-Ingis to show that we can handle it by keeping track of the stack usage. But, hey, why were we using recursion at all for such a simple problem?

I stumbled over a post in comp.lang.pascal.misc by Derek T. Asari. The post included a demo maze generator that was marvellously simple. Both the source (disregarding comments) and the compiled application are less than 2 kilobytes each! I Macified it a bit and commented it so that it will make some sense to you.

COMPILER: Think.
USEFULNESS: Probably the simplest maze generator you can find, which makes it ideal for using in a maze-using game - definitely better than Maze-Ingis.
Novice: ****
Experienced: **

SOURCE: Based on a Pascal demo posted to comp.lang.pascal.misc.



Maze-Ingis.hqx

There was a thread in the Mac Pascal mailing list about programs that use lots of stack, due to deep recursions. One of the problems involved was a maze generator by Robert Dell, later released on the net as Maze Maker. Although Maze Maker is fast and works well, I found it unnecessarily demanding for the problem. I wrote Maze-Ingis aiming for simplicity and low demands on memory and stack.

However, there is a much simpler solution. See "Maze generation" above.

COMPILER: Think.
USEFULNESS: Recusive alorithms. How to avoid stack overflow by watching StackSpace.
Novice: ***
Experienced: **

SOURCE: Original code.



memorygame.hqx

Simple "concetration"-type game. It is ment as a first lesson in Mac game programming. It tries to use as little as possible of the Mac Toolbox to achieve its goals. RECOMMENDED FOR BEGINNERS.

COMPILER: Think and CW.
USEFULNESS: To expand to a full game and/or to learn fundamental QuickDraw and event handling.
Novice: ****
Experienced: *

SOURCE: Original code.



MicroAnimationDemo.cpt.hqx

This is a demo I wrote for the "Tricks of the Mac game programming gurus" book, but that was never used since I didn't write that part of the book. It is also an afterthought to Offscreen Toys; Offscreen Toys got so good that the simplicity was lost. MicroAnimationDemo is minimal, just a few lines of code if you disregard the conditional compilation and all the "uses" that CodeWarrior wants. RECOMMENDED FOR BEGINNERS.

COMPILER: Think and CW.
USEFULNESS: For learning basic off-screen animation methods.
Novice: *****
Experienced: **

SOURCE: Original code.



Mikes-Breakout-Improved.hqx

A Breakout game, written by Michael Tindal, that I made some simple improvements on.

COMPILER: Think.
USEFULNESS: Various game-related techniques.
Novice: ***
Experienced: **

SOURCE: Refurbished Pascal code.



missilecmd23plus-p.hqx

Robert Munafo's Missile Command game may not be the hottest one around, but a classic that has survived all system updates! This revision adds sound and black background. Mostly nostalgic value, but the asynch sound code must be one of the shortest in history!

COMPILER: Think and CW.
USEFULNESS: Simple sound playing.
Novice: ***
Experienced: *

SOURCE: Refurbished 1984 Pascal code.



Modal-TextEdit-p.hqx

A modal dialog with a TextEdit field. Note that it needs some major changes to work with styled TextEdit.

COMPILER: Think.
USEFULNESS: For making advanced dialogs.
Novice: **
Experienced: **

SOURCE: Converted Apple demo.



MoreFiles-121TP.hqx

Enough is enough! MoreFiles for Think Pascal seems not to be available in any archives anywhere, and of course TP users often ask for it, since it is so good! If you use Think Pascal, you should have this! If you use CodeWarrior and don't have it, you should download it from Apple.

HIGHLY RECOMMENDED!

COMPILER: Think.
USEFULNESS: Invaluable for many file management tasks.
Novice: ****
Experienced: *****

SOURCE: Apple library, only slightly modified, mostly by removing files that TP users don't need.



MovieScroll.cpt.hqx

A demo that shows how to make a scrolling "about" box. It is improved a bit over the C code Ken Long posted, which it is based on.

COMPILER: Think and CW.
USEFULNESS: For that neat About box you always wanted.
Novice: ***
Experienced: ***

SOURCE: Converted from C.



MSG-wipes-libs.hqx

Mar Pilgrim's MSG Demo included a wide range of wipes, screen transitions. They are quite impressive, and done all with CopyBits. In order to use them from Pascal, I modified the code slightly, made Pascal interface and built libraries.

COMPILER: Think and CW.
USEFULNESS: For making nice transitions.
Novice: ***
Experienced: ***

SOURCE: Pascal interfaces to a library built from C code.



NewWatch22-p.cpt.hqx

A desktop clock.

COMPILER: Think and CW.
USEFULNESS: If you really want to make a desktop clock... but it has some points for the beginner, using regions, events and resources. For the circular window, see IngisWDEF.
Novice: ***
Experienced: *

SOURCE: Converted from C, and improved quite a bit.



OffscreenToys15.hqx

Fairly advanced sprite animation demo. It addresses a lot of frequently asked questions concerning animation, sprites, GWorlds, collision detection, backwards compatibility, basic speed issues etc. Over time, I have found that the reusable code (which is a separate unit) was so good that I keep using it in any program that need offscreens but where SAT would be overkill.

HIGHLY RECOMMENDED!
COMPILER: Think and CW.
USEFULNESS: Learning offscreen techniques, GWorlds, sprites, events...
Novice: ***
Experienced: *****

SOURCE: Original demo.



on-the-edge-301-p.hqx

This is the game King's Corner. One of the smallest new Mac games I've seen!

COMPILER: Think.
USEFULNESS: Basic game making. Events, "sicn" drawing etc.
Novice: ***
Experienced: **

SOURCE: Converted from C.



OneTest.hqx

If you find Skel too tedious to extend, and TransSkel too big, then OneEvents is for you! OneEvents is a minimal program skeleton, which (unlike Skel) isolates a reusable event loop in the OneEvents unit, and you can then build your application by filling in stubs in a stubs file. I find this quite nice for quick hacks.

COMPILER: Think and CW.
USEFULNESS: Skeleton program.
Novice: ***
Experienced: **

SOURCE: Original code.



OpenGL-Pascal-01.hqx

Interfaces and the very simplest demos for OpenGL, converted from Conix/Apples headers and C source. Now you can use Metrowerks Pascal for making OpenGL programs!

This is a very first, preliminary release. I ported this back in the summer, but never got time to finish more demos and fiddling with getting all the comments right. It is bound to be "dirty", and even incorrect in some points, but it seems to work pretty well.

HOT STUFF!

COMPILER: CW.
USEFULNESS: 3D graphics!
Novice: **
Experienced: *****

SOURCE: Converted Conix/Apple code.



otellop.zip

This is a demo made by Microsoft, modified by Metrowerks as a demo for the x86 Pascal compiler. Alas, the so-called Pascal demo Otello has only two small routines ported, and the rest remained in C! This is now 100% Pascal. CW Pro 3 or better needed.

COMPILER: CW for x86.
USEFULNESS: The only decent Pascal demo for x86 that I know of!.
Novice: ****
Experienced: **

SOURCE: Converted from C.



P4Mac-20d.cpt.hqx

A very simple Pascal compiler/interpreter. It is the basic 70's Pascal, but hey, it's a free Pascal! With full source-code!

COMPILER: Think. (CW project included, but it doesn't work properly. Sorry.)
USEFULNESS: For making an even better free Pascal! The console parts are otherwise the most useful parts.
Novice: *
Experienced: ***

SOURCE: Based on the P4 compiler which I downloaded from the net. Includes the essentials of TransSkel (see below).



Painted_Black.hqx

This is a simple screen saver of the best kind. It is an application that runs in the background, and brings itself to front after a certain idle time or when the mouse is i the sleep corner. Pretty useful source, IMHO.

COMPILER: Think and CodeWarrior.
USEFULNESS: Making your own screen saver, or any other application running in the background that can pop to front on its own initiative.
Novice: ***
Experienced: ***

SOURCE: Converted C code.



pastraeck201.hqx

Pascal interfaces to the SoundTrecker music driver. This was my old favourite, but since it isn't PowerMac native and isn't free for other than freeware, I have abandoned it for MADF.

COMPILER: Think.
USEFULNESS: Playing .mod music.
Novice: **
Experienced: ***

SOURCE: Converted C interfaces.



Pict2Cicn.hqx

Converts a PICT resource to a cicn resource.

COMPILER: Think.
USEFULNESS: Mainly to create "cicn" resources larger than the usual maximum.
Novice: **
Experienced: ***

SOURCE: Converted C snippet.



PCalendar.hqx

Draws a calendar for a year of your choice.

COMPILER: Think.
USEFULNESS: Limited.
Novice: **
Experienced: *

SOURCE: Converted and much revised C demo.



Piggy.hqx

QuickTime MIDI player. Playing MIDI music is fairly easy, as this demo shows.

COMPILER: Think and CW.
USEFULNESS: Playing MIDI music files.
Novice: **
Experienced: ****

SOURCE: Converted from a C demo.



ProcPuppy.hqx

Inspects and terminates processes (running programs). This is like ProcDoggie, but much smaller. I wrote it since I found ProcDoggie too big and complex for demonstrating a fairly easy problem.

COMPILER: Think.
USEFULNESS: Shows how to use the Process Manager.
Novice: **
Experienced: ***

SOURCE: Original code.



PWarp.cpt.hqx

A simple starfield animation. It is in color, but works in B/W too. Good beginner demo, I believe.

COMPILER: Think and CW.
USEFULNESS: QuickDraw demo.
Novice: ***
Experienced: *

SOURCE: Converted from C, and heavily revised.



RAVE-for-Pascal-11.hqx

Pascal interfaces and the very simplest demos for Apple's low-level 3D interface RAVE. This is a new, corrected version.

I don't want to recommend this for beginners at this time, but experienced Pascal programmers who are capable of making a 3D engine may find this useful. A complete 3D engine, well, I've been working on that like everybody else, but I don't have a RAVE-based engine in sight soon.

COMPILER: CW.
USEFULNESS: For making a 3D engine, e.g. 3D games, mainly to use on Macs with hardware accelerated 3D.
Novice: *
Experienced: ****

SOURCE: Converted from C.



ReqVidPas-11.hqx

New version of my Pascal conversion of the Apple demo "Request Video" for Display Manager. This has been requested more than once in the Mac Pascal fora. This new version supports PPC and fixes some rather important bugs affecting older systems.

This code will let you change the resolution of your screen. Please do not confuse this with the much simpler screen depth calls (SetDepth). Also, don't expect it to give you exactly what you ask for ­ always check if you can use what it gives you.

COMPILER: Think and CodeWarrior.
USEFULNESS: To change the resolution of the screen.
Novice: **
Experienced: ****

SOURCE: Converted Apple demo.



Rotate-Bitmap.hqx

Rotates a bitmap 90 degrees.

COMPILER: Think.
USEFULNESS: If you need to rotate bitmaps, I guess...
Novice: *
Experienced: **

SOURCE: Converted Apple demo.



rwBinhex.hqx

I wasn't satisfied with BillHex. BillHex was a nice decoding unit, but couldn't encode. OK, perhaps I could just have figured out encoding myself, but why do that when there are many people who did that before? So I found Roy Wood's source and rewrote it quite a bit. The source is still C, but it is useable from Pascal as well. It doesn't depend on any other libraries, and has a very tight interface. Probably your best pick for adding Binhex capability to your application!

COMPILER: Think or CW, Pascal or C.
USEFULNESS: Binhex enconding and decoding.
Novice: ***
Experienced: ***

SOURCE: Highly revamped old demo.



QD3D-PInterfaces-10d2.hqx

Preliminary Pascal interfaces to QuickDraw 3D - at last! Note that it is preliminary, probably buggy and somewhat incomplete. Three demos included. You need the QD3D development kit to use it.

Note: Apple has released their own QD3D interfaces after I released this, so I guess this is obsolete now.

COMPILER: CW (PPC required).
USEFULNESS: If you want to use QD3D from Pascal, this is what you need!(But I'd use Apple's version if I could find it.)
Novice: **
Experienced: ****

SOURCE: Converted from C code in Apple's QD3D SDK.



SavePICT-FKEY.hqx

FKEYs are small programs attached to command-shift-number keyboard combinations. If you havn't been into Mac hacking as long as I have, the concept of FKEYs may be unknown to you. Very few, if any, FKEY source-code examples are available, so I decided to do something about it.

COMPILER: Think and CW.
USEFULNESS: For learning how to make FKEYs.
Novice: ***
Experienced: ***

SOURCE: Original code.



ScreenDump.hqx

Screen Dump is a DTS snippet converted to Pascal.

COMPILER: Think.
USEFULNESS: Using GetPICTInfo and grabbing screen dumps.
Novice: **
Experienced: ***

SOURCE: Converted DTS demo.



SegLoadPPC.hqx

Implements the Segment Loader calls for native PowerMac code. Pointless? No, it is not. Making simple on-shot drag-and-drop applications is very easy with Segment Loader calls, and much more complicated with the modern way, Apple Events. By hiding the Apple Event code in a reusable unit, the PPC native drag-and-drop programs can now be as simple.

COMPILER: Think or CW. (Hardly meaningful for TP.)
USEFULNESS: For making simple drag-and-drop applications.
Novice: ***
Experienced: ***

SOURCE: Original code.



SetMouse.p

Sets the mouse position by drawing into low-mem globals.

COMPILER: Think. (No project included.)
USEFULNESS: Good for certain games. Might break under future systems.
Novice: **
Experienced: ****

SOURCE: I think I got it from Jonas Wallgren, who didn't like an older SetMouse I found on the net and posted...



SlotVBLTest.hqx

Runs a SlotVBL task. I made it for use with SAT, but it is generic enough for any VBL-synching problem. It is compatible with old non-color Macs as well as PowerMacs. This is a must-have for anyone interested in how to do VBL.

HIGHLY RECOMMENDED!

COMPILER: Think and CW - including PPC!
USEFULNESS: For synching graphics to the CTR beam.
Novice: *
Experienced: *****

SOURCE: Based on two VBL snippets, one in Pascal and one in C, but I guess we could consider it original.



skel-30i.hqx

One of the oldest program skeletons around, slightly modernized. It "does nothing, but does it well"! I prefer TransSkel though.

COMPILER: Think
USEFULNESS: For learning the basics, and for using as a base for building applications on.
Novice: ****
Experienced: *

SOURCE: Converted from C, which was once converted from Pascal. :-) :-(



Skel30x.hqx

Same as above, but now Carbonized. It "does nothing, but does it well"! I prefer TransSkel though. A unique feature with this demo is that it also works under Think Pascal.

COMPILER: CodeWarrior (required for native OSX) or Think
USEFULNESS: For getting started with Carbon, especially if you want to keep using Think Pascal as prototyping/debugging tool.
Novice: *****
Experienced: ***

SOURCE: Converted from C, which was once converted from Pascal. :-) :-(



sndDemo.cpt.hqx

This is a sound demo that was posted to the net long ago. I polished it a bit and compressed the sound, in order to make it less tedious to download. I find it unnecessarily complex. See Three-D Bouncer for a more interesting sound demo.

COMPILER: Think and CW
USEFULNESS: Asynch sound playing.
Novice: **
Experienced: *

SOURCE: Somewhat improved demo by another author.



SpanBuffer-Mac.hqx

This is a demo written by mr Abrash for Dr Dobb's Journal, that demonstrates the span-buffer technique for 3D rendering. I'm not sure if this is really interesting any more, in the days of 3D accelerators, but it performs pretty well on an old 6100. The code is mostly C.

COMPILER: CW.
USEFULNESS: For 3D engine makers.
Novice: *
Experienced: ***

SOURCE: DJGPP code converted to the Mac.



SWar-p.cpt.hqx

The original author wanted to write a SpaceWar, but never completed it. It is pretty neat, but a bit primitive with only eight directions.

COMPILER: Think and CW.
USEFULNESS: It is a good start for a not too hot game. I'm sure there are a few things in it you may like.
Novice: **
Experienced: **

SOURCE: Converted from C.



Text-to-STR-list.hqx

This is a programmer's utility, a drag-and-drop application that converts a text file to a STR# resource, making each line a separate string.

COMPILER: Think.
USEFULNESS: As it is. Useable as shell for very simple drag-and-drop applications.
Novice: ***
Experienced: ***

SOURCE: Original code.



three-d-bouncer.hqx

A demo with a simple (flickering) 3D animation, with stereo panning sounds. The graphics are pretty awful, but the sound parts may interest you.

COMPILER: Think and CW.
USEFULNESS: Mostly as sound demo, but also a little graphics and animation.
Novice: ***
Experienced: ***

SOURCE: Converted from a screen saver module.



TransSkel-Pascal-26.hqx

This is an improved version of TransSkel Pascal, a good library for simplifying the event processing parts of Mac applications. This version has MultiFinder event and Apple Event support. Version 2.6 adds full PPC support with Universal Interfaces rather than MPW interfaces.

If you find Mac applications complex, with all details in handling menus, windows, events etc, try TransSkel!

RECOMMENDED!

COMPILER: Think and CW.
USEFULNESS: Event loop and lots more for any GUI application.
Novice: *****
Experienced: ****

SOURCE: Refurbished Pascal code.



TransSkel-Pascal-27a.hqx

Preliminary version of the next TransSkel Pascal, now Carbonized, that is OSX native! Apple Event support is finally complete.

COMPILER: CW Pro 5 to 7. CW Pro 6 was used for making it.
USEFULNESS: Event loop and lots more for any GUI application.
Novice: ***
Experienced: ****

SOURCE: Refurbished Pascal code.



Turbo3d.hqx

This is old demo code that I seem to have forgotten to put here. It is two old demos from Turbo Pascal for the Mac, demonstrating how to use Graf3D, Apple's old 3D library. No texture mapping here, just line art. Hey, Graf3D was hot in 1984! I've also made a variation of each, one with color and one with off-screen buffering to eliminate flicker.

COMPILER: Think.
USEFULNESS: Fundamental graphics. Simple 3D. Off-screen buffers.
Novice: ***
Experienced: *

SOURCE: Refurbished Pascal code from Turbo Pascal for the Mac.



Ultimate_Button.hqx

Source to a very flexible CDEF (control definition). It can be very useful when putting the final touches to an application, where you aren't satisfied with the controls you use.

COMPILER: Think and CW.
USEFULNESS: To use for special controls in your own applications, or for making your own CDEFs.
Novice: *
Experienced: ****

SOURCE: Converted C code.



zlib-104-for-MacPascal.hqx

"zlib" is a free compression library written by Jean-loup Gailly and Mark Adler. I have adapted it in order to make it usable from both Think and CW. Perhaps even more importantly, I have made two new demos, Dropgz and zResource. Dropgz is a drag-and-drop gz compressor/decompressor. zResource is perhaps the most interesting one, a very slim API (only three calls!) for resource compression/decompression that you can easily plug into your application in order to ship it with large resources compressed.

COMPILER: Think or CW.
USEFULNESS: To incorporate decent compression into your programs, either for files or for resources.
Novice: ***
Experienced: ****

SOURCE: Public library with some adaptions and new demos.



ZoomFKEY.hqx

Source to an FKEY that makes a "zoom" effect towards the current cursor position. This was posted by Matt Mora. I made some quick fixes and added a Think Pascal project.

COMPILER: Think.
USEFULNESS: Learn zoom effects and FKEY programming.
Novice: ***
Experienced: ***

SOURCE: Apple demo converted by Matt Mora.



ZoomRecter.hqx

Draw two rectangles, and the program makes a Finder-style "zoom" effect between them.

COMPILER: Think.
USEFULNESS: To zoom when opening/closing windows etc.
Novice: **
Experienced: **

SOURCE: Converted Apple demo.


Copyright ©1997-2003 Ingemar Ragnemalm.
Webmaster: Bill Catambay