Exemplo n.º 1
0
static int select_video_lcd(const struct menu_opt *menu)
{
#ifdef CONFIG_DISPLAY_LVDS_ENABLE
	int ret;

	ret = run_menu(select_lcd_type_menu, ARRAY_SIZE(select_lcd_type_menu));
	if (ret != 0)
		return ret;
#else

#endif

	return run_menu(select_lcd_menu, ARRAY_SIZE(select_lcd_menu));
}
Exemplo n.º 2
0
int
main(int argc, char **argv)
{
    if (!bm_init())
        return EXIT_FAILURE;

    parse_args(&client, &argc, &argv);

    struct bm_menu *menu;
    if (!(menu = menu_with_options(&client)))
        return EXIT_FAILURE;

    read_items_to_menu_from_stdin(menu);
    bm_menu_set_highlighted_index(menu, client.selected);

    enum bm_run_result status = run_menu(menu);

    if (status == BM_RUN_RESULT_SELECTED) {
        uint32_t i, count;
        struct bm_item **items = bm_menu_get_selected_items(menu, &count);
        for (i = 0; i < count; ++i) {
            const char *text = bm_item_get_text(items[i]);
            printf("%s\n", (text ? text : ""));
        }

        if (!count && bm_menu_get_filter(menu))
            printf("%s\n", bm_menu_get_filter(menu));
    }

    bm_menu_free(menu);
    return (status == BM_RUN_RESULT_SELECTED ? EXIT_SUCCESS : EXIT_FAILURE);
}
Exemplo n.º 3
0
int main(void){
   menu_t *games_list;
   int selected;
   PICvision_init();
   games_list=create_menu("SELECT GAME");
   add_menu_item("snake",1,games_list);
   add_menu_item("2048",2,games_list);
   //add_menu_item("game 3",3,games_list);
   //add_menu_item("etc...",4,games_list);
   while(1){
       clear_screen();
       selected=run_menu(games_list,10,(27-5)/2,PADDLE1);
       clear_screen();
       switch(selected){
           case 1:
               snake_game();
               break;
           case 2:
               gc_2048_game();
               break;
           case 3:
               set_curpos(0,0);
               print("game 3");
               wait_n_frame(60);
               break;
           case 4:
               set_curpos(0,0);
               print("autre jeux");
               wait_n_frame(60);
               break;
       }//switch
   }//while
   return 0;
}//main()
Exemplo n.º 4
0
/*! \return 1 on failure otherwise 0 */
static int do_video(cmd_tbl_t* cmdtp, int flag, int argc, char* argv[])
{
	int ret = 1;
	const char *s;

	if (argc != 1)
		return ret;

	ret = run_menu(select_vif_menu, ARRAY_SIZE(select_vif_menu));
	if (!ret) {
		puts("\n");
#ifdef CONFIG_DISPLAY1_ENABLE
		if ((s = GetEnvVar(VIDEO_VAR, 1)) != NULL)
			printf("%s=%s\n", VIDEO_VAR, s);
#endif
#ifdef CONFIG_DISPLAY2_ENABLE
		if ((s = GetEnvVar(VIDEO2_VAR, 1)) != NULL)
			printf("%s=%s\n", VIDEO2_VAR, s);
#endif
#ifdef CONFIG_DISPLAY_LVDS_ENABLE
		if ((s = GetEnvVar(LDB_VAR, 1)) != NULL)
			printf("%s=%s\n", LDB_VAR, s);
#endif
#if defined(CONFIG_DISPLAY1_ENABLE) && defined(CONFIG_DISPLAY2_ENABLE)
		if ((s = GetEnvVar(FBPRIMARY_VAR, 1)) != NULL)
			printf("%s=%s\n", FBPRIMARY_VAR, s);
#endif
		puts("\nRemember to save the configuration with 'saveenv'\n\n");
	} else if (ret == USER_CANCEL)
		ret = 0;	/* Selection cancelled by user, not error */

	return ret;
}
Exemplo n.º 5
0
int	main(void)
{
	t_env	env;

	init(&env);
	if(run_menu(&env))
		erreur_menu(&env);
	run(&env);
	return 0;
}
Exemplo n.º 6
0
static int select_datamap_ldb(const struct menu_opt *menu)
{
	if (!menu->param)
		return 0;

	if (!strcmp(menu->param, "off")) {
		setenv(LDB_VAR, menu->param);
		return 0;
	}
	strcpy(ldbvar, menu->param);
	return run_menu(select_ldb_datamap_menu, ARRAY_SIZE(select_ldb_datamap_menu));
}
Exemplo n.º 7
0
int main(int argc, char* argv[]) {
    /*X10I BOARD*/
    void *xBoard;
    Authenticate x15Authenticate;
    BYTE fittedBoard;

    /* initialise the firefly device */
    xBoard = XlineInitBoard();
    if (xBoard == NULL) {
        return ( XlineExit("initialisation failed.", xBoard, &x15Authenticate, 1));
    }
    /* Determine which board type is fitted, and unlock the IO security accordingly */


    XlineGetFittedBoard(xBoard, &fittedBoard);

    if (fittedBoard == X10I_BOARD)
        UnlockX10c(xBoard);
    else
        return ( XlineExit("unknown board fitted.", xBoard, &x15Authenticate, 1));

    printf("success.\n\n");

#ifdef X10_LINUX_BUILD
    InitialiseConsole();
#endif
    printf("Bismillah start X10i jogging. \n\n");



    int charkey = 0;
    run_menu();
    init_keyboard();


    for (;;) {
        if (keyboard_hit()) {
            charkey = read_charkey();
            printf("You hit keyboard key: char = %c or int = %d \n", charkey, charkey);
            cmd_interpreter(xBoard,charkey);
        } //END IF
    } // END FOR



    close_keyboard();
    printf("Alhamdulillah. finish Raspberry Pi jogging. \n\n");

    return ( XlineExit("Leaving program.", xBoard, &x15Authenticate, 0));

}
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
    int err;
    err = SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO);
    if(err){
        fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError());
    }


    scaled = SDL_SetVideoMode(SCREENX * 2, SCREENY * 2, 32, SDL_DOUBLEBUF | SDL_SWSURFACE);

    main_screen = SDL_CreateRGBSurface(SDL_SWSURFACE,
            SCREENX,
            SCREENY,
            scaled->format->BitsPerPixel,
            scaled->format->Rmask,
            scaled->format->Gmask,
            scaled->format->Bmask,
            scaled->format->Amask
            );


    if (!main_screen){
        fprintf(stderr, "SDL failed screen init: %s\n", SDL_GetError());
    }

    err = Mix_OpenAudio(22050, MIX_DEFAULT_FORMAT, 2, 2048);
    if (err){
        fprintf(stderr, "SDL audio failed: %s\n", SDL_GetError());
    }
    init_font();
    key_state = SDL_GetKeyState(NULL);
    game_state = 1;
    srand(time(NULL));
    load_game_resources();

    while(game_state != QUIT){
        run_menu();
        if(game_state != QUIT){
            run_game();
        }
    }
    return 0;
}
Exemplo n.º 9
0
void	restart_level(t_env* env)
{
	t_wall	*walls;
	t_wall	*tmp;

	walls = &env->wall;
	while (walls->next != 0)
	{
		tmp = walls->next;
		walls = tmp->next;
		if (tmp->next == 0)
			break;
		free(tmp->next);
	}
	free(env->wall.next);
	sleep(5);
	init(env);
	if(run_menu(env))
		erreur_menu(env);
	run(env);
}
Exemplo n.º 10
0
int main(){
    int option = 0;    
    int main_loop_var = 1;
    //seed the random number generator
    srand(time(0));
    while(main_loop_var){
        option = run_menu();
        int error = 0;
        switch (option) {
            case SINGLE_CHIP:
                error = single_chip();
                break;
            case MULTIPLE_CHIPS:
                error = multiple_chips();
                break;
            case QUIT_PRGM:
                printf("GOODBYE!\n");
                return 0;
                break;
        }
    }
    return 0;
}
Exemplo n.º 11
0
int main(int argc, char *argv[])
{
    char *rom_name;



#ifdef __AMIGA__
    BPTR file_lock = GetProgramDir();
    SetProgramDir(file_lock);
#endif
	signal(SIGSEGV, catch_me);

#ifdef WII
	//   SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE);

	fatInitDefault();
#endif

    cf_init(); /* must be the first thing to do */
    cf_init_cmd_line();
    cf_open_file(NULL); /* Open Default configuration file */

    rom_name=cf_parse_cmd_line(argc,argv);

    /* print effect/blitter list if asked by user */
    if (!strcmp(CF_STR(cf_get_item_by_name("effect")),"help")) {
	print_effect_list();
	exit(0);
    }
    if (!strcmp(CF_STR(cf_get_item_by_name("blitter")),"help")) {
	print_blitter_list();
	exit(0);
    }

	init_sdl();

/* GP2X stuff */
#ifdef GP2X
    gp2x_init();
#endif
    if (gn_init_skin()!=SDL_TRUE) {
	    printf("Can't load skin...\n");
            exit(1);
    }    

	reset_frame_skip();

    if (conf.debug) conf.sound=0;

/* Launch the specified game, or the rom browser if no game was specified*/
	if (!rom_name) {
	//	rom_browser_menu();
		run_menu();
		printf("GAME %s\n",conf.game);
		if (conf.game==NULL) return 0;
	} else {

		if (init_game(rom_name)!=SDL_TRUE) {
			printf("Can't init %s...\n",rom_name);
            exit(1);
		}    
	}

	/* If asked, do a .gno dump and exit*/
    if (CF_BOOL(cf_get_item_by_name("dump"))) {
        char dump[8+4+1];
        sprintf(dump,"%s.gno",rom_name);
        dr_save_gno(&memory.rom,dump);
        close_game();
        return 0;
    }

    if (conf.debug)
	    debug_loop();
    else
	    main_loop();

    close_game();

    return 0;
}
Exemplo n.º 12
0
int main(int argc, char *argv[])
{
    const char *cmdline;
    struct menu *m;
    int rows, cols;
    int i;

    (void)argc;

    parse_configs(argv + 1);

    /*
     * We don't start the console until we have parsed the configuration
     * file, since the configuration file might impact the console
     * configuration, e.g. MENU RESOLUTION.
     */
    start_console();
    if (getscreensize(1, &rows, &cols)) {
	/* Unknown screen size? */
	rows = 24;
	cols = 80;
    }

    /* Some postprocessing for all menus */
    for (m = menu_list; m; m = m->next) {
	if (!m->mparm[P_WIDTH])
	    m->mparm[P_WIDTH] = cols;

	/* If anyone has specified negative parameters, consider them
	   relative to the bottom row of the screen. */
	for (i = 0; i < NPARAMS; i++)
	    if (m->mparm[i] < 0)
		m->mparm[i] = max(m->mparm[i] + rows, 0);
    }

    cm = start_menu;

    if (!cm->nentries) {
	fputs("Initial menu has no LABEL entries!\n", stdout);
	return 1;		/* Error! */
    }

    for (;;) {
	local_cursor_enable(true);
	cmdline = run_menu();

	if (clearmenu)
	    clear_screen();

	local_cursor_enable(false);
	printf("\033[?25h\033[%d;1H\033[0m", END_ROW);

	if (cmdline) {
	    uint32_t type = parse_image_type(cmdline);

	    execute(cmdline, type, false);
	    if (cm->onerror) {
		type = parse_image_type(cm->onerror);
		execute(cm->onerror, type, true);
	    }
	} else {
	    return 0;		/* Exit */
	}
    }
}
Exemplo n.º 13
0
static int select_primary_disp(const struct menu_opt *menu)
{
	return run_menu(select_primary_disp_menu, ARRAY_SIZE(select_primary_disp_menu));
}
Exemplo n.º 14
0
static int select_video_ldb_config(const struct menu_opt *menu)
{
	return run_menu(select_ldb_menu, ARRAY_SIZE(select_ldb_menu));
}
Exemplo n.º 15
0
static int select_video_hdmi(const struct menu_opt *menu)
{
	return run_menu(select_hdmi_menu, ARRAY_SIZE(select_hdmi_menu));
}
Exemplo n.º 16
0
static int select_video_if2(const struct menu_opt *menu)
{
	active_vif = 1;
	return run_menu(select_if2_menu, ARRAY_SIZE(select_if2_menu));
}
Exemplo n.º 17
0
int main(int argc, char **argv)
{
	//puzzletube setup
	srand(time(NULL));
	settings_load();
	highscore_load();
	
	//Language setup
	spReadPossibleLanguages("./translations/languages.txt");
	spBundlePointer translation = spLoadBundle("./translations/translations.txt",1);
	/* //counting all hashes:
	spTextPointer mom = translation->firstText;
	int mesh[257];
	memset(mesh,0,257*4);
	int count = 0;
	while (mom)
	{
		if (mom->hash >= 0 && mom->hash < 256)
		{
			mesh[mom->hash]++;
		}
		else
			mesh[256]++;
		count++;
		mom = mom->next;
	}
	int i,j;
	for (i = 0; i < 16; i++)
	{
		for (j = 0; j < 16; j++)
		{
			printf(" %3i",mesh[i+j*16]);
		}
		printf("\n");
	}
	printf("Invalid hash: %i\n",mesh[256]);
	printf("Total hash: %i\n",count);*/
	settings_set_translation(translation);

	//sparrow3D Init
	//spSetDefaultWindowSize( 800, 480 );
	spInitCore();
	spInitNet();
	spSetAffineTextureHack(0); //We don't need it :)
	spInitMath();
	
	//Setup
	screen = spCreateDefaultWindow();
	resize(screen->w,screen->h);
	
	run_splashscreen(resize);
	spSetCulling(0);
	init_music();
	prepare_game_objects(1);
	change_music("Midnight Mediation","Nick May");
	highscore_save();
	init_c4a();
	run_menu(resize);
	quit_c4a();
	delete_game_objects();
	spDeleteBundle(translation,0);
	spFontDelete(font);
	spFontDelete(small_font);
	spFontDelete(middle_font);
	quit_music();
	spQuitNet();
	spQuitCore();
	return 0;
}