home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v92.tgz
/
v92.tar
/
v92
/
src
/
runtime
/
fxprmnt.ri
< prev
next >
Wrap
Text File
|
1996-03-22
|
3KB
|
94 lines
/*
* fxprmnt.ri -- experimental graphics functions -- not for outside release
*/
/*
* XAnimateFrame --
* This function is not finished; it should be generalized to handle
* multiple moving pixmaps and multiple styles of animation. I have in
* mind that it become the "printf" of frame animation.
*/
"XAnimateFrame(args[]){1} - animate frame"
function {1} XAnimateFrame(argv[argc])
abstract {
return file
}
body {
wbp _w_;
int i, j, n = 0, x[MAXXOBJS], y[MAXXOBJS], closed = 0, npixmaps=0;
int argsbeforeints = 2, delay = 0;
int warg = 0;
char *s;
OptWindow;
/*
* 1 or more pixmaps must be included
*/
while(warg < argc && is:file(argv[warg]) &&
(BlkLoc(argv[warg])->file.status & Fs_Window)) {
npixmaps++;
warg++;
}
if (!npixmaps) runerr(140);
/*
* missing arguments are treated as &null, which isn't convertible
* to integer.
*/
CheckArgMultiple(2);
if (n < 2) runerr(101);
if (IntVal(argv[warg]) == IntVal(argv[argc-2]) &&
IntVal(argv[warg+1]) == IntVal(argv[argc-1])) {
closed = 1; /* duplicate the next to last point */
x[0] = IntVal(argv[argc-4]);
y[0] = IntVal(argv[argc-3]);
x[0] += _w_->dx;
y[0] += _w_->dy;
}
else if (argc > 1) { /* duplicate the first point */
x[0] = IntVal(argv[warg]);
y[0] = IntVal(argv[warg+1]);
x[0] += _w_->dx;
y[0] += _w_->dy;
}
for (i = 0, j = 1; i < n; i++, j++) {
int base = warg + i * 2;
if (j == MAXXOBJS) {
animate(_w_, &(argv[warg-npixmaps]), npixmaps,
x, y, MAXXOBJS, delay);
x[0] = x[j-3];
y[0] = y[j-3]; /* duplicate the last three points */
x[1] = x[j-2]; /* for the next call, to insure */
y[1] = y[j-2]; /* continuity */
x[2] = x[j-1];
y[2] = y[j-1];
j = 3;
}
CnvCInteger(argv[base], x[j]);
CnvCInteger(argv[base + 1], y[j]);
x[j] += _w_->dx;
y[j] += _w_->dy;
}
if (closed) { /* duplicate the second point */
x[j] = x[2];
y[j] = y[2];
}
else { /* duplicate the last point */
x[j] = x[j-1];
y[j] = y[j-1];
}
animate(_w_, &(argv[warg-npixmaps]), npixmaps, x, y, j+1, delay);
ReturnWindow;
}
end