home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
365.lha
/
VSnap
/
frame.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-04-10
|
1KB
|
64 lines
#include "snap.h"
IMPORT struct RastPort rp;
Point OldFrame[9];
Point NewFrame[9];
LONG OFType = 0;
UWORD Ptrn;
STATIC VOID MultiDraw(rp, num, xy)
struct RastPort *rp;
LONG num;
Point *xy;
{
REGISTER LONG i = 0;
REGISTER Point *coord = xy;
while (i<num) {
Move(rp, (LONG)coord->x, (LONG)coord->y);
coord++;
Draw(rp, (LONG)coord->x, (LONG)coord->y);
i++;
}
}
VOID crawl_frame(dir)
LONG dir;
{
REGISTER UWORD temp = Ptrn;
if (dir) {
Ptrn = ((Ptrn<<1) & 0xfffe) | ((Ptrn & 0x8000)>>15);
} else {
Ptrn = ((Ptrn>>1) & 0x7fff) | ((Ptrn & 1)<<15);
}
temp ^= Ptrn;
SetDrPt(&rp, temp);
MultiDraw(&rp, OFType, &OldFrame[0]);
SetDrPt(&rp, Ptrn);
}
VOID erase_frame()
{
if (OFType) {
MultiDraw(&rp, OFType, &OldFrame[0]);
OFType = 0;
}
}
VOID draw_frame(ft)
LONG ft;
{
REGISTER LONG i;
/* Remove old frame */
WaitTOF();
erase_frame();
/* Draw the new frame */
MultiDraw(&rp, ft, &NewFrame[0]);
/* save the frame for erasing later */
for (i=0; i<=ft; i++) {
OldFrame[i].x = NewFrame[i].x;
OldFrame[i].y = NewFrame[i].y;
}
OFType = ft;
}