void shakil:: mixed() { tm=0;ne2=0; cleardevice(); showmouseptr(); settextstyle(1,0,1); show(); while(1) {getmousepos(&button,&x,&y); if((button & 1)==1) {cal(); resu(); show(); if(x>=470&&x<=520) {if(y>=370&&y<=390) {ne2=10; break; } if(y>=270&&y<=290) {save1(); } } } if(result==10) {settextstyle(1,0,10); outtextxy(50,100,"YOU WIN"); delay(1000); getch(); break; } } hidemouseptr(); result=0; cleardevice(); showmouseptr(); }
void user_poly() { int inix,iniy,curx1,cury1,curx2,cury2; int mousex,mousey,button; getmousepos(&button,&mousex,&mousey); inix=mousex; iniy=mousey; curx1=inix; cury1=iniy; for(;button!=2;getmousepos(&button,&mousex,&mousey)) { if(button==1) { curx2=mousex; cury2=mousey; //printf("%d %d\n",mousex,mousey); hidemouseptr(); array_line_entry(curx1,cury1,curx2,cury2); bresline(curx1,cury1,curx2,cury2,1); showmouseptr(); curx1=curx2; cury1=cury2; delay(200); } } hidemouseptr(); array_line_entry(curx1,cury1,inix,iniy); bresline(curx1,cury1,inix,iniy,1); showmouseptr(); }
int main() { int count = 1, gDriver = DETECT, gMode; initgraph(&gDriver, &gMode, "C\\:tc\\bgi"); i.x.ax = 0; int86(0X33, &i, &o); if (o.x.ax == 0) { printf("ntMouse Support is Unavailable !!"); } else { showmouseptr(); while (count <= 10) { getch(); count++; if (count % 2 == 0) hidemouseptr(); else showmouseptr(); } } getch(); return 0; }
int changepassword() { cleardevice(); outer_function_screen("CHANGE PASSWORD"); draw_button(225,225,395,255,1,"Administrator"); draw_button(225,285,395,315,1,"Customer"); draw_button(225,345,395,375,1,"Exit"); showmouseptr(); while(1) { showmouseptr(); getmousepos(&button,&corx,&cory); if((button&1)==1) { if((corx>225&&corx<395)&&(cory>225&&cory<255)) { hidemouseptr(); return(ch_pass(0)); } if((corx>225&&corx<395)&&(cory>285&&cory<315)) { hidemouseptr(); return(ch_pass(1)); } if((corx>225&&corx<395)&&(cory>345&&cory<375)) { hidemouseptr(); closegraph(); exit(0); } } } }
void user_save() { int a,b,w,px,i=-1; char filename[60],ch; restrictmouseptr(0,0,xmax,20); hidemouseptr(); a=textwidth("Enter File Name"); setfillstyle(1,BLUE); bar(0,0,xmax,20); setcolor(BLACK); outtextxy(10,5,"Enter File Name:"); setfillstyle(1,WHITE); bar((a+10),2,(a+410),18); setfillstyle(1,CYAN); a=textwidth("No"); bar((xmax-10-a),2,(xmax-10),18); b=a+10+textwidth("Save"); bar((xmax-10-b),2,(xmax-20-a),18); setcolor(BLACK); outtextxy((xmax-9-b),3,"Save"); outtextxy((xmax-9-a),3,"No"); px=textwidth("Enter File Name")+10; while(1) { ch=get_filename(px,4); if(ch==13||ch==27) break; w=textwidth("A"); px+=w; filename[++i]=ch; } filename[++i]='\0'; showmouseptr(); for(;;) { getmousepos(&button,&mousex,&mousey); if(mousex>(xmax-10-a)&&mousex<(xmax-10)&&button==1) //deny loading/saving { button_hover((xmax-10-a),2,(xmax-10),18); hidemouseptr(); initmouse(); top_panel_default(); top_panel_buttons(tool_but_num,0,1); showmouseptr(); break; } else if(mousex>(xmax-10-b)&&mousex<(xmax-20-a)&&button==1) //confirm loading/saving { button_hover((xmax-10-b),2,(xmax-20-a),18); save_bitmap(filename); hidemouseptr(); initmouse(); top_panel_default(); top_panel_buttons(tool_but_num,0,1); showmouseptr(); break; } } }
void edge::onclick() { setfillstyle(SOLID_FILL,YELLOW); setcolor(RED); hidemouseptr(); bar(101,460,199,478); char *a="edge"; outtextxy(120,463,a); showmouseptr(); setfillstyle(SOLID_FILL,RED); while(flag==1) { getmousepos(); if(button==1&&x<639&&x>0&&y<459&&y>0&&edgenum<30) //if you click on workspace { a1=x; b1=y; while(flag==1) // waits for second click { getmousepos(); if(button==1&&x!=a1&&y!=b1) { a2=x; b2=y; break; } //takes second point when you click } // while end edgenum++; hidemouseptr(); givemid(a1,b1,a2,b2); //gives centers of two points if(givemid(a1,b1,a2,b2)==1&&edge::checkedge(x1,y1,x2,y2)==1) //condition false if you click outside the points { edge::display(x1,y1,x2,y2); //displays an edge } x1=y1=x2=y2=0; showmouseptr(); break; } //if end } // while end setfillstyle(SOLID_FILL,1); setcolor(15); hidemouseptr(); bar(101,460,199,478); outtextxy(120,463,a); showmouseptr(); setfillstyle(SOLID_FILL,RED); }
void drawSpiral() { int b, sx, sy, ex, ey, px, py; int c=cur_color; float r; setdrawmode(XOR_MODE); getmousepos(&b,&sx,&sy); set_color(15-c); ex = px = sx;ey = py = sy; if(b==1) hidemouseptr(); while(b == 1) { if(px != ex || py != ey) { set_color(cur_color); spiral((px+sx)/2, (py+sy)/2, r); px = ex; py = ey; r = (sx<px)?(px-sx)/2:(sx-px)/2; spiral((px+sx)/2, (py+sy)/2, r); } getmousepos(&b,&ex,&ey); } set_color(c); setdrawmode(COPY_MODE); r = (sx<px)?(px-sx)/2:(sx-px)/2; spiral((px+sx)/2, (py+sy)/2, r); showmouseptr(); }
void rem_account() { cleardevice(); outer_function_screen("REMOVE ACCOUNT"); draw_button(220,225,425,255,1,"Remove Account"); draw_button(220,285,425,315,1," EXIT"); showmouseptr(); while(1) { getmousepos(&button,&corx,&cory); if((button&1)==1) { if((corx>220&&corx<425)&&(cory>225&&cory<255)) { hidemouseptr(); rm_menu(); return; } if((corx>220&&corx<425)&&(cory>285&&cory<315)) { hidemouseptr(); showadminmenu(); exit(0); } } } }
void save_bitmap(const char *filename) { int r,be; r = access(filename,0); if( r == 0) { top_message("file already exists,Overwriting"); } hidemouseptr(); top_panel_default(); setcolor(RED); outtextxy(200,3,"Please Wait"); prgx=1; setcolor(BLACK); rectangle(0,2,ymax,18); be = writeBitmapFile(0,0,filename); showmouseptr(); if( be != 0) { top_message("Error While Creating File"); return; } else { top_message("File saved successfully"); } return; }
void drawEllipse() { int b, sx, sy, ex, ey, px, py; int c=cur_color; float r1=0,r2=0; setdrawmode(XOR_MODE); getmousepos(&b,&sx,&sy); set_color(15-c); ex = px = sx;ey = py = sy; if(b==1) hidemouseptr(); while(b == 1) { getmousepos(&b,&ex,&ey); if(px != ex || py != ey) { bellipse((px+sx)/2, (py+sy)/2, r1, r2); px = ex;py = ey; r1 = (sx<px)?(px-sx)/2:(sx-px)/2; r2 = (sy<py)?(py-sy)/2:(sy-py)/2; bellipse((px+sx)/2, (py+sy)/2, r1, r2); } } r1 = (sx<px)?(px-sx)/2:(sx-px)/2; r2 = (sy<py)?(py-sy)/2:(sy-py)/2; set_color(c); setdrawmode(COPY_MODE); bellipse((px+sx)/2, (py+sy)/2,r1, r2); showmouseptr(); }
void drawRectangle() { int b, sx, sy, ex, ey, px, py; int c=cur_color; int x1=0,y1=0,x2=0,y2=0; setdrawmode(XOR_MODE); getmousepos(&b, &sx, &sy); set_color(15-c); ex = px = sx, ey = py = sy; if(b==1) hidemouseptr(); while(b == 1) { getmousepos(&b, &ex, &ey); if(px != ex || py != ey) { drawRect(sx, sy, px, py); drawRect(sx, sy, ex, ey); px = ex, py = ey; x1=sx;y1=sy; x2=ex;y2=ey; } } set_color(c); setdrawmode(COPY_MODE); array_line_entry(x1,y1,x2,y1); array_line_entry(x1,y1,x1,y2); array_line_entry(x2,y1,x2,y2); array_line_entry(x1,y2,x2,y2); drawRect(x1, y1, x2, y2); showmouseptr(); }
void drawThickLine(int op) { int b, sx, sy, ex, ey, px, py; int c=cur_color; int x1=-1,y1=-1,x2=-1,y2=-1; setdrawmode(XOR_MODE); getmousepos(&b,&sx,&sy); set_color(15-c); ex = px = sx; ey = py = sy; if(b==1) hidemouseptr(); while(b==1) { getmousepos(&b, &ex, &ey); if(px != ex || py != ey) { thickline(sx, sy, px, py,op); thickline(sx, sy, ex, ey,op); px = ex; py = ey; x1=sx;y1=sy; x2=ex;y2=ey; } } set_color(c); setdrawmode(COPY_MODE); thickline(x1, y1, x2, y2,op); showmouseptr(); }
void editor_init(void) { Text *txt = text_load(NULL); vga_init(); print_init(); view_main_window(); editor.root = GetMenu(CHINESE); if(!(editor.root)){ messagebox_manager("load menu failed."); getch(); text_free(txt); exit(1); } view_main_menu(editor.root); if(!txt){ messagebox_manager("open empty file failed."); } editor.cli = clipborad_init(); initmouse(); fprintf(stderr,"logging...\n"); showmouseptr(); editor.txt = txt; editor.mode = MENU; }
void main() { int gd=DETECT, gm, maxx, maxy, x, y, button; initgraph(&gd, &gm, "c:/tc/bgi"); maxx=getmaxx(); maxy=getmaxy(); rectangle(0,56,maxx,maxy); setviewport(1,57,maxx-1,maxy-1,1); gotoxy(26,1); printf("DEMONSTRATION : MOUSE IN C"); gotoxy(28,2); printf("BY: OSHO PRAKASH GIRI"); if(initmouse()==0) { closegraph(); restorecrtmode(); printf("\nMOUSE DRIVER NOT LOADED"); exit(); } restrictmouseptr(1,57,maxx-1,maxy-1); showmouseptr(); getch(); }
void main() { int gdriver=DETECT,gmode; int i,a,b,c,d,status,temp=0; clrscr(); initgraph(&gdriver,&gmode,"C:\\TC\\BGI "); line(320,100,310,110); line(310,110,310,120); line(310,120,320,130); line(320,130,330,120); line(330,120,330,110); line(330,110,320,100); a=310; b=120; c=320; d=130; left(a,b,c,d); showmouseptr(); status=initmouse(); while(!kbhit()) { showmouseptr(); again : getmouse(&x,&y,&click); if(click==1) { temp=temp+1; if(temp%2==0) { setfillstyle(SOLID_FILL,RED); floodfill(x,y,WHITE); delay(500); } else { setfillstyle(SOLID_FILL,BLUE); floodfill(x,y,WHITE); delay(500); } } } getch(); }
void enter() { while(1) { if(successfullogin==1) break; show_close_button(); showmouseptr(); getmousepos(&button,&x,&y); if((button&1)==1) { corx=x; cory=y; if((corx>170&&corx<280)&&(cory>250&&cory<290)) { setcolor(WHITE); line(170,290,280,290); line(280,250,280,290); setcolor(DARKGRAY); line(170,250,280,250); line(170,250,170,290); delay(125); hidemouseptr(); resetloginform(); login(); } else if((corx>310&&corx<430)&&(cory>250&&cory<290)) { hidemouseptr(); setcolor(WHITE); line(310,290,430,290); line(430,250,430,290); setcolor(DARKGRAY); line(310,250,430,250); line(310,250,310,290); delay(125); f1=fopen("admin","r"); rewind(f1); fread(&admin,sizeof(admin),1,f1); if((strcmp(admin.loginid,loginid)==0) && (strcmp(admin.password,password)==0)) { successfullogin=1; return; } else { show_err("Wrong LoginID or Password"); resetloginform(); login(); } } else if((corx>618&&corx<630)&&(cory>8&&cory<20)) { show_exit_message(); delay(500); exit(0); } } } }
void main() { int gd=DETECT,gm,maxx,maxy,x,y,button,prevx,prevy; initgraph(&gd,&gm,"d:\\tc\\bgi"); printf("Freehand drawing with the mouse"); maxx=getmaxx(); maxy=getmaxy(); rectangle(0,0,maxx,maxy); setviewport(1,1,maxx-1,maxy-1,1); if(initmouse()==0) { closegraph(); restorecrtmode(); printf("Mouse driver not loaded"); exit(1); } restrictmouseptr(1,1,maxx-1,maxy-1); showmouseptr(); while(!kbhit()) { getmousepos(&button,&x,&y); if((button & 1)==1) { hidemouseptr(); prevx=x; prevy=y; while((button & 1)==1) { line(prevx,prevy,x,y); prevx=x; prevy=y; getmousepos(&button,&x,&y); } showmouseptr(); } } }
int user_new() { int a,b; restrictmouseptr(0,0,xmax,20); hidemouseptr(); a=textwidth("This Action will erase current drawing, Continue?")+10; setfillstyle(1,BLUE); bar(0,0,xmax,20); settextstyle(0,0,1); setcolor(BLACK); outtextxy(10,5,"This Action will erase current drawing, Continue?"); setfillstyle(1,CYAN); bar((a+18),1,(a+18+textwidth("Ya")+2),18); outtextxy((a+20),5,"Ya"); b=a+textwidth("Ya")+10; bar((b+18),1,(b+18+textwidth("Na")+2),18); outtextxy((b+20),5,"Na"); showmouseptr(); for(;;) { getmousepos(&button,&mousex,&mousey); if(mousex>(a+20)&&mousex<b+10&&button==1) //new confirm { hidemouseptr(); initmouse(); draw_canvas_default(); top_panel_default(); top_panel_buttons(tool_but_num,0,1); showmouseptr(); arrcnt=-1; return 1; } else if(mousex>b+20&&mousex<(b+36)&&button==1) //deny new { hidemouseptr(); initmouse(); top_panel_default(); top_panel_buttons(tool_but_num,0,1); showmouseptr(); return 0; } } }
void button_click(int x1,int y1,int x2,int y2) { hidemouseptr(); setcolor(BLACK); line(x1,y2,x1,y1); line(x1,y1,x2,y1); setcolor(WHITE); line(x2,y1,x2,y2); line(x2,y2,x1,y2); showmouseptr(); delay(200); }
void main() {int gd=DETECT,gm; initgraph(&gd,&gm,"G:\\install\\tc\\bgi"); restrictmouseptr(0,0,710,710); showmouseptr(); shakil sa; sa.first(); closegraph(); }
void top_message(char *message) { top_panel_default(); restrictmouseptr(0,0,xmax,20); hidemouseptr(); setcolor(BLACK); outtextxy(10,3,message); showmouseptr(); for(;;) { getmousepos(&button,&mousex,&mousey); if(mousex>619&&button==1) { hidemouseptr(); button_hover((xmax-13),4,(xmax-4),11); initmouse(); showmouseptr(); return; } } }
void drawSpray() { int b,sx,sy; getmousepos(&b,&sx,&sy); if(b==1) hidemouseptr(); while(b==1) { getmousepos(&b,&sx,&sy); spray(sx,sy,cur_color); } showmouseptr(); }
void node::onclick() { setfillstyle(SOLID_FILL,YELLOW); setcolor(RED); hidemouseptr(); bar(1,460,99,478); char *a="node"; outtextxy(20,463,a); showmouseptr(); setfillstyle(SOLID_FILL,RED); while(flag==1) { getmousepos(); if(button==1&&x<639&&x>0&&y<459&&y>0&&nodenum<30&&(node::check(x,y)==1)) //if you click on workspace { nodenum++; n[nodenum].id=nodenum; // n[nodenum].name n[nodenum].x=x; n[nodenum].y=y; hidemouseptr(); node::display(x,y,nodenum); // a node will be displayed showmouseptr(); break; } if(nodenum>=30||(button==1&&(node::check(x,y)==0)))//if node is present { break; } } setfillstyle(SOLID_FILL,1); setcolor(15); hidemouseptr(); bar(1,460,99,478); outtextxy(20,463,a); showmouseptr(); setfillstyle(SOLID_FILL,RED); }
void main() { int gdriver = DETECT, gmode; initgraph(&gdriver, &gmode, "\\tc\\bgi"); cleardevice(); king("ch1"); int Mstatus = initmouse(); int button,m,n; if(Mstatus == 0 ) outtextxy(50,50, "Mouse Support Not Available"); settextstyle(2,0,4); while(1) { showmouseptr(); getmousepos(&button,&m,&n); if(m>245 && m<325 && n>220 && n<232) { setcolor(RED); outtextxy(250,220,"PLAYER vs PLAYER"); } else { setcolor(WHITE); outtextxy(250,220,"PLAYER vs PLAYER"); if(m>245 && m<325 && n>240 && n<252) { setcolor(RED); outtextxy(250,240,"CHESS PUZZLES"); } else { setcolor(WHITE); outtextxy(250,240,"CHESS PUZZLES"); if(m>245 && m<325 && n>260 && n<272) { setcolor(RED); outtextxy(250,260,"BACK"); } else { setcolor(WHITE); outtextxy(250,260,"BACK"); }}} if(button == 1) { if(m>245 && m<325 && n>220 && n<232) { hidemouseptr(); video(450,150); createnewfile(); spawnl(P_WAIT,"load.exe", NULL); // load spawnl(P_WAIT,"chess.exe", NULL); // player vs player cleardevice(); king("ch1"); } if(m>245 && m<325 && n>240 && n<252) { hidemouseptr(); video(450,150); spawnl(P_WAIT,"menu6.exe", NULL); } // chess puzzles menu // exit(0); } if(m>245 && m<325 && n>260 && n<272) { hidemouseptr(); video(450,150); // spawnl(P_WAIT,"g:\\exe\\menu1.exe", NULL); // back to main menu break; }}}}
void top_panel_background() { int back_arrow[16]={2,10,10,18,10,15,17,15,17,5,10,5,10,2,2,10}; hidemouseptr(); setfillstyle(1,BLUE); bar(0,0,xmax,20); setfillstyle(1,GREEN); fillpoly(8,back_arrow); setfillstyle(1,cur_color); bar(500,3,600,17); setcolor(BLACK); rectangle(500,3,600,17); showmouseptr(); }
void main() { start(); login(); welcomeuser(0,"ADMINISTRATOR"); showadminmenu(); cleardevice(); showmouseptr(); while(1) { showadminmenu(); getch(); } }
void main() { int gd=DETECT,gm,maxx,maxy,x,y,button; initgraph(&gd,&gm,"C:\\TC"); maxx=getmaxx(); maxy=getmaxy(); rectangle(0,56,maxx,maxy); setviewport(1,57,maxx-1,maxy-1,1); gotoxy(26,1); printf("MOUSE DEMONSTRATION PROGRAM"); if(initmouse()==0) { closegraph(); restorecrtmode(); printf("\nMouseDriver not loaded"); exit(0); } restrictmouseptr(1,57,maxx-1,maxy-1); showmouseptr(); gotoxy(1,2); printf("Left Button"); gotoxy(15,2); printf("Right Button"); gotoxy(55,3); printf("Press Any Key to Exit..."); while(!kbhit()) { getmousepos(&button,&x,&y); gotoxy(5,3); (button & 1)==1? printf("DOWN") : printf("UP "); gotoxy(20,3); (button & 2)==2? printf("DOWN") : printf("UP "); gotoxy(65,2); printf("x=%03d y=%03d",x,y); } }
void top_panel_buttons(int n,int a,int c) { hidemouseptr(); for(;n>0;n--) { setfillstyle(1,3); //2,3 if(n==a) setfillstyle(1,c); bar((2+n*20),2,(18+n*20),18); } if(cur_panel==0) tools_icons(); else if(cur_panel==1) style_icon(); showmouseptr(); }
//fun��o quando clica void MenuClick(int qt){ int i = 0, j = 0, k = 0; getmouseposClick(&button,&mx,&my); if(button == 1){ button = -1; for(i = 1; i <= qt; i++){ if(mx <= (mn.id[i].x+mn.id[i].w) && mx >= (mn.id[i].x)){ if(my <= (mn.id[i].y+mn.id[i].h) && my >= mn.id[i].y){ hidemouseptr(); actMN = true; clickSM = i; //redesenha palco RemakeStage(); //desenho do menu em outra cor window(mn.id[i].x, mn.id[i].y, mn.id[i].x+mn.id[i].w, mn.id[i].y+mn.id[i].h); textcolor(mn.id[i].scolorT); textbackground(mn.id[i].scolorB); clrscr(); //agora vamos labels e controles gotoxy(((mn.id[i].w/2)-(strlen(mn.id[i].label)/2))+1, (mn.id[i].h/2)+1); printf("%s", mn.id[i].label); WinDefault(); //desenho da sombra do Lorenzo window((mn.id[i].x+mn.id[i].w+1)+1, (mn.id[i].y)+1, (mn.id[i].x+mn.id[i].w+mn.id[i].w)+2, (mn.id[i].y+2*(mn.id[i].cm)-2)+1); textbackground(BLACK); clrscr(); //limpar tela WinDefault(); //desenho do sub menu window(mn.id[i].x+mn.id[i].w+1, mn.id[i].y, mn.id[i].x+mn.id[i].w+mn.id[i].w, mn.id[i].y+2*(mn.id[i].cm)-2); textcolor(mn.id[i].scolorT); textbackground(mn.id[i].scolorB); clrscr(); for(j = 1, k =1; k <= 2*(mn.id[i].cm); j++,k++){ DrawArrow(2, k); gotoxy(4,k); cprintf("%s", mn.id[i].sm[j].label); k++; if(k+1 < 2*(mn.id[i].cm)) DrawLine(1, k, mn.id[i].w); } WinDefault(); showmouseptr(); }//if da coordenada y }//if da coordenada x } } }
//----------------------COLOR FUNCTIONS START----------------- void draw_color() { int n; top_panel_background(); hidemouseptr(); for(n=1;n<=16;n++) { setfillstyle(1,15); bar((3+n*20),3,(17+n*20),17); setfillstyle(1,n); bar((4+n*20),4,(16+n*20),16); } user_pattern(); showmouseptr(); monitor_color(16); }