Пример #1
0
static void othello_color_draw(PzWidget *wid, ttk_surface srf)
{
	unsigned char xline, yline, c;
	int x, y, step, startx, endx, size;

#ifdef SDL
	ttk_fillrect(srf, 0,0, wid->w, wid->h, ttk_ap_getx("window.bg")->color);
#endif
	step = (wid->h / 8);
	size = step * 8;
	startx = (wid->w - wid->h) / 2;
	endx = startx + size;
	ttk_fillrect(srf, startx,0, endx, size, BGCOLOR);
	for (x = 0; x < 9; ++x) {
		int mod = (size / 8) * x;
		ttk_line(srf, startx, mod, endx, mod, 0x000000);
		ttk_line(srf, startx + mod, 0, startx + mod, size, 0x000000);
	}
	yline = 0;
	for (c = 0; c < 64; c++) {
		xline = c % 8;
		x = xline * step + step/2 + startx;
		y = yline * step + step/2 + 0;
		if (_othello->b_set & (1ULL << c)) {
			if (_othello->board & (1ULL << c))
				draw_image(_othello->black, srf, x, y);
			else
				draw_image(_othello->white, srf, x, y);
		}
		else if (_othello->cur_bit == c)
			draw_image(_othello->selection, srf, x, y);
		if (xline == 7) yline++;
	}
}
void ti_mlwlb_draw(TWidget * wid, ttk_surface srf)
{
	ttk_color tcol;
	unsigned short disp[33];
	ttk_ap_fillrect(srf, ti_ap_getx(0), wid->x, wid->y, wid->x+wid->w, wid->y+wid->h);
	
	if (ti_mlwlb_position<1) {
		ttk_ap_fillrect(srf, ti_ap_getx(2), wid->x, wid->y, wid->x+wid->w/2, wid->y+wid->h);
		tcol = ti_ap_get(3);
	} else {
		tcol = ti_ap_get(1);
	}
	
	memcpy(disp, &ti_mlwlb_charset.chars[ti_mlwlb_startpos], ti_mlwlb_limit*2);
	disp[ti_mlwlb_limit]=0;
	ttk_text_uc16(srf, ttk_menufont, wid->x+1, wid->y, tcol, disp);
	
	if (ti_mlwlb_position>5) {
		ttk_ap_fillrect(srf, ti_ap_getx(2), wid->x+wid->w/2, wid->y, wid->x+wid->w, wid->y+wid->h);
		tcol = ti_ap_get(3);
	} else {
		tcol = ti_ap_get(1);
	}
	memcpy(disp, &ti_mlwlb_charset.chars[ti_mlwlb_limit+ti_mlwlb_startpos], ti_mlwlb_limit*2);
	disp[ti_mlwlb_limit]=0;
	ttk_text_uc16(srf, ttk_menufont, wid->x+wid->w/2+1, wid->y, tcol, disp);
	
	/* Position */
	ttk_line(srf, wid->x+wid->w/2, wid->y, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y, ttk_makecol(GREY));
	ttk_line(srf, wid->x+wid->w/2, wid->y+1, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y+1, ttk_makecol(GREY));
	ttk_line(srf, wid->x+wid->w/2, wid->y+wid->h-2, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y+wid->h-2, ttk_makecol(GREY));
	ttk_line(srf, wid->x+wid->w/2, wid->y+wid->h-1, wid->x+((ti_mlwlb_position*wid->w)/6), wid->y+wid->h-1, ttk_makecol(GREY));
}
Пример #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);
}
Пример #4
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));
}
Пример #5
0
le * eval_gfx_DrawLine ( lithp_burrito * lb, const int argc, le * branch )
{
    int x,y,a,b;
    if( !lb || !branch || argc != 5 ) return( leNew( "NIL" ));

    eval_getint_4( lb, branch, &x, &y, &a, &b );
    ttk_line( lb->srf, x, y, a, b, lb->pen1 );
    return( leNew( "T" ));
}
Пример #6
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);
}
Пример #7
0
static void draw_aimer (int x, int y)
{
    ttk_ellipse (duckhunt_srf, x, y, 5, 5, ttk_makecol(RED));
    ttk_line (duckhunt_srf, x-5, y, x+5, y, ttk_makecol(RED));
    ttk_line (duckhunt_srf, x, y-5, x, y+5, ttk_makecol(RED));
}