Ejemplo n.º 1
0
static void piezomaker_draw(TWidget *wid, ttk_surface srf)
{
    char buffer[15];
    ttk_color col[2];

    col[0] = ttk_makecol(5, 115, 175); //Blue
    col[1] = ttk_makecol(80, 175, 0);  //Green

    ttk_fillrect(srf, 0, 0, wid->win->w, wid->win->h, ttk_makecol(WHITE));
    ttk_fillrect(main_srf, 5,  5,  50,  35, (box == 1)?col[0]:col[1]);
    ttk_fillrect(main_srf, 55, 5,  100, 35, (box == 2)?col[0]:col[1]);
    ttk_fillrect(main_srf, 5,  40, 50,  70, (box == 3)?col[0]:col[1]);
    ttk_fillrect(main_srf, 55, 40, 100, 70, (box == 4)?col[0]:col[1]);

    sprintf(buffer, "%.2f Seconds", piezomaker_seconds());
    pz_vector_string(srf, buffer, 5,5, 7,7, 1, ttk_makecol(BLACK)); //Seconds
    sprintf(buffer, "%d", pup);
    pz_vector_string_center(main_srf, buffer, 23,18, 7,7, 1, ttk_makecol(WHITE)); //Period
    sprintf(buffer, "%d", dup);

    pz_vector_string_center(main_srf, buffer, 77,18, 7,7, 1, ttk_makecol(WHITE)); //Duration
    pz_vector_string_center(main_srf, _("Append"), 27,55, 5,7, 1, ttk_makecol(WHITE));
    pz_vector_string_center(main_srf, _("Delete"), 77,55, 5,7, 1, ttk_makecol(WHITE));

    //Blit everything to the screen
    ttk_blit_image (main_srf, srf, (ttk_screen->w/2)-(105/2), ((ttk_screen->h-ttk_screen->wy)/2)-(75/2));
}
Ejemplo n.º 2
0
static void duckhunt_message (char *message)
{
    int length;

    length = pz_vector_width (message, 6, 8, 1);
    ttk_rect (duckhunt_srf, ((WIDTH/2)-(length/2))-6, ((HEIGHT/3)-(8/2))-6, ((WIDTH/2)+(length/2))+6, ((HEIGHT/3)+(8/2))+6, ttk_makecol(WHITE));
    ttk_fillrect (duckhunt_srf, ((WIDTH/2)-(length/2))-5, ((HEIGHT/3)-(8/2))-5, ((WIDTH/2)+(length/2))+5, ((HEIGHT/3)+(8/2))+5, ttk_makecol(BLACK));
    pz_vector_string (duckhunt_srf, message, (WIDTH/2)-(length/2), (HEIGHT/3)-(8/2), 6, 8, 1, ttk_makecol(WHITE));
}
Ejemplo n.º 3
0
le * eval_gfx_DrawVectorText ( lithp_burrito * lb, const int argc, le * branch )
{
    int x,y,w,h;
    le *t, *t2;

    if( !lb || !branch || argc < 6 ) return( leNew( "NIL" ));
    t = eval_getint_4( lb, branch, &x, &y, &w, &h );
    t2 = evaluateNode( lb, t );

    pz_vector_string( lb->srf, t2->data, x, y, w, h, 1, lb->pen1 );

    return( leNew( "T" ));
}
Ejemplo n.º 4
0
static void view_map()
{
  	ttk_surface scaled;
	char file[40];
	int t=-1, s1, s2;
	
	switch(ttk_screen->bpp){
		case 2: texts = ttk_makecol(WHITE); break;
		case 16: texts = ttk_makecol(DKGREY); break;
	}
	 
   ttk_fillrect(iracer_srf,0,0,bgw,bgh,ttk_makecol(GREY));

   ttk_fillrect(iracer_srf,ipods[5],ipods[50],(ipods[320]+ipods[10])*.5,ipods[320]*.5,ttk_makecol(BLACK)); //wholly hackish
  
   ttk_blit_image (scaled = ttk_scale_surface(map.image,.5),iracer_srf,ipods[5],ipods[50]); //Map Scaled View

	 sprintf(file,"MAPS");	
	 pz_vector_string_center(iracer_srf, file, ipods[160], ipods[25] , ipods[20] ,ipods[20] , 1, ttk_makecol(WHITE));

	 sprintf(file,"%s",map.mapname);
	 pz_vector_string(iracer_srf, file, ipods[167] , ipods[50], ipods[6] ,ipods[18] , 1, texts); 
	
	 sprintf(file,"By: %s",map.author);	
	 pz_vector_string(iracer_srf, file, ipods[5] , ipods[175], ipods[8] ,ipods[16] , 1, texts); 
	
	 sprintf(file,"Difficulty: %s",dif_opts[map.difficulty]); 	
	 pz_vector_string(iracer_srf, file, ipods[5] , ipods[210], ipods[8] ,ipods[16] , 1, texts); 

	 if(rhigh>=0&&rhigh<30){

			sprintf(file,"50CC"); 	
	 		pz_vector_string(iracer_srf, file, ipods[175] , ipods[100+(t*20)], 
			ipods[8] ,ipods[16] , 1, ttk_makecol(WHITE)); 

		for(t=0;t<3;t++){

			s1 = map.cc50[t];
			s2 = map.cc50[t]*10;
			s2 = s2 % 10;

			sprintf(file,"laps %d: %2d.%1d",set_laps[t],  s1,s2); 	
	 		pz_vector_string(iracer_srf, file, ipods[175] , ipods[110+(t*20)], 
			ipods[8] ,ipods[16] , 1, ttk_makecol(WHITE)); 
		}
	 }
	 else if(rhigh>=30&&rhigh<59){

			sprintf(file,"100CC"); 	
	 		pz_vector_string(iracer_srf, file, ipods[175] , ipods[100+(t*20)], 
			ipods[8] ,ipods[16] , 1, ttk_makecol(WHITE)); 

		for(t=0;t<3;t++){

			s1 = map.cc100[t];
			s2 = map.cc100[t]*10;
			s2 = s2 % 10;

			sprintf(file,"laps %d: %2d.%1d",set_laps[t],  s1,s2); 	
	 		pz_vector_string(iracer_srf, file, ipods[175] , ipods[110+(t*20)], 
			ipods[8] ,ipods[16] , 1, ttk_makecol(WHITE)); 
		}
	 }
	 else{

			sprintf(file,"150CC"); 	
	 		pz_vector_string(iracer_srf, file, ipods[175] , ipods[100+(t*20)], 
			ipods[8] ,ipods[16] , 1, ttk_makecol(WHITE)); 

		for(t=0;t<3;t++){

			s1 = map.cc150[t];
			s2 = map.cc150[t]*10;
			s2 = s2 % 10;

			sprintf(file,"laps %d: %2d.%1d",set_laps[t], s1,s2); 	
	 		pz_vector_string(iracer_srf, file, ipods[175] , ipods[110+(t*20)], 
			ipods[8] ,ipods[16] , 1, ttk_makecol(WHITE)); 
		}
	 }
	

	 ttk_free_surface(scaled);
}
Ejemplo n.º 5
0
static void draw_race()
{
	 char file[5];
	 char files[20];
	 int s1,s2;

	 ttk_blit_image (map.image,iracer_srf,0,0); //Map 
	
	 ttk_blit_image (car[cpos],iracer_srf,ipods[(map.xstart+(xoff*speed))],ipods[(map.ystart+(yoff*speed))]); //Car
	 	
	 if(count>0){ //3,2,1 
		 sprintf(file,"%d",count);	
		 pz_vector_string_center(iracer_srf, file, ipods[160], ipods[100], ipods[((z<<2)+z)], ipods[((z<<2)+z)],1, ttk_makecol(BLACK));
		if(z==5){ttk_click_ex(100, 150);}
	 }  
	 else if(count>-1){ //GO
		 sprintf(file,"GO");	
		 pz_vector_string_center(iracer_srf, file, ipods[160], ipods[100], ipods[((z<<2)+z)], ipods[((z<<2)+z)],1, ttk_makecol(BLACK)); wall2=0;
		lphold=1;
		if(z==5){ttk_click_ex(50,250);}
	 }

	if(fina==1&&(timed-(times/11))>0&&settings.gdif==0||(fina==1&&settings.gdif==0&&timed==0)){
	  	sprintf(files,"FINISHED");	
		pz_vector_string_center(iracer_srf, files, ipods[160], ipods[100], ipods[20], 
		ipods[(20*z)],1, ttk_makecol(BLACK));
		write_high();
	}
	else if(fina==1&&settings.gdif==0){
	  	sprintf(files,"FAILED");	
		pz_vector_string_center(iracer_srf, files, ipods[160], ipods[100], ipods[20], 
		ipods[(20*z)],1, ttk_makecol(BLACK));
	}
	else if(fina==1){
	  	sprintf(files,"FINISHED");	
		pz_vector_string_center(iracer_srf, files, ipods[160], ipods[100], ipods[20], 
		ipods[(20*z)],1, ttk_makecol(BLACK));
	}

	 ttk_fillrect (iracer_srf, 0, ipods[220], ipods[320], ipods[240], ttk_makecol(BLACK));

 
	 sprintf(files,"Lap %d of %d",lap,set_laps[settings.laps]);	
	 pz_vector_string(iracer_srf, files, ipods[5], ipods[225] , ipods[8],ipods[14], 1, ttk_makecol(WHITE));


	if(settings.gdif==1||(settings.gdif==0&&timed==0)){
			s1 = times/11;
			s2 = (times/11)*10;
			s2 = s2 % 10;
	 sprintf(files,"Time %2d.%1d secs", s1,s2);	
	 pz_vector_string(iracer_srf, files, ipods[150], ipods[225] , ipods[8] ,ipods[14] , 1, ttk_makecol(WHITE));
	}
	else if(settings.gdif==0){
		if(timed-(times/11)<=0)
			sprintf(files,"Time 0.0 secs");
		else{	
			s1 = timed- (times/11);
			s2 = (timed-(times/11))*10;
			s2 = s2 % 10;

		sprintf(files,"Time %2d.%1d secs",s1,s2);}	
	 pz_vector_string(iracer_srf, files, ipods[150], ipods[225] , ipods[8] ,ipods[14] , 1, ttk_makecol(WHITE));
	}
	  
}
Ejemplo n.º 6
0
static void duckhunt_bar()
{
    char str[15], str2[10];
    int i, width;

    sprintf(str, "%d", score);
    sprintf(str2, "R = %d", round+1);
    if(ttk_screen->w == 220) {
        //draw score
        width = pz_vector_width (str2, 6, 6, 1);
        pz_vector_string_center (duckhunt_srf, str, 220-5-27, 176-5-8, 4, 6, 1, ttk_makecol(WHITE));
        //draw round "R = number"
        ttk_fillrect (duckhunt_srf, 21, HEIGHT-31, 21+width+1, (HEIGHT-31)+7, ttk_makecol(BLACK));
        pz_vector_string (duckhunt_srf, str2, 21, HEIGHT-31, 6, 6, 1, ttk_makecol(184,248,24));
        //draw bullets left
        switch(shots) {
        case 3:
            break;
        case 2:
            ttk_fillrect (duckhunt_srf, 34, HEIGHT-19, 40, HEIGHT-12, ttk_makecol(BLACK));
            break;
        case 1:
            ttk_fillrect (duckhunt_srf, 27, HEIGHT-19, 40, HEIGHT-12, ttk_makecol(BLACK));
            break;
        case 0:
            ttk_fillrect (duckhunt_srf, 20, HEIGHT-19, 40, HEIGHT-12, ttk_makecol(BLACK));
            break;
        }
        //draw mini ducks
        for(i=0; i<10; i++)
            ttk_blit_image (s_ducks[mini_ducks[i]], duckhunt_srf, 81+(i*7), HEIGHT-18);
    }
    else  if(ttk_screen->w<220) {
        //draw score
        width = pz_vector_width (str2, 5, 5, 1);
        pz_vector_string_center (duckhunt_srf, str, bg_w-24, bg_h-9, 3, 5, 1, ttk_makecol(WHITE));
        //draw round "R = number"
        ttk_fillrect (duckhunt_srf, 16, HEIGHT-23, 16+width+1, (HEIGHT-23)+6, ttk_makecol(BLACK));
        pz_vector_string (duckhunt_srf, str2, 16, HEIGHT-23, 5, 5, 1, ttk_makecol(184,248,24));
        //draw bullets left
        switch(shots) {
        case 3:
            break;
        case 2:
            ttk_fillrect (duckhunt_srf, 26, HEIGHT-14, 30, HEIGHT-9, ttk_makecol(BLACK));
            break;
        case 1:
            ttk_fillrect (duckhunt_srf, 20, HEIGHT-14, 30, HEIGHT-9, ttk_makecol(BLACK));
            break;
        case 0:
            ttk_fillrect (duckhunt_srf, 15, HEIGHT-14, 30, HEIGHT-9, ttk_makecol(BLACK));
            break;
        }
        //draw mini ducks
        for(i=0; i<10; i++)
            ttk_blit_image (s_ducks[mini_ducks[i]], duckhunt_srf, 61+(i*5), HEIGHT-14);
    }
    else {
        //draw score
        width = pz_vector_width (str2, 9, 9, 1);
        pz_vector_string_center (duckhunt_srf, str, 320-7-40, 240-7-19, 6, 9, 1, ttk_makecol(WHITE));
        //draw round "R = number"
        ttk_fillrect (duckhunt_srf, 30, HEIGHT-45, 30+width+1, (HEIGHT-45)+10, ttk_makecol(BLACK));
        pz_vector_string (duckhunt_srf, str2, 30, HEIGHT-45, 9, 9, 1, ttk_makecol(184,248,24));
        //draw bullets left
        switch(shots) {
        case 3:
            break;
        case 2:
            ttk_fillrect (duckhunt_srf, 50, HEIGHT-28, 58, HEIGHT-17, ttk_makecol(BLACK));
            break;
        case 1:
            ttk_fillrect (duckhunt_srf, 39, HEIGHT-28, 58, HEIGHT-17, ttk_makecol(BLACK));
            break;
        case 0:
            ttk_fillrect (duckhunt_srf, 29, HEIGHT-28, 58, HEIGHT-17, ttk_makecol(BLACK));
            break;
        }
        //draw mini ducks
        for(i=0; i<10; i++)
            ttk_blit_image (s_ducks[mini_ducks[i]], duckhunt_srf, 118+(i*10), HEIGHT-26);
    }

}