SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files

CAFire - a burning pointer toy

Robert Cimrman
e-mail: cimrman3@students.zcu.cz

WARNING: Experimental code - many security holes possible, use at your own risk. (You have been warned.)

Copying: GPL

I. Description
^^^^^^^^^^^^^^
This program displays a burning trace after the mouse pointer in X. It can work in a normal or in the root window. To find something about known bugs, search the JOURNAL file for '[!?]' in the first column.

It should work on 16, 24, and 32 bpp displays (DirectColor or TrueColor). A 8 bpp indexed display is also possible, but as no X colors are allocated by cafire itself, the particle colors are rather random. (However not so ugly as expected. :-) A simple (understand: not perfect) background preservation mode enables you to have your favourite background image while running CAFire in the root window.

Different colormaps can be used - see 'colormaps' directory and section IV.

Other information can be found at: http://home.zcu.cz/~cimrman3/cafire.html

This program is based on the idea of cellular automata (hence CAFire), though I had played with it long before I knew anything about CA, or even that some CA exist.

II. Building
^^^^^^^^^^^^
In Makefile adjust the installation and library paths. Default colormap and input file can be set here as well.

Run 'make'.

Now you can try 'demo' to see whether it works.

Run 'make install'. This will install files 'cafire', 'runcafire' and 'killcafire' into BINDIR and data files into CONFDIR as specified in the Makefile.
It will also edit the runcafire script so that it contains correct paths.

'make uninstall' removes the installation.

III. Running
^^^^^^^^^^^^
cafire


The program 'cafire' can take one of arguments -root, -back, a colormap file name argument, or no arguments. -root -> run in the root window,
-back -> same as previous, preserve a background image) Anything different from above is (silently) ignored.

After starting it awaits some parameters affecting the algorithm to be given on the standard input. Sample parameters are in 'input/*.cafirerc' files.

Do not use it, use 'runcafire'.

runcafire

For user's convenience, a 'runcafire' script can be used to strip the comments off '*.cafirerc' files and run the 'cafire' program. Usage: runcafire <config file> [-root|-back] [colormap file] Without any parameters the script takes default settings found either in $HOME/.cafirerc or CONFDIR (the first run). Subsequent calls of runcafire update $HOME/.cafirerc so that it contains always the last settings. Config file name and colormap file name can be either a full path or just a file name - in the latter case CONFDIR/{input,colormap} is taken as the file name prefix.

Look at the section V. (Examples).

For even more convenience there is a script 'demo' here which you can use to test cafire before running 'make install'.

After a successful launch, a frame per second statistics, as well as a number of fire particles, should be displayed in the lower right corner.

NOTE: If -back option is not used, you should set your display background to black color, because it is updated only where needed.

NOTE: In the normal window mode, a different pointer tracking algorithm is used - the consecutive pointer positions are interpolated by straight lines. This can be changed in 'handle.c' source ("if (gr->inRootWindow) {...").

NOTE: In the root window mode, the only mean to end the program is a brute force (interrupt, kill, power off, shotgun, tank, conventional missile, nuclear strike, asteroid impact, sun going red giant, supernova, gamma ray burst in a short distance (< 1000 light years or so), black hole, esmeralda...). Use 'killcafire' script. It will restore the X pointer cursor as well.
In the normal window mode you can use 'q'. (Yes, the star trek one...) Or his master 'Q'. Or...

killcafire

This kills all cafires AND restores X pointer cursor. Its shape can be specified on the command line.

IV. Colormaps
^^^^^^^^^^^^^
For an example, see 'colormaps' subdirectory. A colormap must have 256 entries of RGB tripples, with values ranging from 0 to 255. The first color is the background -> i.e. usually black (0, 0, 0). You can use 'savecolormap.m' script to generate your own colormaps, if you have access to Matlab, of course.

V. Examples
^^^^^^^^^^^
Compiled, not installed:


./demo

NOTE: 'runcafire' does not work by itself yet - it requires two paths to be set: BINDIR and CONFDIR. You can set them by hand or run 'make install' - this will edit 'runcafire' and set the paths.

Installed

Assumptions: BINDIR is on the executable search PATH and CONFDIR is /usr/local/etc/cafire.

runcafire

runcafire /usr/local/etc/cafire/input/magic2.cafirerc is same as
runcafire magic2.cafirerc

runcafire magic2.cafirerc -back

runcafire /usr/local/etc/cafire/input/magic.cafirerc /usr/local/etc/cafire/colormaps/green-b.col is same as
runcafire /usr/local/etc/cafire/input/magic.cafirerc green-b.col is same as
runcafire magic.cafirerc /usr/local/etc/cafire/colormaps/green-b.col is same as
runcafire magic.cafirerc green-b.col

this one is dangerous :-)
runcafire stars.cafirerc -back red-g.col

runcafire /usr/local/etc/cafire/input/magic2.cafirerc -root blue-r.col

runcafire magic2.cafirerc -back /usr/local/etc/cafire/colormaps/blue-r.col is same as subsequent
runcafire

Colormap saving:

savecolormap( 'colormaps/some_colormap.col', round( some_colormap * 255 ) );


NOTE: This version has two zeros before you get a non-trivial integer, so be patient...


This file was created 25.12.1999.
Updated 11.01.2000. (WARNING, e-mail address, log moved to the end) Updated 13.01.2000. (16 bpp constraint removed) Updated 27.01.2000. (Partial background preservation.) Updated 04.09.2000. (Colormap support info, section.) Updated 06.09.2000. (Building and running sections updated.) Updated 11.09.2000. (Building and running sections updated, examples section.)


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.