home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
413a.lha
/
sMOVIE
/
source
/
smovielines.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-02
|
2KB
|
94 lines
/* sMOVIElines.c - function to smooth scroll horizontal lines up
through a view.
M. J. Round. 7 - Oct - 1989. */
/* See sMOVIEtext.c for an explanation of how this works. */
#include "sMOVIE.h"
extern int maxfontheight,abort_prog;
extern int mousemonitor(void);
extern int maxwidth;
extern int delay; /* delay between each pixel scroll */
extern int ypos; /* y posn of previous text base */
extern struct View v; /* view to be smooth scrolled */
extern struct RastPort rp; /* rastport to write text to */
void smoothlines (number,length,xpos,apen,bpen)
short number; /* number of lines to draw */
short length; /* length of line (in pixels) */
short xpos; /* x position to start line (in pixels) */
BYTE apen; /* foreground (ink colour) pen */
BYTE bpen; /* background (paper colour) pen */
{
int j,hipos,jump;
register int i;
WORD *ryoffset;
ryoffset = &(v.ViewPort->RasInfo->RyOffset);
jump = v.ViewPort->DHeight + maxfontheight;
SetDrMd(&rp,JAM1);
for(i=0; i < number; i++) { /* each pass scrolls one pixel */
if (!abort_prog) abort_prog = mousemonitor();
else break;
if (ypos >= (rp.BitMap->Rows - 6)) {
ypos -= jump;
*ryoffset -= jump;
}
hipos = ypos - jump;
Move (&rp,0,ypos);
if (xpos) {
SetAPen(&rp,bpen);
Draw (&rp,xpos,ypos);
}
SetAPen (&rp,apen);
Draw (&rp,xpos+length,ypos);
if (xpos+length < maxwidth-1) {
SetAPen (&rp,bpen);
Draw (&rp,maxwidth-1,ypos);
}
if((hipos >= 0) && (*ryoffset >= hipos)) {
Move (&rp,0,hipos);
if (xpos) {
SetAPen(&rp,bpen);
Draw (&rp,xpos,hipos);
}
SetAPen (&rp,apen);
Draw (&rp,xpos+length,hipos);
if (xpos+length < maxwidth-1) {
SetAPen (&rp,bpen);
Draw (&rp,maxwidth-1,hipos);
}
}
++(*ryoffset);
MakeVPort(&v, v.ViewPort);
MrgCop(&v);
for (j=0; j<delay; j++)
WaitTOF();
LoadView(&v); /* scroll up one pixel */
ypos++;
} /* repeat (number) times */
} /* end of sMOVIElines */