Esempio n. 1
0
static void settings_menu() 
{
	 char str[35];
	 char buf[15];
	 int height;
	
	switch(ttk_screen->bpp){
		case 2: texts = ttk_makecol(WHITE); break;
		case 16: texts = ttk_makecol(151, 124, 33); break;
	}
	 
	 height = ttk_text_height(ttk_menufont);
	 
	 ttk_blit_image (menu_sbg, iracer_srf, 0, 0);
	 
	 strcpy(str, "Laps: ");
	 sprintf(buf, "%d", set_laps[settings.laps]);
	 strcat(str, buf);
	 ttk_text (iracer_srf, ttk_menufont, 5, bgh/4, (option==0)?texts:ttk_makecol(BLACK), str);
	 
	 strcpy(str, "Speed: ");
	 sprintf(buf, "%d CC", set_cc[settings.cc]);
	 strcat(str, buf);
	 ttk_text (iracer_srf, ttk_menufont, 5, bgh/4+(height+2), (option==1)?texts:ttk_makecol(BLACK), str);
	 
	 strcpy(str, "Time Limit: ");
	 sprintf(buf, "%s", onoff_opts[settings.gdif]);
	 strcat(str, buf);
	 ttk_text (iracer_srf, ttk_menufont, 5, bgh/4+(2*height+4), (option==2)?texts:ttk_makecol(BLACK), str);
	 
	 ttk_text (iracer_srf, ttk_menufont, 5, bgh/4+(3*height+6), (option==3)?texts:ttk_makecol(BLACK), "Save Settings");
}
Esempio n. 2
0
/* draws everything else */
void draw_1dtetris (TWidget *wid, ttk_surface srf)
{
	char buffer[8];
	if (score == 0) snprintf(buffer, 8, "%d", score); else	snprintf(buffer, 8, "%d00", score);

	// draw playfield
	ttk_fillrect (srf, 0, 0, w, HWH, ttk_makecol(BLACK));
	ttk_rect (srf, pf_x, 6, pf_x+pf_w, 6+pf_h, ttk_makecol(WHITE));
	ttk_line (srf, pf_x+1, 6, pf_x+pf_w-2, 6, ttk_makecol(BLACK));

	// draw next frame
	ttk_rect (srf, nf_x, nf_y, nf_x+nf_w, nf_y+nf_h, ttk_makecol(WHITE));
	ttk_text (srf, ttk_textfont, nf_x+1, nf_y-ttk_text_height(ttk_textfont), ttk_makecol(WHITE), "next");

	// draw score frame
	ttk_rect (srf, sf_x, nf_y, sf_x+sf_w, nf_y+nf_w, ttk_makecol(WHITE));
	ttk_text (srf, ttk_textfont, sf_x+1, nf_y-ttk_text_height(ttk_textfont), ttk_makecol(WHITE), "score");
	ttk_text (srf, ttk_textfont, sf_x+sf_w-ttk_text_width(ttk_textfont, buffer)-3, nf_y + (nf_w/2 - ttk_text_height(ttk_textfont)/2), ttk_makecol(WHITE), buffer);

	// draw moving brick
	draw_brick(srf, pf_x, 7-(sq_size*brick_length), brick_length, brick_depth);
	// draw next brick
	draw_brick(srf, nf_x+sq_size/2, nf_y+sq_size/2, next_length, 0);

	// hide bad programming skills for users eyes :)
	ttk_fillrect (srf, pf_x, 0, pf_x+pf_w, 6, ttk_makecol(BLACK));
}
Esempio n. 3
0
void draw_mymodule (PzWidget *wid, ttk_surface srf) 
{
    // Draw the message
    char *p = text;
    int y = wid->y + 5;
    while (*p) {
	char svch;
	if (strchr (p, '\n')) {
	    svch = *strchr (p, '\n');
	    *strchr (p, '\n') = 0;
	} else {
	    svch = 0;
	}
	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), p);
	p += strlen (p);
	y += ttk_text_height (ttk_textfont) + 1;
	*p = svch;
	if (*p) p++;
    }
    y += 3;
    // Dividing line
    ttk_line (srf, wid->x + 5, y, wid->x + wid->w - 5, y, ttk_makecol (DKGREY));
    
    y += 3;
    // The image
    ttk_blit_image (image, srf, wid->x + (wid->w - imgw) / 2, wid->y + (wid->h - imgh) / 2);
    y += imgh;
    
    // The message
