CGameControllerSimon::CGameControllerSimon()
:
    dimTW(200),
    dimTH(200)
{

    m_LastMouseX = mousex();
    m_LastMouseY = mousey();
    m_TimerCPU = GetTickCount();
    m_SeqCPUPos = 0;
    m_SeqP1Pos = 0;
    m_ActivePlayer = PLAYER_CPU;
    m_Started = false;

    for (int i=0;i<4;i++)
    {
        v_Cursor[i].m_Radius = 10;
        v_Cursor[i].m_Dir = -1;
        v_Cursor[i].m_Start = GetTickCount() + 1000 * 0.5f * i;
        v_Cursor[i].m_Pos = vec2(mousex(), mousey());
    }

    for (int i=0;i<NUM_PADS;i++)
    {
        v_Pads[i].m_Timer = GetTickCount();
        v_Pads[i].m_Used = false;
    }

    //Primer Color de la Secuencia
    v_Seq.push_back(rand()%NUM_PADS);
}
Пример #2
0
bool Pause() {
	char it_is_pause[] = "Пауза";
	const int num_of_item_menu = 5;
	bool flag_exit = false;
	bool flag_is_click = false;
	int number_of_func = -1;
	char* arr_str_menu[num_of_item_menu];
	for (int i = 0; i < num_of_item_menu; i++) {
		arr_str_menu[i] = new char[17];
	}
	strcpy(arr_str_menu[0], "Продолжить");
	strcpy(arr_str_menu[1], "Сохранить игру");
	strcpy(arr_str_menu[2], "Настройки");
	strcpy(arr_str_menu[3], "Правила игры");
	strcpy(arr_str_menu[4], "Выход в меню");
	Menu Pause_Menu(it_is_pause, arr_str_menu);
	for (int i = 0; i < num_of_item_menu; i++)
		delete[] arr_str_menu[i];

	Pause_Menu.draw_background();
	Pause_Menu.set_style_headline(BLACK, 5, 10);
	Pause_Menu.set_coord_start_headline(320, 30);
	Pause_Menu.draw_headline();
	Pause_Menu.set_style_body(GREEN, YELLOW, 4, 10);
	Pause_Menu.set_starting_settings_for_output_of_body(200, 150, 600, 500);
	while (!flag_exit) {
		flag_is_click = false;
		if (ismouseclick(WM_LBUTTONUP)) {
			clearmouseclick(WM_LBUTTONUP);
			flag_is_click = true;
		}
		number_of_func = Pause_Menu.draw_body(mousex(), mousey(), flag_is_click);
		switch (number_of_func)
		{
		case 0:
			/*Продолжить игру*/
			return false;
			//std::cout << " 0 ";
			break;
		case 1:
			/*Сохранить игру*/
			//std::cout << " 1 ";
			break;
		case 2:
			/*Настройки*/
			//std::cout << " 2 ";
			break;
		case 3:
			/*Правила игры*/
			//std::cout << " 3 ";
			break;
		case 4:
			/*Выход в главное меню*/
			return true;
		default:
			break;
		}
	}
}
void CGameControllerRalla3::DrawHUD()
{
    if (m_PlayerWin == PLAYER_NULL)
    {
        if (m_ActivePlayer == PLAYER_1)
        {
            circle(mousex(), mousey(), 10);
            outtextxy(g_Game.GetScreenW()/2-textwidth("TURNO: JUGADOR 1")/2, dimTY+60, "TURNO: JUGADOR 1");
        }
        else
        {
            moveto(mousex()-10, mousey()-10);
            lineto(mousex()+10, mousey()+10);
            moveto(mousex()+10, mousey()-10);
            lineto(mousex()-10, mousey()+10);

            if (m_CPU)
                outtextxy(g_Game.GetScreenW()/2-textwidth("TURNO: CPU")/2, dimTY+120, "TURNO: CPU");
            else
                outtextxy(g_Game.GetScreenW()/2-textwidth("TURNO: JUGADOR 2")/2, dimTY+60, "TURNO: JUGADOR 2");
        }
    }
    else
    {
        const char *sBuff;
        if (m_PlayerWin == PLAYER_1)
            sBuff = "Gana el JUGADOR 1";
        else if (m_PlayerWin == PLAYER_2)
            sBuff = "Gana el JUGADOR 2";
        else if (m_PlayerWin == PLAYER_CPU)
            sBuff = "Gana la CPU";
        else
            sBuff = "EMPATE!";

        int xt = g_Game.GetScreenW()/2 - textwidth(sBuff)/2;
        int yt = g_Game.GetScreenH()/2 - textheight(sBuff)/2;

        outtextxy(xt, yt, sBuff);

        xt = g_Game.GetScreenW()/2 - textwidth("pulsa INTRO para reiniciar")/2;
        yt = g_Game.GetScreenH()/2 - textheight("pulsa INTRO para reiniciar")/2;
        yt += textheight(sBuff) + 15;
        outtextxy(xt, yt, "pulsa INTRO para reiniciar");
        rectangle(-1, yt-2, g_Game.GetScreenW()+1, yt-1 + textheight("pulsa INTRO para reiniciar") + 2);
    }
}
Пример #4
0
bool Bunches::ismousehere(int num_of_bunch, Logic_Nim &nim) {
	int mx = mousex();
	int my = mousey();
	if (my > Bunches::coord_lineY[num_of_bunch] &&
		my < Bunches::coord_lineY[num_of_bunch + 1] &&
		mx > Bunches::coord_lineX[0] &&
		mx < Bunches::coord_lineX[nim.array_bunches[num_of_bunch]])
		return true;
	return false;
}
Пример #5
0
void malla()
{
    MALLA malla;
    int corX,corY,color,tamX,tamY,x1,y1,x2,y2;
    x2 = y2 = 0;
    char name[20];
    
    x1 = 175;
    y1 = 25;
    x2 = 278;
    y2 = 52;
    
    inicializaMalla( &malla );
    
    do
    {
       dibujaMenu();
       
       corX = mousex();
       corY = mousey();
       
      
       if( corX > x1 && corX < x2 && corY > y1 && corY < y2 ){  //nuevo          
             dibujaLinea( x1 , y2 + 4, x2 , y2 + 4 , YELLOW );
             
             if( ismouseclick( WM_LBUTTONDOWN )){
                    eliminaMalla( &malla );
                    leerDimensiones( &malla );
                    creaMalla( &malla );
             }
       }else{
               dibujaLinea( x1 ,  y2 + 4, x2 , y2 + 4 , BLACK);
               
               if( corX > x2 + 15 && corX < x2 + 95  && corY > y1 && corY < y2  ){  //Abrir
                     dibujaLinea( x2+15,y2+4, x2 + 130 , y2+4, YELLOW );
                       
                         if( ismouseclick(WM_LBUTTONDOWN ) ){
                            imprimeMalla(malla);
                                 
                         }
                   //    printf( " name : %s\n", name );*/        
                }else 
                       dibujaLinea( x2+15, y2+4 , x2 + 130 , y2 + 4, BLACK );         
                        
                  
                }  
             
           clearmouseclick(WM_LBUTTONDOWN );
       
       }while(!kbhit());
}
Пример #6
0
void main(void)
{
    int maxx, maxy;  // Maximum x and y pixel coordinates
    int x, y;        // x and y pixel coordinates of a mouse click
    int divisor;     // Divisor for the length of a triangle side
    bool red_clicked;// Changes to true when a red pixel is clicked
    
    // Put the machine into graphics mode and get the maximum coordinates:
    initwindow(450, 300);         
    maxx = getmaxx( );
    maxy = getmaxy( );
    
    // Draw a white circle with red inside and a radius of 50 pixels:
    setfillstyle(SOLID_FILL, RED);
    setcolor(WHITE);
    fillellipse(maxx/2, maxy/2, 50, 50);
    
    // Print a message and wait for a red pixel to be double clicked:
    settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
    outtextxy(20, 20, "Left click in RED to end.");
    setcolor(BLUE);
    red_clicked = false;
    divisor = 2;
    while (!red_clicked)
    {
        triangle(maxx/divisor, maxy/divisor);
        delay(500);
        divisor++;
	if (ismouseclick(WM_LBUTTONDOWN))
	{
	    getmouseclick(WM_LBUTTONDOWN, x, y);
	    red_clicked = (getpixel(x, y) == RED);
	}
    }

    cout << "The mouse was clicked at: ";
    cout << "x=" << mousex( );
    cout << " y=" << mousey( ) << endl;
    
    // Switch back to text mode:
    closegraph( );
}
Пример #7
0
void Guess (int level, int code[])
{
     static int guessNum = 1;
     int i = 0, j;
     int guess[level];
     char selection;
     int x,y;
     
     outtextxy(410,150, "Now, Let\'s make your guess!");     
     
     if (guessNum == 13)
     {
         printf("\n\nYou have made 12 guesses already! You lost!\n\n");
         outtextxy(380,180, "GAME OVER! You have lost the game");
         printf("\nWould you like to play again? (Y/N): ");
         fflush(stdin);
         scanf("%c",&selection);
         fflush(stdin);
         if (selection == 'Y' || selection == 'y')
         {
              guessNum = 1;
              Menu();
         }
         else if (selection == 'N' || selection == 'n')
         {
              printf("\n");
              system("pause");
              exit(1);     
         }
         else
         {
              printf("\aWARNING: you should enter \'Y\' or \'N\'\n");
              Guess(level,code);
         }
     }
     
     printf("\nGuess %d:\n------------\n",guessNum);
     
     while (i != level)
     {
         switch (i)                               // according to i value (which goes to level), automatically running correct printf function..
         {
              case 0:
                   printf("Enter your guess for hat");
                   break;
                   
              case 1:
                   printf("Enter your guess for eyes");
                   break;
                   
              case 2:
                   printf("Enter your guess for nose");
                   break; 
                   
              case 3:
                   printf("Enter your guess for mouth");
                   break;
                   
              case 4:
                   printf("Enter your guess for clothes");
                   break; 
         }
         FillColor(i,11);                                            // changing color of current feature
         
         if (level == 5)                                             // according to level, running correct printf function..
         printf(" (1:red, 2:green, 3:blue, 4:purple, 5:yellow): ");
         else
         printf(" (1:red, 2:green, 3:blue): ");
         
         while (1)                                                  // taking mouse clicks or running scanf function
         {            
                guess[i] = -1;
    // ---------------------------------------------------------------------------------------------------------  
    // NOTICE:  Make "Comment" here, If you want to use Mouse while guessing          
    
    // <== REMOVE HERE              /*         
    
                if ( scanf("%d",&guess[i]) != -1 )
                {
                     if (guess[i] > level)
                     continue;
                     
                     else
                     {
                         clearmouseclick(WM_LBUTTONDOWN);     
                         break;
                     }
                }
                
    //                      */
    // ---------------------------------------------------------------------------------------------------------  
    
                if ( ismouseclick(WM_LBUTTONDOWN) )
                {
                      x = mousex();
                      y = mousey();
                      
                      if ( ( (x >= 380 && x <= 420) && (y >= 80 && y <= 120) )  ||
                           ( (x >= 430 && x <= 470) && (y >= 80 && y <= 120) )  ||
                           ( (x >= 480 && x <= 520) && (y >= 80 && y <= 120) )  ||
                           ( (x >= 530 && x <= 570) && (y >= 80 && y <= 120) && level == 5 )  ||
                           ( (x >= 580 && x <= 620) && (y >= 80 && y <= 120) && level == 5 )  )
                      {
                                                 
                           clearmouseclick(WM_LBUTTONDOWN);      // if user clicks on correct place (buttons), take it..
                           break;
                      }
                      else
                      {
                           clearmouseclick(WM_LBUTTONDOWN);      // if user clicks on anywhere except buttons, wait to be clicked correctly..
                           continue;
                      }
                }
                

         }
      
                                                                   // Assigning guess[] array values according to the coordinates of mouse clicks
         if ( (x >= 380 && x <= 420) && (y >= 80 && y <= 120) )
         guess[i] = 1;
         if ( (x >= 430 && x <= 470) && (y >= 80 && y <= 120) )
         guess[i] = 2;
         if ( (x >= 480 && x <= 520) && (y >= 80 && y <= 120) )
         guess[i] = 3;
         if ( (x >= 530 && x <= 570) && (y >= 80 && y <= 120) )
         guess[i] = 4;
         if ( (x >= 580 && x <= 620) && (y >= 80 && y <= 120) )
         guess[i] = 5;
         
         
         if (guess[i] != -1)                                    
         printf("%d\n",guess[i]);                                  // this runs when Mouse is used.. 
    
         if (guess[i] == 1)                                        // Calling FillColor() function according to the guesses..
         FillColor(i,4);
         if (guess[i] == 2)
         FillColor(i,2);
         if (guess[i] == 3)
         FillColor(i,1);
         if (guess[i] == 4)
         FillColor(i,5);
         if (guess[i] == 5)
         FillColor(i,14);
           
         i++;                                                    // increasing i, which goes to level
     }
     guessNum++;                                                 // increasing guessNum
     
     CodeCheck(level,code,guess,&guessNum);                      // continue through CodeCheck()
}
void CGameControllerSimon::DrawHUD()
{
    /** Teclado **/
    if (g_Game.Keyboard.KeyPressed)
    {
        switch(g_Game.Keyboard.Key)
        {
            case 13:
                if (g_Game.m_WorldPaused)
                {
                    g_Game.m_GameState = CGameContext::GAME_MENU;
                    return;
                }

                break;
        }
    }
    /** Raton **/
    vec2 m_MousePos = vec2(mousex(), mousey());
    //Captar Acciones
    if (!g_Game.m_WorldPaused)
    {
        if (g_Game.Mouse.m_isPressed)
        {
            if (!m_Started)
                m_Started = true;

            if (m_ActivePlayer == PLAYER_1 && m_Started)
            {

                for (int i=0; i<3;i++)
                {
                    if (m_MousePos.x >= g_Game.GetScreenW()/2-dimTW/2+dimTH/3*i && m_MousePos.x <= g_Game.GetScreenW()/2-dimTW/2+dimTH/3*i+(dimTW/3)
                        && m_MousePos.y >= g_Game.GetScreenH()/2-dimTH/2+dimTH/3 && m_MousePos.y <= g_Game.GetScreenH()/2-dimTH/2+dimTH/3+(dimTH/3))
                        {
                            if (i == 0)
                                PushPad(PAD_RED);
                            else if (i==1)
                                PushPad(PAD_YELLOW);
                            else
                                PushPad(PAD_GREEN);

                            m_TimerCPU = GetTickCount() + 1000 * 0.7f;
                            break;
                        }
                }

                for (int i=0;i<3;i+=2)
                {

                    if (m_MousePos.x >= g_Game.GetScreenW()/2-dimTW/2+dimTH/3 && m_MousePos.x <= g_Game.GetScreenW()/2-dimTW/2+dimTH/3+(dimTW/3)
                        && m_MousePos.y >= g_Game.GetScreenH()/2-dimTH/2+dimTH/3*i && m_MousePos.y <= g_Game.GetScreenH()/2-dimTH/2+dimTH/3*i+(dimTH/3))
                        {
                            if (i==0)
                                PushPad(PAD_BLUE);
                            else
                                PushPad(PAD_CYAN);

                            m_TimerCPU = GetTickCount() + 1000 * 0.7f;
                            break;
                        }
                }
            }
            clearmouseclick(WM_LBUTTONDOWN);
        }
    }


    //* PERDIO? *//
    if (g_Game.m_WorldPaused)
    {
        setbkcolor(WHITE);
        setcolor(BLACK);
        int xt = g_Game.GetScreenW()/2 - textwidth("Eres un Noob!!!")/2;
        int yt = g_Game.GetScreenH()/2 - textheight("Eres un Noob!!!")/2;

        outtextxy(xt, yt, "Eres un Noob!!!");

        xt = g_Game.GetScreenW()/2 - textwidth("pulsa INTRO para reiniciar")/2;
        yt = g_Game.GetScreenH()/2 - textheight("pulsa INTRO para reiniciar")/2;
        yt += textheight("Eres un Noob!") + 15;
        outtextxy(xt, yt, "pulsa INTRO para reiniciar");
        rectangle(-1, yt-2, g_Game.GetScreenW()+1, yt-1 + textheight("pulsa INTRO para reiniciar") + 2);
    }
    else
    {
        if (!m_Started)
        {
            int xt = g_Game.GetScreenW()/2 - textwidth("Haz CLICK para empezar")/2;
            int yt = g_Game.GetScreenH()/2 - textheight("Haz CLICK para empezar")/2;
            yt += 15;
            outtextxy(xt, yt, "Haz CLICK para empezar");
            rectangle(-1, yt-2, g_Game.GetScreenW()+1, yt-1 + textheight("Haz CLICK para empezar") + 2);
        }
    }

    //Marcadores
    vec2 m_SBPos;
    vec2 m_SBEPos;
    const char *m_pTexto;
    char m_ExText[25];

    if (m_ActivePlayer == PLAYER_CPU)
    {
        m_pTexto = "CPU";
        sprintf(m_ExText, "%i/%i", m_SeqCPUPos, v_Seq.size()-1);
    }
    else
    {
        m_pTexto = "JUGADOR 1";
        sprintf(m_ExText, "%i/%i", m_SeqP1Pos, v_Seq.size()-1);
    }

    m_SBPos = vec2(g_Game.GetScreenW() - textwidth(m_pTexto) - 10, 10);
    m_SBEPos = vec2(g_Game.GetScreenW() - textwidth(m_ExText) - 10, 15+textheight(m_pTexto));
    outtextxy(static_cast<int>(m_SBPos.x), static_cast<int>(m_SBPos.y), m_pTexto);
    outtextxy(static_cast<int>(m_SBEPos.x), static_cast<int>(m_SBEPos.y), m_ExText);

    //Effecto cola...
    setcolor(DARKGRAY);
    setfillstyle(SOLID_FILL, DARKGRAY);
    for (int i=1; i<4; i++)
    {
        ANIM *a_Esfera = &v_Cursor[i];

        if (GetTickCount() < a_Esfera->m_Start)
            continue;

        if (a_Esfera->m_Radius > 10)
            a_Esfera->m_Dir = -1;
        else if (a_Esfera->m_Radius <= 0)
        {
            a_Esfera->m_Pos = m_MousePos;
            a_Esfera->m_Radius = 10;
        }
        a_Esfera->m_Radius += a_Esfera->m_Dir;

        if (m_LastMouseX != mousex() || m_LastMouseY != mousey())
            fillellipse(static_cast<int>(a_Esfera->m_Pos.x), static_cast<int>(a_Esfera->m_Pos.y), a_Esfera->m_Radius, a_Esfera->m_Radius);
    }
    //Cursor
    setcolor(LIGHTGRAY);
    setfillstyle(SOLID_FILL, LIGHTGRAY);
    v_Cursor[0].m_Pos = m_MousePos;
    fillellipse(static_cast<int>(v_Cursor[0].m_Pos.x), static_cast<int>(v_Cursor[0].m_Pos.y), v_Cursor[0].m_Radius, v_Cursor[0].m_Radius);

    m_LastMouseX = mousex();
    m_LastMouseY = mousey();
}
void CGameControllerRalla3::Tick()
{
    if (g_Game.Keyboard.KeyPressed)
    {
        switch(g_Game.Keyboard.Key)
        {
            case 13:
                if (g_Game.m_WorldPaused && m_PlayerWin != PLAYER_NULL)
                {
                    g_Game.m_GameState = CGameContext::GAME_MENU;
                    return;
                }
                break;
        }
    }

    if (!g_Game.m_WorldPaused)
    {
        /** Captar Raton **/
        if (g_Game.Mouse.m_isPressed)
        {
            vec2 m_MousePos = vec2(mousex(), mousey());

            for (int i=0; i<3;i++)
            {
                for (int o=0;o<3;o++)
                {
                    if (m_MousePos.x > g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*o && m_MousePos.x <= g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)
                        && m_MousePos.y >= 20+((dimTY/3)*i) && m_MousePos.y <= 20+((dimTY/3)*(i+1)))
                    {
                        if (v_GameTable[i][o] != PLAYER_NULL)
                        {
                            m_Indicator.m_Timer = GetTickCount() + 1000 * 0.15f;
                            m_Indicator.m_Pos = vec2(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*o, 20+((dimTY/3)*i));
                            continue;
                        }

                        v_GameTable[i][o] = m_ActivePlayer;
                        CheckWinner(m_ActivePlayer);

                        if (m_CPU)
                            m_ActivePlayer = (m_ActivePlayer==PLAYER_1)?PLAYER_CPU:PLAYER_1;
                        else
                            m_ActivePlayer = (m_ActivePlayer==PLAYER_1)?PLAYER_2:PLAYER_1;
                    }
                }
            }
            clearmouseclick(WM_LBUTTONDOWN);
        }

        //Comprobar Empate
        if (m_PlayerWin == PLAYER_NULL)
        {
            bool draw=true;
            for (int i=0; i<3; i++)
            {
                for (int o=0; o<3; o++)
                    if (v_GameTable[i][o] == PLAYER_NULL)
                    {
                        draw=false;
                        break;
                    }
            }
            if (draw)
            {
                m_PlayerWin = PLAYER_DRAW;
                EndRound();
            }
        }

        //Jugada de la Makina
        if (m_PlayerWin == PLAYER_NULL && m_ActivePlayer == PLAYER_CPU)
        {
            int i, o;
            bool error = true;
            for (int i=rand()%3; i<3; i++)
            {
                for (int o=rand()%3; o<3; o++)
                {
                    if (v_GameTable[i][o] == PLAYER_NULL)
                    {
                        if ((i-1 > 0 && (v_GameTable[i-1][o] == PLAYER_NULL || v_GameTable[i-1][o] == PLAYER_CPU))
                            || (i+i<3 && (v_GameTable[i+1][o] == PLAYER_NULL || v_GameTable[i+1][o] == PLAYER_CPU))
                            || (o-1 > 0 && (v_GameTable[i][o-1] == PLAYER_NULL || v_GameTable[i][o-1] == PLAYER_CPU))
                            || (o+1 > 0 && (v_GameTable[i][o+1] == PLAYER_NULL || v_GameTable[i][o+1] == PLAYER_CPU))
                            || (i-1>0 && o-1>0 && (v_GameTable[i-1][o-1] == PLAYER_NULL || v_GameTable[i-1][o-1] == PLAYER_CPU))
                            || (i+1<3 && o-1>0 && (v_GameTable[i+1][o-1] == PLAYER_NULL || v_GameTable[i+1][o-1] == PLAYER_CPU))
                            || (i+1<3 && o+1<3 && (v_GameTable[i+1][o+1] == PLAYER_NULL || v_GameTable[i+1][o+1] == PLAYER_CPU))
                            || (i-1>0 && o+1<3 && (v_GameTable[i-1][o+1] == PLAYER_NULL || v_GameTable[i-1][o+1] == PLAYER_CPU)))
                        {
                            v_GameTable[i][o]=PLAYER_CPU;
                            error = false;
                            break;
                        }
                    }
                }

                if (!error)
                    break;
            }

            if (error)
            {
                do {
                    i=rand() % 3;
                    o=rand() % 3;
                } while (v_GameTable[i][o] != PLAYER_NULL);

                v_GameTable[i][o]=PLAYER_CPU;
            }

            CheckWinner(PLAYER_CPU);
            m_ActivePlayer = PLAYER_1;
        }

        //Resetear Color Indicador
        if (GetTickCount() < m_Indicator.m_Timer)
        {
            setfillstyle(SOLID_FILL, RED);
            int points[4*2];
            points[0]=static_cast<int>(m_Indicator.m_Pos.x);
            points[1]=static_cast<int>(m_Indicator.m_Pos.y);
            points[2]=static_cast<int>(m_Indicator.m_Pos.x) + dimTX/3;
            points[3]=points[1];
            points[4]=points[2];
            points[5]=static_cast<int>(m_Indicator.m_Pos.y) + dimTY/3;
            points[6]=points[0];
            points[7]=points[5];
            fillpoly(4, points);
        }
    }

    /** Dibujar Tablero **/
    int offsetx = dimTX/3;
    int offsety = dimTY/3;

    setcolor(DARKGRAY);
    for (int i=offsety; i<dimTY-dimTY/3; i+=offsety)
    {
        moveto(g_Game.GetScreenW()/2-dimTX/2, i+20);
        lineto(g_Game.GetScreenW()/2-dimTX/2+dimTX, i+20);
    }
    for (int i=offsetx; i<dimTX-dimTX/3; i+=offsetx)
    {
        moveto(g_Game.GetScreenW()/2-dimTX/2+i, 1+20);
        lineto(g_Game.GetScreenW()/2-dimTX/2+i, dimTY+20);
    }
    setcolor(WHITE);
    //Fichas
    for (int i=0;i<3;i++)
    {
        for (int o=0;o<3;o++)
        {
            if (v_GameTable[i][o] == PLAYER_NULL)
                continue;

            if (v_GameTable[i][o] == PLAYER_1)
            {
                circle(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1) - ((dimTX/3)/2), 20+dimTY/3*(i+1) - (dimTY/3)/2, 25);
            }
            else
            {
                moveto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) -25, 20+dimTY/3*(i+1)-(dimTY/3)/2 -25);
                lineto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) +25, 20+dimTY/3*(i+1)-(dimTY/3)/2 +25);
                moveto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) +25, 20+dimTY/3*(i+1)-(dimTY/3)/2 -25);
                lineto(g_Game.GetScreenW()/2-dimTX/2 + dimTX/3*(o+1)-((dimTX/3)/2) -25, 20+dimTY/3*(i+1)-(dimTY/3)/2 +25);
            }
        }
    }
}
Пример #10
0
int click()
{
    int x,y;
    x=mousex();
    y=mousey();
    if(x>=108&&x<=156&&y>=138&&y<=188)
    {
        clearmouseclick(513);
        return 9;
    }
    else if(x>=56&&x<=104&&y>=138&&y<=188)
    {
        clearmouseclick(513);
        return 8;
    }
    else if(x>=4&&x<=52&&y>=138&&y<=188)
    {
        clearmouseclick(513);
        return 7;
    }
    else if(x>=108&&x<=156&&y>=192&&y<=246)
    {
        clearmouseclick(513);
        return 6;
    }
    else if(x>=56&&x<=104&&y>=192&&y<=246)
    {
        clearmouseclick(513);
        return 5;
    }
    else if(x>=4&&x<=52&&y>=192&&y<=246)
    {
        clearmouseclick(513);
        return 4;
    }
    else if(x>=108&&x<=156&&y>=250&&y<=300)
    {
        clearmouseclick(513);
        return 3;
    }
    else if(x>=56&&x<=104&&y>=250&&y<=300)
    {
        clearmouseclick(513);
        return 2;
    }
    else if(x>=4&&x<=52&&y>=250&&y<=300)
    {
        clearmouseclick(513);
        return 1;
    }
    else if(x>=56&&x<=104&&y>=304&&y<=354)
    {
        clearmouseclick(513);
        return 0;
    }
    else if(x>=4&&x<=52&&y>=304&&y<=354)
    {
        clearmouseclick(513);
        return -2;
    }
    else if(x>=108&&x<=156&&y>=75&&y<=125)
    {
        clearmouseclick(513);
        return -3;
    }
    else if(x>=56&&x<=104&&y>=75&&y<=125)
    {
        clearmouseclick(513);
        return -4;
    }
     else if(x>=4&&x<=52&&y>=75&&y<=125)
    {
        clearmouseclick(513);
        return -5;
    }
    else if(x>=108&&x<=156&&y>=304&&y<=354)
    {
        clearmouseclick(513);
        return -6;
    }
    else if(x>=175&&x<=225&&y>=138&&y<=246)
    {
        clearmouseclick(513);
        return 11;
    }
    else if(x>=200&&x<=254&&y>=304&&y<=354)
    {
        clearmouseclick(513);
        return 12;
    }
    else if(x>=229&&x<=279&&y>=138&&y<=188)
    {
        clearmouseclick(513);
        return 13;
    }
    else if(x>=175&&x<=225&&y>=250&&y<=300)
    {
        clearmouseclick(513);
        return 14;
    }
    else if(x>=229&&x<=279&&y>=192&&y<=246)
    {
        clearmouseclick(513);
        return 15;
    }
    else if(x>=229&&x<=279&&y>=250&&y<=300)
    {
        clearmouseclick(513);
        return 16;
    }
    else if(x>=175&&x<=225&&y>=75&&y<=125)
    {
        clearmouseclick(513);
        return -1;
    }
    else if(x>=230&&x<=280&&y>=75&&y<=125)
    {
        clearmouseclick(513);
        return -100;
    }
    else if(x>=1&&x<=48&&y>=55&&y<=65)
    {
        cleardevice();
        setviewport(0,0,300,370,1);
        setcolor(BLUE);
        settextstyle(8,0,1);
        outtextxy(10,10,"MD. NAHIDUL ISLAM OPU");
        outtextxy(10,50,"*****@*****.**");
        delay(2000);
        cleardevice();
        clearviewport();
        layout();
        setviewport(3,8,290,50,1);
        return -1000;
    }
    clearmouseclick(513);
    return -1000;
}