home *** CD-ROM | disk | FTP | other *** search
- Programming modules for BlitzBlank
- ==================================
-
- General rules:
- --------------
-
- - modules can be written in any language (examples are in BlitzBasic 2).
- - don`t turn the multitasking off!!
- - don`t use too much CPU-time, if possible.
- - you must be AGA/OS 3.0 compatible, test it on AGA-machines.
- - if you want to be compatible to graphic-cards, then use OS-graphic-
- routines (in BlitzBasic also: WLine etc...).
- - use the given task-priority (set with SetTaskPriority()).
- - be screenmode- and depth-flexible.
- - use the screenmode/depth provided from BlitzBlank if possible.
- - assume that you are running under OS 2.04 or higher.
- - take advantage of AGA or OS 3.0 if present (AGA-colors,
- InterLeaved-BitMaps for faster blitting, etc.).
- - save your modules` prefs in BlitzBlank`s general configfile.
- - if you`ve written a module, please don`t release it on your own.
- Send it to me. I will then bundle it with the next BlitzBlank
- release.
- - please allow me to make minimal changes in your code if this would
- be necessary.
-
-
- The name of your module:
- ------------------------
-
- The name MUST begin with "BB.", so that BlitzBlank can find it.
-
-
- How your module is called from BlitzBlank:
- ------------------------------------------
-
- Your module must incorporate these three functions:
-
- - Blank
- - Config
- - Info
-
- Your module is called from the CLI with the following parameters:
-
- Command Width Height Mode Monitor Depth Reserved Pri Path [Path Path Path...]
-
-
- Command: The actual function your module has to execute.
- Three commands are used right now:
-
- - BLANK : Do your action (blanktime has come)
- - CONFIG: Display your config-window (user clicked on Config)
- - INFO : Display a window with your name, copyright and
- miscellaneous information (user clicked on Info)
-
- Check this argument first to see what your module has to do.
-
- Width: The user-choosen width of the display
-
- Height: The user-choosen height of the display
-
- Mode: The user-choosen lower 16 bits of the screenmodeID.
-
- Monitor: The user-choosen higher 16 bits of the screenmodeID.
-
- Note 1: You get the modeID by calculating: mode+$10000*monitor
- Note 2: Mode and monitor are NOT the correct values of the screenmode and
- monitor, they just represent the modeID! Always use the
- complete modeID to open a screen.
-
- Depth: The user-choosen depth of the screen.
-
- Note: Width, height, mode, monitor and depth are only interesting for
- you, if you don`t clone the actual frontscreen.
- Tiles is an example for the case of cloning, Lines for the case
- of opening a desired screen.
-
- Reserved: This is reserved for future use and contains "x" right now.
-
- Pri: The task-priority for your module.
-
- Path: This is the path where the BlitzBlank-config-file can be found.
- Be careful: The path can have spaces so get all following arguments
- to get the full path
-
-
- Example 1:
- ~~~~~~~~~~
- BlitzBlank starts your module with the following parameters:
-
- Modulename BLANK 676 476 36868 9 4 x -2 sys:wbstartup/
-
- That means:
- You should do your blankaction on a screen with a resolution of 676x476
- and 16 colors on a screen with the modeID $99004 (36868=$9004).
- Your task-priority must be set to -2.
- The configfile can be found in "sys:wbstartup/"
-
- Example 2:
- ~~~~~~~~~~
- BlitzBlank starts your module with the following parameters:
-
- Modulename CONFIG 676 476 36868 9 4 x -2 sys:wbstartup/
-
- That means:
- You should open your config-window and get/save your config-data
- from the config-file in "sys:wbstartup/".
-
- Example 3:
- ~~~~~~~~~~
- BlitzBlank starts your module with the following parameters:
-
- Modulename INFO
-
- That means:
- You should display a window with your name and copyright.
- (This can be easily done with EasyRequestArgs())
-
-
- Blanking:
- ---------
-
- If BlitzBlank starts your module asking it to blank, you should do the
- following:
-
- - Create a messageport with CreateMsgPort() by the name of
- "BB.BlankModule".
- - Add this port to the public list with AddPort().
- - Set your taskpriority with SetTaskPri(FindTask(0),Pri) to `Pri`.
- - Evaluate the other arguments.
- - Read your config-data (if you have some).
- See the section Configuring.
- - Open your screen using OpenScreenTagList().
- - Blank the mouse if you wish.
- See the section Methods of mouseblanking.
- - Do your screen-action.
- - While doing your blanking, check your port frequently if there
- is a message with GetMsg(Port).
- - If there was a message, stop all action and close your screen.
- - Free spritedata, if you have blanked the mouse.
- - Remove port from the public list with RemPort().
- - Delete your messageport with DeleteMsgPort().
-
-
- Configuring:
- ------------
-
- If you have config-data (like the number of objects etc), you must save
- this data in BlitzBlank`s configfile "BB.Modules.config".
- It can be found in the path that BlitzBlank tells you as last parameter.
- This configfile is shared by BlitzBlank and all modules.
- In the examples above the configfile would have been
- "sys:wbstartup/BB.Modules.config".
-
- Example how the configfile could look:
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- *** Fade ***
- 10
- *** Tiles ***
- 2
- 3
- *** Spot ***
- 3
- *** Lines ***
- 200
- *** Stars ***
- 50
- 1
- 1
- 0
- *** BlitzBlank ***
- 676
- 467
- 36868
- 9
- 3
- *** Pyro ***
- 50
- 0
-
- There must always be a header "*** Modulename ***" followed by the
- module`s data.
-
- If you want to read your module`s data then browse through the configfile
- until you reach your header and then read your data.
-
- If you want to write your data, then use the following procedure:
-
- - Open a temporary file (eg. "BB.Modules.temp").
- - Write all data from the other modules in this file.
- - Then you delete the original config-file, rename the temp-file to
- "BB.Modules.config" and append your own modules' config data.
-
- Assuming that your module was the "Lines"-module from the example above,
- the new config-file should look like this after a change:
-
- *** Fade ***
- 10
- *** Tiles ***
- 2
- 3
- *** Spot ***
- 3
- *** Stars ***
- 50
- 1
- 1
- 0
- *** BlitzBlank ***
- 676
- 467
- 36868
- 9
- 3
- *** Pyro ***
- 50
- 0
- *** Lines ***
- 150
-
- Doing it this way, you can make sure that your data in the config-file
- is 100% accurate after writing to it.
- Keep in mind that the user may accidentally delete the config-file keep
- default-values of all data or change it illegally himself.
-
- New modules may use the "readconfig" and "writeconfig" subroutines
- of my supplied modules, if you are programming in BlitzBasic 2.
-
- If you have nothing to configure, then please inform the user about this
- with an EasyRequest if your module is started with "CONFIG".
-
-
- Methods of mouseblanking:
- -------------------------
-
- I currently use 2 methods of mouseblanking in my modules. I hope, they are
- both legal.
- I DO NOT turn sprite-DMA off, because of the side effects that can happen
- (can be read in the RKMs). Both methods use a structure "spritedata" of 6
- words which MUST be in CHIP-RAM (allocate with AllocMem()).
-
- If you use one screen:
- ~~~~~~~~~~~~~~~~~~~~~~
- Open your screen, bring it to front, then do:
-
- WaitTOF() (or VWait for Blitz-users)
- ChangeSprite (0,spr,*sprdata)
-
- spr = empty SimpleSprite-structure
- *sprdata = Pointer to the spritedata in CHIP-RAM
-
- Using this method, the mouse is automatically unblanked if it is moved, or
- if another screen is brought to front.
-
- If you use more than one screen (doublebuffering for example):
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Open a small 1x1 window on the WB, which is automatically activated
- (WFLG_ACTIVATE). Then do:
-
- WaitTOF() (or VWait for Blitz-users)
- SetPointer(*mywindow,*sprdata,0,0,0,0)
-
- *mywindow = Pointer to the mini-window
- *sprdata = Pointer to the spritedata in CHIP-RAM
-
- Using this method, the mouse is blanked until the mini-window is
- deactivated.
- Don`t forget to do this before leaving your module:
-
- ClearPointer( *mywindow)
- CloseWindow( *mywindow)
-
- For both methods:
- ~~~~~~~~~~~~~~~~~
- Don`t forget to free the memory of the spritedata.
-
-
- Testing:
- --------
-
- While testing your module, you can use the provided "Signal"-program to
- tell your module to halt, when you have started your module via the CLI and
- not via BlitzBlank.
-
-
- Problems:
- ---------
-
- Feel free to look at the source of the included modules.
-
- If you have problems writing a module, feel free to contact me and I`ll
- give you all the help I can.
-