Ejemplo n.º 1
0
void menu()
{
    int op=-1, xm, ym, i, margin = 70;
    String opciones[] = {"Jugar", "Tienda", "Ayuda", "Créditos"};
    setbkcolor(0x0066F4);
    setfillstyle(1, 0x0066F4);
    setcolor(0x003988);
    settextstyle(2, HORIZ_DIR, 8);

    for(i=0; i<4; i++, margin+=50)
    {
        bar(WIDTH/2-textwidth(opciones[3])/2-5, HEIGHT/2+margin-10, WIDTH/2+textwidth(opciones[3])/2+5, HEIGHT/2+margin+textheight(opciones[3])+10);
        outtextxy(WIDTH/2-textwidth(opciones[i])/2, HEIGHT/2+margin, opciones[i]);
    }

    do
    {
        while(!ismouseclick(WM_LBUTTONDOWN));
        getmouseclick(WM_LBUTTONDOWN, xm, ym);
        margin = 70;
        for(i=0; i<4; i++, margin+=50)
            if(xm>WIDTH/2-textwidth(opciones[3])/2-5
               && xm<WIDTH/2+textwidth(opciones[0])/2-10
               && ym>HEIGHT/2+margin-10
               && ym<HEIGHT/2+margin+textheight(opciones[3])+10)
                {
                    op = i;
                    i=5;
                    break;
                }
    }while(op==-1);

    fflush(stdin);
    switch(op)
    {
        case 0:
            juego(3);
            break;
        case 1:
            tienda();
            break;
        case 2:
            ayuda();
            break;
        case 3:
            creditos();
            break;
    }
}
Ejemplo n.º 2
0
void botoes(char tecla){
	if(ismouseclick(WM_LBUTTONDOWN)){
		getmouseclick(WM_LBUTTONDOWN, mouse_dx, mouse_dy);
		
		if (come < CONTROLE_STATS){
			if ((CONTROLE_STATS - come) >= 5){
				come += 5; 
				pontuacao += 100;
			}else{
				come += (CONTROLE_STATS - come);
				pontuacao += (come/3);
			}
		}
	}
}
Ejemplo n.º 3
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( );
}
Ejemplo n.º 4
0
int main()
{   
    initwindow(1275,700);
    setfillstyle(1,1);
    floodfill(100,100,1);
    
    setcolor(12);
    setbkcolor(1);
    settextstyle(0,0,8);
    outtextxy(330,160,"WELCOME TO ");
    outtextxy(140,270,"THE V-PLAY STORE");
    
    setcolor(7);
    rectangle(140,450,440,550);
    rectangle(840,450,1140,550);
    setfillstyle(1,7);
    floodfill(300,500,7);
    setfillstyle(1,7);
    floodfill(950,500,7);
    settextstyle(0,0,4);
    setcolor(0);
    setbkcolor(7);
    outtextxy(170,480,"Sign Up!");
    outtextxy(875,480,"Sign In");
    
    
    int x = getmaxx( );
    int y = getmaxy( );
    setmousequeuestatus(WM_LBUTTONDOWN);
    while(!ismouseclick(WM_LBUTTONDOWN));
    {
                                        getmouseclick(WM_LBUTTONDOWN,x,y);
                                        if((x>840 && x<1140) && (y>450 && y<550))
                                        login();
                                        else if((x>140 && x<440) && (y>450 && y<550))
                                        signup();
    }
    system("pause");
    return 0;
}
Ejemplo n.º 5
0
int mainb()
{
     initwindow(1000,750);
     int x=0,y=0;
     while (!ismouseclick(WM_LBUTTONDOWN))
        {
            setfillstyle(SOLID_FILL, RED);
            rectangle(0,0,1000,1000);
            floodfill(0,0,RED);
            
            readimagefile("logo.bmp",0,0,100,100);
            readimagefile("french_fries.bmp",700,200,825,325);
            readimagefile("paneer_wrap.bmp",850,275,975,400);
            readimagefile("chicken_mcnuggets.bmp",850,425,975,550);
            readimagefile("potato_wedges.bmp",700,350,825,475);
            readimagefile("veg_pizza_mcpuff.bmp",700,500,825,625);
           
            settextstyle(9,HORIZ_DIR,6);
            outtextxy(400,10,"Add-ons");
            
            settextstyle(9,HORIZ_DIR,4);
            outtextxy(275,70,"(Click on the name to order)");
            
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(445,150,"PRICE (in Rs.)");
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,200,400,275);
            rectangle(500,200,575,275);
            floodfill(11,201,WHITE);     
            floodfill(501,201,WHITE);
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,300,400,375);
            floodfill(11,301,WHITE);  
            rectangle(500,300,575,375);
            floodfill(501,301,WHITE);  
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,400,400,475);
            floodfill(11,401,WHITE);   
            rectangle(500,400,575,475);
            floodfill(501,401,WHITE); 
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,500,400,575);
            floodfill(11,501,WHITE);    
            rectangle(500,500,575,575);
            floodfill(501,501,WHITE);
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(10,600,400,675);
            floodfill(11,601,WHITE);    
            rectangle(500,600,575,675);
            floodfill(501,601,WHITE);
            
            setfillstyle(SOLID_FILL, WHITE);
            rectangle(675,675,950,725);
            floodfill(676,676,WHITE);
            
            setbkcolor(WHITE);
            setcolor(BLACK);
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(50,225,"BigSpicy Paneer Wrap");
            outtextxy(520,225,"50");
            outtextxy(75,325,"Veg Pizza McPuff");
            outtextxy(520,325,"50");
            outtextxy(120,425,"French Fries");
            outtextxy(520,425,"25");
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(40,525,"BigSpicy Chicken Wrap");
            outtextxy(520,525,"65");
            settextstyle(9,HORIZ_DIR,3);
            outtextxy(65,625,"Chicken McNuggets");
            outtextxy(520,625,"55");
            settextstyle(9,HORIZ_DIR,2);
            outtextxy(685,690,"Return to main menu");
        }
                 

        tryagain:
        getmouseclick(WM_LBUTTONDOWN,x,y);
        
        if (x>10 && x<400 && y>200 && y<275);
                //ask for qty
        else if (x>10 && x<400 && y>300 && y<375);
                //ask for qty
        else if (x>10 && x<400 && y>200 && y<475);
                //ask for qty 
        else if (x>10 && x<400 && y>200 && y<575);  
                //ask for qty
        else if (x>10 && x<400 && y>200 && y<675);
                //ask for qty
        else if (x>675 && x<950 && y>675 && y<725)
        {     closegraph();
               mainx();
         }  
        else
            goto tryagain;
        
        return 0;
}
Ejemplo n.º 6
0
void download()
{
    closegraph();
    initwindow(1275,700);
    setfillstyle(1,1);
    floodfill(100,100,1);
    
    setcolor(11);
    setbkcolor(1);
    settextstyle(10,0,5);
    outtextxy(30,275,"Downloading");                                     //Download bar start
    setcolor(15);
    moveto(40,325);
    lineto(1230,325);
    arc(40,335,90,270,10);
    moveto(40,345);
    lineto(1230,345);
    arc(1230,335,270,90,10);                                             //Download bar end
    
    settextstyle(10,0,7);
    setbkcolor(1);
    setcolor(1);                                                //Increasing bar
    for(int i=0,j=40;i<100;i++,j=j+12)
    {
            outintxy(1120,250,i);
            outtextxy(1200,250,"%");
            setcolor(15);
            moveto(j,325);
            lineto(j,345);
            setcolor(11);
            setfillstyle(1,11);
            floodfill(j-2,335,15);
            delay(200);
    }
    delay(3000);
    outtextxy(1100,250,"100%");
    floodfill(1231,335,15);
    
    setcolor(0);                                                  //Done button
    rectangle(1075,580,1205,650);
    setfillstyle(1,7);
    floodfill(1100,600,0);
    setbkcolor(7);
    settextstyle(0,0,3);
    outtextxy(1090,605,"Done");
    
    int x=0,y=0;
    x = getmaxx( );
    y = getmaxy( );
      
      
    setmousequeuestatus(WM_LBUTTONDOWN);
    while(!ismouseclick(WM_LBUTTONDOWN));
    {
               getmouseclick(WM_LBUTTONDOWN,x,y);
    }
        
    if(( x > 1075 && x < 1205 ) && ( y > 580 && y < 650 ))
    {
         thank();
    }
    system("pause");
}
Ejemplo n.º 7
0
void Menu::processEvents(){
    
    if ( ismouseclick(WM_LBUTTONDOWN) ) {
        int mouseX, mouseY;
        
        getmouseclick(WM_LBUTTONDOWN, mouseX, mouseY);
        
        if ( startBtn.isClick(mouseX, mouseY) ) {
            status = 1;
            exit = true;
        }
        if ( exitBtn.isClick(mouseX, mouseY) ) {

            status = 2;
            exit = true;
        }
    }
    
    
    
    if(kbhit())
    {
        char key = getch();

        if(key == '\r')
        {
            if(buttonIndex)
            {
                status = 2;
                exit = true;
            }
            else
            {
                status = 1;
                exit = true;
            }
        }
        
        if(key == 27)
        {
            exit = true;
            status = 2;
        }
        
        if(key == NULL)
        {
            char keychar = getch();
            switch(keychar)
            {
                case 'M': //arrow right
                {
                    if(buttonIndex == 1)
                        buttonIndex--;
                    else if(buttonIndex == 0)
                        buttonIndex++;    
                }
                    break;
                
                case 'K': //arrow left
                {
                    if(buttonIndex == 0)
                        buttonIndex = 1;
                    else
                        buttonIndex--;  
                }
                    break;
            }
            
            if(buttonIndex == 1)
            {
                exitBtn.setFocus(true);
                startBtn.setFocus(false);
            }
            else
            {
                exitBtn.setFocus(false);
                startBtn.setFocus(true);
            }
        }
    }    
}