Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.13 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "gfx.h"
  3. #include <stdlib.h>
  4. #include <time.h>
  5.  
  6. int main()
  7.  
  8. { //116
  9. char c;
  10. char *test = "Would you like to play a game? Y/N" ;
  11.  
  12. char *red = "RED";
  13. char *lblue = "LIGHT BLUE";
  14. char *dblue = "DARK BLUE";
  15. char *yellow = "YELLOW";
  16. char *dgreen = "DARK GREEN";
  17. char *lgreen = "LIGHT GREEN";
  18. char *brown = "BROWN";
  19. char *purple ="PURPLE";
  20. char *pink = "PINK";
  21. char *black = "BLACK";
  22.  
  23. char *correct = "CORRECT";
  24.  
  25. char *guessone = "You have 1 guess left";
  26. char *guesstwo = "You have 2 guesses left";
  27. char *guessthree = "You have 3 guesses left";
  28.  
  29. char *end = "Okay, Please come again!";
  30. char *end1 = "Press any key to exit";
  31.  
  32. int score,guess,level,x,y;
  33. char n;
  34.  
  35. srand(time(NULL));
  36.  
  37. score = 0;
  38. guess = 3;
  39.  
  40. gfx_open(3000,1000,"bew");
  41. gfx_clear_color(255,255,255);
  42. gfx_clear();
  43.  
  44. gfx_color(0,0,0);
  45. gfx_text(test,800,500);
  46.  
  47. while (1) {//144
  48.  
  49. c = gfx_wait();
  50. x=gfx_xpos();
  51. y=gfx_ypos();
  52.  
  53. if (c==0x01)
  54. {
  55. }
  56. else if (c==0x02)
  57. {
  58. printf("2 - middle button ");
  59. }
  60. else if (c==0x03)
  61. {
  62. printf("3 - right button ");
  63. }
  64. /* else
  65. {
  66. printf("%c \n",c);
  67. printf("Mouse pos xpos is %d and ypos is %d \n", gfx_xpos(),gfx_ypos());
  68. }
  69.  
  70. if ((x >= 200 && x <= 400) && (y >= 100 && y <= 300))
  71. {//123
  72. printf("Correct \n");
  73. //gfx_color(255,255,0);
  74. //gfx_fillcircle(50,500,100);
  75. }//121*/
  76.  
  77. //c = gfx_wait();
  78.  
  79. if ((c =='Y') || (c == 'y'))
  80. {//111
  81. gfx_clear();
  82. gfx_text(red,100,100);
  83.  
  84. // setting line color
  85. gfx_color(0,0,0);
  86.  
  87. //drawing vertical grid
  88. gfx_line(600,0,600,1000);
  89. gfx_line(800,0,800,1000);
  90. gfx_line(1000,0,1000,1000);
  91.  
  92. //drawing horizontal grid
  93. gfx_line(600,200,1000,200);
  94. gfx_line(600,400,1000,400);
  95. gfx_line(600,600,1000,600);
  96. gfx_line(600,800,1000,800);
  97. gfx_line(600,1000,1000,1000);
  98.  
  99. // drawing in circles with different colors
  100.  
  101. gfx_color(0,0,0); //black
  102. gfx_fillcircle(700,100,150);
  103. gfx_circle(700,100,150);
  104.  
  105. gfx_color(255,0,0); //red
  106. gfx_fillcircle(900,100,150);
  107. gfx_circle(900,100,150);
  108.  
  109. gfx_color(0,255,0); //light green
  110. gfx_fillcircle(700,300,150);
  111. gfx_circle(700,300,150);
  112.  
  113. gfx_color(0,0,255); //light blue
  114. gfx_fillcircle(900,300,150);
  115. gfx_circle(900,300,150);
  116.  
  117. gfx_color(255,255,0); //yellow
  118. gfx_fillcircle(700,500,150);
  119. gfx_circle(700,500,150);
  120.  
  121. gfx_color(0,128,0); //dark green
  122. gfx_fillcircle(900,500,150);
  123. gfx_circle(900,500,150);
  124.  
  125. gfx_color(255,0,255); //pink
  126. gfx_fillcircle(700,700,150);
  127. gfx_circle(700,700,150);
  128.  
  129. gfx_color(128,0,128); //purple
  130. gfx_fillcircle(900,700,150);
  131. gfx_circle(900,700,150);
  132.  
  133. gfx_color(0,0,100); //dark blue
  134. gfx_fillcircle(700,900,150);
  135. gfx_circle(700,900,150);
  136.  
  137. gfx_color(65,42,42); //brown
  138. gfx_fillcircle(900,900,150);
  139. gfx_circle(900,900,150);
  140.  
  141. if ((x >= 800 && x <= 1000) || (y >= 0 && y <= 200)) // decision making part
  142. {
  143. printf("CORRECT\n");
  144. }
  145. }//53
  146.  
  147. }//48
  148.  
  149.  
  150. }//8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement