1
+ /**********************************************
2
+ Statement - Smiling Face Animation
3
+ Programmer - Vineet Choudhary
4
+ Written For - http://developerinsider.in
5
+ **********************************************/
6
+
7
+ #include <graphics.h>
8
+ #include <conio.h>
9
+ #include <stdlib.h>
10
+
11
+ main ()
12
+ {
13
+ int gd = DETECT , gm , area , temp1 , temp2 , left = 25 , top = 75 ;
14
+ void * p ;
15
+
16
+ initgraph (& gd ,& gm ,"C:\\TURBOC3\\BGI" );
17
+
18
+ setcolor (YELLOW );
19
+ circle (50 ,100 ,25 );
20
+ setfillstyle (SOLID_FILL ,YELLOW );
21
+ floodfill (50 ,100 ,YELLOW );
22
+
23
+ setcolor (BLACK );
24
+ setfillstyle (SOLID_FILL ,BLACK );
25
+ fillellipse (44 ,85 ,2 ,6 );
26
+ fillellipse (56 ,85 ,2 ,6 );
27
+
28
+ ellipse (50 ,100 ,205 ,335 ,20 ,9 );
29
+ ellipse (50 ,100 ,205 ,335 ,20 ,10 );
30
+ ellipse (50 ,100 ,205 ,335 ,20 ,11 );
31
+
32
+ area = imagesize (left , top , left + 50 , top + 50 );
33
+ p = malloc (area );
34
+
35
+ setcolor (WHITE );
36
+ settextstyle (SANS_SERIF_FONT ,HORIZ_DIR ,2 );
37
+ outtextxy (20 ,451 ,"Smiling Face Project by http://www.turboc.codeplex.com" );
38
+
39
+ setcolor (BLUE );
40
+ rectangle (0 ,0 ,639 ,449 );
41
+
42
+ while (!kbhit ())
43
+ {
44
+ temp1 = 1 + random ( 588 );
45
+ temp2 = 1 + random ( 380 );
46
+
47
+ getimage (left , top , left + 50 , top + 50 , p );
48
+ putimage (left , top , p , XOR_PUT );
49
+ putimage (temp1 , temp2 , p , XOR_PUT );
50
+ delay (500 );
51
+ left = temp1 ;
52
+ top = temp2 ;
53
+ }
54
+
55
+ getch ();
56
+ closegraph ();
57
+ return 0 ;
58
+ }
0 commit comments