Пример #1
0
void UI_WINDOW::draw()
{
	UI_GADGET *tmp;

	gr_reset_clip();
	font::set_font(f_id);

	if (foreground_bmap_id >= 0) {
		gr_set_bitmap(foreground_bmap_id);
		gr_bitmap(x, y, GR_RESIZE_MENU);
	}

	if (flags & WIN_FILLED)	{
		ui_draw_box_out(x, y, x+w-1, y+h-1);
	}

	if (flags & WIN_BORDER)	{
		ui_draw_frame(x-BORDER_WIDTH, y-BORDER_WIDTH, x+w+BORDER_WIDTH-1, y+h+BORDER_WIDTH-1);
	}

	if (first_gadget) {
		tmp = first_gadget;
		do	{
			if (!tmp->hidden)
				tmp->draw();

			tmp = tmp->next;

		} while (tmp != first_gadget);
	}

	if (first_gadget) {
		tmp = first_gadget;
		do	{
			if (!tmp->hidden && (tmp->kind == UI_KIND_BUTTON) && ((UI_BUTTON *) tmp)->button_down()){
				tmp->draw();
			}

			tmp = tmp->next;
		} while (tmp != first_gadget);
	}

	// draw all xstrs
	draw_xstrs();

	// draw tooltips
	draw_tooltip();

	// convenient debug code for showing mouse coords
	if(Cmdline_mouse_coords){
		int mx, my;
		mouse_get_pos(&mx, &my);
		// mprintf(("MOUSE (%d, %d)\n", mx, my));					
		gr_set_color_fast(&Color_normal);
		gr_printf_no_resize(mx, my - 12, "%d %d", mx, my);
	}	
}
Пример #2
0
// display timing 
void timing_display(int x, int y)
{
#ifndef USE_TIMING
	return;
#else
	int idx;

	int line_height = gr_get_font_height() + 1;

	gr_set_color_fast(&Color_bright_blue);

	// total time
	gr_printf_no_resize(x, y, "Total time %f\n", (float)timing_frame_total() / 1000000.0f);
	y += line_height;

	// each event percentage
	for(idx=0; idx<Timing_event_count; idx++){
		gr_printf_no_resize(x, y, "%s: %f\n", Timing_events[idx].name, timing_event_pct(Timing_events[idx].name));
		y += line_height;
	}
#endif
}