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

Home » C Home » Games and Graphics Home » Faceoff - human face which smiles.

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

Search Projects & Source Codes:

Title Faceoff - human face which smiles.
Author shoeb ali
Author Email shoebmail [at] yahoo.com
Description This is a human face which smiles.
Category C » Games and Graphics
Hits 383552
Code Select and Copy the Code
#include <graphics.h> #include <stdlib.h> #include <stdio.h> #include<malloc.h> #include<dos.h> #include <conio.h> int xasp,yasp,gdriver = VGA, gmode=VGAMED, errorcode; struct pos { int x; int y; }; struct face { int radius; struct pos position; int mood; }; typedef struct face face; face *face1; void getposition() { printf("Enter X Co-ordinate:"); scanf("%d",&face1->position.x); printf("Enter X Co-ordinate:"); scanf("%d",&face1->position.y); } void drawface() { char ch='x'; int i=0,x,y,color,r,imgsize,dif; x=face1->position.x=320; y=face1->position.y=180; face1->radius=150; color=15; r=face1->radius; setbkcolor(0); getaspectratio(&xasp,&yasp); setcolor(8); circle(x,y,face1->radius); setfillstyle(1,color); floodfill(x,y,getcolor()); draweyes(face1); drawhair(face1); drawmouth(face1); drawnose(face1); } drawnose() { int i,x,y,r; x=face1->position.x; y=face1->position.y; r=face1->radius; setcolor(0); for(i=0;i<2;i++) { arc(x-160-i,y-r/4,340-i,10,r); line(x-20,y+4+i,x+20,y+10+i); } } draweyes() { int i,x1,x2,y1,y2,r; setcolor(0); r=face1->radius; x1=face1->position.x-r/2; y1=face1->position.y-r/4; x2=face1->position.x+r/2; y2=face1->position.y-r/4; setaspectratio(xasp/2,yasp); arc(x1,y1-r/8,40,140,r/4);//left eyebrow arc(x1,y1-r/8+1,40,140,r/4);//left eyebrow arc(x1,y1-r/8+2,40,140,r/4);//left eyebrow setaspectratio(xasp,yasp); for(i=0;i<2;i++) { arc(x1,y1+i+5,40,140,r/4); //upper left eye arc(x1,y1-r/5+i,220,320,r/4); //lower left eye } circle(x1,y1-r/12,r/10);//left pupul setfillstyle(1,0); floodfill(x1,y1-r/10,getcolor()); setfillstyle(1,WHITE); floodfill(x1-15,y1-r/6,getcolor()); setaspectratio(xasp/2,yasp); arc(x2,y2-r/8,40,140,r/4);//right eyebrow arc(x2,y2-r/8+1,40,140,r/4);//right eyebrow arc(x2,y2-r/8+2,40,140,r/4);//right eyebrow setaspectratio(xasp,yasp); for(i=0;i<2;i++) { arc(x2,y2+i+5,40,140,r/4);//upper right eye arc(x2,y2-r/5+i,220,320,r/4);//lower right eye } circle(x2,y2-r/12,r/10);//right pupil setfillstyle(1,0); floodfill(x2,y2-r/12,getcolor()); setfillstyle(1,WHITE); floodfill(x2-15,y2-r/6,getcolor()); } drawmouth() { int x,y,r,i; x=face1->position.x; y=face1->position.y+(face1->radius/1.5); r=face1->radius; setcolor(BLACK); if((face1->mood)==1) for(i=0;i<4;i++) arc(x,y-r/2+i,220,320,r/2);//make happy if((face1->mood)==0) for(i=0;i<4;i++) arc(x,y-i,40,140,r/2);//make sad } drawhair() { int x,y,r; setcolor(8); setaspectratio(xasp,yasp/1.5); r=face1->radius; x=face1->position.x-r/2; y=face1->position.y-r/3; arc(x,y,34,225,100); arc(x+r,y,314,138,100); setfillstyle(1,RED); floodfill(x,y-70,getcolor()); floodfill(x+r,y-70,getcolor()); setaspectratio(xasp,yasp); } void main(void) { int i=0; initgraph(&gdriver, &gmode,""); while(!kbhit()) { if((i%2)==1) { setvisualpage(1); setactivepage(0); clearviewport(); face1->mood=0; drawface(); delay(1000); } else { setvisualpage(0); setactivepage(1); clearviewport(); face1->mood=1; drawface(); delay(300); } i++; } getch(); closegraph(); }

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=574


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