home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
c_news
/
09
/
hgraph2
/
h_demo2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-07-14
|
7KB
|
244 lines
#include <h_graph2.c>
main()
{
extern char fore[],back[],lgrey[],wrhatch[];
extern int stndl[],glass[],check[],xmark[],hand[];
char alphabet[3590];
char far *shape;
int status,buttons,i,j,k;
status=h_isherc();
switch(status)
{
case -1:
printf("** Sorry, a color card is installed **\n");
exit();
break;
case 1:
printf("** Sorry, adapter is not Hercules compatible **\n");
exit();
break;
default:
printf("** Hercules compatible adapter installed **\n");
}
status=m_init(&buttons);
if(status!=-1)
{
printf("** Mouse driver not installed **\n");
buttons=0;
}
else
{
printf("** Mouse driver detected with %d buttons **\n",buttons);
}
printf("\n\n\n** Press a key to begin the box demo **\n");
printf("** Continue pressing until demo is over **\n");
getch();
status=h_init(99);
if(status==7)
{
printf("** Sorry, can't initialize graphics **\n");
exit();
}
h_setpmode(H_PSET);
h_moveto(0,0);
h_box(719,347,fore);
getch();
h_box(719,347,lgrey);
getch();
h_clrw(back);
h_moveto(0,0);
h_patterns();
getch();
h_clrw(fore);
getch();
h_clrw(back);
h_explode(fore);
h_explode(lgrey);
h_explode(back);
h_moveto(10,10);
status=h_loadfont("standard.fnt",alphabet);
if(status)
{
h_init(7);
printf("\n ***** ERROR - can not find standard.fnt file *****\n");
}
else
{
h_draws("This is STANDARD.FNT",alphabet);
status=h_loadfont("script.fnt",alphabet);
h_moveto(10,24);
if(status)
{
h_draws(" ***** ERROR - can not find script.fnt file *****",alphabet);
}
else
{
h_draws("This is SCRIPT.FNT",alphabet);
}
h_moveto(10,38);
status=h_loadfont("smallapl.fnt",alphabet);
if(status)
{
h_draws(" ***** ERROR - can not find smallapl.fnt file *****",alphabet);
}
else
{
h_draws("This is SMALLAPL.FNT",alphabet);
}
h_moveto(10,52);
status=h_loadfont("gothic.fnt",alphabet);
if(status)
{
h_draws(" ***** ERROR - can not find gothic.fnt file *****",alphabet);
}
else
{
h_draws("This is GOTHIC.FNT",alphabet);
}
h_moveto(10,66);
status=h_loadfont("compute.fnt",alphabet);
if(status)
{
h_draws(" ***** ERROR - can not find compute.fnt file *****",alphabet);
}
else
{
h_draws("This is COMPUTE.FNT",alphabet);
}
h_moveto(10,80);
status=h_loadfont("italic.fnt",alphabet);
if(status)
{
h_draws(" ***** ERROR - can not find italic.fnt file *****",alphabet);
}
else
{
h_draws("This is ITALIC.FNT",alphabet);
}
h_moveto(10,94);
status=h_loadfont("apl.fnt",alphabet);
if(status)
{
h_draws(" ***** ERROR - can not find apl.fnt file *****",alphabet);
}
else
{
h_draws("This is APL.FNT",alphabet);
}
h_moveto(10,320);
status=h_loadfont("sideways.fnt",alphabet);
if(status)
{
h_draws(" ***** ERROR - can not find sideways.fnt file *****",alphabet);
}
else
{
h_draws("This is SIDEWAYS.FNT",alphabet);
}
getch();
h_loadfont("standard.fnt",alphabet);
h_clrw(wrhatch);
h_moveto(10,10);
h_draws("This is H_PSET put mode",alphabet);
getch();
h_clrw(wrhatch);
h_moveto(10,10);
h_setpmode(H_OR);
h_draws("This is H_OR put mode",alphabet);
getch();
h_clrw(wrhatch);
h_moveto(10,10);
h_setpmode(H_XOR);
h_draws("This is H_XOR put mode",alphabet);
getch();
h_moveto(10,10);
h_draws("This is H_XOR put mode",alphabet);
getch();
h_clrw(back);
h_moveto(10,10);
h_draws("This is how to make grey text using the H_AND mode of H_BOXFILL",alphabet);
h_moveto(10,10);
h_setpmode(H_AND);
getch();
h_boxfill(577,24,lgrey);
getch();
h_moveto(0,0);
h_setpmode(H_PSET);
h_clrw(back);
h_box(639,199,fore);
if(buttons)
{
m_cursor(ON);
h_moveto(10,220);
h_draws("After m_init, the mouse is limited to this area",alphabet);
h_moveto(10,234);
h_draws("You must use m_limit to allow full screen movement",alphabet);
getch();
m_limit(0,0,719,347);
getch();
m_cursor(OFF);
h_clrw(back);
h_moveto(10,10);
h_draws("m_limit can also constrict mouse movement",alphabet);
h_moveto(360,174);
h_box(620,320,fore);
m_limit(360,174,620,320);
m_cursor(ON);
getch();
m_cursor(OFF);
h_clrw(back);
h_moveto(10,10);
m_limit(0,0,719,347);
h_draws("m_move can be used to force the mouse cursor to any screen position",alphabet);
m_cursor(ON);
for(k=0;k<5;k++)
{
for(i=0,j=0;i<698;i+=2,j++)
{
m_move(i,j);
}
}
m_move(360,174);
getch();
m_cursor(OFF);
h_clrw(back);
h_moveto(10,10);
h_draws("m_shape creates different mouse cursor shapes",alphabet);
h_moveto(10,24);
h_draws("You will need a function to turn a pointer into a segment & offset",alphabet);
h_moveto(10,38);
h_draws("Look for ones called FP_SEG & FP_OFF",alphabet);
m_cursor(ON);
for(i=0;i<5;i++)
{
getch();
switch(i)
{
case 0:
shape=hand;
break;
case 1:
shape=glass;
break;
case 2:
shape=check;
break;
case 3:
shape=xmark;
break;
case 4:
shape=stndl;
break;
}
m_shape(FP_SEG(shape),FP_OFF(shape));
}
getch();
m_cursor(OFF);
}
}
if(buttons==0) getch();
h_init(7);
printf("\n ** End of DEMO **\n");
}