ADgm'. The rest of the resources described are optional.
After Dark makes use of several different resource types to implement its features. A few are common but the majority are new. Most of these resources are used to construct sliders, buttons, check boxes, and menus in the Control Panel. Below is a description of all the resource types used by After Dark.
STR "Credit Line" ID = 128 String Value
TEXT' with ID = 1000. Enter the text you wish displayed into this resource. To display a picture, create a resource of type '
PICT' with ID = 1000. Here are the formats:
TEXT "Help Text" ID = 1000 String Value PICT "Help Picture" ID = 1000 Picture
Closemessages, it may or may not want the
DoHelpmessages (described in the "More About Messages" section). The resource is a byte value and each bit is a flag for a message. Bit 0 is a flag for the
Initializemessage. If it is 1, After Dark will send your module the message. Bit 1 is a flag for the
Blankmessage, Bit 2 =
DrawFrame, Bit 3 =
Close, Bit 4 =
ModuleSelected, and Bit 5 =
DoHelp. Here is its format:
Cals "Messages Supported" ID = 1 Byte Value
sysz' resource tells After Dark, Randomizer, and MultiModule the number of bytes of memory a graphics module needs. To determine the amount of memory needed, add the amount of memory allocated for your structure/record, the size of your code resource (the '
ADgm' resource in your module), and any additional memory your module allocates. On startup, After Dark allocates 30K of memory for graphics modules unless a module has a '
sysz' resource requesting more. Randomizer and MultiModule use a graphics module's '
sysz' resource to determine how much memory they should allocate for it. Here is its format:
sysz "Memory required" ID = 0 Long word value
sVal'. Its resource ID determines where it appears in the Control Panel. The resources name ("Slider 1" in this case) is displayed next to the slider in the Control Panel. Slider values range from 0 to 100. The integer value of the 'sVal' resource is the slider's current value. Here is its format:
sVal "Slider 1" ID = 1000 Integer valueIf only an '
sVal' resource is created, the numbers 0 to 100 are displayed as the slider is used. If your module needs a different number range or a label ("seconds", "pixels") for its slider, an '
sUnt' resource can be created to do this. The '
sUnt' resource has the same ID number as its associated 'sVal' resource. An 'sUnt' resource consists of pairs of integers and strings, and it is prefaced by an integer which is a count of the number of pairs. Each pair of integers and strings specifies a string that is to be displayed when the value of the slider is greater than or equal to the integer in the pair and less than the integer in the next pair. Here is its format:
sUnt "Slider 1" ID = 1000 Integer (count) and pairs of strings and integers.Let's say you wanted a slider that would display "0 sec.", "1 sec.", and "2 sec." as the slider is moved. Create an '
sVal' resource and an '
sVal "Seconds" ID = 1000 Value = 0 sUnt "Seconds" ID = 1000 Count = 3 Lower Limit = 0, String = "0 sec." Lower Limit = 33, String = "1 sec." Lower Limit = 66, String = "2 sec."The '
sVal' resource sets the slider to 0. When the slider value is between 0 and 33, the string "0 sec." is displayed under the slider. When the slider value is between 33 and 66, the string "1 sec." is displayed and when the slider value is greater than or equal to 66, the string "2 sec." is displayed. Remember, an integer from 0 to 100 is passed to your module in the "controlValues" field as the slider's current value, not the string value being displayed or which range of the '
sUnt' resource you are in. Your module is responsible for interpreting this number in a way that is consistent with what the user sees. If your understanding of this resource is unclear, examine an '
sUnt' resource in an After Dark module with ResEdit. ResEdit templates for the After Dark resource types are provided. See the section "Resource Templates" at the end of this section for more information about them.
mVal' resource. The name of the resource ("Menu 1" in this case) is displayed next to the popup menu. Its resource ID determines where it appears in the Control Panel. The integer value of the resource is the item number of the currently selected item in the popup menu. This value ranges from 1 to the number of items in the menu. The number passed to the graphics module in the "controlValues" field is the current menu item selected. Here is its format:
mVal "Menu 1" ID = 1000 IntegerA standard '
MENU' resource must also be created. It must have the same resource ID number as its associated 'mVal' resource. This manual does not describe how to build a '
MENU' resource. If you are unfamiliar with this process, refer to Inside Macintosh Volume 1 for more information. Here is its format:
MENU "Menu 1 ID = 1000 Standard menu resource
xVal'. The name of the resource is the string displayed next to the check box. Its resource ID determines where it appears in the Control Panel. The value of the resource determines if the box is checked or not. If the value is 0 it is not checked. If the value is 1 it is checked. This value is passed to your module in the "controlValues" field. Here is its format:
xVal "Check Box 1" ID = 1000 Integer value
STR#' resource. It is simply a list of strings. The second is a resource of type 'tVal'. The value of this resource determines which, if any, of the strings in the '
STR#' resource appear in the Control Panel. The value ranges from 0 to the number of strings in the '
STR#' resource. A value of 0 means no string is displayed in the Control Panel. A value of 1 or greater displays the corresponding numbered string in the '
STR#' resource. This value is passed to your module in the "controlValues" field. Both resources must have the same ID and the resource ID determines where the string appears in the Control Panel. Here are their formats:
STR# "String List 1" ID = 1000 List of Strings tVal "String List 1" ID = 1000 Integer Value
bVal' resource. The resource name ("Button 1" in this case) appears in the button. Its resource ID determines where it appears in the Control Panel. The message value passed to
main()identifies which button was clicked. This value must be 8 or greater and unique for each button defined. Here is its format:
bVal "Button 1" ID = 1000 Integer value
ÁVal "Control 1" ID = 1000 Integer valueTo display a control conditionally, create a '
ÁVal' resource ('Á' is option - m) with the same ID number as the control it is associated with. This resource consists of boolean flags that correspond to the bits in "systemConfig" field of the GMParamBlock structure/record (see "Graphics Module Parameters"). The "systemConfig" field contains information about the configuration of the Macintosh. If you want a control to be displayed only under a certain configuration, set the appropriate flags in the '
ÁVal' resource for that configuration. After Dark compares the '
ÁVal' resource to the "systemConfig" field. If all the bits set in the '
ÁVal' resource are set in the "systemConfig" field, After Dark displays the control. For example, if you want a control to be displayed only if Color QuickDraw is present, set the value of the 'uVal' resource to 1. The "cqdAvail" flag is the first (lowest order) bit in "systemConfig" field. After Dark checks the first bit in the "systemConfig" field. If it is set, the control is displayed.
If you want a different control to appear depending on the
configuration, construct the controls (you can have as many controls as
there are configurations) and their associated '
ÁVal' resources. The
resource ID for each control differs by 1000. One control is "ID =
1000", the next control is "ID = 2000", etc. For example if you want a
"Choose Color" button to appear if all the monitors are in color mode
and a "Choose Pattern" if they are not, define the following resources:
bVal "Choose Color" ID = 1000 Value = 8 uVal "Choose Color" ID = 1000 Value = 16 bVal "Choose Pattern" ID = 2000 Value = 9The "Choose Color" button passes an 8 and the "Choose Pattern" button passes a 9 to your main() function in your graphics module if they are clicked. The '
ÁVal' resource for the "Choose Color" button is set to 16. This sets the flag that "all monitors must be in color mode." After Dark checks the "systemConfig" field to see if "all the monitors are in color mode" flag is set. If it is, the "Choose Color" button is displayed. If it is not, the "Choose Pattern" is displayed as the default since it does not have a 'uVal' resource.
If you are unclear about this use ResEdit on a copy of the "FadeAway"
graphics module to see an example of a '
Chnl' resource with ID = 0. This resource consists of two integer values, "Channel Kind" and "Volume". The "Channel Kind" value tells After Dark what type of sound channel your module wants. This value can be noteSynth = 1, waveTable = 3, or sampledSynth = 5. As described in the section "Using Sound", After Dark currently only supports the sampledSynth type sound channel. The "Volume" value is current volume setting of your module. This value can be an integer from 0 to 7. Here is its format:
Chnl "Sound Channel" ID = 0 Two integer values
clut' (For more information about '
clut' resources, see the Color QuickDraw chapter in Inside Macintosh Volume 5.) After Dark sets this resource as the current color lookup table when your module is activated. Since different 'clut' resources are needed for different monitor pixel depths, a specific '
clut' resource can be used according to the pixel depth. The resource ID determines which '
clut' resource is used. If the monitor is set to 1 bit depth, the '
clut' resource with ID = 1001 is used. If the the monitor is set to 2 bit depth, the 'clut' resource with ID = 1002 is used. For a bit depth of 4, the resource ID = 1004 and for a bit depth of 8, the resource ID = 1008. Here is its format:
clut "1 Bit clut" ID = 1001 Standard 'clut' resourceThere are two guidelines when using this resource. A '
clut' resource should begin with the color white and end with the color black. If this is not done, the Control Panel is displayed with random colors when the module is used in "Demo Mode". Modules should also black the screen in
DoClose(). This prevents the screen from displaying a "color flash" when the color lookup table is set back the original one.
TMPL'. Open this file and paste these resources into your copy of ResEdit. You are now able to create and edit the resources used by After Dark more easily.
| Advanced | Parameters | Sound | Resources | Hints & Tips | Further Info