1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#include <iostream.h>
#include <graphics.h>
#include <dos.h>
union REGS in,out;
void showMouse(){
in.x.ax=1;
int86(0x33,&in,&out);
}
void getMousePos(int &x,int &y){
in.x.ax=3;
int86(0x33,&in,&out);
if(out.x.bx==1){
x=out.x.cx;
y=out.x.dx;
delay(1);
}
}
int menu(){
int color;
cout<<"\nSelect color of brush:"<<endl;
cout<<"1.Dark Blue\n2.Green\n3.Light Blue\n4.Red\n5.Pink\n6.Orange\n7.White\n8.Grey\n9.Purple\n10.Lime Green"<<endl;
cout<<"Your Choice:";
cin>>color;
return color;
}
void main(){
int gd=DETECT,gm,x,y,color;
initgraph(&gd,&gm,"C:\\TurboC3\\BGI");
color=menu();
showMouse();
cleardevice();
while(!kbhit()){
getMousePos(x,y);
putpixel(x,y,color);
}
closegraph();
}
|