#define MSG "Press a button to quit."
    ttk_text (srf, ttk_menufont, wid->x + (wid->w - ttk_text_width (ttk_menufont, MSG)) / 2,
	      wid->y + wid->h - ttk_text_height (ttk_menufont) - 5, ttk_makecol (BLACK), MSG);
}
Esempio n. 4
0
void transfer_alt_stat_draw (PzWidget *wid, ttk_surface srf) {
	char buf[128];
	stat_data *stats = (stat_data *)wid->data;
    int y = wid->y + 5; 
	
	ttk_color color = ttk_ap_getx ("window.fg")->color;
	
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, _("Selected:"));
	y += ttk_text_height (ttk_textfont) + 1;

	sprintf(buf, "%i tracks.", stats->num_files);
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, buf);
/*
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, _("Tracks:"));
    sprintf(buf, "%i", stats->num_tracks);
	printf("textwid: %i\n", ttk_text_width(ttk_textfont, buf));
    ttk_text (srf, ttk_textfont, wid->w - ttk_text_width(ttk_textfont, buf) - 6,
                      y, color, buf);
*/	
	y += ttk_text_height (ttk_textfont) + 1;

	sprintf(buf, "%s bytes.", humanize_size(stats->total_bytes));
    ttk_text (srf, ttk_textfont, wid->x + 5, y, color, buf);
	y += ttk_text_height (ttk_textfont) + 1;
}
Esempio n. 5
0
/* set text to NULL for updating, to a value for new window stuff */
static void updateprogress( TWindow * sliderwin, TWidget * slider,
			    int newVal, char * displayText,
			    char * lineTwo )
{
	ttk_color menu_bg_color = 0;
	ttk_color menu_fg_color = 0;
	int textw;

	if( newVal < 0 ) newVal = 0; /* jsut in case */

	/* if displayText is non-NULL, rerender the whole thing */
	if( displayText || lineTwo ) {
		if( ttk_ap_getx( "menu.bg" ))
			menu_bg_color = ttk_ap_getx("menu.bg")->color;
		if( ttk_ap_getx( "menu.fg" ))
			menu_fg_color = ttk_ap_getx("menu.fg")->color;

		if( menu_fg_color == menu_bg_color ) {
		    if( menu_fg_color == 0 || menu_fg_color == 3 ) { /*why 3?*/
			menu_fg_color = ttk_makecol( BLACK );
			menu_bg_color = ttk_makecol( WHITE );
		    }
		}

		ttk_fillrect(sliderwin->srf,0,0,
				sliderwin->w,sliderwin->h,
				menu_bg_color );

		if( displayText ) {
			textw = ttk_text_width(ttk_textfont,displayText);
			ttk_text(sliderwin->srf,ttk_textfont,
				ttk_screen->w/ 2 - textw/2, ttk_screen->h/2,
				menu_fg_color, displayText);
		}

		if( lineTwo ) {
			textw = ttk_text_width(ttk_textfont, lineTwo);
			ttk_text(sliderwin->srf,ttk_textfont,
				ttk_screen->w/ 2 - textw/2, 
				ttk_screen->h/2 + ttk_textfont->height + 5,
				menu_fg_color, lineTwo);
		}
	}

	ttk_slider_set_val(slider,newVal);
	ttk_slider_draw(slider,sliderwin->srf);
	ttk_draw_window(sliderwin);
	ttk_gfx_update(ttk_screen->srf);
//	ttk_delay(10);  //useful for testing
}
Esempio n. 6
0
void ti_dial_draw(TWidget * wid, ttk_surface srf)
{
	int sc, n, i, j, ty;
	int m = ti_dial_max()+1;
	uc16 s[2] = {0,0};
	ttk_ap_fillrect(srf, ti_ap_getx(0), wid->x, wid->y, wid->x+wid->w, wid->y+wid->h);
	n = wid->w / CW;
	sc = ti_dial_charlist_pos - n/2;
	ty = 0;
	if (sc > (m-n) ) { sc = (m-n); }
	if (sc < 0) { sc = 0; }
	if (ti_dial_cursormode()) {
		ttk_text(srf, ttk_menufont, wid->x+(wid->w - ttk_text_width(ttk_menufont, ti_dial_cmstring))/2, wid->y+ty, ti_ap_get(1), ti_dial_cmstring);
	} else {
		for (i = sc, j = 0; ((i<m) && (j<n)); i++, j++)
		{
			s[0] = ti_dial_get_char(i);
			if (i == ti_dial_charlist_pos) {
				ttk_ap_fillrect(srf, ti_ap_getx(2), wid->x+j*CW, wid->y, wid->x+j*CW+CW, wid->y+wid->h);
				ttk_text_uc16(srf, ttk_menufont, wid->x+j*CW+(10-ttk_text_width_uc16(ttk_menufont, s))/2, wid->y+ty, ti_ap_get(3), s);
			} else {
				ttk_text_uc16(srf, ttk_menufont, wid->x+j*CW+(10-ttk_text_width_uc16(ttk_menufont, s))/2, wid->y+ty, ti_ap_get(1), s);
			}
		}
	}
}
Esempio n. 7
0
static void pp_place_text(PzWidget *wid, ttk_surface srf, void *text, int num) {
	int w, h;
	w = ttk_text_width(ttk_menufont,  (char *)text); 
	h = ttk_text_height(ttk_menufont);
	
	ttk_text(srf, ttk_menufont, w < wid->w ? (wid->w - w) / 2 : 8,
			h*num - (2*h)/3, ttk_ap_getx("window.fg")->color,
			(char *)text); 
}
Esempio n. 8
0
static int draw_duckhunt_highscore (TWidget *wid, ttk_surface srf)
{
    int length;
    char str[30];

    sprintf (str, "High Score = %d", readHighScore("/mnt/aj/duckhunt/hs"));
    length = ttk_text_width (ttk_menufont, str);
    ttk_fillrect (srf, 0, 0, ttk_screen->w, ttk_screen->h, ttk_makecol(WHITE));
    ttk_text (srf, ttk_menufont, (ttk_screen->w/2)-(length/2), (ttk_screen->h-HEADER)/2, ttk_makecol(BLACK), str);
    return 0;
}
Esempio n. 9
0
static void main_menu() 
{

	switch(ttk_screen->bpp){
		case 2: texts = ttk_makecol(WHITE); break;
		case 16: texts = ttk_makecol(151, 124, 33); break;
	}
		
	int width;
   	width = ttk_text_width (ttk_menufont, menu_opts[option]);
	 
	ttk_blit_image (menu_bg, iracer_srf, 0, 0);
	ttk_blit_image (menu_wheel, iracer_srf, (bgw/2)-((ipods[191])/2), ipods[44]);
	ttk_text (iracer_srf, ttk_menufont, (bgw/2)-(width/2), ipods[95], texts,menu_opts[option]);
}
Esempio n. 10
0
void tix_rename_draw(TWidget * wid, ttk_surface srf)
{
	ttk_ap_fillrect(srf, ttk_ap_getx("window.bg"), wid->x, wid->y, wid->w, wid->h);
	ttk_text(srf, ttk_menufont, wid->x, wid->y, ttk_ap_getx("window.fg")->color, _("Rename file to:"));
}
Esempio n. 11
0
void tix_mkdir_draw(TWidget * wid, ttk_surface srf)
{
	ttk_ap_fillrect(srf, ttk_ap_getx("window.bg"), wid->x, wid->y, wid->w, wid->h);
	ttk_text(srf, ttk_menufont, wid->x, wid->y, ttk_ap_getx("window.fg")->color, _("Make directory named:"));
}
Esempio n. 12
0
void draw_about_remote_ipod_widget (PzWidget *wid, ttk_surface srf) 
{
    // Draw the message
    int y = wid->y + 5;

	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "Test");
	y += ttk_text_height (ttk_textfont) + 1;

	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "Test2");
	y += ttk_text_height (ttk_textfont) + 1;
	
	if (check_kernel_module("tsb43aa82"))
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "tsb43aa82 loaded");
	else
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "tsb43aa82 NOT loaded");
	y += ttk_text_height (ttk_textfont) + 1;
	
	if (check_kernel_module("scsi_mod"))
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "scsi_mod loaded");
	else
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "scsi_mod NOT loaded");
	y += ttk_text_height (ttk_textfont) + 1;

	if (check_kernel_module("sd_mod"))
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "sd_mod loaded");
	else
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "sd_mod NOT loaded");
	y += ttk_text_height (ttk_textfont) + 1;
	
	if (check_kernel_module("sbp2"))
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "sbp2 loaded");
	else
 	ttk_text (srf, ttk_textfont, wid->x + 5, y, ttk_makecol (BLACK), "sbp2 NOT loaded");
	y += ttk_text_height (ttk_textfont) + 1;
	
    y += 3;

    // Dividing line
    ttk_line (srf, wid->x + 5, y, wid->x + wid->w - 5, y, ttk_makecol (DKGREY));
    
    y += 3;
    // The message
#define MSG "Press a button to quit."
    ttk_text (srf, ttk_menufont, wid->x + (wid->w - ttk_text_width (ttk_menufont, MSG)) / 2,
	      wid->y + wid->h - ttk_text_height (ttk_menufont) - 5, ttk_makecol (BLACK), MSG);
}