Advertisement
Guest User

milionerzy v.0.01

a guest
Mar 24th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.81 KB | None | 0 0
  1. #include <allegro.h>
  2. #include <time.h>
  3.  
  4. void drugie_pytanie();
  5.  
  6. void menu_glowne_tekst()
  7. {
  8. textout_ex(screen, font, "Witajcie w grze Milionerzy!", 60, 60, makecol(255,50,255), makecol(100,100,100));
  9. textout_ex(screen, font, "1. Start", 60, 80, makecol(255,50,255), makecol(100,100,100));
  10. textout_ex(screen, font, "2. Tworcy", 60, 100, makecol(255,50,255), makecol(100,100,100));
  11. textout_ex(screen, font, "3. Wyjscie", 60, 120, makecol(255,50,255), makecol(100,100,100));
  12. }
  13.  
  14. void menu_glowne_wybor()
  15. {
  16. char klawisz = 0;
  17. while(!key[KEY_ESC])
  18. {
  19. klawisz = readkey();
  20. //
  21. // textprintf(screen, font, 60, 140, makecol(255, 0, 255), "%c", klawisz, makecol(100, 100, 100));
  22. if(klawisz=='1')
  23. {
  24. textout_ex(screen, font, "ZACZYNAMY", 60, 160, makecol(255,50,255), makecol(100,100,100));
  25. rest(1000);
  26. clear_to_color(screen, makecol(100,100,100));
  27. clear_keybuf();
  28. pierwsze_pytanie();
  29. }
  30. else if(klawisz=='2')
  31. {
  32. rest(1000);
  33. clear_to_color(screen, makecol(100,100,100));
  34. textout_ex(screen, font, "Danio", 60, 80, makecol(255,50,255), makecol(100,100,100));
  35. textout_ex(screen, font, "Szimi", 60, 100, makecol(255,50,255), makecol(100,100,100));
  36. textout_ex(screen, font, "Mati", 60, 120, makecol(255,50,255), makecol(100,100,100));
  37. clear_keybuf();
  38. rest(3000);
  39.  
  40. break;
  41. }
  42. else if(klawisz=='3')
  43. {
  44. textout_ex(screen, font, "Dziekujemy za gre!", 160, 160, makecol(255,50,255), makecol(100,100,100));
  45. rest(3000);
  46. clear_to_color(screen, makecol(100,100,100));
  47. break;
  48. }
  49. }
  50. menu_glowne_tekst();
  51. }
  52.  
  53. void pierwsze_pytanie()
  54. {
  55. srand(time(0));
  56. int pytanie = rand()%2;
  57. char klawisz = 0;
  58.  
  59. switch (pytanie)
  60. {
  61. case 0:
  62. textout_ex(screen, font, "Ile nog ma osiol?", 60, 60, makecol(255,50,255), makecol(100,100,100));
  63. rest(300);
  64. textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
  65. rest(300);
  66. textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
  67. rest(300);
  68. textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
  69. rest(300);
  70. textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
  71. rest(300);
  72. while(!key[KEY_ESC])
  73. {
  74. klawisz = readkey();
  75. if(klawisz=='D'||klawisz=='d')
  76. {
  77. rest(500);
  78. textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
  79. clear_to_color(screen, makecol(100,100,100));
  80. drugie_pytanie();
  81. }
  82. else
  83. textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
  84. clear_keybuf();
  85. rest(3000);
  86. clear_to_color(screen, makecol(100,100,100));
  87. break;
  88. }
  89. break;
  90. menu_glowne_tekst();
  91. menu_glowne_wybor();
  92. case 1:
  93. textout_ex(screen, font, "Ile nog ma czlowiek?", 60, 60, makecol(255,50,255), makecol(100,100,100));
  94. rest(300);
  95. textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
  96. rest(300);
  97. textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
  98. rest(300);
  99. textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
  100. rest(300);
  101. textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
  102. rest(300);
  103. while(!key[KEY_ESC])
  104. {
  105. klawisz = readkey();
  106. if(klawisz=='B'||klawisz=='b')
  107. {
  108. rest(500);
  109. textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
  110. clear_to_color(screen, makecol(100,100,100));
  111. drugie_pytanie();
  112. }
  113. else
  114. textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
  115. clear_keybuf();
  116. rest(3000);
  117. clear_to_color(screen, makecol(100,100,100));
  118. break;
  119. }
  120. break;
  121. menu_glowne_tekst();
  122. menu_glowne_wybor();
  123.  
  124. }
  125.  
  126. }
  127.  
  128. void drugie_pytanie()
  129. {
  130. srand(time(0));
  131. int pytanie = rand()%2;
  132. char klawisz = 0;
  133.  
  134. switch (pytanie)
  135. {
  136. case 0:
  137. textout_ex(screen, font, "elo 4", 60, 60, makecol(255,50,255), makecol(100,100,100));
  138. rest(300);
  139. textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
  140. rest(300);
  141. textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
  142. rest(300);
  143. textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
  144. rest(300);
  145. textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
  146. rest(300);
  147. while(!key[KEY_ESC])
  148. {
  149. klawisz = readkey();
  150. if(klawisz=='D'||klawisz=='d')
  151. {
  152. rest(500);
  153. textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
  154. //clear_to_color(screen, makecol(100,100,100));
  155. }
  156. else
  157. textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
  158. clear_keybuf();
  159. rest(3000);
  160. clear_to_color(screen, makecol(100,100,100));
  161. break;
  162. }
  163. break;
  164. menu_glowne_tekst();
  165. menu_glowne_wybor();
  166. case 1:
  167. textout_ex(screen, font, "elo 2?", 60, 60, makecol(255,50,255), makecol(100,100,100));
  168. rest(300);
  169. textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
  170. rest(300);
  171. textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
  172. rest(300);
  173. textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
  174. rest(300);
  175. textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
  176. rest(300);
  177. while(!key[KEY_ESC])
  178. {
  179. klawisz = readkey();
  180. if(klawisz=='B'||klawisz=='b')
  181. {
  182. rest(500);
  183. textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
  184. //clear_to_color(screen, makecol(100,100,100));
  185. }
  186. else
  187. textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
  188. clear_keybuf();
  189. rest(3000);
  190. clear_to_color(screen, makecol(100,100,100));
  191. break;
  192. }
  193. break;
  194. menu_glowne_tekst();
  195. menu_glowne_wybor();
  196.  
  197. }
  198. }
  199.  
  200. int main()
  201. {
  202. allegro_init();
  203. install_keyboard();
  204. set_color_depth( 32 );
  205. set_gfx_mode( GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0 );
  206. clear_to_color( screen, makecol( 100, 100, 100 ) );
  207.  
  208. menu_glowne_tekst();
  209. menu_glowne_wybor();
  210.  
  211. //readkey();
  212.  
  213. allegro_exit();
  214. return 0;
  215. }
  216. END_OF_MAIN();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement