Exemplo n.º 1
0
void menu_show( MENU * menu )
{
	int i;

	ui_mouse_hide();

	gr_set_current_canvas(NULL);
	// Don't save background it if it's already drawn
        if (!menu->Displayed && menu->w>0 && menu->h>0) 
	{
		// Save the background
		gr_bm_ubitblt(menu->w, menu->h, 0, 0, menu->x, menu->y, &(grd_curscreen->sc_canvas.cv_bitmap), menu->Background);

		// Draw the menu background
		gr_setcolor( CGREY );
		gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
		if ( menu != &Menu[0] )
		{
			gr_setcolor( CBLACK );
			gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
		}
	}
		
	// Draw the items
	
	for (i=0; i< menu->NumItems; i++ )
		item_show( menu, i );

	ui_mouse_show();
	
	// Mark as displayed.
	menu->Displayed = 1;
}
Exemplo n.º 2
0
int gr_palette_fade_in(ubyte *pal, int nsteps, int allow_keys)	
{
	int i;
	
	if (!gr_palette_faded_out) return 0;
	
#ifdef OGLES
	GLuint saved_screen_tex;
	grs_canvas *save_canvas;
	int darken_step;
	
	if (!grd_curscreen) {
		return 0;
	}
	
	save_canvas = grd_curcanv;
	gr_set_current_canvas(NULL);
	darken_step = GR_FADE_LEVELS / nsteps;
	Gr_scanline_darkening_level = 1;
	saved_screen_tex = ogles_save_screen();
	for (i = 0; i < nsteps; ++i) {
		ogles_draw_saved_screen(saved_screen_tex);
		Gr_scanline_darkening_level	+= darken_step;
		gr_urect(0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h);
		showRenderBuffer();
		gr_sync_display();
	}
	glDeleteTextures(1, &saved_screen_tex);
	Gr_scanline_darkening_level = GR_FADE_LEVELS;
	gr_set_current_canvas(save_canvas);
	gr_palette_apply(pal);
#else
	int j;
	ubyte c[768];
	fix fade_palette[768];
	fix fade_palette_delta[768];
	
	allow_keys  = allow_keys;
	
	for (i=0; i<768; i++ )	{
		fade_palette[i] = 0;
		fade_palette_delta[i] = i2f(pal[i]+gr_palette_gamma) / nsteps;
	}

	for (j=0; j<nsteps; j++ )	{
		gr_sync_display();
		for (i=0; i<768; i++ )	{		
			fade_palette[i] += fade_palette_delta[i];
			if (fade_palette[i] > i2f(pal[i]+gr_palette_gamma) )
				fade_palette[i] = i2f(pal[i]+gr_palette_gamma);
			c[i] = f2i(fade_palette[i]);
			if ( c[i] > 63 ) c[i] = 63;					
		}
		gr_palette_apply(c);
	}
#endif
	gr_palette_faded_out = 0;
	return 0;
}
Exemplo n.º 3
0
void ui_draw_box_in( short x1, short y1, short x2, short y2 )
{

	gr_setcolor( CWHITE );
	gr_urect( x1+2, y1+2, x2-2, y2-2 );

	ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CGREY, CBRIGHT );
	ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CGREY, CBRIGHT );
}
Exemplo n.º 4
0
Arquivo: menubar.c Projeto: btb/d2x
void item_show( MENU * menu, int n )
{
	ITEM * item = &menu->Item[n];
	
	gr_set_current_canvas(NULL);
	// If this is a seperator, then draw it.
	if ( item->Text[0] == '-'  )
	{
		gr_setcolor( CBLACK );
		gr_urect( item->x, item->y+item->h/2, item->x+item->w-1, item->y+item->h/2 );
		return;
	}	

	if ( menu->CurrentItem==n && menu->ShowBar )
	{
		if ( menu != &Menu[0] )
		{
			gr_setcolor( CBLACK );
			gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 );
		}
	 	gr_set_fontcolor( CWHITE, CBLACK );
	}else {
		if ( menu != &Menu[0] )
		{
			gr_setcolor( CGREY );
			gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 );
		}
		gr_set_fontcolor( CBLACK, CGREY );
	}

	if ( menu != &Menu[0] )
	{
		if ( menu->Active)
			gr_ustring( item->x+1, item->y+1, item->Text );
		else
			gr_ustring( item->x+1, item->y+1, item->InactiveText );
	} else {
		if ( menu->Active)
			gr_ustring( item->x, item->y, item->Text );
		else
			gr_ustring( item->x, item->y, item->InactiveText );
	}
}
Exemplo n.º 5
0
void ui_pad_draw(UI_DIALOG *dlg, int x, int y)
{
	int bh, bw;
	
	bw = 56; bh = 30;
	
	ui_dialog_set_current_canvas( dlg );
	ui_draw_box_in( x, y, x+(bw*4)+10 + 200, y+(bh*5)+45 );

	gr_set_current_canvas( NULL );
	gr_setcolor( CWHITE );
	gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 );
	gr_set_fontcolor( CBLACK, CWHITE );
	gr_ustring( desc_x, desc_y, KeyPad[active_pad]->description );
}
Exemplo n.º 6
0
static void menu_draw(MENU *menu)
{
	int i;
	
	gr_set_default_canvas();
	auto &canvas = *grd_curcanv;

	// Draw the menu background
	gr_urect(canvas, menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1, CGREY);
	if ( menu != &Menu[0] )
	{
		gr_ubox(canvas, menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1, CBLACK);
	}
	
	// Draw the items
	
	for (i=0; i< menu->NumItems; i++ )
		item_show( menu, i );
}
Exemplo n.º 7
0
void menu_draw(MENU *menu)
{
	int i;
	
	gr_set_current_canvas(NULL);

	// Draw the menu background
	gr_setcolor( CGREY );
	gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
	if ( menu != &Menu[0] )
	{
		gr_setcolor( CBLACK );
		gr_ubox( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
	}
	
	// Draw the items
	
	for (i=0; i< menu->NumItems; i++ )
		item_show( menu, i );
}
Exemplo n.º 8
0
static void ui_pad_set_active( int n )
{
	int np;
	char * name;
	int i, j;

	

	gr_set_current_canvas( NULL );
	gr_setcolor( CWHITE );
	gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 );
	gr_set_fontcolor( CBLACK, CWHITE );
	gr_ustring( desc_x, desc_y, KeyPad[n]->description );
		
	for (i=0; i<17; i++ )
	{
		Pad[i]->text = KeyPad[n]->buttontext[i];
		Pad[i]->status = 1;
		Pad[i]->user_function = NULL;
		Pad[i]->dim_if_no_function = 1;
		Pad[i]->hotkey = -1;
				
		for (j=0; j< KeyPad[n]->numkeys; j++ )
		{
			if (HotKey[i] == KeyPad[n]->keycode[j] )
			{
				Pad[i]->hotkey =  HotKey[i];
				Pad[i]->user_function = func_nget( KeyPad[n]->function_number[j], &np, &name );
			}
			if (HotKey1[i] == KeyPad[n]->keycode[j] )
			{
				Pad[i]->hotkey1 =  HotKey1[i];
				Pad[i]->user_function1 = func_nget( KeyPad[n]->function_number[j], &np, &name );
			}
		}
	}

	active_pad = n;
}