Add to Favorites    Make Home Page 2069 Online  
 Language Categories  
 Our Services  

Home » C Home » Games and Graphics Home » The Ultimate Puzzle Game !!

A D V E R T I S E M E N T

Search Projects & Source Codes:

Title The Ultimate Puzzle Game !!
Author Ajeesh C O
Author Email ajeeshc [at] gmail.com
Description This Program is intended to demonstrate the Ultimate Puzzle
Game.This Program features
(i) Camera Mode Title loading
(ii) Loading screen
(iii) Mouse Sensitive menu
(ii) Radio Buttons & Ordinary Command Buttons
(iii) keyboard & Mouse Enabled
(iv) A Message Box which resembles the Message Box in Microsoft Windows
98
Category C » Games and Graphics
Hits 384613
Code Select and Copy the Code
Code: #include <stdio.h> #include <graphics.h> #include <conio.h> #include <dos.h> #include <alloc.h> #define UP 72 #define DOWN 80 #define LEFT 75 #define RIGHT 77 union REGS i,o; char *main_mnu[]={ " Start Game ", " Select Level", " How To Play ", " About ", " Exit " }; char **buffer1,*buffer3,*buffer4; char *dbox,*yes_up,*no_up,*yes_down,*no_down,*icon; int count1,level=1; int max_row=5,max_col=4; void create_dialog(void); void dialog(void); void error_sound(void); void puzzle(void); int getkey(void); void paint(int [][20]); void swap(int*,int*); void introduction(void); void loading(void); void bk_button(void); void about(void); void level_screen(void); void mnu(void); void how_to_play(void); void exit_screen(void); void displaymenu(char **menu,int count,int x1,int y1); void savemenu(char **menu,char **buffer,int width,int count,int x1,int y1); int getresponse(char **menu,char **buffer,int width,int count,int x1,int y1); void highlight(char **buffer,int ch,int h,int x1,int y1); void dehighlight(char **buffer,int ch,int h,int x1,int y1); int initmouse(void); void showmouseptr(void); void hidemouseptr(void); void getmousepos(int *button,int *x,int *y); void setmouseptr(int x,int y); void restrictmouseptr(int x1,int y1,int x2,int y2); int main(void) { int gdriver=DETECT,gmode,errorcode; int i,width1=0; int area; initgraph(&gdriver,&gmode,"c:\tc\bgi"); errorcode=graphresult(); if(errorcode!=grOk) { printf("Graphics not initialized : %s",grapherrormsg(errorcode)); getche(); exit(1); } if(!initmouse()) { printf(" Mouse driver can't be loaded"); getche(); exit(1); } setbkcolor(BROWN); setcolor(LIGHTGREEN); setfillstyle(1,BLUE); settextstyle(DEFAULT_FONT,HORIZ_DIR,1); bar(20,getmaxy()-40,75,getmaxy()-10); outtextxy(32,getmaxy()-28,"Back"); area=imagesize(20,getmaxy()-40,75,getmaxy()-10); buffer3=(char *)malloc(area); getimage(20,getmaxy()-40,75,getmaxy()-10,buffer3); putimage(20,getmaxy()-40,buffer3,XOR_PUT); bar(getmaxx()-125,getmaxy()-40,getmaxx()-50,getmaxy()-10); outtextxy(getmaxx()-115,getmaxy()-28,"Restart"); area=imagesize(getmaxx()-125,getmaxy()-40,getmaxx()-50,getmaxy()-10); buffer4=(char *)malloc(area); getimage(getmaxx()-125,getmaxy()-40,getmaxx()-50,getmaxy()-10,buffer4); putimage(getmaxx()-125,getmaxy()-40,buffer4,XOR_PUT); count1=sizeof(main_mnu)/sizeof(char*); settextstyle(4,0,3); displaymenu(main_mnu,count1,200,125); for(i=0;i<count1;i++) { if(textwidth(main_mnu[i])>width1) width1=textwidth(main_mnu[i]); } buffer1=malloc(sizeof(main_mnu)); savemenu(main_mnu,buffer1,width1,count1,200,125); cleardevice(); create_dialog(); cleardevice(); introduction(); loading(); showmouseptr(); setmouseptr(getmaxx()/2,getmaxy()/2+100); mnu(); return (0); } void create_dialog(void) { int area; int poly[10]; struct textsettingstype textinfo; hidemouseptr(); cleardevice(); gettextsettings(&textinfo); settextstyle(0,HORIZ_DIR,1); setbkcolor(BROWN); setfillstyle(1,BLUE); bar(200,160,400,235); setcolor(7); outtextxy(205,163,"Puzzle"); //title bar setfillstyle(1,7); bar(200,175,400,250); bar(388,162,398,172); setcolor(WHITE); line(388,162,398,162); line(388,162,388,172); setcolor(5); line(388,172,398,172); line(398,162,398,172); setcolor(7); setcolor(8); outtextxy(390,164,"X"); //close button //outtextxy(204,163,"�"); //setcolor(LIGHTBLUE); outtextxy(260,190,"Are u sure ?"); //message setcolor(WHITE); line(200,160,400,160); line(200,160,200,250); setcolor(8); //outside normal look line(400,160,400,250); line(200,250,400,250); setfillstyle(1,BLUE); //bar(230,215,280,238); //bar(320,215,370,238); outtextxy(243,223,"Yes"); //button texts outtextxy(337,223,"No"); setcolor(LIGHTBLUE); //rectangle(199,159,401,251); //outside blue rectangle setcolor(WHITE); line(230,215,280,215); line(230,215,230,238); line(320,215,370,215); line(320,215,320,238); //flash effect when mouse over setcolor(8); line(280,215,280,238); line(230,238,280,238); line(370,215,370,238); line(320,238,370,238); poly[0] = 100; poly[1] = 100; poly[2] = 90; poly[3] = 122; poly[4] = 110; poly[5] = 122; poly[6] = poly[0]; poly[7] = poly[1]; setcolor(YELLOW); setfillstyle(1,7); bar(89,99,111,123); setfillstyle(1,YELLOW); fillpoly(4, poly); setcolor(8); settextstyle(4,0,1); outtextxy(98,100,"!"); setcolor(WHITE); //rectangle(89,99,111,123); area=imagesize(89,99,111,123); icon=malloc(area); getimage(89,99,111,123,icon); putimage(89,99,icon,XOR_PUT); putimage(210,180,icon,COPY_PUT); setfillstyle(1,BLUE); settextstyle(0,HORIZ_DIR,1); setcolor(WHITE); //rectangle(198,158,402,252); //saving bitmaps area=imagesize(198,158,402,252); dbox=malloc(area); getimage(198,158,402,252,dbox); putimage(198,158,dbox,XOR_PUT); putimage(198,158,dbox,XOR_PUT); //rectangle(230,215,280,238); area=imagesize(230,215,280,238); yes_up=malloc(area); getimage(230,215,280,238,yes_up); putimage(230,215,yes_up,XOR_PUT); putimage(230,215,yes_up,XOR_PUT); //rectangle(320,215,370,238); area=imagesize(320,215,370,238); no_up=malloc(area); getimage(320,215,370,238,no_up); putimage(320,215,no_up,XOR_PUT); putimage(320,215,no_up,XOR_PUT); setcolor(8); line(230,215,280,215); line(230,215,230,238); line(320,215,370,215); line(320,215,320,238); setcolor(WHITE); line(280,215,280,238); line(230,238,280,238); line(370,215,370,238); line(320,238,370,238); //rectangle(230,215,280,238); area=imagesize(230,215,280,238); yes_down=malloc(area); getimage(230,215,280,238,yes_down); putimage(230,215,yes_down,XOR_PUT); putimage(230,215,yes_down,XOR_PUT); //rectangle(320,215,370,238); area=imagesize(320,215,370,238); no_down=malloc(area); getimage(320,215,370,238,no_down); putimage(320,215,no_down,XOR_PUT); putimage(320,215,no_down,XOR_PUT); putimage(320,215,no_up,COPY_PUT); putimage(230,215,yes_up,COPY_PUT); settextstyle(textinfo.font,0,textinfo.charsize); } void dialog(void) { int button,x,y,in1=0,in2=0; struct textsettingstype textinfo; hidemouseptr(); cleardevice(); putimage(198,158,dbox,XOR_PUT); gettextsettings(&textinfo); settextstyle(0,HORIZ_DIR,1); showmouseptr(); while(1) { getmousepos(&button,&x,&y); if(x>=388&&x<=398&&y>=162&&y<=172) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); //close button click cleardevice(); settextstyle(textinfo.font,0,textinfo.charsize); hidemouseptr(); cleardevice(); showmouseptr(); mnu(); break; } } if(x>=230&&x<=280&&y>=215&&y<=238) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); break; } if(in1==1) continue; in1=1; hidemouseptr(); putimage(230,215,yes_down,COPY_PUT); showmouseptr(); } else if(in1!=0) { in1=0; hidemouseptr(); putimage(230,215,yes_up,COPY_PUT); showmouseptr(); } getmousepos(&button,&x,&y); if(x>=320&&x<=370&&y>=215&&y<=238) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); cleardevice(); settextstyle(textinfo.font,0,textinfo.charsize); hidemouseptr(); cleardevice(); showmouseptr(); mnu(); } if(in2==1) continue; in2=1; hidemouseptr(); putimage(320,215,no_down,COPY_PUT); showmouseptr(); } else if(in2!=0) { in2=0; hidemouseptr(); putimage(320,215,no_up,COPY_PUT); showmouseptr(); } } } void exit_screen() { dialog(); closegraph(); restorecrtmode(); exit(0); } void introduction(void) { char *str="Ultimate Puzzle"; int i,j; int x[]={200,100, 10,-40,-110,-130,-150,-175,-200,-230,-270,-310,-350,-395,-435,-470,-520,-5 50,-590,-630,-670,-710,-750,-800,-840}; int y[]={200,175,165,155, 155, 155, 155, 155, 155, 145, 135, 125, 115, 100, 85, 74, 60, 50, 35, 20, 19, 10, 0, -20, -25}; //int c[]={ 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}; char check; int color; cleardevice(); settextstyle(4,HORIZ_DIR,0); setcolor(YELLOW); for(i=1,j=0;i<=50;i++,j++) { clearviewport(); setusercharsize(i, 1, i, 1); if(kbhit()) break; if(j<24) outtextxy(x[j],y[j],str); else { x[23]-=41; y[23]-=13; outtextxy(x[23],y[23],str); } if(i<3) delay(300); if(i<=10) delay(200); else if(i<=50) delay(165); } settextstyle(2,0,5); for(i=1,color=9;i<25;i++) { if(kbhit()) break; setcolor(color++); if(color>15) color=9; delay(100); outtextxy(getmaxx()/2-110,getmaxy()/2+35,"WELCOME"); } cleardevice(); } void loading(void) { int i,j,w,x=250,y=225; int save; cleardevice(); settextstyle(3,0,5); setcolor(LIGHTCYAN); outtextxy(100,220,"Loading "); setcolor(LIGHTGREEN); settextstyle(10,0,1); w=textwidth("�"); for(i=1;i<2;i++) { save=getcolor(); setcolor(BLACK); for(j=0,x=250;j<15;j++) { x+=w; outtextxy(x,y,"�"); } setcolor(save); for(j=0,x=250;j<15;j++) { delay(150); x+=w; outtextxy(x,y,"�"); } } cleardevice(); } void bk_button(void) { int button,x,y,in=0; showmouseptr(); putimage(20,getmaxy()-40,buffer3,COPY_PUT); while(1) { getmousepos(&button,&x,&y); if(x>=20&&x<=75&&y>=getmaxy()-40&&y<=getmaxy()-10) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); break; } if(in==1) continue; in=1; hidemouseptr(); putimage(20,getmaxy()-40,buffer3,NOT_PUT); showmouseptr(); } else if(in!=0) { in=0; hidemouseptr(); putimage(20,getmaxy()-40,buffer3,COPY_PUT); showmouseptr(); } } hidemouseptr(); cleardevice(); showmouseptr(); } void about(void) { settextstyle(2,0,6); setcolor(LIGHTBLUE); rectangle(195,175,448,271); rectangle(195,174,448,272); rectangle(195,173,448,273); rectangle(195,172,448,274); rectangle(195,171,448,275); setcolor(LIGHTGREEN); outtextxy(200,180,"Ultimate Puzzle v1.0"); outtextxy(200,200,"Programmer : Ajeesh.C.O."); outtextxy(200,220,"e-mail : [email protected]"); outtextxy(200,240,"Copyright (c) 2005-2006"); bk_button(); } void level_screen(void) { int xx,yy,h; int button,x,y,in=0; struct fillsettingstype f,fillinfo; char msg[20]; int save; getfillsettings(&f); hidemouseptr(); cleardevice(); setcolor(LIGHTBLUE); rectangle(209,129,351,251); rectangle(210,130,350,250); rectangle(211,131,349,249); setcolor(YELLOW); settextstyle(4,0,3); setfillstyle(1,12); h=textheight("N"); //bar(221,146,229,154); circle(225,150, 4); outtextxy(245,132,"Novice"); //bar(221,161+h,229,169+h); circle(225,165+h,4); outtextxy(245,147+h,"Advanced"); //bar(221,176+2*h,229,184+2*h); circle(225,180+2*h,4); outtextxy(245,162+2*h,"Expert"); showmouseptr(); putimage(20,getmaxy()-40,buffer3,COPY_PUT); getfillsettings(&fillinfo); setfillstyle(1,2); bar(getmaxx()/3+10,getmaxy()-40,getmaxx()-200,getmaxy()-10); level=1; sprintf(msg,"Current Level : %d",level); outtextxy(getmaxx()/3+30,getmaxy()-40,msg); setfillstyle(fillinfo.pattern,fillinfo.color); fillellipse(225,150,4,4); while(1) { getmousepos(&button,&x,&y); if(x>=221&&x<=229&&y>=146&&y<=154) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); fillellipse(225,150,4,4); getfillsettings(&fillinfo); setfillstyle(1,GREEN); bar(getmaxx()/3+10,getmaxy()-40,getmaxx()-200,getmaxy()-10); setfillstyle(fillinfo.pattern,fillinfo.color); level=1; sprintf(msg,"Current Level : %d",level); outtextxy(getmaxx()/3+30,getmaxy()-40,msg); getfillsettings(&fillinfo); setfillstyle(1,getbkcolor()); fillellipse(225,165+h,4,4); fillellipse(225,180+2*h,4,4); setfillstyle(fillinfo.pattern,fillinfo.color); showmouseptr(); } } if(x>=221&&x<=229&&y>=161+h&&y<=169+h) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); fillellipse(225,165+h,4,4); getfillsettings(&fillinfo); setfillstyle(1,GREEN); bar(getmaxx()/3+10,getmaxy()-40,getmaxx()-200,getmaxy()-10); setfillstyle(fillinfo.pattern,fillinfo.color); level=2; sprintf(msg,"Current Level : %d",level); outtextxy(getmaxx()/3+30,getmaxy()-40,msg); getfillsettings(&fillinfo); setfillstyle(1,getbkcolor()); fillellipse(225,150,4,4); fillellipse(225,180+2*h,4,4); setfillstyle(fillinfo.pattern,fillinfo.color); showmouseptr(); } } if(x>=221&&x<=229&&y>=176+2*h&&y<=184+2*h) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); fillellipse(225,180+2*h,4,4); getfillsettings(&fillinfo); setfillstyle(1,GREEN); bar(getmaxx()/3+10,getmaxy()-40,getmaxx()-200,getmaxy()-10); setfillstyle(fillinfo.pattern,fillinfo.color); level=3; sprintf(msg,"Current Level : %d",level); outtextxy(getmaxx()/3+30,getmaxy()-40,msg); getfillsettings(&fillinfo); setfillstyle(1,getbkcolor()); fillellipse(225,165+h,4,4); fillellipse(225,150,4,4); setfillstyle(fillinfo.pattern,fillinfo.color); showmouseptr(); } } if(x>=20&&x<=75&&y>=getmaxy()-40&&y<=getmaxy()-10) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); break; } if(in==1) continue; in=1; hidemouseptr(); putimage(20,getmaxy()-40,buffer3,NOT_PUT); showmouseptr(); } else if(in!=0) { in=0; hidemouseptr(); putimage(20,getmaxy()-40,buffer3,COPY_PUT); showmouseptr(); } } hidemouseptr(); cleardevice(); showmouseptr(); setfillstyle(f.pattern,f.color); } void mnu(void) { int choice=1,width=0,i; cleardevice(); settextstyle(4,0,3); setcolor(LIGHTGREEN); for(i=0;i<count1;i++) { if(textwidth(main_mnu[i])>width) width=textwidth(main_mnu[i]); } displaymenu(main_mnu,count1,200,125); showmouseptr(); while(1) { choice=getresponse(main_mnu,buffer1,width,count1,200,125); switch(choice) { case 1: cleardevice(); puzzle(); cleardevice(); mnu(); break; case 2: cleardevice(); level_screen(); cleardevice(); mnu(); break; case 3: how_to_play(); mnu(); break; case 4: hidemouseptr(); cleardevice(); about(); showmouseptr(); mnu(); break; case 5: hidemouseptr(); cleardevice(); showmouseptr(); exit_screen(); } } } int getkey(void) { i.h.ah=0; int86(0x16,&i,&o); return (o.h.ah); } void puzzle(void) { int r=1,c=3; int key; int num[][20]={ {1,10,3,7}, {6,8,12,20}, {4,14,2,18}, {17,19,9,16}, {11,15,13,5} }; int button,x,y,in=0,in1=0,in2=0; int flag=0; hidemouseptr(); cleardevice(); putimage(20,getmaxy()-40,buffer3,COPY_PUT); putimage(getmaxx()-125,getmaxy()-40,buffer4,COPY_PUT); paint(num); showmouseptr(); while(1) { getmousepos(&button,&x,&y); if(x>=20&&x<=75&&y>=getmaxy()-40&&y<=getmaxy()-10) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); cleardevice(); showmouseptr(); mnu(); return; } if(in1==1) continue; in1=1; hidemouseptr(); putimage(20,getmaxy()-40,buffer3,NOT_PUT); showmouseptr(); } else if(in1!=0) { in1=0; hidemouseptr(); putimage(20,getmaxy()-40,buffer3,COPY_PUT); showmouseptr(); } getmousepos(&button,&x,&y); if(x>=getmaxx()-125&&x<=getmaxx()-50&&y>=getmaxy()-40&&y<=getmaxy()-10) { if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); hidemouseptr(); cleardevice(); showmouseptr(); puzzle(); } if(in2==1) continue; in2=1; hidemouseptr(); putimage(getmaxx()-125,getmaxy()-40,buffer4,NOT_PUT); showmouseptr(); } else if(in2!=0) { in2=0; hidemouseptr(); putimage(getmaxx()-125,getmaxy()-40,buffer4,COPY_PUT); showmouseptr(); } if(kbhit()) { key=getkey(); flag=1; } else flag=0; if(flag==1) { switch(key) { case UP: if(r<=0) { error_sound(); break; } in=1; r--; swap(&num[r][c],&num[r+1][c]); break; case DOWN: if(r>=max_row-1) { error_sound(); break; } in=1; r++; swap(&num[r][c],&num[r-1][c]); break; case LEFT: if(c<=0) { error_sound(); break; } in=1; c--; swap(&num[r][c],&num[r][c+1]); break; case RIGHT: if(c>=max_col-1) { error_sound(); break; } in=1; c++; swap(&num[r][c],&num[r][c-1]); break; } if(in==1) { hidemouseptr(); cleardevice(); paint(num); putimage(20,getmaxy()-40,buffer3,COPY_PUT); putimage(getmaxx()-125,getmaxy()-40,buffer4,COPY_PUT); showmouseptr(); } in=0; } } } void error_sound(void) { sound(2000); delay(15); nosound(); } void mnu_sound(void) { int frequency; for(frequency=2000;frequency<5000;frequency++) sound(frequency); nosound(); } void swap(int *x,int *y) { int temp; temp=*x; *x=*y; *y=temp; } void paint(int n[][20]) { int i,j; int x,y; char out[5]; int w,h; setfillstyle(1,BLUE); setbkcolor(BROWN); settextstyle(1,0,4); setcolor(LIGHTGREEN); w=textwidth("20"); h=textheight("20"); for(i=0,y=50;i<max_row;i++,y+=60) { for(j=0,x=190;j<max_col;j++,x+=70) { if(n[i][j]==20) strcpy(out,""); else sprintf(out,"%d ",n[i][j]); bar(x-10,y-5,x+w+5,y+h+10); outtextxy(x,y,out); strcpy(out,""); } } setcolor(LIGHTBLUE); rectangle(179-12,45-12,448+12,331+12); rectangle(179-12,45-13,448+12,331+13); rectangle(179-12,45-14,448+12,331+14); rectangle(179-12,45-15,448+12,331+15); rectangle(179-12,45-16,448+12,331+16); rectangle(179-12,45-17,448+12,331+17); rectangle(179-12,45-18,448+12,331+18); rectangle(179-12,45-19,448+12,331+19); rectangle(179-12,45-20,448+12,331+20); rectangle(179-12,45-21,448+12,331+21); } void how_to_play(void) { int x=getmaxx()/2-175,y=getmaxy()/2-200,h; hidemouseptr(); cleardevice(); setcolor(LIGHTGREEN); settextstyle(4,0,5); outtextxy(x,y,"Keyboard Controls"); setcolor(YELLOW); settextstyle(2,0,5); h=textheight("C"); x+=50; y+=100; outtextxy(x,y+1*h,"Move Up : Up Arrow"); outtextxy(x,y+2*h,"Move Down : Down Arrow"); outtextxy(x,y+3*h,"Move Left : Left Arrow"); outtextxy(x,y+4*h,"Move Right : Right Arrow"); showmouseptr(); bk_button(); cleardevice(); } void displaymenu(char **menu,int count,int x1,int y1) { int i,h,w; h=textheight(menu[0]); for(i=0;i<count1;i++) { if(textwidth(main_mnu[i])>w) w=textwidth(main_mnu[i]); } for(i=0;i<count;i++) { bar(x1-1,y1+i*(h+5),x1+w+1,y1+(i+1)*(h+5)); outtextxy(x1,y1+i*(h+5),menu[i]); } } void savemenu(char **menu,char **buffer,int width,int count,int x1,int y1) { int i,x2,yy1,yy2,area,h; h=textheight(menu[0]); for(i=0;i<count;i++) { x2=x1+width; yy1=y1+i*(h+5); yy2=y1+(i+1)*(h+5); area=imagesize(x1,yy1,x2,yy2); buffer[i]=malloc(area); getimage(x1,yy1,x2,yy2,buffer[i]); } } int getresponse(char **menu,char **buffer,int width,int count,int x1,int y1) { int choice=1,prevchoice=0,x,y,x2,y2,button; int in,i,h; h=textheight(menu[0]); y2=y1+count*(h+5); x2=x1+width; setcolor(LIGHTBLUE); hidemouseptr(); rectangle(x1-1,y1-1,x2+1,y2+1); rectangle(x1-2,y1-2,x2+2,y2+2); rectangle(x1-3,y1-3,x2+3,y2+3); rectangle(x1-8,y1-4,x2+8,y2+4); rectangle(x1-8,y1-5,x2+8,y2+5); rectangle(x1-8,y1-6,x2+8,y2+6); rectangle(x1-8,y1-7,x2+8,y2+7); rectangle(x1-8,y1-8,x2+8,y2+8); rectangle(x1-8,y1-9,x2+8,y2+9); showmouseptr(); while(1) { getmousepos(&button,&x,&y); if(x>=x1&&x<=x2 && y>=y1&&y<=y2) { in=1; for(i=1;i<=count;i++) { if(y<=y1+i*(h+5)) { choice=i; break; } } if(prevchoice!=choice) { hidemouseptr(); highlight(buffer,choice,h,x1,y1); if(prevchoice) dehighlight(buffer,prevchoice,h,x1,y1); prevchoice=choice; showmouseptr(); } if((button&1)==1) { while((button&1)==1) getmousepos(&button,&x,&y); if(x>=x1&&x<=x2&&y>=y1&&y<=y2) return choice; } } else { if(in==1) { in=0; prevchoice=0; hidemouseptr(); dehighlight(buffer,choice,h,x1,y1); showmouseptr(); } } } } void highlight(char **buffer,int ch,int h,int x1,int y1) { putimage(x1,y1+(ch-1)*(h+5),buffer[ch-1],NOT_PUT); } void dehighlight(char **buffer,int ch,int h,int x1,int y1) { putimage(x1,y1+(ch-1)*(h+5),buffer[ch-1],COPY_PUT); } int initmouse(void) { i.x.ax=0; int86(0x33,&i,&o); return (o.x.ax); } void showmouseptr(void) { i.x.ax=1; int86(0x33,&i,&o); } void hidemouseptr(void) { i.x.ax=2; int86(0x33,&i,&o); } void 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; } void setmouseptr(int x,int y) { i.x.ax=4; i.x.cx=x; i.x.dx=y; int86(0x33,&i,&o); } void 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); }

