示例#1
0
// progressbar. Uses cur_save!  / PopUp
void prg_bar (int pro, unsigned char size, char fgc, char bgc)
{
	
	cur_save();
	color_save();
	int i, perc;
	
	/*if (perc > 0)
		pro = (perc*100)/size;
	else
		pro = 0;*/
		
	perc = size * pro / 100;
	
	
	set_color(fgc, bgc);
	for (i = 0; i < perc; i++)
		kprint(" ");
		
	set_color(bgc, fgc);
	for (; i < size; i++)
		kprint(" ");
	
	
	set_color(fgc, bgc);
	cur_load();
	
	cur_x += (size / 2) - 2;
	
	if ((size / 2) - 2 >= perc) set_color(bgc, fgc);
	kprint(itoa(pro / 100 % 10));
	
	if ((size / 2) - 1 >= perc) set_color(bgc, fgc);
	kprint(itoa(pro / 10 % 10));
	
	if ((size / 2) - 0 >= perc) set_color(bgc, fgc);
	kprint(itoa(pro % 10));
	
	if ((size / 2) + 1 >= perc) set_color(bgc, fgc);
	kprint("%");
	
	
	color_load();
	cur_load();
	
	/*kprint("[");
	kprint(itoa(pro / 100 % 10));
	kprint("]");*/
	
}
示例#2
0
文件: conf.c 项目: erikg/bmud
void
apply_cb (GtkWidget * crap, gpointer * nothing)
{
    int x;

    if (this_panel_cb)
	this_panel_cb ();

    /*
     * pack the new font 
     */
    if (fntname != NULL)
    {

/*		if(mud->disp_font_name)
			g_free(mud->disp_font_name);
*/
	mud->disp_font_name = g_strdup (fntname);
    }

/*	g_free(mud->disp_font);	*/
    mud->disp_font = gdk_font_load (mud->disp_font_name);

    /*
     * pack the colors 
     */
    for (x = 0; x < 9; ++x)
    {				/* unrolled. 2 isn't 'nuff for a loop. */
	memcpy (&color[x][0], &ccol[x][0], sizeof (GdkColor));
	memcpy (&color[x][1], &ccol[x][1], sizeof (GdkColor));
    }

    color_save ();
    session_save ();

    return;
}