
#include<mpmouse.h>
#include<stdlib.h>
#include<mypaint.h>
#include<deb.h>
#include<zoom.h>
int but,x1,y1,x2,y2;
void setcurpos(int dhh,int dll)
{
union REGS i,o;
i.h.ah=0x02;
i.h.dh=dhh;
i.h.dl=dll;
i.h.bh=0;
int86(0x10,&i,&o);
}
footer()
{
setcurpos(27,0);
printf(" ");
//setcurpos(28,10);
//printf(" ");
}
helpline(char ch[80])
{
setcurpos(27,1);
printf("%s",ch);
}
void draw(int back)
{
static int i,j,m,n,p,q;
static union REGS ind,outd;
in.x.ax=3;
int86(0x33,&in,&out);
i=out.x.cx;
j=out.x.dx;
if(out.x.bx==0)
{
p=i;
q=j;
}
/*else if(out.x.bx==1)
{
ind.x.ax=2;
int86(0x33,&ind,&outd);
line(p,q,i,j);
ind.x.ax=1;
int86(0x33,&ind,&outd);
p=i;
q=j;
} */
else if(out.x.bx==2)
{
for(m=0;m<=5;m++)
for(n=0;n<=5;n++)
putpixel(i-m,j-n,back);
}
}
freehand()
{
while(!kbhit())
{
showmouseptr();
getmousepos(&but,&x1,&y1);
x2=x1;
y2=y1;
while(but==1)
{
hidemouseptr();
line(x1,y1,x2,y2);
x1=x2;
y1=y2;
getmousepos(&button,&x2,&y2);
}
}
}
void main(void)
{
int i,j,maxx,maxy,c,k=0;
int but,x,y,prevx,prevy;
int color=0,currentcol=0;
int row,column;
int fontnum,fontsize;
int style;
int distance;
int blendnum,outcol,fillcol;
int thick;
static int background=0;
char a[80],ch,ch1,*col,*col2;
char name[30],* passwd;
FILE * fp;
clrscr();
printf("\nEnter filename: ");
scanf("%s",name);
graph();
fp=fopen(name,"r");
maxx=getmaxx();
maxy=getmaxy();
pvx=20;pvy=40;range=4;
form("My Paint: Developed By Debasis Bhattacharjee.");
footer();
//setcurpos(27,1);
//printf("DISPLAY HELP LINES HERE:");
setcolor(1);
outtextxy(0,maxy-13,"The black area is the help line area which helps the drawing more easy. Enjoy it");
button(1,22,50,50,"Table");
button(53,22,83,50,"Rec");
button(86,22,116,50,"Cir");
button(119,22,149,50,"Ers");
button(152,22,192,50,"Line");
button(195,22,235,50,"Fill");
button(238,22,278,50,"Text");
button(281,22,311,50,"Col");
button(314,22,344,50,"Ext");
button(347,22,377,50,"Con");//****
button(380,22,410,50,"Bnd");
button(413,22,443,50,"Pen");
button(595,22,635,50,"Save");
line(0,maxy-49,maxx-1,maxy-49);
line(1,55,maxx,55);
setviewport(1,57,maxx-1,maxy-57,1);
if(fp==NULL)
{
fclose(fp);
}
else
{
background=fgetc(fp);
for(i=0;i<=640;i++)
for(j=0;j<=480;j++)
putpixel(i,j,fgetc(fp));
fclose(fp);
}
show();
while(1)
{
draw(background);
//setcolor(color);
if(click(413,22,443,50,"Pen")==0)
{
while(!kbhit())
{
showmouseptr();
getmousepos(&but,&x1,&y1);
x2=x1;
y2=y1;
while(but==1)
{
hidemouseptr();
line(x1,y1,x2,y2);
x1=x2;
y1=y2;
getmousepos(&button,&x2,&y2);
}
}
}
if(click(347,22,377,50,"Con")==0)
{
setcolor(currentcol);
footer();
helpline("You select Contor tool(creat concentric shapes). Now press I for incontor and O for outcontor and C for colorfull rectangular incontor: ");
ch=getch();
if(ch=='c'||ch=='C')
{
footer();
helpline("Enter the outline color code: ");
col=stopget(2);
outcol=atoi(col);
footer();
helpline("Enter the fill color code: ");
col=stopget(2);
fillcol=atoi(col);
footer();
helpline("Now you can draw it");
colincontor(fillcol,outcol);
footer();
}
if(ch=='i'||ch=='I')
{
footer();
helpline("Now you can draw it");
incontor();
footer();
}
if(ch=='o'||ch=='O')
{
footer();
helpline("Now press R for rectangle contor and C for circle contor");
ch1=getch();
if(ch1=='r'||ch1=='R')
{
footer();
helpline("Now you can draw it");
outcontor();
footer();
}
if(ch1=='c'||ch1=='C')
{
footer();
helpline("Now you can draw it");
circontor();
footer();
}
}
}
if(click(380,22,410,50,"Bnd")==0)
{
footer();
helpline("You select Blend tool (Blend rectangles). Now enter the side. u for up left, r for up right, l for leftdown and d for right down: ");
ch=getch();
footer();
helpline("Now enter the color code for outline color of rectangles: ");
col=stopget(2);
outcol=atoi(col);
footer();
helpline("Now enter the color code for fill color of the rectangles: ");
col=stopget(2);
fillcol=atoi(col);
footer();
helpline("Now Enter the number of rectangles to be drawn: ");
col=stopget(2);
blendnum=atoi(col);
footer();
helpline("Now you can draw it");
blend(ch,blendnum-1,outcol,fillcol);
footer();
}
if(click(314,22,344,50,"Ext")==0)
{
footer();
helpline("You select Extrude tool (Three dimensional object). Now enter the side. u for up left, r for up right, l for leftdown and d for right down: ");
ch=getch();
footer();
helpline("Now enter the difference between to rectangle: ");
col=stopget(3);
distance=atoi(col);
footer();
helpline("Now you can draw it");
box(ch,distance,color);
footer();
}
if(click(281,22,311,50,"Col")==0)
{
footer();
helpline("Foreground color: You press 0 to 9 to select color and then press enter.");
while(1)
{
ch=getch();
if(ch==13)
{
color=currentcol;
footer();
break;
}
if(ch=='1')
{
footer();
helpline("You select Blue");
currentcol=1;
}
if(ch=='2')
{
footer();
helpline("You select Green");
currentcol=2;
}
if(ch=='3')
{
footer();
helpline("You select Cyan");
currentcol=3;
}
if(ch=='4')
{
footer();
helpline("You select Red");
currentcol=4;
}
if(ch=='5')
{
footer();
helpline("You select Magenta");
currentcol=5;
}
if(ch=='6')
{
footer();
helpline("You select Brown");
currentcol=6;
}
if(ch=='7')
{
footer();
helpline("You select Yellow");
currentcol=14;
}
if(ch=='8')
{
footer();
helpline("You select Light Blue");
currentcol=9;
}
if(ch=='9')
{
footer();
helpline("You select White");
currentcol=15;
}
if(ch=='0')
{
footer();
helpline("You select Black");
currentcol=0;
}
}
}
if(click(238,22,278,50,"Text")==0)
{
footer();
helpline("Press D for default text and U for user text");
ch=getch();
if(ch=='d'||ch=='D')
{
setcolor(currentcol);
settextstyle(SMALL_FONT,HORIZ_DIR,5);
while(!kbhit())
{
hidemouseptr();
getmousepos(&but,&x,&y);
if((but&1)==1)
{
prevx=x;
prevy=y;
break;
}
showmouseptr();
}
moveto(prevx,prevy-57);
getstring(a);
showmouseptr();
footer();
}
if(ch=='u'||ch=='U')
{
footer();
helpline("Enter the corresponding number of the Font: ");
ch1=getche();
if(ch1=='1')
fontnum=1;
if(ch1=='2')
fontnum=2;
if(ch1=='3')
fontnum=3;
if(ch1=='4')
fontnum=4;
if(ch1=='5')
fontnum=5;
if(ch1=='6')
fontnum=6;
if(ch1=='7')
fontnum=7;
if(ch1=='8')
fontnum=8;
if(ch1=='9')
fontnum=9;
if(ch1=='0')
fontnum=10;
footer();
helpline("Enter the corresponding number of the Font size: ");
ch1=getche();
if(ch1=='1')
fontsize=1;
if(ch1=='2')
fontsize=2;
if(ch1=='3')
fontsize=3;
if(ch1=='4')
fontsize=4;
if(ch1=='5')
fontsize=5;
if(ch1=='6')
fontsize=6;
if(ch1=='7')
fontsize=7;
if(ch1=='8')
fontsize=8;
if(ch1=='9')
fontsize=9;
if(ch1=='0')
fontsize=10;
//scanf("%d%d",&fontnum,&fontsize);
//fflush(stdin);
/*col=stopget(2);
fontnum=atoi(col);
//fflush(stdin);
col2=stopget(2);
fontsize=atoi(col2);
fflush(stdin);*/
footer();
helpline("Now you can write");
setcolor(currentcol);
settextstyle(fontnum,HORIZ_DIR,fontsize);
while(!kbhit())
{
hidemouseptr();
getmousepos(&but,&x,&y);
if((but&1)==1)
{
prevx=x;
prevy=y;
break;
}
showmouseptr();
}
moveto(prevx,prevy-57);
getstring(a);
showmouseptr();
footer();
}
}
//writetext(background);
if(click(195,22,235,50,"Fill")==0)
fillobj(color);
if(click(595,22,635,50,"Save")==0)
{
hide();
delay(500);
if(k==0)
{
fp=fopen(name,"w");
if(fp==NULL)
{
printf("Cannot open file");
getch();
}
in.x.ax=2;
int86(0x33,&in,&out);
fputc(background,fp);
for(i=0;i<=640;i++)
for(j=0;j<=480;j++)
fputc(getpixel(i,j),fp);
//fclose(fp);
show();
}
//goto next;
show();
} //*********************************************************
if(click(620,3,635,18,"X")==0)
exit(0);
if(click(152,22,192,50,"Line")==0)
{
setcurpos(27,1);
printf("Press N for Normal H for Horizontal and V for vertical line:");
ch=getch();
if(ch=='n'||ch=='N')
{
footer();
helpline("Now you can draw it");
bline(currentcol);
footer();
}
if(ch=='h'||ch=='H')
{
footer();
helpline("Press N for normal and S for stylish line:");
ch=getch();
if(ch=='n'||ch=='N')
{
footer();
helpline("Now you can draw it");
horizline();
footer();
}
if(ch=='s'||ch=='S')
{
footer();
helpline("Now Enter the Style and Thickness of the line: ");
col=stopget(1);
style=atoi(col);
col=stopget(1);
thick=atoi(col);
if(thick>3)
{
footer();
helpline("Thickness is 1 to 3");
thick=3;
footer();
}
footer();
/*
col2=stopget(1);
//scanf("%s",col2);
thick=atoi(col2);*/
if(style==0||style>11)
{
footer();
helpline("Sorry. You enter a wrong number. 1 to 11 is available style. Press any key.");
getch();
footer();
}
else
{
//footer();
helpline("Now you can draw it");
stylehorizline(style,thick);
footer();
}
}
}
if(ch=='v'||ch=='V')
{
verline();
footer();
}
}
if(click(119,22,149,50,"Ers")==0)
erase();
if(click(53,22,83,50,"Rec")==0)
{
setcurpos(27,1);
printf("Press N for normal and F for Fill and S fo Stylish Rectangle:");
ch=getch();
if(ch=='s'||ch=='S')
{
footer();
helpline("Enter the style number: ");
col=stopget(2);
style=atoi(col);
if(style==0||style>11)
{
footer();
helpline("Sorry. You enter a wrong number. 1 to 11 is available style. Press any key.");
getch();
footer();
}
else
{
footer();
helpline("Now you can draw it (Note: If the corrent color is black then please change it to see the change:");
fillbar(color,style);
footer();
}
}
if(ch=='n'||ch=='N')
{
footer();
helpline("Now you can draw it");
rec(color);
footer();
}
if(ch=='f'||ch=='F')
{
footer();
setcurpos(27,1);
printf("Enter the color Number for filling: ");
col=stopget(3);
c=atoi(col);
fillrec(c);
footer();
}
}
if(click(86,22,116,50,"Cir")==0)
{
footer();
helpline("Press N for normal circle and S for stylish circle:");
ch=getch();
if(ch=='n'||ch=='N')
{
footer();
helpline("Now you can draw it");
cir();
footer();
}
if(ch=='s'||ch=='S')
{
footer();
helpline("Enter the style number: ");
col=stopget(2);
style=atoi(col);
if(style==0||style>11)
{
footer();
helpline("Sorry. You enter a wrong number. 1 to 11 is available style. Press any key.");
getch();
footer();
}
else
{
footer();
helpline("Now you can draw it (Note: If the corrent color is black then please change it to see the change:");
fillcir(currentcol,style);
footer();
}
}
}
if(click(1,22,50,50,"Table")==0)
{
//hide();
footer();
helpline("Enter the number of Column: ");
col=stopget(3);
row=atoi(col);
footer();
helpline("Enter the number of Row: ");
col=stopget(3);
column=atoi(col);
footer();
helpline("Now you can draw it ");
table(row,column);
show();
footer();
}
//button(600,3,615,18,"?");
}
//next:
getch();
}
Now needed header files:
MPMOUSE.H
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
union REGS i,o;
struct SREGS s;
//Different Types of Icons of mouse.
int arrow2[][32]={ 0x9fff,0x8fff,0x87ff,0x83ff,0x81ff,0x80ff,0x807f,0x803f,0x801f,0x800f,0x80ff,
0x887f,0x987f,0xfc3f,0xfc3f,0xfe3f,0x0000,0x2000,0x3000,0x3800,0x3c00,0x3e00,
0x3f00,0x3f80,0x3fc0,0x3e00,0x3600,0x2300,0x0300,0x0180,0x0180,0x0000
};
int ibeam[][32]={ 0xe187,0xe007,0xfc3f,0xfc3f,0xfc3f,0xfc3f,0xfc3f,0xfc3f,0xfc3f,0xfc3f,0xfc3f,
0xfc3f,0xfc3f,0xfc3f,0xe007,0xe187,0x0000,0x0e70,0x0180,0x0180,0x0180,0x0180,
0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0180,0x0e70,0x0000
};
int invisible[][32]={ 0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,
0x0080,0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,0xff7f,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
};
int wait[][32]={ 0x8001,0xc003,0xc003,0xc003,0xc003,0xe007,0xf00f,0xf81f,0xf81f,0xf00f,0xe007,
0xc003,0xc003,0xc003,0xc003,0x8001,0x7ffe,0x2004,0x2004,0x2004,0x2664,0x13c8,
0x0990,0x0420,0x0420,0x0990,0x13c8,0x27e4,0x2ff4,0x2ff4,0x2004,0x7ffe
};
int icon[][32]={ 0xffff,0xffff,0xc003,0xc003,0xc003,0xc003,0xc003,0xc003,0xc003,0xc003,0xc003,
0xc003,0xc003,0xc003,0xffff,0xffff,0x0000,0x0000,0x3ffc,0x3ffc,0x300c,0x300c,
0x33cc,0x33cc,0x33cc,0x33cc,0x300c,0x300c,0x3ffc,0x3ffc,0x0000,0x0000
};
int arrow[][32]={0xffff,0xffff,0xe003,0xf003,0xf803,0xfc03,
0xfe03,0xfc03,0xf803,0xf043,0xe0e3,0xc1f3,
0x83fb,0x07ff,0x8fff,0xdfff,0x0000,0x0000,
0x1ffc,0x0804,0x0404,0x0204,0x0104,0x0204,
0x0444,0x08a4,0x1114,0x220c,0x4404,0x8800,
0x5000,0x2000};
int pencil[][32]={0xf800,0x8400,0x8200,0x8100,
0x8080,0x4040,0x2020,0x1010,
0x0808,0x0404,0x0202,0x0101,
0x0082,0x0044,0x0028,0x0010,
0x07ff,0x03ff,0x01ff,0x00ff,
0x00ff,0x803f,0xc01f,0xe00f,
0xf00f,0xf803,0xfc01,0xfe00,
0xff01,0xff83,0xffc7,0xffef
};
int hourglass[][32]={0x0000,0x0000,0x0000,0x0000,0x8001,0xc003,
0xf00f,0xfc3f,0xfc3f,0xf00f,0xc003,0x8001,
0x0000,0x0000,0x0000,0x0000,0xffff,0x8001,
0xffff,0x8001,0x4002,0x2004,0x1008,0x0240,
0x0240,0x0810,0x2004,0x4002,0x8001,0xffff,
0x8001,0xffff};
int hand[][32]={0xe1ff,0xeff,0xeff,0xeff,0xeff,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x1e00,0x1200,
0x1200,0x1200,0x13ff,0x1249,0x1249,0xf249,
0x9001,0x9001,0x9001,0x8001,0x8001,0x8001,
0xffff,0x0000};
int textt[][32]={0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
0x0000,0x0000,0x0000,0x0000,0xffff,0xffff,
0xffff,0x0007,0x0007,0xeee7,0x0007,0x0007,
0xeee7,0x0007,0x0007,0xeee7,0x0007,0x0007,
0xeee7,0xeee7};
/*getmstat(int *b,int *x,int *y)
{
union REGS i,o;
i.x.ax=3;
int86(51,&i,&o);
*b=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
return 0;
}
/*middle click check*/
/*int midleclick(void)
{
int b,x,y;
getmstat(&b,&x,&y);
if(b==3) return 0;
else return 1;
}
/*Right click check*/
/*int rightclick(void)
{
int b,x,y;
getmstat(&b,&x,&y);
if(b==2) return 0;
else return 1;
}
/*left click check*/
/*int leftclick(void)
{
int b,x,y;
getmstat(&b,&x,&y);
if(b==1) return 0;
else return 1;
} */
initialize() /*Initialise mouse*/
{
union REGS inregs,outregs;
inregs.x.ax = 0;
int86(0x33,&inregs,&outregs);
return(outregs.x.ax);
}
show() /*Show cursor*/
{
union REGS inregs,outregs;
inregs.x.ax = 1;
int86(0x33,&inregs,&outregs);
return(0);
}
mousepress(int button,int *notimes,int *row,int *col) /*Key Pressed or not*/
{
union REGS inregs,outregs;
inregs.x.bx = button;
inregs.x.ax = 5;
int86(0x33,&inregs,&outregs);
*notimes = outregs.x.bx;
*row = outregs.x.dx ;
*col = outregs.x.cx;
}
graphstatus(int button,int *notimes,int *row,int *col) /*Key Pressed or not*/
{
union REGS inregs,outregs;
inregs.x.bx = button;
inregs.x.ax = 5;
int86(0x33,&inregs,&outregs);
*notimes = outregs.x.bx;
*row = outregs.x.dx;
*col = outregs.x.cx;
}
hide() /*Hide cursor*/
{
union REGS inregs,outregs;
inregs.x.ax = 2;
int86(0x33,&inregs,&outregs);
}
mouserelease(int button,int *notimes,int *row,int *col)
{
union REGS inregs,outregs;
inregs.x.bx = button;
inregs.x.ax = 6;
int86(0x33,&inregs,&outregs);
*notimes = outregs.x.bx;
*row = outregs.x.dx;
*col = outregs.x.cx;
}
mousestatus(int *row,int *col)
{
union REGS inregs,outregs;
inregs.x.ax=3;
int86(0x33,&inregs,&outregs);
*row = outregs.x.dx;
*col = outregs.x.cx;
}
initmouse()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
showmouseptr()
{
i.x.ax=1;
int86(0x33,&i,&o);
}
hidemouseptr()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
restrictmouseptr(int x1,int y1,int x2,int y2)
{
i.x.ax=7;
i.x.cx=x1;
i.x.dx=x2;
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=y1;
i.x.dx=y2;
int86(0x33,&i,&o);
}
getmousepos(int *button,int *x,int *y)
{
i.x.ax=3;
int86(0x33,&i,&o);
*button=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
}
changecursor(int *shape)
{
i.x.ax=9;
i.x.bx=0;
i.x.cx=0;
i.x.dx=(unsigned)shape;
segread(&s);
s.es=s.ds;
int86x(0x33,&i,&i,&s);
}
void outconcir(void)
{
union REGS i,o;
int x1,y1,x2,y2,x3,c;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
//y2=o.x.dx;
x3=x2-x1;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
for(c=0;c<=5;c++)
{
circle(x1,y1,x3);//draw line by first and second x and just one(first) y co-ordinate.
x3=x3+10;
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void td (int col,int width)
{
union REGS i,o;
int x1,y1,x2,y2,y3;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
y3=y2-y1;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
//if(width==3)
//{
setfillstyle(SOLID_FILL,col);
bar(x1+width,y1-57+width,x2+width,y2-57+width);
setfillstyle(SOLID_FILL,getbkcolor());
bar(x1,y1-57,x2,y2-57);
setcolor(col);
rectangle(x1,y1-57,x2,y2-57);
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(100);
}
void poscir(void)
{
union REGS i,o;
int x1,y1,x2,y2,x3,y3,c;
char ch;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
//y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
circle(x1,y1-57,x2-x1);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
while(1)
{
ch=getch();
if(ch==13)
{
x1=x1+10;
x2=x2+10;
y1=y1+10;
circle(x1,y1-57,x2-x1);
}
if(ch==27)
break;
}
delay(500);
}
void table(float hp,float vp)
{
union REGS i,o;
float x1,y1,x2,y2,x3,x4,x5,y3,y4,y5,c;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
x3=x2-x1;
x4=x3/hp;
x5=x4;
for(c=0;c<hp;c++)
{
line(x1+x4,y1-57,x1+x4,y2-57);
x4=x4+x5;
}
y3=y2-y1;
y4=y3/vp;
y5=y4;
for(c=0;c<vp;c++)
{
line(x1,y1-57+y4,x2,y1-57+y4);
y4=y4+y5;
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void horizline(void)
{
union REGS i,o;
int x1,y,x2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
line(x1,y-57,x2,y-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void stylehorizline(int style,int thick)
{
union REGS i,o;
int x1,y,x2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setlinestyle(style,1,thick);
line(x1,y-57,x2,y-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void bline(int color)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setcolor(color);
line(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void rec(int col)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setcolor(col);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void incontor(void)
{
union REGS i,o;
int x1,y1,x2,y2,x3,x4,x5,x6,x7;
int y3,y4,y5,y6,y7,x8,y8,out,c;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
x3=x2-x1;
y3=y2-y1;
if(x3>=10&&y3<=10)
out=1;
if(x3<=10&&y3>=10)
out=1;
if(x3<=10&&y3<=10)
out=1;
if(x3>10&&y3>10)
out=0;
x4=x3/2;
x5=x1+x4;
x6=x5-2;
x7=x6-x1;
x8=x7/5;
y4=y3/2;
y5=y1+y4;
y6=y5-2;
y7=y6-y1;
y8=y7/5;
while(1)
{
if(out==1)
break;
if(out==0)
{
if(x8>y8)
{
for(c=0;c<y8;c++)
{
rectangle(x1+5,y1-57+5,x2-5,y2-57-5);
x1=x1+5;
y1=y1+5;
x2=x2-5;
y2=y2-5;
}
break;
}
if(y8>x8)
{
for(c=0;c<x8;c++)
{
rectangle(x1+5,y1-57+5,x2-5,y2-57-5);
x1=x1+5;
y1=y1+5;
x2=x2-5;
y2=y2-5;
}
break;
}
if(x8==y8)
{
for(c=0;c<y8;c++)
{
rectangle(x1+5,y1-57+5,x2-5,y2-57-5);
x1=x1+5;
y1=y1+5;
x2=x2-5;
y2=y2-5;
}
break;
}
}
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void colincontor(int fill,int outline)
{
union REGS i,o;
int x1,y1,x2,y2,x3,x4,x5,x6,x7;
int y3,y4,y5,y6,y7,x8,y8,out,c;
out=getcolor();
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setfillstyle(SOLID_FILL,fill);
bar(x1,y1-57,x2,y2-57);
setcolor(outline);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
x3=x2-x1;
y3=y2-y1;
if(x3>=10&&y3<=10)
out=1;
if(x3<=10&&y3>=10)
out=1;
if(x3<=10&&y3<=10)
out=1;
if(x3>10&&y3>10)
out=0;
x4=x3/2;
x5=x1+x4;
x6=x5-2;
x7=x6-x1;
x8=x7/5;
y4=y3/2;
y5=y1+y4;
y6=y5-2;
y7=y6-y1;
y8=y7/5;
while(1)
{
if(out==1)
break;
if(out==0)
{
if(x8>y8)
{
for(c=0;c<y8;c++)
{
setfillstyle(SOLID_FILL,fill);
bar(x1+5,y1-57+5,x2-5,y2-57-5);
setcolor(outline);
rectangle(x1+5,y1-57+5,x2-5,y2-57-5);
x1=x1+5;
y1=y1+5;
x2=x2-5;
y2=y2-5;
}
break;
}
if(y8>x8)
{
for(c=0;c<x8;c++)
{
setfillstyle(SOLID_FILL,fill);
bar(x1+5,y1-57+5,x2-5,y2-57-5);
setcolor(outline);
rectangle(x1+5,y1-57+5,x2-5,y2-57-5);
x1=x1+5;
y1=y1+5;
x2=x2-5;
y2=y2-5;
}
break;
}
if(x8==y8)
{
for(c=0;c<y8;c++)
{
setfillstyle(SOLID_FILL,fill);
bar(x1+5,y1-57+5,x2-5,y2-57-5);
setcolor(outline);
rectangle(x1+5,y1-57+5,x2-5,y2-57-5);
x1=x1+5;
y1=y1+5;
x2=x2-5;
y2=y2-5;
}
break;
}
}
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
setcolor(out);
delay(500);
}
void outcontor(void)
{
union REGS i,o;
int x1,y1,x2,y2,c=0;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
if(x1>x2)
{
gotoxy(55,1);
printf("Error:Click left to right ");
gotoxy(55,2);
printf("on the screen ");
delay(3000);
gotoxy(55,1);
printf(" ");
gotoxy(55,2);
printf(" ");
}
if(x2>x1)
{
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
while(1)
{
rectangle(x1-5,y1-5-57,x2+5,y2-57+5);
x1=x1-5;
y1=y1-5;
x2=x2+5;
y2=y2+5;
c++;
if(c==5)
break;
}
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void blend(char side,int num,int outline,int back)
{
union REGS i,o;
int col,bac,x1,y1,x2,y2,c=0;
bac=getbkcolor();
col=getcolor();
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
if(x1>x2)
{
gotoxy(55,1);
printf("Error:Click left to right ");
gotoxy(55,2);
printf("on the screen ");
delay(3000);
gotoxy(55,1);
printf(" ");
gotoxy(55,2);
printf(" ");
}
if(x2>x1)
{
if(side=='r')
{
setfillstyle(SOLID_FILL,back);
bar(x1,y1-57,x2,y2-57);
setcolor(outline);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
while(1)
{
setfillstyle(SOLID_FILL,back);
bar(x1+5,y1-5-57,x2+5,y2-57-5);
setcolor(outline);
rectangle(x1+5,y1-5-57,x2+5,y2-57-5);
x1=x1+5;
y1=y1-5;
x2=x2+5;
y2=y2-5;
c++;
if(c==num-1)
break;
}
}
if(side=='u')
{
setfillstyle(SOLID_FILL,back);
bar(x1,y1-57,x2,y2-57);
setcolor(outline);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
while(1)
{
setfillstyle(SOLID_FILL,back);
bar(x1-5,y1-5-57,x2-5,y2-57-5);
setcolor(outline);
rectangle(x1-5,y1-5-57,x2-5,y2-57-5);
x1=x1-5;
y1=y1-5;
x2=x2-5;
y2=y2-5;
c++;
if(c==num)
break;
}
}
if(side=='l')
{
setfillstyle(SOLID_FILL,back);
bar(x1,y1-57,x2,y2-57);
setcolor(outline);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
while(1)
{
setfillstyle(SOLID_FILL,back);
bar(x1-5,y1+5-57,x2-5,y2-57+5);
setcolor(outline);
rectangle(x1-5,y1+5-57,x2-5,y2-57+5);
x1=x1-5;
y1=y1+5;
x2=x2-5;
y2=y2+5;
c++;
if(c==num)
break;
}
}
if(side=='d')
{
setfillstyle(SOLID_FILL,back);
bar(x1,y1-57,x2,y2-57);
setcolor(outline);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
while(1)
{
setfillstyle(SOLID_FILL,back);
bar(x1+5,y1+5-57,x2+5,y2-57+5);
setcolor(outline);
rectangle(x1+5,y1+5-57,x2+5,y2-57+5);
x1=x1+5;
y1=y1+5;
x2=x2+5;
y2=y2+5;
c++;
if(c==num)
break;
}
}
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
setcolor(col);
setbkcolor(bac);
delay(500);
}
void box(char side,int num,int color)
{
union REGS i,o;
int x1,y1,x2,y2,x3,y3,x4,y4,c=0;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
setcolor(color);
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
if(x1>x2)
{
gotoxy(55,1);
printf("Error:Click left to right ");
gotoxy(55,2);
printf("on the screen ");
delay(3000);
gotoxy(55,1);
printf(" ");
gotoxy(55,2);
printf(" ");
}
if(x2>x1)
{
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
if(side=='r')
{
//For up-right.
x3=x1+num;
y3=y1-num-57;
x4=x2+num;
y4=y2-57-num;
rectangle(x3,y3,x4,y4);
line(x1,y1-57,x3,y3);
line(x2,y2-57,x4,y4);
line(x1,y2-57,x3,y4);
line(x2,y1-57,x4,y3);
}
if(side=='u')
{
//For up-left
x3=x1-num;
y3=y1-num-57;
x4=x2-num;
y4=y2-57-num;
rectangle(x3,y3,x4,y4);
line(x1,y1-57,x3,y3);
line(x2,y2-57,x4,y4);
line(x1,y2-57,x3,y4);
line(x2,y1-57,x4,y3);
}
if(side=='d')
{
//For down-right.
x3=x1+num;
y3=y1+num-57;
x4=x2+num;
y4=y2+num-57;
rectangle(x3,y3,x4,y4);
line(x1,y1-57,x3,y3);
line(x2,y2-57,x4,y4);
line(x1,y2-57,x3,y4);
line(x2,y1-57,x4,y3);
}
if(side=='l')
{
//For down-left.
x3=x1-num;
y3=y1+num-57;
x4=x2-num;
y4=y2+num-57;
rectangle(x3,y3,x4,y4);
line(x1,y1-57,x3,y3);
line(x2,y2-57,x4,y4);
line(x1,y2-57,x3,y4);
line(x2,y1-57,x4,y3);
}
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void stylerec(int style,int thick)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setlinestyle(style,1,thick);
rectangle(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void fillrec(int col)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setfillstyle(SOLID_FILL,col);
bar(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void fillbar(int col,int fill)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setfillstyle(fill,col);
bar(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void erase(void)
{
union REGS i,o;
int x1,y1,x2,y2,col;
col=15;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setfillstyle(SOLID_FILL,col);
bar(x1,y1-57,x2,y2-57);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void cir(void)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
//y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
circle(x1,y1-57,x2-x1);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void circontor(void)
{
union REGS i,o;
int x1,y1,x2,y2,x3,c;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
//y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
x3=x2-x1;
for(c=0;c<=5;c++)
{
circle(x1,y1-57,x3);//draw line by first and second x and just one(first) y co-ordinate.
x3=x3+5;
}
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void fillcir(int col,int fill)
{
union REGS i,o;
int x1,y1,x2,y2;
o.x.bx=0;//Get button.
i.x.ax=3;//Getmousepos.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);
x1=o.x.cx;//get first x co-ordinate.
y1=o.x.dx;//get first y co-ordinate.
delay(500);
o.x.bx=0;//Get button.
while(o.x.bx==0)//If button is not depressed.
int86(0x33,&i,&o);//Here mean a delay for again mouse click.
x2=o.x.cx;//get second x co-ordinate.
//y2=o.x.dx;
i.x.ax=2;//hidemouseptr();
int86(0x33,&i,&o);
setfillstyle(fill,col);
fillellipse(x1,y1-57,x2-x1,x2-x1);//draw line by first and second x and just one(first) y co-ordinate.
i.x.ax=1;//showmouseptr();
int86(0x33,&i,&o);
delay(500);
}
void verline(void)
{
union REGS inh,outh;
int x1,y1,y2;
outh.x.bx=0;
inh.x.ax=3;
while(outh.x.bx==0)
int86(0x33,&inh,&outh);
x1=outh.x.cx;
y1=outh.x.dx;
delay(500);
outh.x.bx=0;
while(outh.x.bx==0)
int86(0x33,&inh,&outh);
y2=outh.x.dx;
inh.x.ax=2;
int86(0x33,&inh,&outh);
line(x1,y1-57,x1,y2-57);
inh.x.ax=1;
int86(0x33,&inh,&outh);
delay(500);
}
void ruler(void)
{
union REGS inh,outh;
int x1,y1,y2;
outh.x.bx=0;
inh.x.ax=3;
while(outh.x.bx==0)
int86(0x33,&inh,&outh);
x1=outh.x.cx;
y1=outh.x.dx;
inh.x.ax=2;
int86(0x33,&inh,&outh);
line(x1,y1-57,x1,getmaxy());
inh.x.ax=1;
int86(0x33,&inh,&outh);
delay(500);
}
void styleverline(int style,int thick)
{
union REGS inh,outh;
int x1,y1,y2;
outh.x.bx=0;
inh.x.ax=3;
while(outh.x.bx==0)
int86(0x33,&inh,&outh);
x1=outh.x.cx;
y1=outh.x.dx;
delay(500);
outh.x.bx=0;
while(outh.x.bx==0)
int86(0x33,&inh,&outh);
y2=outh.x.dx;
inh.x.ax=2;
int86(0x33,&inh,&outh);
inh.x.ax=1;
int86(0x33,&inh,&outh);
setlinestyle(style,1,thick);
line(x1,y1-57,x1,y2-57);
delay(500);
}
void clear(void)
{
gotoxy(51,1);
printf(" ");
gotoxy(51,2);
printf(" ");
gotoxy(1,3);
printf(" ");
}
DEB.H
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<dos.h>
#include<string.h>
#include<math.h>
#include<dir.h>
int ascii,scan;
union REGS in,out;
char far *vid_mem=0xb8000000L;
getkey( )
{
union REGS ii, oo ;
/* wait till a key is hit */
while ( ! kbhit( ) ) ;
ii.h.ah = 0 ; /* service number */
/* issue interrupt */
int86 ( 22, &ii, &oo ) ;
scan = oo.h.ah ;
ascii = oo.h.al ;
}
checkpass(char *pass,char c,int num)
{
int i=0;
char t[80],ch;
while(ch!=13)
{
getkey();
if(ascii!=0)
{
ch=ascii;
if(i<num&&ch>=33&&ch<=47)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=58&&ch<=65)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=91&&ch<=96)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=123&&ch<=126)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=97&&ch<=122)
{
printf("%c",c);
t[i]=ch;
i++;
}
if(i<num&&ch>=65&&ch<=90)
{
ch=ch+32;
printf("%c",c);
t[i]=ch;
i++;
}
if(i<num&&ch>=48&&ch<=57)
{
printf("%c",c);
t[i]=ch;
i++;
}
if(ch==8)
{
printf("\b");
t[i]='\0';
i--;
}
if(ch==13)
{
t[i]='\0';
break;
}
}
if(i>num)
{
sound(500);
delay(100);
nosound();
}
}
t[i]='\0';
if(!(strcmp(pass,t)))
return 1;
else
return 0;
}
char *stopget(int num)
{
int i=0;
char t[80],ch;
while(ch!=13)
{
getkey();
if(ascii!=0)
{
ch=ascii;
if(i<num&&ch>=33&&ch<=47)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=58&&ch<=65)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=91&&ch<=96)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=123&&ch<=126)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=97&&ch<=122)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=65&&ch<=90)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(i<num&&ch>=48&&ch<=57)
{
printf("%c",ch);
t[i]=ch;
i++;
}
if(ch==8)
{
printf("\b");
t[i]='\0';
i--;
}
if(ch==32)
{
printf(" ");
t[i]=ch;
i++;
}
if(ch==13)
{
t[i]='\0';
break;
}
}
if(i>num)
{
sound(500);
delay(100);
nosound();
}
}
t[i]='\0';
return(t);
}
void backborder(int col)
{
in.h.ah=0xb;
in.h.bh=0;
in.h.bl=col;
int86(0x10,&in,&out);
}
getdrives()
{
int save,disk,disks;
save = getdisk();
disks = setdisk(save);
printf("Available drives are: ");
for (disk = 0;disk < 26;++disk)
{
setdisk(disk);
if (disk == getdisk())
printf("%c: ", disk + 'A');
}
setdisk(save);
}
size ( int ssl, int esl )
{
union REGS i, o ;
i.h.ah = 1 ; /* service number */
i.h.ch = ssl ; /* starting scan line */
i.h.cl = esl ; /* ending scan line */
i.h.bh = 0 ; /* video page number */
/* issue interrupt for changing the size of the cursor */
int86 ( 16, &i, &o ) ;
}
printchar(char ch,int attr,int r,int c)
{
char far *vidmem=0xB8000000;
char far *v;
v=vidmem+r*160+c*2;
*v=ch;
v++;
*v=attr;
}
printtext(char *s,int attr,int r,int c)
{
while(*s)
{
printchar(*s,attr,r,c);
s++;
c++;
}
}
void mysetmode(int m)
{
union REGS i,o;
i.h.ah=0;
i.h.al=m;
int86(16,&i,&o);
}
//char far *vid_mem ;
int ascii, scan ;
/* sets video mode */
/* prepares the screen for popping up a menu */
hidecursor()
{
size(32,0);
}
showcursor()
{
size(6,7);
}
char *current_directory(char *path)
{
strcpy(path, "X:\\"); /* fill string with form of response: X:\ */
path[0] = 'A' + getdisk(); /* replace X with current drive letter */
getcurdir(0, path+3); /* fill rest of string with current directory */
return(path);
}
void curdir(void)
{
char curdir[MAXPATH];
current_directory(curdir);
printf("The current directory is %s\n", curdir);
}
void uptolow(char w[80])
{
int i;
for(i=0;w[i]!='\0';i++)
{
if((w[i]>=65)&&(w[i]<=90))
printf("%c",w[i]+32);
else
printf("%c",w[i]);
}
}
void lowtoup(char w[80])
{
int i;
for(i=0;w[i]!='\0';i++)
{
if((w[i]>=97)&&(w[i]<=122))
printf("%c",w[i]-32);
else
printf("%c",w[i]);
}
}
void peekchar(char w[80], int take, int num)
{
int i,j=0,k,c=0,co=0,count=0;
char temp[80];
for (k=0;w[k]!='\0';k++)
count++;
if(take>count)
printf("%s",w);
else
{
printf("%c",w[take-1]);
c=1;
for(i=take;w[i]!='\0';i++)
{
c++;
if(c<=num)
printf("%c",w[i]);
}
}
}
copy(char fn[80], char fnt[80])
{
FILE *fs,*ft;
char ch;
fs=fopen(fn,"r");
if(fs==NULL)
perror("Checked if the sourse file is present there");
else
{
ft=fopen(fnt,"w");
if(fs==NULL)
perror(" The destination may be incorrect.");
else
{
while(4)
{
ch=fgetc(fs);
if(ch==EOF)
break;
else
fputc(ch,ft);
}
}
fclose(fs);
fclose(ft);
}
}
MYPAINT.H
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
#include<string.h>
m()
{
union REGS i,o;
i.x.ax=0;
int86(51,&i,&o);
return 0;
}
changemp(int i1,int j1)
{
union REGS i,o;
i.x.ax=4;
i.x.cx=i1;
i.x.dx=j1;
int86(51,&i,&o);
return 0;
}
hidemp()
{
union REGS i,o;
i.x.ax=2; int86(51,&i,&o);
return 0;
}
showmp()
{
union REGS i,o;
i.x.ax=1;
int86(51,&i,&o);
return 0;
}
getmstat(int *b,int *x,int *y)
{
union REGS i,o;
i.x.ax=3;
int86(51,&i,&o);
*b=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
return 0;
}
/* graphics function*/
win(char caption[80],int x1,int y1,int x2,int y2)
{
setlinestyle(0,1,1);
setfillstyle(1,7);
bar(x1,y1,x2,y2);
setcolor(WHITE);
line(x1,y1,x2,y1);
line(x1,y1,x1,y2);
setcolor(0);
line(x1,y2,x2,y2);
line(x2,y1,x2,y2);
setfillstyle(1,1);
bar(x1+1,y1+1,x2-1,y1+20);
setcolor(15);
outtextxy(x1+8,y1+6,caption);
return 0;
}
form(char caption[80])
{
win(caption,0,0,640,480);
setfillstyle(1,15);
bar(0,20,640,480);
button(620,3,635,18,"X");
button(600,3,615,18,"?");
}
button(int x1,int y1,int x2,int y2,char s[30])
{
int t1,t2,k=0,i;
setlinestyle(0,1,1);
for(i=0;i<strlen(s);i++)
k=k+4;
t1=(x2-x1)/2+x1-k;
t2=(y2-y1)/2+y1;
unpress(x1,y1,x2,y2);
settextstyle(0,0,0);
outtextxy(t1,t2,s);
return 0;
}
unpress(int x1,int y1,int x2,int y2)
{
setlinestyle(0,1,1);
setfillstyle(1,7);
bar(x1,y1,x2,y2);
setcolor(WHITE);
line(x1,y1,x2,y1);
line(x1,y1,x1,y2);
setcolor(0);
line(x1,y2,x2,y2);
line(x2,y1,x2,y2);
return 0;
}
press(int x1,int y1,int x2,int y2)
{
setlinestyle(0,1,1);
setfillstyle(1,7);
bar(x1,y1,x2,y2);
setcolor(0);
line(x1,y1,x2,y1);
line(x1,y1,x1,y2);
setcolor(WHITE);
line(x1,y2,x2,y2);
line(x2,y1,x2,y2);
return 0;
}
/*objects and events*/
click(int x1,int y1,int x2,int y2,char s[30])
{
int b,x,y;
int t1,t2,k=0,i,j;
setlinestyle(0,1,1);
for(i=0;i<strlen(s);i++)
k=k+4;
t1=(x2-x1)/2+x1-k;
t2=(y2-y1)/2+y1;
getmstat(&b,&x,&y);
if( (x>x1 && x<x2) && (y>y1 && y<y2) && b==1)
{
hidemp();
press(x1,y1-57,x2,y2-57);
setcolor(0);
settextstyle(0,0,0);
outtextxy(t1+2,t2+2-57,s);
showmp();
while((b==1))
getmstat(&b,&x,&y);
hidemp();
unpress(x1,y1-57,x2,y2-57);
settextstyle(0,0,0);
outtextxy(t1,t2-57,s);
for(i=50;i<500;i=i+50)
{
delay(10);
sound(i+200);
}
showmp();
nosound();
return 0;
}
else return 1;
}
help()
{
win("HELP",120,100,500,400);
tbox(130,145,490,360);
setcolor(0);
settextstyle(0,0,0);
outtextxy(140,180," Welcome to online help");
outtextxy(140,210,"This is my biggest time pass beleive");
outtextxy(140,230,"me i am not that bad programmer");
outtextxy(140,250,"I hope u dont need any help to play");
outtextxy(140,270,"the game .About virus it is really not");
outtextxy(140,290,"harming any hardware part but in its next");
outtextxy(140,310,"version it will defintely.You will be able");
outtextxy(140,330,"to program the game in this package");
outtextxy(140,350,"JUST WAIT FOR NEXT VERSION....");
button(280,370,330,390,"Close");
return 0;
}
tbox(int x1,int y1,int x2,int y2)
{
setlinestyle(0,1,1);
setfillstyle(1,WHITE);
bar(x1,y1,x2,y2);
setcolor(0);
line(x1,y1,x2,y1);
line(x1,y1,x1,y2);
setcolor(WHITE);
line(x1,y2,x2,y2);
line(x2,y1,x2,y2);
return 0;
}
cleararea(int left,int top,int right,int bottom)
{
int col;
col=getbkcolor();
setfillstyle(1,col);
bar(left,top,right,bottom);
}
fillarea(int left,int top,int right,int bottom)
{
int col;
col=15;
setfillstyle(1,col);
bar(left,top,right,bottom);
}
void fillobj(int color)
{
union REGS inf,outf;
int c,d;
setfillstyle(1,color);
//while(!kbhit())
//{
outf.x.bx=0;
inf.x.ax=3;
while(outf.x.bx==0&&!kbhit())
int86(0x33,&inf,&outf);
//if(outf.x.bx!=1)
// break;
c=outf.x.cx;
d=outf.x.dx;
inf.x.ax=2;
int86(0x33,&inf,&outf);
floodfill(c+2,d-57+2,color);
inf.x.ax=1;
int86(0x33,&inf,&outf);
//}
}
void getstring(char *input)
{
int std=0,oc;
char ch,out[2];
int xval[255];
out[1]=0;
xval[0]=getx();
do
{
//cursor(ON);
ch=getch();
//cursor(OFF);
if(ch==0)
getch();
else
{
if(ch==8)
{
oc=getcolor();
--std;
if(std<0)
std=0;
moveto(xval[std],gety());
setcolor(getbkcolor());
out[0]=input[std];
outtext(out);
moveto(xval[std],gety());
setcolor(oc);
}
else
{
input[std]=ch;
out[0]=ch;
outtext(out);
++std;
xval[std]=getx();
}
}
}while(ch!=13&&ch!=10);
input[std]=0;
}
void writetext(int back)
{
union REGS in2,out2,i1,o1,i2,o2;
char k[30],i,p,q,flag,size=1,style=0;
i1.x.ax=3;
int86(0x33,&i1,&o1);
i2.x.ax=2;
int86(0x33,&i2,&o2);
for(i=0;1;i++)
{
flag=0;
while(!kbhit());
in2.h.ah=0;
int86(0x16,&in2,&out2);
if(out2.h.ah==28)
break;
if(out2.h.ah==14)
{
i--;
for(p=0;p<=8*size;p++)
for(q=0;q<=10*size;q++)
putpixel(o1.x.cx+8*size*i+p-16*size,o1.x.dx+q,back);
i--;
k[0]=' ';
flag=1;
}
if(out2.h.ah>60 && out2.h.ah<69)
{
size=out2.h.ah-58;
settextstyle(style,0,out2.h.ah-58);
/*settextstyle(1,2,out2.h.ah-58);*/
}
if(out2.h.ah>93 && out2.h.ah<104)
{
style=out2.h.ah-94;
settextstyle(style,0,out2.h.ah-58);
}
if(flag!=1)
k[0]=out2.h.al;
k[1]='\0';
outtextxy(o1.x.cx+8*i*size-16*size,o1.x.dx,k);
}
settextstyle(0,0,1);
i2.x.ax=1;
int86(0x33,&i2,&o2);
}
Lastly ZOOM.H
/*
****************************************************************************
Zoom 30x30 pixels area
It can Zoom an area of 30x30 pixels or more.Not complicated just get
pixel color and put a bar of that color to show zoom.If you found this
useful email me.
By:
NEERAJ SHARMA
n21@indiatimes.com
/***************************************************************************
*/
#include <dos.h>
//#include<debmedia.h>
#include <conio.h>
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
//**************************************************************************
union REGS i,o;
char *text="Zomming !";
int but,x,y;
int pvx,pvy,range;
void setscreen();
void fillgrid(int gx,int gy);
void zoom();
int initmouse2();
void showmouse();
void hidemouse();
void restrictmouse(int x1,int y1,int x2,int y2);
void getmouse(int *button,int *x,int *y);
void zoomwin(int sx,int sy,int ex,int ey,int ck);
void winp(int sx,int sy,int ex,int ey,int state);
//**************************************************************************
/*void main()
{
setscreen();
//graph();
zoom();
getch();
closegraph();
} */
//**************************************************************************
void setscreen()
{
int d=DETECT,m;
pvx=20;pvy=40;range=4;
initgraph(&d,&m,"");
restrictmouse(195,10,600,440);
setfillstyle(1,15);
bar(0,0,640,480);
zoomwin(pvx-20,pvy-30,pvx+34*range,pvy+34*range,1);
winp(pvx-2,pvy-2,pvx+30*range+2,pvy+30*range+2,1);
setcolor(9);
settextstyle(2,0,4);
outtextxy(230,30,"Zoom Area of 30x30 pixels !");
setcolor(10);
settextstyle(4,0,4);
outtextxy(210,50,"Zoom Area of 30x30 pixels !");
setcolor(12);
settextstyle(5,0,4);
outtextxy(210,90,"Zoom Area of 30x30 pixels !");
setcolor(13);
settextstyle(6,0,3);
outtextxy(210,150,"Move this rectangle to see selected area !");
for(d=0;d<=15;d++)
{
setcolor(d);
line(210,250+d,610,250+d);
}
setcolor(2);
settextstyle(7,0,3);
outtextxy(230,290,"Programming By :-");
setcolor(9);
outtextxy(250,340,"Debasis Bhattacharjee");
for(d=0;d<=15;d++)
{
setcolor(d);
line(210,430+d,610,430+d);
}
}
//**************************************************************************
void ZoomIt(int gx,int gy)
{
int i,j,c=0,r=0;
for(i=1;i<=30;i++)
{
for(j=1;j<=30;j++)
{
setfillstyle(1,getpixel(gx+j,gy+i));
bar(pvx+c,pvy+r,pvx+range+c,pvy+range+r);
c+=range;
}
r+=range;
c=0;
}
}
//**************************************************************************
void zoom()
{
int ox,oy,x_pos,y_pos,wa;
hidemouse();
setwritemode(1);
while(1)
{
if(kbhit()) if(getch()==27) {showmouse();break;}
getmouse(&but,&x,&y);
setcolor(14);
rectangle(x-1,y-1,x+31,y+31);
ox=x;
oy=y;
ZoomIt(x,y);
while(ox==x && oy==y)
{
getmouse(&but,&x,&y);
if((but & 1)==1) break;
}
setcolor(14);
rectangle(ox-1,oy-1,ox+31,oy+31);
}
setwritemode(0);
}
//**************************************************************************
// Mouse functions
//**************************************************************************
int initmouse2()
{
i.x.ax=0;
int86(0x33,&i,&o);
return(o.x.ax);
}
void showmouse()
{ i.x.ax=1;
int86(0x33,&i,&o);
}
void hidemouse()
{
i.x.ax=2;
int86(0x33,&i,&o);
}
void restrictmouse(int x1,int y1,int x2,int y2)
{
i.x.ax=7;
i.x.cx=x1;
i.x.dx=x2;
int86(0x33,&i,&o);
i.x.ax=8;
i.x.cx=y1;
i.x.dx=y2;
int86(0x33,&i,&o);
}
void getmouse(int *button,int *x,int *y)
{
i.x.ax=3;
int86(0x33,&i,&o);
*button=o.x.bx;
*x=o.x.cx;
*y=o.x.dx;
}
//**************************************************************************
void zoomwin(int sx,int sy,int ex,int ey,int ck)
{
setfillstyle(1,7);
bar(sx,sy,ex,ey);
setfillstyle(1,7);
setcolor(15);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
setcolor(0);
line(ex,sy,ex,ey);
line(ex,sy,ex,ey);
line(sx,ey,ex,ey);
line(sx,ey,ex,ey);
if(ck==1)
{
settextstyle(0,0,0);
setfillstyle(1,1);
bar(sx+2,sy+2,ex-2,sy+17);
setcolor(15);
outtextxy(sx+4,sy+4,text);
//for x
setfillstyle(1,7);
bar(ex-15,sy+4,ex-4,sy+15);
setcolor(15);
line(ex-15,sy+4,ex-4,sy+4);
line(ex-15,sy+4,ex-15,sy+15);
setcolor(0);
line(ex-15,sy+15,ex-4,sy+15);
line(ex-4,sy+4,ex-4,sy+15);
setcolor(1);
outtextxy(ex-13,sy+5,"x");
setfillstyle(1,7);
}
}
//**************************************************************************
void winp(int sx,int sy,int ex,int ey,int state)
{
hidemouse();
if(state==1)
{
setcolor(0);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
setcolor(15);
line(ex,sy,ex,ey);
line(ex,sy,ex,ey);
line(sx,ey,ex,ey);
line(sx,ey,ex,ey);
}
else
{
setcolor(15);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
line(sx,sy,sx,ey);
line(sx,sy,ex,sy);
setcolor(0);
line(ex,sy,ex,ey);
line(ex,sy,ex,ey);
line(sx,ey,ex,ey);
line(sx,ey,ex,ey);
}
showmouse();
}
//**************************************************************************
//**************************************************************************