Related Source Codes

Script Name Author
The Game Opposite as seen on Nokia 2300 Mobile Manikanta
RECURSIVE BALANCED QUICK SORT ashish
Radix Sort ashish
Change your mouse pointer Ashim
The blinking star Shashank
Data Validation Crylittlebaby
To search a file by giving file type like mp3 or mpeg or doc Prashanth SR
Menus Demonstration B.Chidhambaram
Employee Database Project Using C. Reenku Raman Nayak
Creating a Lexical Analyzer in c fahad bader al-buhairi �դ ?�� ��??���
Calendar Program Omkar & Devendra
Stop double Process for start in C Cedrik Jurak
Stop double Process for start in C Cedrik Jurak
Time Scheduler Atiq Anwar
A timepass game between atmost two players Rahul Roy

A D V E R T I S E M E N T




Google Groups Subscribe to SourceCodesWorld - Techies Talk
Email:

Free eBook - Interview Questions: Get over 1,000 Interview Questions in an eBook for free when you join JobsAssist. Just click on the button below to join JobsAssist and you will immediately receive the Free eBook with thousands of Interview Questions in an ebook when you join.

New! Click here to Add your Code!


ASP Home | C Home | C++ Home | COBOL Home | Java Home | Pascal Home
Source Codes Home Page

 Advertisements  

Google Search

Google

Source Codes World.com is a part of Vyom Network.

Vyom Network : Web Hosting | Dedicated Server | Free SMS, GRE, GMAT, MBA | Online Exams | Freshers Jobs | Software Downloads | Interview Questions | Jobs, Discussions | Placement Papers | Free eBooks | Free eBooks | Free Business Info | Interview Questions | Free Tutorials | Arabic, French, German | IAS Preparation | Jokes, Songs, Fun | Free Classifieds | Free Recipes | Free Downloads | Bangalore Info | Tech Solutions | Project Outsourcing, Web Hosting | GATE Preparation | MBA Preparation | SAP Info | Software Testing | Google Logo Maker | Freshers Jobs

Sitemap | Privacy Policy | Terms and Conditions | Important Websites
Copyright ©2003-2024 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=1037


Download Yahoo Messenger | Placement Papers | Free SMS | C Interview Questions | C++ Interview Questions | Quick2Host Review