Advertisement
Guest User

ikan

a guest
Nov 20th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "gfx.h"
  3.  
  4. int main()
  5. {
  6. int ysize = 600;
  7. int xsize = 800;
  8. int a,b;
  9. char c;
  10. char title[]="Matching Game ";
  11. char begin[]="Start";
  12. char information[]="Info";
  13. char direct[]="yes";
  14. char next[]= "next";
  15. char read_info[]="Welcome to Matching The Box";
  16. char read_info2[]="To start this game u need to left click the start button.";
  17. char read_info3[]="Below are key words:";
  18. char read_info4[]="p =box 1";
  19. char read_info5[]="o =box 2";
  20. char read_info6[]="i =box 3";
  21. char read_info7[]="u =box 4";
  22. char read_info8[]="y =box 5";
  23. char read_info9[]="t =box 6";
  24. char read_info10[]="r =box 7";
  25. char read_info11[]="e =box 8";
  26. char read_info12[]="w =box 9";
  27. char read_info13[]="q =box 10";
  28. char read_info14[]="l =box 11";
  29. char read_info15[]="k =box 12";
  30. char read_info16[]="x =Quit";
  31. char read_info17[]="left click = choose any boxes";
  32. char read_info18[]="right click = Quit";
  33. char read_info19[]="Next here's how the game works:";
  34.  
  35. char read_info20[]="LEVEL 1:";
  36. char read_info21[]="A total of 5 pairs of white boxes randomly arranged will be displayed.";
  37. char read_info22[]="5 boxes on the right side and 5 boxes on the left side.";
  38. char read_info23[]="Behind each white box, there would be another colour.";
  39. char read_info24[]="As the user manages to find both boxes of same colour, the box of that respective color will disappear.";
  40. char read_info25[]="Failed to do so, the boxes will turn white again.";
  41. char read_info26[]="Level 1 ends when user manages to match all 5 pairs.";
  42.  
  43. char read_info27[]="LEVEL 2:";
  44. char read_info28[]="A total of 6 pairs of white boxes randomly arranged will be displayed. ";
  45. char read_info29[]="4 boxes would be arranged in 3 respective rows.";
  46. char read_info30[]="Behind each white box, there would be another colour.";
  47. char read_info31[]="As the user manages to find both boxes of same colour, that two choosen boxes will disappear.";
  48. char read_info32[]="Failed to do so, the boxes will turn white again. ";
  49. char read_info33[]="Level 2 ends when user manages to match all 6 pairs.";
  50.  
  51. char read_info34[]="LEVEL 3:";
  52. char read_info35[]="A total of 6 pairs of white shapes randomly arranged will be displayed.";
  53. char read_info36[]="4 boxes would be arranged in 3 respective rows.";
  54. char read_info37[]="Behind each white box, there would be another colour and shape.";
  55. char read_info38[]="As the user manages to find both box of same colour and shape, that two choosen boxes will disappear.";
  56. char read_info39[]="Failed to do so, the boxes will turn white again. ";
  57. char read_info40[]="Level 3 ends when user manages to match all 6 pairs.";
  58.  
  59. // Open a new window for drawing.
  60. gfx_open(xsize,ysize,"Example Graphics Program");
  61.  
  62. gfx_clear_color(0,0,0);
  63. gfx_clear();
  64.  
  65. //title's button
  66. gfx_color(255,100,0);
  67. gfx_fillrectangle(260,50,200,100);
  68. gfx_color(0,0,0);
  69. gfx_text(title,320,100);
  70.  
  71. //begin's button
  72. gfx_color(255,0,0);
  73. gfx_fillcircle(320,250,100);
  74.  
  75. gfx_color(255,0,0);
  76. gfx_fillcircle(340,250,100);
  77.  
  78. gfx_color(255,0,0);
  79. gfx_fillcircle(360,250,100);
  80.  
  81. gfx_color(255,0,0);
  82. gfx_fillcircle(380,250,100);
  83.  
  84. gfx_color(255,0,0);
  85. gfx_fillcircle(400,250,100);
  86. gfx_color(0,0,0);
  87. gfx_text(begin,345,250);
  88.  
  89.  
  90. //info's button
  91. gfx_color(255,0,0);
  92. gfx_fillcircle(320,400,100);
  93.  
  94. gfx_color(255,0,0);
  95. gfx_fillcircle(340,400,100);
  96.  
  97. gfx_color(255,0,0);
  98. gfx_fillcircle(360,400,100);
  99.  
  100. gfx_color(255,0,0);
  101. gfx_fillcircle(380,400,100);
  102.  
  103. gfx_color(255,0,0);
  104. gfx_fillcircle(400,400,100);
  105. gfx_color(0,0,0);
  106. gfx_text(information,345,400);
  107.  
  108. while(1)
  109. {
  110.  
  111. c = gfx_wait();
  112.  
  113. //while((x>x1)&&(x<x2)&&(y>y1)&&(y<y2))
  114. a=gfx_xpos();
  115. b=gfx_ypos();
  116.  
  117. /*//to start the game
  118. if((c==0x01)&&(a>320)&&(a<400)&&(b>250)&&(b<350))
  119. {
  120. gfx_color(255,255,255);
  121. gfx_text(direct,345,400);
  122. }*/
  123.  
  124.  
  125. //to read the info
  126. if((c==0x01)&&(a>320)&&(a<400)&&(b>400)&&(b<450))
  127. {
  128. gfx_clear();
  129. gfx_color(255,255,255);
  130. gfx_text(read_info,250,50);
  131. gfx_text(read_info2,250,70);
  132. gfx_text(read_info3,250,100);
  133. gfx_text(read_info4,250,120);
  134. gfx_text(read_info5,250,140);
  135. gfx_text(read_info6,250,160);
  136. gfx_text(read_info7,250,180);
  137. gfx_text(read_info8,250,200);
  138. gfx_text(read_info9,250,220);
  139. gfx_text(read_info10,250,240);
  140. gfx_text(read_info11,250,260);
  141. gfx_text(read_info12,250,280);
  142. gfx_text(read_info13,250,300);
  143. gfx_text(read_info14,250,320);
  144. gfx_text(read_info15,250,340);
  145. gfx_text(read_info16,250,360);
  146. gfx_text(read_info17,250,380);
  147. gfx_text(read_info18,250,400);
  148. //usleep(300000);
  149.  
  150. //gfx_color(255,100,0);
  151. //gfx_fillcircle(400,400,100);
  152. gfx_color(255,255,255);
  153. gfx_text(next,345,400);
  154.  
  155. }
  156. //info part2
  157.  
  158.  
  159. if((c==0x01)&&(a>320)&&(a<400)&&(b>400)&&(b<450))
  160. {
  161. gfx_clear();
  162. gfx_text(read_info19,100,50);
  163. gfx_text(read_info20,100,80);
  164. gfx_text(read_info21,100,100);
  165. gfx_text(read_info22,100,120);
  166. gfx_text(read_info23,100,140);
  167. gfx_text(read_info24,100,160);
  168. gfx_text(read_info25,100,180);
  169. gfx_text(read_info26,100,200);
  170. gfx_text(read_info27,100,290);
  171. gfx_text(read_info28,100,310);
  172. gfx_text(read_info29,100,330);
  173. gfx_text(read_info30,100,350);
  174. gfx_text(read_info31,100,370);
  175. gfx_text(read_info32,100,390);
  176. gfx_text(read_info33,100,410);
  177. //usleep(300000);
  178. }
  179. gfx_color(255,0,0);
  180. gfx_fillcircle(400,400,100);
  181. gfx_color(0,0,0);
  182. gfx_text(next,345,400);
  183. //info part3
  184. if((c==0x01)&&(a>320)&&(a<400)&&(b>400)&&(b<450))
  185. {
  186. gfx_clear();
  187. gfx_text(read_info34,100,80);
  188. gfx_text(read_info35,100,100);
  189. gfx_text(read_info36,100,120);
  190. gfx_text(read_info37,100,140);
  191. gfx_text(read_info38,100,160);
  192. gfx_text(read_info39,100,180);
  193. gfx_text(read_info40,100,200);
  194. //usleep(300000);
  195. }
  196.  
  197. if(c=='q') break;
  198. }
  199.  
  200.  
  201. return(0);
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement