Programming
After Dark modules

Getting Started

To program a graphics module one need not be ADgmacintosh Guru." In fact, the simplest module (one that just blanks the screen) is less than 20 lines of code. Some familiarity with Macintosh programming is expected but simple modules can be created fairly quickly by novice programmers.

In addition to letting you create your own screen saver graphics, After Dark allows you to implement sliders, menus, check boxes, text strings, and buttons in the Control Panel to change the behavior of your screen saver. Sound can also be added to enhance the effect of your screen saver. After Dark also provides graphics modules with information about the number, size and pixel depth of the monitors in use, the availability of Color QuickDraw, and a copy of the QuickDraw global variables. A description of these are found in the "Advanced Features" section of this manual.

Graphics Module Code Resource

A graphics module is a code resource of type 'ADgm'. When After Dark calls a graphics module, it calls the function main() in the 'ADgm' code resource. We have written a generic function main() in each of the example projects. It can be used as a basis to create a new graphics module.

When activated, After Dark calls a graphics module and passes it a message. The message asks the module to perform a certain task. Basic messages are:

  1. Ask the module to initialize itself.
  2. Ask the module to blank the screen.
  3. Ask the module to draw a frame of animation.
  4. Ask the module to finish and clean up.
If the user is in the Control Panel, three other messages can be passed:
  1. Tell the module a button has been pressed.
  2. Tell the module it has been selected.
These last messages are optional and are described further in the advanced section.

For further information about code resources, consult your development system's documentation.

Next


Begin | Introduction | Getting Started | main() | Advanced | Parameters | Sound | Resources | Hints & Tips | Further Info