/* SG C Tools 1.2 (C) 1993 Steve Goldsmith All Rights Reserved Example of using high speed scrolling pop-up windows. Compiled with HI-TECH C 3.09 (CP/M-80). To compile with HI-TECH C and SG C Tools source on same disk use: C WINDOWS.C -LC128 */ #include #include #include #include #define appClrScrCh 32 void drawwindows(void); void scrollwindow(uchar X1, uchar Y1, uchar X2, uchar Y2); char appScrlStr1[] = { "Use scrollupvdc() to scroll windows!" }; main() { srand(9); savevdc(); /* save vdc regs */ mapvdc(); clrscrvdc(appClrScrCh); /* clear screen */ clrattrvdc(vdcAltChrSet+vdcLightBlue); /* clear attributes */ setcursorvdc(0,0,vdcCurNone); /* turn cursor off */ outvdc(vdcFgBgColor,vdcBlack); /* set new screen color */ clrattrvdc(vdcAltChrSet+vdcLightBlue); clrscrvdc(137); drawwindows(); /* draw random windows */ scrollwindow(20,6,59,16); /* scroll 3 different size windows */ scrollwindow(10,4,69,18); scrollwindow(1,1,77,22); while (getch() != 0x0D); /* wait for return press */ restorevdc(); /* restore registers saved by savevdc() */ putchar(0x1A); /* adm-3a clear-home cursor */ } void drawwindows(void) { uchar X1, Y1, X2, Y2, I; for (I = 1; I <= 50; I++) /* draw 50 random windows */ { X1 = (uchar) (rand() >> 10); Y1 = (uchar) (rand() >> 12); X2 = X1+(uchar) (rand() >> 10)+3; Y2 = Y1+(uchar) (rand() >> 12)+3; winvdc(X1,Y1,X2,Y2,vdcAltChrSet+(uchar) (rand() >> 11),"C Windows!"); } } void scrollwindow(uchar X1, uchar Y1, uchar X2, uchar Y2) { uchar I; winvdc(X1,Y1,X2,Y2,vdcAltChrSet+vdcDarkGreen,"Scroller"); for (I = 1; I <= 100; I++) /* scroll window with random color string */ { scrollupvdc(X1+1,Y1+2,X2-1,Y2-1); printstrvdc(X1+1,Y2-2,vdcAltChrSet+(uchar) (rand() >> 11),appScrlStr1); } }