Guide to programming modules for BlitzBlank 2.50 ================================================ 0. Preface 1. Requirements for modules 2. Introduction 3. Construction of the GUI 4. Description of the GUI objects 5. Communication with BlitzBlank/BlitzBlankPrefs 6. Description of the flags 7. Description of the BlitzBlank structures and flags 8. Description of the global definitions of a module (example) 9. Exact description of the main program (example) 10. Exact description of blank() 11. Advice to support the locale.library 12. AmigaGuide documentation for the modules 13. Tips and tricks 0. Preface ---------- Because I can't program everything alone I have tried to make the programming of modules as easy as possible. But I have to ask the potential programmers to tell me if they start to work on a module. So I can make sure that not two people work on a similar module at the same time. On the other hand they also get the number of the locale strings from me. I also don't want anybody to publish a module on their own but to send me the module. I will then implement the necessary text in the BlitzBlank.catalog and the documentation in the BlitzBlank.guide and release it with the next BlitzBlank version or as an update. Due to BlitzBlank being no shareware the modules can't be shareware also. They can only be card- or giftware. What a module author writes in his info requester (eg. address, etc.) is up to him/her but should be similar to my own modules. I'd really like to have the following modules (at least ;-) ): - Flying something (Toaster etc.) - Something with 3D graphic - Maze - Starfield - ASwarm - Fractals - Anything else that's funny Have fun, Thomas Börkel 1. Requirements for the modules ------------------------------- - OS 2.x/3.x compatible - Minimum OS: V2.04 - Don't turn off the multitasking - AGA compatible - Compatible with graphic cards (if possible) - Should not rely on a special screen mode and depth (if possible) - Comply with the described guidelines - If you use double buffering do it on ONE screen but with several BitMaps - Don't try to open your own screen but get one from BB (if possible) - Use the blitzblank.library - if the module uses graphic or similar data it should read it from the harddisk (using Read() or the iff.library), so that the module itself will be as small as possible (e.g. during configuration this data isn't needed) 2. Introduction --------------- It's quite easy to write modules for BlitzBlank because BlitzBlank offers very much for the modules. Because of this the programmer can concentrate on the module itself. BlitzBlank/BlitzBlankPrefs administers the GUI, the configuration and the screen for the module. Module names have to start with "BB." and mustn't have another "." in its name. Datafiles for the modules (if they require any) have to follow the format "BB.Modulename.*". BlitzBlank modules are essentially ordinary CLI programs which get started from BlitzBlank or BlitzBlankPrefs. If they are running they will be stopped with a CTRL-C. A module has to have at least 2 functions: - main program (determines the programs behaviour with the 1. argument) - blank() routine (the essential blank routine) The modules are communicating with BlitzBlank and BlitzBlankPrefs through the blitzblank.library. The instructions in the library all start with "BBL_". The modules get up to 3 command line parameters at start: - Action key word (BLANK|CONFIG|INFO) - Name of the module's communication port - Address of BlitzBlank's screen info structure The key word determines what the module has to do. Example of such a routine in C: if (strcmp (argv[1],"BLANK")==0) { StrToLong (argv[3],(long *) &screeninfo); BBL_SendMessage (&message,argv[2]); if (screeninfo->bbscreen) blank (); BBL_ModuleDone (); } else if (strcmp (argv[1],"CONFIG")==0) { BBL_SendMessage (&message,argv[2]); } else { message.first=NULL; BBL_SendMessage (&message,argv[2]); } The first argument is checked for BLANK|CONFIG|INFO and proceeds as follows: BLANK: Argument 3 will be changed to a numeral with the OS routine StrToLong() and is assigned to a pointer to a BB_Screeninfo structure. Then BBL_SendMessage (&message,argv[2]) is called. Afterwards the blank() function is called which contains the essentail module routines. If a screen was requested prior to the call it has to be checked if screeninfo->bbscreen isn't zero (could happen if low on memory). Just before the main routine in the blank() function CTRL-C has to be checked and then BBL_ModuleRunning() is started. After blanking BBL_ModuleDone() must be called in ANY case. CONFIG: Argument 3 can be changed to a numeral with the OS routine StrToLong() and is assigned to a pointer to a BB_Screeninfo structure. BBL_SendMessage (&message,argv[2]) is called. If a module sets BBF_Screenmode, doesn't set BBF_Colors and sets depth in Screeninfo then only those modes will be displayed in the screenmode requester of BBPrefs which have at least the requested depth. INFO: The pointer to the first GUI object is set to NULL. Then BBL_SendMessage (&message,argv[2]) is called. 3. Construction of the GUI -------------------------- The graphic user interface a a BB module is described with GUI objects. The administration af the GUI and the saving and loading of the configuration is done by BlitzBlank and BlitzBlankPrefs. The module doesn't have to think about this. GUI objects do describe the structure of the GUI and also represent the memory for the parameters (configuration of the module). Available GUI objects are checkmark, stringgadget, filegadget, slider, cycle gadget, VGroup and PGroup. The GUI objects are compiled in VGroups and maybe in PGroups. A VGroup is started via a GUI object of the BB_VGroup type and ends via a BB_VGroup_End. VGroups can be compiled in PGroups. A module GUI must have at least one VGroup. VGroups and PGroups may NOT(!) be placed in groups of the same type. The GUI objects (BB_Object) are a single-chained list and are terminated with a NULL. Because right now all GUI objects are of the same size, one can simply create an array of the type BB_Object and chain the array elements appropriately (field points to the next object or to NULL if it is the last). The individual fields of the objects (eg. , ...) have to be reset by the module with default values prior to sending the message. If the message is sent back (BLANK) the module can read the really selected parameters from the GUI objects. A VGroup is a vertical group of Gadgets. The Gadgets are displayed below each other in the GUI. If a module GUI has several VGroups then the vertical Groups will be displayed beside one another. A PGroup contains several VGroups. They can be switched with a cycle or register gadget (depends on how MUI is configured). A GUI could have this structure: BB_VGroup->BB_Slider->BB_Slider->BB_VGroup_End->BB_VGroup->BB_Check-> BB_Check->BB_VGroup_End This GUI would have 2 columns. There would be 2 sliders In the left column and 2 checkmarks in the right. You can find more examples in the supplied module sourcecodes. 4. Description of the GUI objects --------------------------------- You can attach or insert an underscore "_" to the lables of the GUI-objects. The following letter will then be the one to be used for the selection via keyboard. The letters A, C, I, P, S, T can not be used since they are needed for the lower row of buttons. What follows is the description of the possible GUI objects. Names in <> are constants or fields within BB_Object. Pagegroup: Started via and ends via . The default page number is in ,