From don@brillig.umd.edu Tue May 30 22:07:02 1989 Date: Tue, 30 May 89 22:07:02 EDT To: NeWS-makers@brillig.umd.edu Subject: psPyro, a user extensible fireworks display screen saver From: marshall@software.org (Eric Marshall) Sender: NeWS-makers-request@brillig.umd.edu (Don Hopkins) psPyro is a user extensible fireworks display screen saver. psPyro is fashioned after the MacIntosh screen saver program "Pyro", written by Bill Steinberg and Steve Brecher. Although psPyro actually contains no code which determines if the screen saver should be invoked, it should be possible to incorporate psPyro into a "true" screen saver program, e.g. Stan Switzer's NeWS-based BlankScreen program or some system-level screen saver. psPyro executes by randomly selecting a place to fire each firework, randomly selects a direction in which to fire the firework, randomly selects a width and height for the firework trail to follow, and finally, randomly selects a number of explosions to explode to conclude the firework firing. This continues forever until either the mouse is moved or one of the mouse buttons is pressed. User extensibility is achieved via definitions in the /PSPyro dictionary, which is located in /systemdict. Although only a small number of psPyro's internal definitions were intended to be user configurable, all can be modified. The intended user modifiable definitions are as follows: /unusable_screen_width - the percent of each side of the screen which will not be used to fire a firework from. The default is 10% of the screen width. /unusable_screen_height - the percent of the top of the screen which will not be used by the trail of a firework. The default is 10% of the screen height. /minimum_trail_height - the minimum height of a firework trail, in terms of a percentage of the screen height. The default is 75% of the screen height. /minimum_explosion_angle - the minimum angle a firework trail will travel before an explosion occurs. Logically, fireworks travel in a counterclockwise direction, starting at angle 0. The default is 100. /maximum_explosion_angle - the maximum angle a firework trail will travel before an explosion occurs. The default is 150. /minimum_#_explosions - the minimum number of explosions per firework. The default is 1. /maximum_#_explosions - the maximum number of explosions per firework. The default is 5. /trail_length - the length (in degrees) of the animated firework trail. The default is 3. /time_between_firings - the time (in seconds) between firework firings. The default is 2. /multiple_explosion_radius - the radius (in units) from the center of the original explosion to the center of multiple explosions. The default is 100. /delay_amount - the number of /pause's between firework trail updates. The default is 50. I would have preferred to specify a time in seconds to delay for, but /sleep wasn't allowing for satisfactory animation. /explosion_kinds - the array which contains the names of the procedures implementing the different explosions. A standard place to provide user specific definitions for psPyro is in your user.ps file. An example user.ps fragment follows which specifies the values for the minimum and maximum explosion angles, and which adds a new explosion to the list of available explosions (default is 5 different explosions): systemdict begin /PSPyro 20 dict def PSPyro begin /minimum_explosion_angle 45 def /maximum_explosion_angle 90 def /T { translate 0 0 moveto 1 setgray (Explosion) show } def /explosion_kinds [ /T ] def end end A few words are in order concerning the definition of new explosions. If /explosion_kinds is provided within /PSPyro, then the contents of the provided array are ADDED to the internal psPyro list of available explosions. If /replace_explosion_kinds is provided, the provided array is used to REPLACE the internal psPyro list. Also, each procedure named in the /explosion_kinds and /replace_explosion_kinds arrays accept two parameters, the x and y position of the center of the explosion. The supplied explosion procedures simply /translate to the specified location and draw about the origin, but more sophisticated procedures could use the positional information as the basis for altering the explosion shape, e.g. if the explosion is to occur very high or very low. Go ahead and write some fancy explosions. Collect them, trade them, sell them :-) Unfortunately, I don't have access to a color monitor, so there is no support for color anything. Wouldn't it be nice if someone with a color monitor ... psPyro was developed on a Sun 3/160 running NeWS 1.1 under SunOS 3.5. Eric Marshall Software Productivity Consortium SPC Building 2214 Rock Hill Road Herndon, VA 22070 (703) 742-7153 CSNET: marshall@software.org ARPANET: marshall%software.org@relay.cs.net ---------------------------------------------------------------------- I'm just an X programmer gone straight.