Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <allegro.h>
- #include <time.h>
- void drugie_pytanie();
- void menu_glowne_tekst()
- {
- textout_ex(screen, font, "Witajcie w grze Milionerzy!", 60, 60, makecol(255,50,255), makecol(100,100,100));
- textout_ex(screen, font, "1. Start", 60, 80, makecol(255,50,255), makecol(100,100,100));
- textout_ex(screen, font, "2. Tworcy", 60, 100, makecol(255,50,255), makecol(100,100,100));
- textout_ex(screen, font, "3. Wyjscie", 60, 120, makecol(255,50,255), makecol(100,100,100));
- }
- void menu_glowne_wybor()
- {
- char klawisz = 0;
- while(!key[KEY_ESC])
- {
- klawisz = readkey();
- //
- // textprintf(screen, font, 60, 140, makecol(255, 0, 255), "%c", klawisz, makecol(100, 100, 100));
- if(klawisz=='1')
- {
- textout_ex(screen, font, "ZACZYNAMY", 60, 160, makecol(255,50,255), makecol(100,100,100));
- rest(1000);
- clear_to_color(screen, makecol(100,100,100));
- clear_keybuf();
- pierwsze_pytanie();
- }
- else if(klawisz=='2')
- {
- rest(1000);
- clear_to_color(screen, makecol(100,100,100));
- textout_ex(screen, font, "Danio", 60, 80, makecol(255,50,255), makecol(100,100,100));
- textout_ex(screen, font, "Szimi", 60, 100, makecol(255,50,255), makecol(100,100,100));
- textout_ex(screen, font, "Mati", 60, 120, makecol(255,50,255), makecol(100,100,100));
- clear_keybuf();
- rest(3000);
- break;
- }
- else if(klawisz=='3')
- {
- textout_ex(screen, font, "Dziekujemy za gre!", 160, 160, makecol(255,50,255), makecol(100,100,100));
- rest(3000);
- clear_to_color(screen, makecol(100,100,100));
- break;
- }
- }
- menu_glowne_tekst();
- }
- void pierwsze_pytanie()
- {
- srand(time(0));
- int pytanie = rand()%2;
- char klawisz = 0;
- switch (pytanie)
- {
- case 0:
- textout_ex(screen, font, "Ile nog ma osiol?", 60, 60, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- while(!key[KEY_ESC])
- {
- klawisz = readkey();
- if(klawisz=='D'||klawisz=='d')
- {
- rest(500);
- textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
- clear_to_color(screen, makecol(100,100,100));
- drugie_pytanie();
- }
- else
- textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
- clear_keybuf();
- rest(3000);
- clear_to_color(screen, makecol(100,100,100));
- break;
- }
- break;
- menu_glowne_tekst();
- menu_glowne_wybor();
- case 1:
- textout_ex(screen, font, "Ile nog ma czlowiek?", 60, 60, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- while(!key[KEY_ESC])
- {
- klawisz = readkey();
- if(klawisz=='B'||klawisz=='b')
- {
- rest(500);
- textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
- clear_to_color(screen, makecol(100,100,100));
- drugie_pytanie();
- }
- else
- textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
- clear_keybuf();
- rest(3000);
- clear_to_color(screen, makecol(100,100,100));
- break;
- }
- break;
- menu_glowne_tekst();
- menu_glowne_wybor();
- }
- }
- void drugie_pytanie()
- {
- srand(time(0));
- int pytanie = rand()%2;
- char klawisz = 0;
- switch (pytanie)
- {
- case 0:
- textout_ex(screen, font, "elo 4", 60, 60, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- while(!key[KEY_ESC])
- {
- klawisz = readkey();
- if(klawisz=='D'||klawisz=='d')
- {
- rest(500);
- textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
- //clear_to_color(screen, makecol(100,100,100));
- }
- else
- textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
- clear_keybuf();
- rest(3000);
- clear_to_color(screen, makecol(100,100,100));
- break;
- }
- break;
- menu_glowne_tekst();
- menu_glowne_wybor();
- case 1:
- textout_ex(screen, font, "elo 2?", 60, 60, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "A. 1 ", 60, 80, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "B. 2 ", 60, 100, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "C. 3 ", 60, 120, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- textout_ex(screen, font, "D. 4 ", 60, 140, makecol(255,50,255), makecol(100,100,100));
- rest(300);
- while(!key[KEY_ESC])
- {
- klawisz = readkey();
- if(klawisz=='B'||klawisz=='b')
- {
- rest(500);
- textout_ex(screen, font, "To dobra odpowiedz! Przechodzisz dalej!", 60, 180, makecol(255,50,255), makecol(100,100,100));
- //clear_to_color(screen, makecol(100,100,100));
- }
- else
- textout_ex(screen, font, "Niestety, to nie jest dobra odpowiedz. Porazka.", 60, 180, makecol(255,50,255), makecol(100,100,100));
- clear_keybuf();
- rest(3000);
- clear_to_color(screen, makecol(100,100,100));
- break;
- }
- break;
- menu_glowne_tekst();
- menu_glowne_wybor();
- }
- }
- int main()
- {
- allegro_init();
- install_keyboard();
- set_color_depth( 32 );
- set_gfx_mode( GFX_AUTODETECT_WINDOWED, 800, 600, 0, 0 );
- clear_to_color( screen, makecol( 100, 100, 100 ) );
- menu_glowne_tekst();
- menu_glowne_wybor();
- //readkey();
- allegro_exit();
- return 0;
- }
- END_OF_MAIN();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement