Пример #1
0
Файл: menubar.c Проект: btb/d2x
void menubar_do( int keypress )
{
	if (menubar_hid) return;
		
	do_state_0(last_keypress);
	
	while (state > 0 )
	{
		ui_mega_process();
		switch(state)
		{
		case 1:
			do_state_1(last_keypress);
			break;
		case 2:
			do_state_2(last_keypress);
			break;
		case 3:
			do_state_3(last_keypress);			
			break;
		default:
			state = 0;
		}
		last_keypress  = 0;

		vid_update();
	}
}
Пример #2
0
int menubar_handler(window *wind, d_event *event, MENU *menu)
{
	int rval = 0;

	if (event->type == EVENT_WINDOW_DRAW)
	{
		menu_draw(&Menu[0]);
		return 1;
	}
	else if (event->type == EVENT_WINDOW_CLOSE)
	{
		int i;
		
		
		//menu_hide_all();
		//menu_hide( &Menu[0] );
		
		for (i=1; i<num_menus; i++ )
		{
			if (Menu[i].wind)
			{
				window_close(Menu[i].wind);
				Menu[i].wind = NULL;
			}
		}
		
		Menu[0].wind = NULL;
	}

	switch (state)
	{
		case 0:
			rval = do_state_0(event);
			break;
			
		case 1:
			rval = do_state_1(event);
			break;
			
		case 2:
			rval = do_state_2(event);
			break;
			
		case 3:
			break;

		default:
			state = 0;
			menu_hide_all();
	}
	
	return rval;
}