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

Home » C Home » Games and Graphics Home » Icons in C and Mouse programming

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

Search Projects & Source Codes:

Title Icons in C and Mouse programming
Author Bibin John
Author Email njbibin [at] sify.com
Description This program is compiled on Turbo C
Category C » Games and Graphics
Hits 79952
Code Select and Copy the Code
#include<graphics.h> #include<dos.h> #include<stdio.h> void mainscreenin1list(int sx,int sy,int ex,int ey); void mainscreenin2list(int sx,int sy,int ex,int ey); void list(); void icons(); void iconindex(int x1,int y1, int x2, int y2); void funct( int x,int y); //mouse functions union REGS i,o; int initmouse(); void showmouseptr(); void restrictmouseptr(); void getmousepos(); //end of mouse functions void main() { int gd=DETECT,gm; initgraph(&gd,&gm,"e:\tc\bgi"); list(); getch(); } void list() { int sx,sy,ex,ey,frequency, i=0,button, x,y; sx=15; sy=10; ex=630; ey=470; mainscreenin1list(sx,sy,ex,ey); mainscreenin2list(sx,sy,ex,ey); setviewport(1,1,640,470,1); if( initmouse()==0) { closegraph(); restorecrtmode(); printf("Mouse Driver is not loaded"); exit(1); } restrictmouseptr(10,10,620,460); showmouseptr(); icons(); do { getmousepos(&button,&x,&y); if((button&1)==1) { i=1; for(frequency=2000;frequency<5000;frequency++) sound(frequency); nosound(); } if(i==1) break; } while(1); funct(x,y); } void mainscreenin1list(int sx,int sy,int ex,int ey) { 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); settextstyle(0,0,0); setfillstyle(1,1); bar(sx+2,sy+2,ex-2,sy+20); setcolor(13); settextstyle(8,0,1); outtextxy(sx+190,sy-5,"IC LIST"); //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); settextstyle(0,0,1); outtextxy(ex-13,sy+5,"x"); setfillstyle(1,7); } void mainscreenin2list(int sx,int sy,int ex,int ey) { sx=sx+15; sy=sy+24; ex=ex-17; ey=ey-9; 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); } void icons() { int x1,y1,a,x2; x1=70; y1=50; x2=150; a=14; //increment of y=45 from previous y //increment of the y=30 from the same value settextstyle(1,0,2); iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"EXIT"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7401"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7402"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7404"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7408"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7410"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7411"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7426"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7427"); y1+=45; //end of first column //start of next column x1+=150; y1=50; x2+=150; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7432"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7437"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7445"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7446"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7447"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7474"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7475"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7476"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7483"); y1+=45; //end of second column //start of next column x1+=150; y1=50; a=10; x2+=160; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7485"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"7486"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"74106"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"74145"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"74148"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"74151"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"74251"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"74266"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a-3,y1,"74445"); y1+=45; //end of second column //start of next column x1+=150; y1=50; x2+=130; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4001"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4011"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4012"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4013"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4069"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4081"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4518"); y1+=45; iconindex(x1,y1,x2,y1+30); outtextxy(x1+a,y1,"4520"); y1+=45; iconindex(x1,y1,x2,y1+30); setcolor(4); outtextxy(x1+a,y1,"EXIT"); y1+=45; } void funct(int x, int y) { if(x>70&&x<150&&y>50&&y<80) exit(0); list(); } //making icons void iconindex(int x1,int y1, int x2, int y2) { setlinestyle(0,0,3); setcolor(15); line(x1,y1,x2,y1); line(x1,y1,x1,y2); setcolor(0); line(x1,y2,x2,y2); line(x2,y2,x2,y1); } //start of mouse declarations initmouse() { i.x.ax=0; int86(0x33,&i,&o); return(o.x.ax); } void showmouseptr() { i.x.ax=1; 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); } 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; }

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-2021 SourceCodesWorld.com, All Rights Reserved.
Page URL: http://www.sourcecodesworld.com/source/show.asp?ScriptID=693


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