Advertisement
Guest User

Untitled

a guest
Jan 15th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 19.16 KB | None | 0 0
  1. #include <iostream>
  2. #include <graphics.h>
  3. #include <winbgim.h>
  4. #include <conio.h>
  5. #include <time.h>
  6. #include <math.h>
  7. using namespace std;
  8.  
  9. int x, y, lungime, solutie[8][8], generare[8][8];
  10.  
  11. void patrat(int lungime, int x, int y)
  12. {
  13.     int latura;
  14.     latura=lungime/2;
  15.     line(x-latura,y-latura,x+latura,y-latura);
  16.     line(x+latura,y-latura,x+latura,y+latura);
  17.     line(x+latura,y+latura,x-latura,y+latura);
  18.     line(x-latura,y+latura,x-latura,y-latura);
  19.  
  20. }
  21.  
  22. void verificare();
  23. void menu();
  24. void mouseClick();
  25.  
  26.  
  27. void random(int &numar, int &numar2)
  28. {
  29.     int num, num2, a=225, b=275, c=325, d=375, e=425, f=475, g=525, h=575;
  30.     num = rand()%8;
  31.     num2 = rand()%8;
  32.     if(num==0)
  33.         numar = a;
  34.     if(num==1)
  35.         numar = b;
  36.     if(num==2)
  37.         numar = c;
  38.     if(num==3)
  39.         numar = d;
  40.     if(num==4)
  41.         numar = e;
  42.     if(num==5)
  43.         numar = f;
  44.     if(num==6)
  45.         numar = g;
  46.     if(num==7)
  47.         numar = h;
  48.     if(num2==0)
  49.         numar2 = a;
  50.     if(num2==1)
  51.         numar2 = b;
  52.     if(num2==2)
  53.         numar2 = c;
  54.     if(num2==3)
  55.         numar2 = d;
  56.     if(num2==4)
  57.         numar2 = e;
  58.     if(num2==5)
  59.         numar2 = f;
  60.     if(num2==6)
  61.         numar2 = g;
  62.     if(num2==7)
  63.         numar2 = h;
  64. }
  65.  
  66. int i, j, aux1, aux2, cerc, lvl1, lvl2, lvl3; // variabilele folosite pentru crearea nivelelor
  67.  
  68. void level1()
  69. {
  70.     settextstyle(0,0,0);
  71.     lvl1=1;
  72.     rectangle(200,100,380,150);
  73.     outtextxy(225,115,"VERIFICARE");
  74.     rectangle(450,100,600,150);
  75.     outtextxy(500,115,"MENIU");
  76.     for(i=0;i<8;i++)
  77.     {
  78.         for(j=0;j<8;j++)
  79.           {
  80.               rectangle(200+i*50,200+j*50,200+(i+1)*50,200+(j+1)*50); // aici pornim de la coordonatele x=200, y=200 pana la x=600, y=600
  81.           }
  82.     }
  83.     setfillstyle(SOLID_FILL,WHITE);
  84.     setcolor(WHITE);
  85.     for (cerc=1;cerc<=8;cerc++)
  86.     {
  87.         random(x,y);
  88.         aux1=x;
  89.         aux2=y;
  90.         x=x-225;
  91.         y=y-225;
  92.         x=x/50;
  93.         y=y/50;
  94.         if(generare[x][y]==0)
  95.         {
  96.             generare[x][y]=1;
  97.             circle(aux1,aux2,12.5);
  98.             floodfill(aux1,aux2,WHITE);
  99.         }
  100.         else
  101.             cerc--;
  102.     }
  103.     mouseClick();
  104. }
  105.  
  106. void level2()
  107. {
  108.     settextstyle(0,0,0);
  109.     lvl1=1;
  110.     rectangle(200,100,380,150);
  111.     outtextxy(225,115,"VERIFICARE");
  112.     rectangle(450,100,600,150);
  113.     outtextxy(500,115,"MENIU");
  114.     for(i=0;i<8;i++)
  115.     {
  116.         for(j=0;j<8;j++)
  117.           {
  118.               rectangle(200+i*50,200+j*50,200+(i+1)*50,200+(j+1)*50); // aici pornim de la coordonatele x=200, y=200 pana la x=600, y=600
  119.           }
  120.     }
  121.     setfillstyle(SOLID_FILL,WHITE);
  122.     for (cerc=1;cerc<=8;cerc++)
  123.     {
  124.         random(x,y);
  125.         aux1=x;
  126.         aux2=y;
  127.         x=x-225;
  128.         y=y-225;
  129.         x=x/50;
  130.         y=y/50;
  131.         if(generare[x][y]==0)
  132.         {
  133.             generare[x][y]=1;
  134.             circle(aux1,aux2,12.5);
  135.             floodfill(aux1,aux2,WHITE);
  136.         }
  137.         else
  138.             cerc--;
  139.     }
  140.     setfillstyle(SOLID_FILL,RED);
  141.     for (cerc=1;cerc<=8;cerc++)
  142.     {
  143.         random(x,y);
  144.         aux1=x;
  145.         aux2=y;
  146.         x=x-225;
  147.         y=y-225;
  148.         x=x/50;
  149.         y=y/50;
  150.         if(generare[x][y]==0)
  151.         {
  152.             generare[x][y]=2;
  153.             circle(aux1,aux2,12.5);
  154.             floodfill(aux1,aux2,WHITE);
  155.         }
  156.         else
  157.             cerc--;
  158.     }
  159.     mouseClick();
  160. }
  161.  
  162. void level3()
  163. {
  164.     settextstyle(0,0,0);
  165.     lvl1=1;
  166.     rectangle(200,100,380,150);
  167.     outtextxy(225,115,"VERIFICARE");
  168.     rectangle(450,100,600,150);
  169.     outtextxy(500,115,"MENIU");
  170.     for(i=0;i<8;i++)
  171.     {
  172.         for(j=0;j<8;j++)
  173.           {
  174.               rectangle(200+i*50,200+j*50,200+(i+1)*50,200+(j+1)*50); // aici pornim de la coordonatele x=200, y=200 pana la x=600, y=600
  175.           }
  176.     }
  177.     setfillstyle(SOLID_FILL,WHITE);
  178.     for (cerc=1;cerc<=8;cerc++)
  179.     {
  180.         random(x,y);
  181.         aux1=x;
  182.         aux2=y;
  183.         x=x-225;
  184.         y=y-225;
  185.         x=x/50;
  186.         y=y/50;
  187.         if(generare[x][y]==0)
  188.         {
  189.             generare[x][y]=1;
  190.             circle(aux1,aux2,12.5);
  191.             floodfill(aux1,aux2,WHITE);
  192.         }
  193.         else
  194.             cerc--;
  195.     }
  196.     setfillstyle(SOLID_FILL,RED);
  197.     for (cerc=1;cerc<=8;cerc++)
  198.     {
  199.         random(x,y);
  200.         aux1=x;
  201.         aux2=y;
  202.         x=x-225;
  203.         y=y-225;
  204.         x=x/50;
  205.         y=y/50;
  206.         if(generare[x][y]==0)
  207.         {
  208.  
  209.             generare[x][y]=2;
  210.             circle(aux1,aux2,12.5);
  211.             floodfill(aux1,aux2,WHITE);
  212.         }
  213.         else
  214.             cerc--;
  215.     }
  216.     setfillstyle(SOLID_FILL,BLUE);
  217.     for (cerc=1;cerc<=8;cerc++)
  218.     {
  219.         random(x,y);
  220.         aux1=x;
  221.         aux2=y;
  222.         x=x-225;
  223.         y=y-225;
  224.         x=x/50;
  225.         y=y/50;
  226.         if(generare[x][y]==0)
  227.         {
  228.             generare[x][y]=3;
  229.             circle(aux1,aux2,12.5);
  230.             floodfill(aux1,aux2,WHITE);
  231.         }
  232.         else
  233.             cerc--;
  234.     }
  235.     mouseClick();
  236.  
  237. }
  238.  
  239. int centru(int x) // pentru a afla coordonatele centrului cercului
  240. {
  241.     if(x>=200&&x<250)
  242.         return 225;
  243.     if(x>=250&&x<300)
  244.         return 275;
  245.     if(x>=300&&x<350)
  246.         return 325;
  247.     if(x>=350&&x<400)
  248.         return 375;
  249.     if(x>=400&&x<450)
  250.         return 425;
  251.     if(x>=450&&x<500)
  252.         return 475;
  253.     if(x>=500&&x<550)
  254.         return 525;
  255.     if(x>=550&&x<600)
  256.         return 575;
  257. }
  258.  
  259. int matrice(int x)
  260. {
  261.     if(x>=200&&x<250)
  262.         return 0;
  263.     if(x>=250&&x<300)
  264.         return 1;
  265.     if(x>=300&&x<350)
  266.         return 2;
  267.     if(x>=350&&x<400)
  268.         return 3;
  269.     if(x>=400&&x<450)
  270.         return 4;
  271.     if(x>=450&&x<500)
  272.         return 5;
  273.     if(x>=500&&x<550)
  274.         return 6;
  275.     if(x>=550&&x<600)
  276.         return 7;
  277. }
  278.  
  279. int margine(int x, int y)
  280. {
  281.     int i, j, marginx,marginy;
  282.     for(i=1;i<=6;i++)
  283.         for(j=1;j<=6;j++)
  284.     {
  285.         marginx=200+50*i;
  286.         marginy=200+50*j;
  287.         if(x==marginx&&y==marginy)
  288.             return 1;
  289.     }
  290.     return 0;
  291. }
  292.  
  293. int alb[8], rosu[8], albastru[8];
  294.  
  295. void mouseClick()
  296. {
  297.     int culoare=2, arie=0, contor=0, cerculet=0, linie, coloana, edge=0, start=0, aux2, aux;
  298.  
  299.     while(contor<=63)
  300.     {
  301.         getmouseclick(WM_LBUTTONUP,x,y);
  302.         if(x>200&&x<350&&y>100&&y<150)
  303.             verificare();
  304.         if(x>450&&x<600&&y>100&&y<150)
  305.         {
  306.             lvl1=0;
  307.             lvl2=0;
  308.             lvl3=0;
  309.             cleardevice();
  310.             culoare=2;
  311.             contor=0;
  312.             start=0;
  313.             arie=0;
  314.             for(i=0;i<=7;i++)
  315.                 for(j=0;j<=7;j++)
  316.             {
  317.                 solutie[i][j]=0;
  318.                 generare[i][j]=0;
  319.             }
  320.             menu();
  321.         }
  322.         linie=matrice(x);
  323.         coloana=matrice(y);
  324.         if(margine(x,y)==1)
  325.                 edge=1;
  326.         else edge=0;
  327.         if(start==0&&edge==0&&solutie[linie][coloana]==0&&x>=200&&x<=600&&y>=200&&y<=600)
  328.         {
  329.             clearmouseclick(WM_LBUTTONUP);
  330.             i=centru(mousex());
  331.             j=centru(mousey());
  332.             aux=i;
  333.             aux2=j;
  334.             i=i-225;
  335.             j=j-225;
  336.             i=i/50;
  337.             j=j/50;
  338.             if(generare[i][j]==1||generare[i][j]==2||generare[i][j]==3)
  339.                 cerculet=1;
  340.             else cerculet=0;
  341.             if(cerculet==1&&sqrt((mousex()-centru(mousex()))*(mousex()-centru(mousex()))+(mousey()-centru(mousey()))*(mousey()-centru(mousey())))>12.5) // distanta dintre doua drepte
  342.             {
  343.                 arie++;
  344.                 if(arie==8)
  345.                     start=0;
  346.                 if(arie==9)
  347.                 {
  348.                     arie=1;
  349.                     culoare++;
  350.                     if(culoare == 4 || culoare == 7 || culoare == 8 || culoare == 10)
  351.                         culoare ++;
  352.                 }
  353.                 setfillstyle(SOLID_FILL,culoare);
  354.                 floodfill(mousex(),mousey(),WHITE);
  355.                 cerculet=0;
  356.                 solutie[linie][coloana]=culoare;
  357.                 if(generare[i][j]==1)
  358.                     alb[culoare]++;
  359.                 if(generare[i][j]==2)
  360.                     rosu[culoare]++;
  361.                 if(generare[i][j]==3)
  362.                     albastru[culoare]++;
  363.             }
  364.             else if(cerculet==0)
  365.             {
  366.                 arie++;
  367.                 if(arie==8)
  368.                     start=0;
  369.                 if(arie==9)
  370.                 {
  371.                     arie=1;
  372.                     culoare++;
  373.                     if(culoare == 4 || culoare == 7 || culoare == 8 || culoare == 10)
  374.                         culoare ++;
  375.                 }
  376.                 setfillstyle(SOLID_FILL,culoare);
  377.                 floodfill(mousex(),mousey(),WHITE);
  378.                 solutie[linie][coloana]=culoare;
  379.             }
  380.             start=1;
  381.          }
  382.          else if(start==1&&edge==0&&solutie[linie][coloana]==0&&(arie>=1&&(solutie[linie+1][coloana]==culoare||solutie[linie-1][coloana]==culoare||solutie[linie][coloana+1]==culoare||solutie[linie][coloana-1]==culoare)))
  383.         {
  384.             clearmouseclick(WM_LBUTTONUP);
  385.             i=centru(mousex());
  386.             j=centru(mousey());
  387.             i=i-225;
  388.             j=j-225;
  389.             i=i/50;
  390.             j=j/50;
  391.             if(generare[i][j]==1||generare[i][j]==2||generare[i][j]==3)
  392.                 cerculet=1;
  393.             else cerculet=0;
  394.             if(cerculet==1&&sqrt((mousex()-centru(mousex()))*(mousex()-centru(mousex()))+(mousey()-centru(mousey()))*(mousey()-centru(mousey())))>12.5) // distanta dintre doua drepte
  395.             {
  396.                 arie++;
  397.                 if(arie==8)
  398.                     start=0;
  399.                 if(arie==9)
  400.                 {
  401.                     arie=1;
  402.                     culoare++;
  403.                     if(culoare == 4 || culoare == 7 || culoare == 8 || culoare == 10)
  404.                         culoare ++;
  405.                 }
  406.                 setfillstyle(SOLID_FILL,culoare);
  407.                 floodfill(mousex(),mousey(),WHITE);
  408.                 cerculet=0;
  409.                 solutie[linie][coloana]=culoare;
  410.                 if(generare[i][j]==1)
  411.                     alb[culoare]++;
  412.                 if(generare[i][j]==2)
  413.                     rosu[culoare]++;
  414.                 if(generare[i][j]==3)
  415.                     albastru[culoare]++;
  416.  
  417.             }
  418.             else if(cerculet==0)
  419.             {
  420.                 arie++;
  421.                 if(arie==8)
  422.                     start=0;
  423.                 if(arie==9)
  424.                 {
  425.                     arie=1;
  426.                     culoare++;
  427.                     if(culoare == 4 || culoare == 7 || culoare == 10)
  428.                         culoare ++;
  429.                 }
  430.                 setfillstyle(SOLID_FILL,culoare);
  431.                 floodfill(mousex(),mousey(),WHITE);
  432.                 solutie[linie][coloana]=culoare;
  433.             }
  434.          }
  435.  
  436.         getmouseclick(WM_RBUTTONUP,x,y);
  437.         linie=matrice(x);
  438.         coloana=matrice(y);
  439.         if(edge==0&&solutie[linie][coloana]==culoare&&x>=200&x<=600&&y>=200&y<=600&&(arie>=1&&(solutie[linie+1][coloana]==culoare||solutie[linie-1][coloana]==culoare||solutie[linie][coloana+1]==culoare||solutie[linie][coloana-1]==culoare)))
  440.         {
  441.             clearmouseclick(WM_RBUTTONUP);
  442.             i=centru(mousex());
  443.             j=centru(mousey());
  444.             i=i-225;
  445.             j=j-225;
  446.             i=i/50;
  447.             j=j/50;
  448.             if(generare[i][j]==1||generare[i][j]==2||generare[i][j]==3)
  449.                 cerculet=1;
  450.             else cerculet = 0;
  451.             if(cerculet==1&&sqrt((mousex()-centru(mousex()))*(mousex()-centru(mousex()))+(mousey()-centru(mousey()))*(mousey()-centru(mousey())))>12.5)
  452.             {
  453.                 if(arie>=1)
  454.                 {
  455.                     setfillstyle(SOLID_FILL,BLACK);
  456.                     floodfill(mousex(),mousey(),WHITE);
  457.                     arie--;
  458.                     contor--;
  459.                     solutie[linie][coloana]=0;
  460.                 }
  461.                 else if (arie==0&&culoare>=2)
  462.                 {
  463.                     setfillstyle(SOLID_FILL,BLACK);
  464.                     floodfill(mousex(),mousey(),WHITE);
  465.                     arie=6;
  466.                     culoare--;
  467.                 }
  468.                 if(generare[i][j]==1)
  469.                     alb[culoare]--;
  470.                 if(generare[i][j]==2)
  471.                     rosu[culoare]--;
  472.                 if(generare[i][j]==3)
  473.                     albastru[culoare]--;
  474.              }
  475.                 else if(cerculet==0)
  476.                 {
  477.                     if(arie>=1)
  478.                     {
  479.                         setfillstyle(SOLID_FILL,BLACK);
  480.                         floodfill(mousex(),mousey(),WHITE);
  481.                         arie--;
  482.                         contor--;
  483.                         solutie[linie][coloana]=0;
  484.                     }
  485.                 }
  486.         }
  487.     }
  488.  
  489.  
  490. }
  491.  
  492. void verificare()
  493. {
  494.     int ok=1;
  495.     if(lvl1==1)
  496.     {
  497.         for(i=2;i<=12;i++)
  498.         {
  499.             if(i==4 || i==7 || i==10)
  500.                 i++;
  501.             if(alb[i]!=1)
  502.             {
  503.                 ok=0;
  504.                 outtextxy(380,120,"GRESIT");
  505.             }
  506.         }
  507.     }
  508.     if(lvl2==1)
  509.     for(i=2;i<=12;i++)
  510.     {
  511.         if(i==4 || i==7 || i==10)
  512.             i++;
  513.         if(alb[i]!=1||rosu[i]!=1)
  514.         {
  515.             ok=0;
  516.             outtextxy(380,120,"GRESIT");
  517.         }
  518.     }
  519.     if(lvl3==1)
  520.     for(i=2;i<=12;i++)
  521.     {
  522.         if(i==4 || i==7 || i==10)
  523.             i++;
  524.         if(alb[i]!=1||rosu[i]!=1||albastru[i]!=1)
  525.         {
  526.             ok=0;
  527.             outtextxy(380,120,"GRESIT");
  528.         }
  529.     }
  530.     if(ok==1)
  531.         outtextxy(350,170,"FELICITARI, AI CASTIGAT");
  532.  
  533.  
  534.  
  535. }
  536.  
  537. int W=800,H=800;
  538.  
  539. void menu();
  540. void start();
  541. void options();
  542. void howto();
  543. void quit();
  544.  
  545.  
  546. int main()
  547. {
  548.     initwindow(W,H," IMPARTIREA CAREULUI ");
  549.     x=200;
  550.     y=200;
  551.     lungime=50;
  552.     srand(time(NULL));
  553.     menu();
  554.     mouseClick();
  555.     getch();
  556.     closegraph();
  557.     return 0;
  558. }
  559.  
  560. void start()
  561. {
  562.     int ok;
  563.     rectangle(200,370,500,430);
  564.     line(300,370,300,430);
  565.     line(400,370,400,430);
  566.     settextstyle(1,0,4);
  567.     outtextxy(300,330,"LEVELS:");
  568.     outtextxy(240,385,"1");
  569.     outtextxy(340,385,"2");
  570.     outtextxy(440,385,"3");
  571.     settextstyle(1,0,2);
  572.     rectangle(50,600,200,650);
  573.     outtextxy(80,615,"BACK");
  574.     POINT cursorPosition;
  575.     int mX,mY;
  576.     while(1)
  577.     {
  578.         GetCursorPos(&cursorPosition);
  579.         mX=cursorPosition.x;
  580.         mY=cursorPosition.y;
  581.         cout << mX << " " << mY << endl;
  582.         if(GetAsyncKeyState(VK_LBUTTON))
  583.         {
  584.             if(mX>50 && mX<200 && mY>626 && mY<675)
  585.             {
  586.                 cleardevice();
  587.                 ok=1;
  588.             }
  589.             if(ok==1)
  590.                 break;
  591.         }
  592.         getmouseclick(WM_LBUTTONUP,x,y);
  593.         if(x>200&&x<300&&y>370&&y<430)
  594.         {
  595.             cleardevice();
  596.             level1();
  597.         }
  598.         else if(x>300&&x<400&&y>370&&y<430)
  599.         {
  600.             cleardevice();
  601.             level2();
  602.         }
  603.         else if(x>400&&x<500&&y>370&&y<430)
  604.         {
  605.             cleardevice();
  606.             level3();
  607.         }
  608.         x=mousex();
  609.         y=mousey();
  610.  
  611.         delay(600);
  612.     }
  613.  
  614.     menu();
  615. }
  616.  
  617. void options()
  618. {
  619.     int ok;
  620.     rectangle(200,370,600,430);
  621.     line(300,370,300,430);
  622.     line(400,370,400,430);
  623.     line(500,370,500,430);
  624.     setfillstyle(1,RED);
  625.     floodfill(210,380,WHITE);
  626.     setfillstyle(1,GREEN);
  627.     floodfill(310,380,WHITE);
  628.     setfillstyle(1,YELLOW);
  629.     floodfill(410,380,WHITE);
  630.     setfillstyle(1,BLUE);
  631.     floodfill(510,380,WHITE);
  632.     outtextxy(215,320,"BACKGROUND:");
  633.  
  634.     POINT cursorPosition;
  635.     int mX,mY;
  636.     while(1)
  637.     {
  638.         GetCursorPos(&cursorPosition);
  639.         mX=cursorPosition.x;
  640.         mY=cursorPosition.y;
  641.         if(GetAsyncKeyState(VK_LBUTTON))
  642.         {
  643.             if(mX>200 && mX<300 & mY>395 && mY<455)
  644.             {
  645.                 setbkcolor(RED);
  646.                 cleardevice();
  647.                 ok=1;
  648.             }
  649.             if(mX>300 && mX<400 & mY>395 && mY<455)
  650.             {
  651.                 setbkcolor(GREEN);
  652.                 cleardevice();
  653.                 ok=1;
  654.             }
  655.             if(mX>400 && mX<500 & mY>395 && mY<455)
  656.             {
  657.                 setbkcolor(YELLOW);
  658.                 cleardevice();
  659.                 ok=1;
  660.             }
  661.             if(mX>500 && mX<600 & mY>395 && mY<455)
  662.             {
  663.                 setbkcolor(BLUE);
  664.                 cleardevice();
  665.                 ok=1;
  666.             }
  667.  
  668.             if(ok==1)
  669.                 break;
  670.         }
  671.  
  672.         delay(600);
  673.     }
  674.    menu();
  675. }
  676.  
  677. void howto()
  678. {
  679.     int ok;
  680.     settextstyle(1,0,4);
  681.     outtextxy(50,100,"RULES:");
  682.     settextstyle(1,0,2);
  683.     outtextxy(50,200,"1.You're allowed to move just in nearby boxes");
  684.     outtextxy(50,250,"2.Depending on level you've chosen you ought to");
  685.     outtextxy(75,280,"group 1/2/3 dots");
  686.     outtextxy(50,330,"3.At the end table must be fully coloured");
  687.     outtextxy(50,380,"4.Depending on level you've chosen you ought to");
  688.     outtextxy(75,410,"have sections of 8 or 16 boxes");
  689.     rectangle(50,600,200,650);
  690.     outtextxy(80,615,"BACK");
  691.  
  692.     POINT cursorPosition;
  693.     int mX,mY;
  694.     while(1)
  695.     {
  696.         GetCursorPos(&cursorPosition);
  697.         mX=cursorPosition.x;
  698.         mY=cursorPosition.y;
  699.         if(GetAsyncKeyState(VK_LBUTTON))
  700.         {
  701.             if(mX>50 && mX<200 && mY>626 && mY<675)
  702.             {
  703.                 cleardevice();
  704.                 ok=1;
  705.             }
  706.             if(ok==1)
  707.                 break;
  708.         }
  709.  
  710.         delay(600);
  711.     }
  712.     menu();
  713.  
  714. }
  715.  
  716. void menu()
  717. {
  718.     int ok;
  719.     settextstyle(1,0,4);
  720.     outtextxy(100,200,"IMPARTIREA CAREULUI");
  721.     rectangle(200,300,600,350);
  722.     rectangle(200,350,600,400);
  723.     rectangle(200,400,600,450);
  724.     rectangle(200,450,600,500);
  725.     settextstyle(1,0,4);
  726.     outtextxy(320,310,"START");
  727.     outtextxy(290,360,"OPTIONS");
  728.     outtextxy(290,410,"HOW TO?");
  729.     outtextxy(330,460,"QUIT");
  730.     POINT cursorPosition;
  731.     int mX,mY;
  732.     while(1)
  733.     {
  734.         GetCursorPos(&cursorPosition);
  735.         mX=cursorPosition.x;
  736.         mY=cursorPosition.y;
  737.         if(GetAsyncKeyState(VK_LBUTTON))
  738.         {
  739.             if(mX>200 && mX<600 && mY>325 && mY<375)
  740.             {
  741.                 cleardevice();
  742.                 ok=1;
  743.  
  744.  
  745.             }
  746.             if(mX>200 && mX<600 && mY>375 && mY<425)
  747.             {
  748.                 cleardevice();
  749.                 ok=2;
  750.             }
  751.  
  752.             if(mX>200 && mX<600 && mY>425 && mY<475)
  753.             {
  754.                 cleardevice();
  755.                 ok=3;
  756.             }
  757.             if(mX>200 && mX<600 && mY>475 && mY<525)
  758.             {
  759.                 closegraph(-2);
  760.             }
  761.         if(ok==1 || ok==2 || ok==3)
  762.             break;
  763.         }
  764.  
  765.         delay(600);
  766.     }
  767.             if(ok==1)
  768.                 start();
  769.             else if(ok==2)
  770.                 options();
  771.             else if(ok==3)
  772.                 howto();
  773. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement