Beispiel #1
0
char		*exec_menu()
{
  SDL_Surface	*screen;
  SDL_Surface	*background;
  SDL_Rect	pos;
  int		continuer;
  char		*ret;

  if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
    err_SDL("Can't init SDL", 1);
  SDL_WM_SetIcon(SDL_LoadBMP("image/DonkeyKong2.bmp"), NULL);
  screen = SDL_SetVideoMode(MWIN_WIDTH, MWIN_HEIGHT, WIN_COLOR,
			    SDL_HWSURFACE | SDL_DOUBLEBUF );
  SDL_WM_SetCaption("Epikong", NULL);
  background = img_load(MENU_BACK);
  pos.x = 0;
  pos.y = 0;
  while (continuer)
    {
      SDL_BlitSurface(background, NULL, screen, &pos);
      disp_menu(screen);
      ret = menu_loop(screen);
      if (ret)
	continuer = 0;
    }
  SDL_Quit();
  return (ret);
}
Beispiel #2
0
int main()
{
	int choice = -1;	//choice of oepration to be performed
	char cont[100];		//continue to main menu?
	int i_cont;

	//intialise memory
	init_mem();

	do	
	{
		//display main menu	
		disp_menu();
		//operation selection 
		do
		{
			choice = get_selection();	
		}while(!is_valid_choice(choice));

		//perform selected operation
		perform_opn(choice);
			
		//continue confirmation
		printf("\n\nContinue to main menu? (1 = yes, any other character = no) : ");
		scanf("%s",cont);
		i_cont = atoi(cont);

	}while(i_cont == 1);

	//destroy memory
	destroy_mem();
	printf("\n\nProgram Exited Successfully!!\n\n");

	return 0;
}	 
Beispiel #3
0
int main (int argc, char *argv[])
{
    /*
     * Program header request increments and other data.
     */

    init_scr();
    menu_window();
    disp_menu();
    get_choice();
    quit_prg();

    return 0;

}
Beispiel #4
0
/*
 * Root Menu
 */
int menu(unsigned int level, unsigned int n_menu, unsigned int select)
{
	int s,ss=0;

	while(1){
		frame(level,menus[n_menu].items,select);
		disp_menu(level,n_menu);
		s=select_menu(level,n_menu);
		switch(s){
		case -1:
		case 999:
			return(s);
			break;
		default:
			switch(menus[n_menu].next[s]){
			case 0:
				return(s);
				break;
			case 99:
				switch(file_menu(level+1, s)){
				case -1:
					return(-1);
					break;
				case 999:
					break;
				default:
					return(s);
					break;
				}
				break;
			default:
				ss=menu(level+1,menus[n_menu].next[s],s);
				if(ss==-1){
					return(ss);
				}else if(ss==999){
					break;
				}else{
					return(s*10+ss);
				}
			}
			break;
		}
	}
	return(-1);
}
Beispiel #5
0
int main(void)
{
  Node *head = NULL;
  int sel;

  init_list(&head);

  while(1){
    sel=disp_menu();
    if(sel==0) break;
    switch(sel){
      case 1: add_employee(head); break;
      case 2: retrieve_employee(head); break;
      case 3: remove_employee(head); break;
      default: break;
    }
  }
  deallocate_list(head);

  system("pause");
  return 0;
}