예제 #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);
}
예제 #2
0
int main(int argc, char *argv[])
{
   get_environment_settings();

   rarch_main_clear_state();
   config_set_defaults();

   char full_path[1024];
   snprintf(full_path, sizeof(full_path), "game:\\CORE.xex");

   bool find_libretro_file = rarch_configure_libretro_core(full_path, "game:\\", "game:\\", 
   SYS_CONFIG_FILE, ".xex");

   set_default_settings();
   rarch_config_load(SYS_CONFIG_FILE, "game:\\", ".xex", find_libretro_file);
   init_libretro_sym();

   video_xdk360.start();
   input_xdk360.init();

   rarch_input_set_default_keybind_names_for_emulator();

   menu_init();

begin_loop:
   if(g_console.mode_switch == MODE_EMULATION)
   {
      bool repeat = false;

      input_xdk360.poll(NULL);

	  rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);

      do{
         repeat = rarch_main_iterate();
      }while(repeat && !g_console.frame_advance_enable);
   }
   else if(g_console.mode_switch == MODE_MENU)
   {
      menu_loop();
      rarch_startup(SYS_CONFIG_FILE);
   }
   else
      goto begin_shutdown;

   goto begin_loop;

begin_shutdown:
   if(path_file_exists(SYS_CONFIG_FILE))
      rarch_config_save(SYS_CONFIG_FILE);

   menu_free();
   video_xdk360.stop();
   input_xdk360.free(NULL);
   rarch_exec();

   return 0;
}
예제 #3
0
void collision_detect() // called from game_loop() in Run.cpp - check for basic collision detection
{
    if ( ( rPlayer.x == rExit.x ) && ( rPlayer.y == rExit.y ) ) // if the player coordinates meet the exit coordinates
    {
        play_fx("res/audio/finish.wav"); // play finish level sound effect
        running = false; // stop the game loop
        SDL_Delay(3000); // 3 seconds delay for the audio effect
        release_level(); // free the level resources
        menu_loop(); // reinitialize the menu
    }
    for ( int i = 0; i < 32; i++ )
        for ( int j = 0; j < 24; j++ )
            if ( ( rPlayer.x == rTiles[i][j].x ) && ( rPlayer.y == rTiles[i][j].y ) ) // check the tile to which the player's coordinates equal
            {
                if ( tiles[i][j] == 9 ) // if the current tile is a checkpoint
                {
                    // player will respawn at the checkpoint's coordinates
                    death_x = rTiles[i][j].x;
                    death_y = rTiles[i][j].y;
                }
                if ( tiles[i][j] == 14 ) // if the current tile is a jump pad
                {
                    play_fx("res/audio/jump_pad.wav");
                    for ( int i = 0; i < 8; i++ )
                    {
                        rPlayer.y -= 32; // jump high
                        for ( int i = 0; i < 32; i++ ) // unoptimized check for traps
                            for ( int j = 0; j < 24; j++ )
                                if ( ( rPlayer.x == rTiles[i][j].x ) && ( rPlayer.y == rTiles[i][j].y ) )
                                    if ( ( ( ( tiles[i][j] == 3 ) || ( tiles[i][j] == 4 ) ) || ( ( tiles[i][j] == 5 ) || ( tiles[i][j] == 6 ) ) ) || ( ( ( tiles[i][j] == 7 ) || ( tiles[i][j] == 8 ) ) || ( ( tiles[i][j] == 10 ) || ( tiles[i][j] == 11 ) ) ) || ( tiles[i][j] == 13 ) )
                                        goto trap; // bad jump
                    }
                }
                // if the tile is a trap(death situation):
                if ( ( ( ( tiles[i][j] == 3 ) || ( tiles[i][j] == 4 ) ) || ( ( tiles[i][j] == 5 ) || ( tiles[i][j] == 6 ) ) ) ||  ( ( ( tiles[i][j] == 7 ) || ( tiles[i][j] == 8 ) ) || ( ( tiles[i][j] == 10 ) || ( tiles[i][j] == 11 ) ) ) || ( tiles[i][j] == 13 ) )
trap: // bad goto
                    if ( !god_mode ) // if we are not in cheating/testing mode
                    {
                        ghost_fx(); // located below, shows a death effect texture
                        // move the player either at the beginning of the level, either at some checkpoint if reached already
                        rPlayer.x = death_x;
                        rPlayer.y = death_y;
                        // reset moving and jumping
                        jump = dir_left = dir_right = false;
                        jump = false;
                        jcounter = 0;
                        // shord delay for esthetic reasons
                        SDL_Delay(300);
                    }
            }
}
예제 #4
0
파일: main.c 프로젝트: DSJim/genesis4iphone
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
	emu_ReadConfig(0, 0);
	giz_init(hInstance, hPrevInstance);
	emu_Init();
	menu_init();

	engineState = PGS_Menu;

	for (;;)
	{
		switch (engineState)
		{
			case PGS_Menu:
				menu_loop();
				break;

			case PGS_ReloadRom:
				if (emu_ReloadRom())
					engineState = PGS_Running;
				else {
					lprintf("PGS_ReloadRom == 0\n");
					engineState = PGS_Menu;
				}
				break;

			case PGS_RestartRun:
				engineState = PGS_Running;

			case PGS_Running:
				emu_Loop();
				break;

			case PGS_Quit:
				goto endloop;

			default:
				lprintf("engine got into unknown state (%i), exitting\n", engineState);
				goto endloop;
		}
	}

	endloop:

	emu_Deinit();
	giz_deinit();

	return 0;
}
예제 #5
0
void c_loop() {
  switch(game_state) {
    case STATE_MENU:
      menu_loop();
      break;
    case STATE_GAME:
      game_loop();
      break;
    case STATE_HIGHSCORE:
      highscore_loop();
      break;
    case STATE_NEW_HIGHSCORE:
      new_highscore_loop();
      break;
  }
}
예제 #6
0
파일: sdl_env.c 프로젝트: Horsell/42
int				sdl_env(int **map)
{
	t_env	*e;

	if (map == NULL)
		return (0);
	e = init_env(map);
	menu_loop(e);
	while (1)
	{
		while (SDL_PollEvent(&e->event))
		{
			SDL_GetWindowSize(e->win_sdl, &e->w, &e->h);
			handle_event(e);
			draw(e);
		}
	}
	if (ft_free(e))
		return (1);
	else
		return (0);
}
예제 #7
0
파일: main.c 프로젝트: evktalo/lacewing
int main(void)
{
/* TODO
 cprintf("\n\rHello and welcome to Lacewing version 1.10!");
 cprintf("\n\rCopyright 2003 by Linley Henzell & Captain Pork.\n\r");
 cprintf("\n\rLacewing is free software published under the");
 cprintf("\n\rGeneral Public Licence. It can be modified and");
 cprintf("\n\rredistributed under certain conditions and comes");
 cprintf("\n\rwith no warranties of any kind.");
 cprintf("\n\rPlease read the LICENCE.TXT file for more information.\n\r");
 cprintf("\n\rPress Q to Quit, or any other key to continue...\n\r");

 char rkey;
*/
 int randcount; // doesn't matter if it's not initialised - better, actually
/*
 do
 {
   randcount ++;
 }
  while(kbhit() == 0);
  
 rkey = getch();
 if (rkey == 'q' || rkey == 'Q')
  return 0;
 if (rkey == 0)
  getch();
*/
 srandom(randcount);

 init_at_startup();

 menu_loop();
 
 return 0;

}
예제 #8
0
파일: main.c 프로젝트: mmodahl/RetroArch
int main(int argc, char *argv[])
{
#ifdef HW_RVL
   IOS_ReloadIOS(IOS_GetVersion());
   L2Enhance();
   gx_init_mem2();
#endif

   fatInitDefault();

#ifdef HAVE_LOGGER
   g_extern.verbose = true;
   logger_init();
   devoptab_list[STD_OUT] = &dotab_stdout;
   devoptab_list[STD_ERR] = &dotab_stdout;
   dotab_stdout.write_r = gx_logger_net;
#elif defined(HAVE_FILE_LOGGER)
   g_extern.verbose = true;
   log_fp = fopen("/retroarch-log.txt", "w");
   devoptab_list[STD_OUT] = &dotab_stdout;
   devoptab_list[STD_ERR] = &dotab_stdout;
   dotab_stdout.write_r = gx_logger_file;
#endif

#ifdef HW_RVL
   lwp_t gx_device_thread;
   gx_devices[GX_DEVICE_SD].interface = &__io_wiisd;
   gx_devices[GX_DEVICE_SD].name = "sd";
   gx_devices[GX_DEVICE_SD].mounted = fatMountSimple(gx_devices[GX_DEVICE_SD].name, gx_devices[GX_DEVICE_SD].interface);
   gx_devices[GX_DEVICE_USB].interface = &__io_usbstorage;
   gx_devices[GX_DEVICE_USB].name = "usb";
   gx_devices[GX_DEVICE_USB].mounted = fatMountSimple(gx_devices[GX_DEVICE_USB].name, gx_devices[GX_DEVICE_USB].interface);
   LWP_MutexInit(&gx_device_mutex, false);
   LWP_CreateThread(&gx_device_thread, gx_devthread, NULL, NULL, 0, 66);
#endif

   get_environment_settings();
   make_directories();
   config_set_defaults();
   input_gx.init();

   video_gx.start();
   driver.video = &video_gx;

   gx_video_t *gx = (gx_video_t*)driver.video_data;
   gx->menu_data = (uint32_t *) menu_framebuf;

   char tmp_path[PATH_MAX];
   const char *extension = default_paths.executable_extension;
   snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir);
   const char *path_prefix = tmp_path; 

   char full_path[1024];
   snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension);

   bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix, 
   default_paths.config_file, extension);

   rarch_settings_set_default(&input_gx);
   rarch_config_load(default_paths.config_file, path_prefix, extension, find_libretro_file);

   char core_name[64];
   rarch_console_name_from_id(core_name, sizeof(core_name));
   char input_path[1024];
   snprintf(input_path, sizeof(input_path), "%s/%s.cfg", default_paths.input_presets_dir, core_name);
   config_read_keybinds(input_path);

   init_libretro_sym();

   input_gx.post_init();

   menu_init();

   if (argc > 2 && argv[1] != NULL && argv[2] != NULL)
   {
      char rom[PATH_MAX];
      g_console.external_launcher_support = EXTERN_LAUNCHER_CHANNEL;
      snprintf(rom, sizeof(rom), "%s%s", argv[1], argv[2]);
      g_console.zip_extract_mode = ZIP_EXTRACT_TO_CURRENT_DIR_AND_LOAD_FIRST_FILE;
      rarch_console_load_game_wrap(rom, g_console.zip_extract_mode, S_DELAY_1);

      rgui_iterate(rgui, RGUI_ACTION_MESSAGE);
      gx->menu_render = true;
      rarch_render_cached_frame();
      gx->menu_render = false;

      rarch_startup(default_paths.config_file);
   }
   else
   {
      g_console.external_launcher_support = EXTERN_LAUNCHER_SALAMANDER;
   }

begin_loop:
   if(g_console.mode_switch == MODE_EMULATION)
   {
      bool repeat = false;

      input_gx.poll(NULL);

      video_set_aspect_ratio_func(g_console.aspect_ratio_index);

      audio_start_func();

      do{
         repeat = rarch_main_iterate();
      }while(repeat && !g_console.frame_advance_enable);

      audio_stop_func();
   }
   else if(g_console.mode_switch == MODE_MENU)
   {
      menu_loop();

      if (g_console.mode_switch != MODE_EXIT)
         rarch_startup(default_paths.config_file);
   }
   else
      goto begin_shutdown;
   goto begin_loop;

begin_shutdown:
   rarch_config_save(default_paths.config_file);
   config_save_keybinds(input_path);

   if(g_console.emulator_initialized)
      rarch_main_deinit();

   input_gx.free(NULL);

   video_gx.stop();
   menu_free();

#ifdef HAVE_LOGGER
   logger_shutdown();
#elif defined(HAVE_FILE_LOGGER)
   fclose(log_fp);
#endif

   if(g_console.return_to_launcher)
      rarch_console_exec(g_console.launch_app_on_exit);

   exit(0);
}
예제 #9
0
파일: difficulty.c 프로젝트: miton/taisei
int difficulty_menu_loop(MenuData *menu) {
	return menu_loop(menu, NULL, draw_difficulty_menu);	
}
예제 #10
0
int saverpy_menu_loop(MenuData *m) {
	return menu_loop(m, saverpy_menu_input, draw_saverpy_menu, NULL);
}
예제 #11
0
파일: main.c 프로젝트: libretro/picodrive
int main(int argc, char *argv[])
{
	g_argv = argv;

	plat_early_init();

	in_init();
	//in_probe();

	plat_target_init();
	plat_init();

	emu_prep_defconfig(); // depends on input
	emu_read_config(NULL, 0);

	emu_init();
	menu_init();

	engineState = PGS_Menu;

	if (argc > 1)
		parse_cmd_line(argc, argv);

	if (engineState == PGS_ReloadRom)
	{
		if (emu_reload_rom(rom_fname_reload)) {
			engineState = PGS_Running;
			if (load_state_slot >= 0) {
				state_slot = load_state_slot;
				emu_save_load_game(1, 0);
			}
		}
	}

	for (;;)
	{
		switch (engineState)
		{
			case PGS_Menu:
				menu_loop();
				break;

			case PGS_TrayMenu:
				menu_loop_tray();
				break;

			case PGS_ReloadRom:
				if (emu_reload_rom(rom_fname_reload))
					engineState = PGS_Running;
				else {
					printf("PGS_ReloadRom == 0\n");
					engineState = PGS_Menu;
				}
				break;

			case PGS_RestartRun:
				engineState = PGS_Running;
				/* vvv fallthrough */

			case PGS_Running:
				emu_loop();
				break;

			case PGS_Quit:
				goto endloop;

			default:
				printf("engine got into unknown state (%i), exitting\n", engineState);
				goto endloop;
		}
	}

	endloop:

	emu_finish();
	plat_finish();
	plat_target_finish();

	return 0;
}
예제 #12
0
파일: main.c 프로젝트: palfrey/RetroArch
int main(int argc, char *argv[])
{
    get_environment_settings();

    rarch_main_clear_state();
    config_set_defaults();

#ifdef _XBOX1
    configure_libretro("D:\\", ".xbe");
#else
    configure_libretro("game:\\", ".xex");
#endif

#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
    video_xdk_d3d.start();
#else
    video_null.start();
#endif
    input_xinput.init();

    rarch_input_set_default_keybind_names_for_emulator();

    menu_init();

begin_loop:
    if(g_console.mode_switch == MODE_EMULATION)
    {
        bool repeat = false;

        input_xinput.poll(NULL);

        rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);

        do {
            repeat = rarch_main_iterate();
        } while(repeat && !g_console.frame_advance_enable);
    }
    else if(g_console.mode_switch == MODE_MENU)
    {
        menu_loop();
        rarch_startup(SYS_CONFIG_FILE);
    }
    else
        goto begin_shutdown;

    goto begin_loop;

begin_shutdown:
    if(path_file_exists(SYS_CONFIG_FILE))
        rarch_config_save(SYS_CONFIG_FILE);

    menu_free();
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
    video_xdk_d3d.stop();
#else
    video_null.stop();
#endif
    input_xinput.free(NULL);
    rarch_exec();

    return 0;
}
예제 #13
0
파일: main.c 프로젝트: erichuang1994/fbbs
void start_client(void)
{
	extern char currmaildir[];

	initialize_mdb();
#ifndef ENABLE_SSH
	initialize_db();
#endif

	initialize_convert_env();
	system_init();

	if (setjmp(byebye)) {
		system_abort();
	}

	strlcpy(BoardName, BBSNAME, sizeof(BoardName));

	if (login_query() == -1) {
		terminal_flush();
		sleep(3);
		exit(1);
	}
#ifndef ENABLE_SSH
	screen_negotiate_size();
#endif // ENABLE_SSH
	screen_init(0);

	user_login();

	setmdir(currmaildir, currentuser.userid);
	RMSG = NA;
	screen_clear();
	editor_restore();
#ifdef TALK_LOG
	tlog_recover();
#endif

	if (strcmp(currentuser.userid, "guest")) {
		if (check_maxmail())
			pressanykey();
		screen_move(9, 0);
		screen_clrtobot();
		if (!DEFINE(DEF_NOLOGINSEND))
			if (session_visible())
				login_msg();
		screen_clear();
		set_numofsig();
	}

	active_board_init(false);
	fill_date();

	if (DEFINE(DEF_LOGFRIEND)
			&& session_count_online_followed(!HAS_PERM(PERM_SEECLOAK)) > 0)
		show_online_followings();

	menu_load("menu.img");
	while (1) {
		if (DEFINE(DEF_NORMALSCR))
			menu_loop("TOPMENU");
		else
			menu_loop("TOPMENU2");
		Goodbye();
	}
}
예제 #14
0
int main(int argc, char *argv[])
{
	char file[MAXPATHLEN] = "";
	char path[MAXPATHLEN];
	const char *cdfile = NULL;
	const char *loadst_f = NULL;
	int psxout = 0;
	int loadst = 0;
	int i;

	emu_core_preinit();

	// read command line options
	for (i = 1; i < argc; i++) {
		     if (!strcmp(argv[i], "-psxout")) psxout = 1;
		else if (!strcmp(argv[i], "-load")) loadst = atol(argv[++i]);
		else if (!strcmp(argv[i], "-cfg")) {
			if (i+1 >= argc) break;
			strncpy(cfgfile_basename, argv[++i], MAXPATHLEN-100);	/* TODO buffer overruns */
			SysPrintf("Using config file %s.\n", cfgfile_basename);
		}
		else if (!strcmp(argv[i], "-cdfile")) {
			char isofilename[MAXPATHLEN];

			if (i+1 >= argc) break;
			strncpy(isofilename, argv[++i], MAXPATHLEN);
			if (isofilename[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(isofilename) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, isofilename);
					strcpy(isofilename, path);
				} else
					isofilename[0] = 0;
			}

			cdfile = isofilename;
		}
		else if (!strcmp(argv[i], "-loadf")) {
			if (i+1 >= argc) break;
			loadst_f = argv[++i];
		}
		else if (!strcmp(argv[i], "-h") ||
			 !strcmp(argv[i], "-help") ||
			 !strcmp(argv[i], "--help")) {
			 printf("PCSX-ReARMed " REV "\n");
			 printf("%s\n", _(
							" pcsx [options] [file]\n"
							"\toptions:\n"
							"\t-cdfile FILE\tRuns a CD image file\n"
							"\t-cfg FILE\tLoads desired configuration file (default: ~/.pcsx/pcsx.cfg)\n"
							"\t-psxout\t\tEnable PSX output\n"
							"\t-load STATENUM\tLoads savestate STATENUM (1-5)\n"
							"\t-h -help\tDisplay this message\n"
							"\tfile\t\tLoads a PSX EXE file\n"));
			 return 0;
		} else {
			strncpy(file, argv[i], MAXPATHLEN);
			if (file[0] != '/') {
				getcwd(path, MAXPATHLEN);
				if (strlen(path) + strlen(file) + 1 < MAXPATHLEN) {
					strcat(path, "/");
					strcat(path, file);
					strcpy(file, path);
				} else
					file[0] = 0;
			}
		}
	}

	if (cdfile)
		set_cd_image(cdfile);

	// frontend stuff
	// init input but leave probing to platform code,
	// they add input drivers and may need to modify them after probe
	in_init();
	pl_init();
	plat_init();
	menu_init(); // loads config

	if (emu_core_init() != 0)
		return 1;

	if (psxout)
		Config.PsxOut = 1;

	if (LoadPlugins() == -1) {
		// FIXME: this recovery doesn't work, just delete bad config and bail out
		// SysMessage("could not load plugins, retrying with defaults\n");
		set_default_paths();
		snprintf(path, sizeof(path), "." PCSX_DOT_DIR "%s", cfgfile_basename);
		remove(path);
		SysMessage("Failed loading plugins!");
		return 1;
	}
	pcnt_hook_plugins();

	if (OpenPlugins() == -1) {
		return 1;
	}
	plugin_call_rearmed_cbs();

	CheckCdrom();
	SysReset();

	if (file[0] != '\0') {
		if (Load(file) != -1)
			ready_to_go = 1;
	} else {
		if (cdfile) {
			if (LoadCdrom() == -1) {
				ClosePlugins();
				SysPrintf(_("Could not load CD-ROM!\n"));
				return -1;
			}
			emu_on_new_cd(!loadst);
			ready_to_go = 1;
		}
	}

	if (loadst_f) {
		int ret = LoadState(loadst_f);
		SysPrintf("%s state file: %s\n",
			ret ? "failed to load" : "loaded", loadst_f);
		ready_to_go |= ret == 0;
	}

	if (ready_to_go) {
		menu_prepare_emu();

		// If a state has been specified, then load that
		if (loadst) {
			int ret = emu_load_state(loadst - 1);
			SysPrintf("%s state %d\n",
				ret ? "failed to load" : "loaded", loadst);
		}
	}
	else
		menu_loop();

	pl_start_watchdog();

	while (!g_emu_want_quit)
	{
		stop = 0;
		emu_action = SACTION_NONE;

		psxCpu->Execute();
		if (emu_action != SACTION_NONE)
			do_emu_action();
	}

	printf("Exit..\n");
	ClosePlugins();
	SysClose();
	menu_finish();
	plat_finish();

	return 0;
}
예제 #15
0
int ingame_menu_loop(MenuData *m) {
	return menu_loop(m, NULL, draw_ingame_menu, NULL);
}
예제 #16
0
파일: stageselect.c 프로젝트: miton/taisei
int stage_menu_loop(MenuData *m) {
	return menu_loop(m, NULL, draw_stage_menu);
}
예제 #17
0
void game_input() // called from game_loop() in Run.cpp - checks for user input
{
    // works the same way as in Menu.cpp
    SDL_Event game_kprs;
    while ( SDL_PollEvent(&game_kprs) )
    {
        switch ( game_kprs.type )
        {
        case SDL_KEYDOWN: // when we press down a button
        {
            switch ( game_kprs.key.keysym.sym ) // Note: jumping and moving are handled in the timer functions below
            {
            case SDLK_ESCAPE:
                running = false; // stops the game loop
                release_level(); // free the resources used in the level
                menu_loop(); // go back to menu - located in Menu.cpp
                break;
            case SDLK_UP:
            case SDLK_w:
            case SDLK_SPACE:
                jump = true; // allow for a jump
                play_jump(); // play audio effect
                break;
            case SDLK_LEFT:
            case SDLK_a:
                dir_left = true; // allow for a move on the left
                break;
            case SDLK_RIGHT:
            case SDLK_d:
                dir_right = true; // allow for a move on the right
                break;
            case SDLK_F6: // switch on and off cheating/testing mechanism
                if ( !god_mode )
                    god_mode = true;
                else
                    god_mode = false;
                break;
            default:
                break;
            }
            // case KEYDOWN break
            break;
        }
        case SDL_KEYUP: // when we release a key from down state
        {
            switch ( game_kprs.key.keysym.sym ) // Note: jumping and moving are handled in the timer functions below
            {
            case SDLK_UP:
            case SDLK_w:
            case SDLK_SPACE:
                jump = true; // continue jumping when pressing the jump keys
                break;
            // control the movement variables so the player does not automove:
            case SDLK_LEFT:
            case SDLK_a:
                dir_left = false;
                break;
            case SDLK_RIGHT:
            case SDLK_d:
                dir_right = false;
                break;
            default:
                break;
            }
            // case KEYUP break
            break;
        }
        case SDL_QUIT:
            running = false;
            break;
        default:
            break;
        }
    }
}
예제 #18
0
void do_emu_action(void)
{
	int ret;

	emu_action_old = emu_action;

	switch (emu_action) {
	case SACTION_LOAD_STATE:
		ret = emu_load_state(state_slot);
		snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "LOADED" : "FAIL!");
		break;
	case SACTION_SAVE_STATE:
		ret = emu_save_state(state_slot);
		snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "SAVED" : "FAIL!");
		break;
#ifndef NO_FRONTEND
	case SACTION_ENTER_MENU:
		toggle_fast_forward(1);
		menu_loop();
		return;
	case SACTION_NEXT_SSLOT:
		state_slot++;
		if (state_slot > 9)
			state_slot = 0;
		goto do_state_slot;
	case SACTION_PREV_SSLOT:
		state_slot--;
		if (state_slot < 0)
			state_slot = 9;
do_state_slot:
		snprintf(hud_msg, sizeof(hud_msg), "STATE SLOT %d [%s]", state_slot,
			emu_check_state(state_slot) == 0 ? "USED" : "FREE");
		hud_new_msg = 3;
		SysPrintf("* %s\n", hud_msg);
		break;
	case SACTION_TOGGLE_FSKIP:
		pl_rearmed_cbs.fskip_advice = 0;
		pl_rearmed_cbs.frameskip++;
		if (pl_rearmed_cbs.frameskip > 1)
			pl_rearmed_cbs.frameskip = -1;
		snprintf(hud_msg, sizeof(hud_msg), "FRAMESKIP: %s",
			pl_rearmed_cbs.frameskip == -1 ? "AUTO" :
			pl_rearmed_cbs.frameskip == 0 ? "OFF" : "1" );
		plugin_call_rearmed_cbs();
		break;
	case SACTION_SWITCH_DISPMODE:
		pl_switch_dispmode();
		plugin_call_rearmed_cbs();
		if (GPU_open != NULL && GPU_close != NULL) {
			GPU_close();
			GPU_open(&gpuDisp, "PCSX", NULL);
		}
		break;
	case SACTION_FAST_FORWARD:
		toggle_fast_forward(0);
		plugin_call_rearmed_cbs();
		break;
	case SACTION_TOGGLE_FPS:
		if ((g_opts & (OPT_SHOWFPS|OPT_SHOWCPU))
		    == (OPT_SHOWFPS|OPT_SHOWCPU))
			g_opts &= ~(OPT_SHOWFPS|OPT_SHOWCPU);
		else if (g_opts & OPT_SHOWFPS)
			g_opts |= OPT_SHOWCPU;
		else
			g_opts |= OPT_SHOWFPS;
		break;
	case SACTION_TOGGLE_FULLSCREEN:
		plat_target.vout_fullscreen = !plat_target.vout_fullscreen;
		if (GPU_open != NULL && GPU_close != NULL) {
			GPU_close();
			GPU_open(&gpuDisp, "PCSX", NULL);
		}
		break;
	case SACTION_SCREENSHOT:
		{
			char buf[MAXPATHLEN];
			void *scrbuf;
			int w, h, bpp;
			time_t t = time(NULL);
			struct tm *tb = localtime(&t);
			int ti = tb->tm_yday * 1000000 + tb->tm_hour * 10000 +
				tb->tm_min * 100 + tb->tm_sec;

			scrbuf = pl_prepare_screenshot(&w, &h, &bpp);
			get_gameid_filename(buf, sizeof(buf),
				"screenshots/%.32s-%.9s.%d.png", ti);
			ret = -1;
			if (scrbuf != 0 && bpp == 16)
				ret = writepng(buf, scrbuf, w, h);
			if (ret == 0)
				snprintf(hud_msg, sizeof(hud_msg), "SCREENSHOT TAKEN");
			break;
		}
	case SACTION_VOLUME_UP:
	case SACTION_VOLUME_DOWN:
		{
			static int volume;
			plat_target_step_volume(&volume,
				emu_action == SACTION_VOLUME_UP ? 1 : -1);
		}
		return;
	case SACTION_MINIMIZE:
		if (GPU_close != NULL)
			GPU_close();

		plat_minimize();

		if (GPU_open != NULL) {
			ret = GPU_open(&gpuDisp, "PCSX", NULL);
			if (ret)
				SysMessage("GPU_open returned %d", ret);
		}
		return;
#endif
	default:
		return;
	}

	hud_new_msg = 3;
}
예제 #19
0
파일: main.c 프로젝트: emukidid/swiss-gc
/****************************************************************************
* Main
****************************************************************************/
int main () 
{
	// Setup defaults (if no config is found)
	memset(&swissSettings, 0 , sizeof(SwissSettings));

	// Register all devices supported (order matters for boot devices)
	int i = 0;
	for(i = 0; i < MAX_DEVICES; i++)
		allDevices[i] = NULL;
	i = 0;
	allDevices[i++] = &__device_wkf;
	allDevices[i++] = &__device_wode;
	allDevices[i++] = &__device_sd_a;
	allDevices[i++] = &__device_sd_b;
	allDevices[i++] = &__device_card_a;
	allDevices[i++] = &__device_card_b;
	allDevices[i++] = &__device_dvd;
	allDevices[i++] = &__device_ide_a;
	allDevices[i++] = &__device_ide_b;
	allDevices[i++] = &__device_qoob;
	allDevices[i++] = &__device_smb;
	allDevices[i++] = &__device_sys;
	allDevices[i++] = &__device_usbgecko;
	allDevices[i++] = &__device_ftp;
	allDevices[i++] = &__device_fsp;
	allDevices[i++] = NULL;
	
	// Set current devices
	devices[DEVICE_CUR] = NULL;
	devices[DEVICE_DEST] = NULL;
	devices[DEVICE_TEMP] = NULL;
	devices[DEVICE_CONFIG] = NULL;
	devices[DEVICE_PATCHES] = NULL;
	
	Initialise();
	
	// Sane defaults
	refreshSRAM(&swissSettings);
	swissSettings.debugUSB = 0;
	swissSettings.gameVMode = 0;	// Auto video mode
	swissSettings.exiSpeed = 1;		// 32MHz
	swissSettings.uiVMode = 0; 		// Auto UI mode
	swissSettings.aveCompat = 1;
	swissSettings.enableFileManagement = 0;

	needsDeviceChange = 1;
	needsRefresh = 1;
	
	//debugging stuff
	if(swissSettings.debugUSB) {
		if(usb_isgeckoalive(1)) {
			usb_flush(1);
		}
		print_gecko("Arena Size: %iKb\r\n",(SYS_GetArena1Hi()-SYS_GetArena1Lo())/1024);
		print_gecko("DVD Drive Present? %s\r\n",swissSettings.hasDVDDrive?"Yes":"No");
		print_gecko("GIT Commit: %s\r\n", GITREVISION);
		print_gecko("GIT Revision: %s\r\n", GITVERSION);
	}
	
	// Go through all devices with FEAT_BOOT_DEVICE feature and set it as current if one is available
	for(i = 0; i < MAX_DEVICES; i++) {
		if(allDevices[i] != NULL && (allDevices[i]->features & FEAT_BOOT_DEVICE)) {
			print_gecko("Testing device %s\r\n", allDevices[i]->deviceName);
			if(allDevices[i]->test()) {
				deviceHandler_setDeviceAvailable(allDevices[i], true);
				devices[DEVICE_CUR] = allDevices[i];
				break;
			}
		}
	}
	if(devices[DEVICE_CUR] != NULL) {
		print_gecko("Detected %s\r\n", devices[DEVICE_CUR]->deviceName);
		if(devices[DEVICE_CUR]->init(devices[DEVICE_CUR]->initial)) {
			if(devices[DEVICE_CUR]->features & FEAT_AUTOLOAD_DOL) {
				load_auto_dol();
			}
			memcpy(&curFile, devices[DEVICE_CUR]->initial, sizeof(file_handle));
			needsDeviceChange = 0;
		}
	}

	// Scan here since some devices would already be initialised (faster)
	populateDeviceAvailability();

	// If there's no default config device, set it to the first writable device available
	if(swissSettings.configDeviceId == DEVICE_ID_UNK) {
		for(int i = 0; i < MAX_DEVICES; i++) {
			if(allDevices[i] != NULL && (allDevices[i]->features & FEAT_WRITE) && deviceHandler_getDeviceAvailable(allDevices[i])) {
				swissSettings.configDeviceId = allDevices[i]->deviceUniqueId;
				print_gecko("No default config device found, using [%s]\r\n", allDevices[i]->deviceName);
				syssramex* sramex = __SYS_LockSramEx();
				sramex->__padding0 = swissSettings.configDeviceId;
				__SYS_UnlockSramEx(1);
				while(!__SYS_SyncSram());
				break;
			}
		}
	}
	
	// Try to open up the config .ini in case it hasn't been opened already
	if(config_init()) {
		// TODO notification area this
		print_gecko("Loaded %i entries from the config file\r\n",config_get_count());
	}
	
	if(swissSettings.initNetworkAtStart) {
		// Start up the BBA if it exists
		uiDrawObj_t *msgBox = DrawPublish(DrawProgressBar(true, 0, "Initialising Network"));
		init_network();
		init_httpd_thread();
		DrawDispose(msgBox);
	}
	
	// DVD Motor off setting; Always stop the drive if we only started it to read the ID out
	if((swissSettings.stopMotor && swissSettings.hasDVDDrive) || (swissSettings.hasDVDDrive == 2)) {
		dvd_motor_off();
	}

	// Swiss video mode force
	GXRModeObj *forcedMode = getVideoModeFromSwissSetting(swissSettings.uiVMode);
	
	if((forcedMode != NULL) && (forcedMode != getVideoMode())) {
		setVideoMode(forcedMode);
	}

	while(1) {
		menu_loop();
	}
	return 0;
}
예제 #20
0
파일: main.c 프로젝트: freakdave/RetroArch
int main(int argc, char *argv[])
{
   rarch_main_clear_state();
   get_environment_settings();

   config_set_defaults();
   
   input_xinput.init();

#ifdef _XBOX1
   char path_prefix[256];
   snprintf(path_prefix, sizeof(path_prefix), "D:\\");
#else
   const char *path_prefix = default_paths.filesystem_root_dir;
#endif
   const char *extension = default_paths.executable_extension;
   const input_driver_t *input = &input_xinput;

   char full_path[1024];
   snprintf(full_path, sizeof(full_path), "%sCORE%s", path_prefix, extension);

   bool find_libretro_file = rarch_configure_libretro_core(full_path, path_prefix, path_prefix, 
   default_paths.config_file, extension);

   rarch_settings_set_default();
   rarch_input_set_controls_default(input);
   rarch_config_load(default_paths.config_file, find_libretro_file);
   init_libretro_sym();

   input_xinput.post_init();

#if defined(HAVE_D3D9) || defined(HAVE_D3D8)
   video_xdk_d3d.start();
   driver.video = &video_xdk_d3d;
#else
   video_null.start();
   driver.video = &video_null;
#endif

   system_init();

   menu_init();

begin_loop:
   if(g_extern.console.rmenu.mode == MODE_EMULATION)
   {
      bool repeat = false;

      input_xinput.poll(NULL);

      driver.video->set_aspect_ratio(driver.video_data, g_settings.video.aspect_ratio_idx);

      do{
         repeat = rarch_main_iterate();
      }while(repeat && !g_extern.console.screen.state.frame_advance.enable);
   }
   else if(g_extern.console.rmenu.mode == MODE_MENU)
   {
      menu_loop();

      if (g_extern.console.rmenu.mode != MODE_EXIT)
         rarch_startup(default_paths.config_file);
   }
   else
      goto begin_shutdown;

   goto begin_loop;

begin_shutdown:
   rarch_config_save(default_paths.config_file);

   menu_free();
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
   video_xdk_d3d.stop();
#else
   video_null.stop();
#endif
   input_xinput.free(NULL);

   if(g_extern.console.external_launch.enable)
      rarch_console_exec(g_extern.console.external_launch.launch_app);

   return 0;
}
예제 #21
0
파일: replayview.c 프로젝트: miton/taisei
int replayview_menu_loop(MenuData *m) {
	return menu_loop(m, replayview_menu_input, replayview_draw);
}
예제 #22
0
int main(int argc, char *argv[])
{
#ifdef HAVE_SYSUTILS
   RARCH_LOG("Registering system utility callback...\n");
   cellSysutilRegisterCallback(0, callback_sysutil_exit, NULL);
#endif

#ifdef HAVE_SYSMODULES
   cellSysmoduleLoadModule(CELL_SYSMODULE_IO);
   cellSysmoduleLoadModule(CELL_SYSMODULE_FS);
   cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_GAME);
   cellSysmoduleLoadModule(CELL_SYSMODULE_AVCONF_EXT);
   cellSysmoduleLoadModule(CELL_SYSMODULE_PNGDEC);
   cellSysmoduleLoadModule(CELL_SYSMODULE_JPGDEC);
   cellSysmoduleLoadModule(CELL_SYSMODULE_NET);
   cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_NP);
#endif

   sys_net_initialize_network();

#ifdef HAVE_LOGGER
   logger_init();
#endif

   sceNpInit(NP_POOL_SIZE, np_pool);

   rarch_main_clear_state();
   get_environment_settings(argc, argv);

   config_set_defaults();
   input_ps3.init();

   char tmp_path[PATH_MAX];
   snprintf(tmp_path, sizeof(tmp_path), "%s/", default_paths.core_dir);
   rarch_configure_libretro(&input_ps3, tmp_path, default_paths.executable_extension);

#if(CELL_SDK_VERSION > 0x340000)
   if (g_console.screenshots_enable)
   {
#ifdef HAVE_SYSMODULES
      cellSysmoduleLoadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
#endif
#ifdef HAVE_SYSUTILS
      CellScreenShotSetParam screenshot_param = {0, 0, 0, 0};

      screenshot_param.photo_title = "RetroArch PS3";
      screenshot_param.game_title = "RetroArch PS3";
      cellScreenShotSetParameter (&screenshot_param);
      cellScreenShotEnable();
#endif
   }
#ifdef HAVE_SYSUTILS
   if (g_console.custom_bgm_enable)
      cellSysutilEnableBgmPlayback();
#endif
#endif

   video_gl.start();


#ifdef HAVE_OSKUTIL
   oskutil_init(&g_console.oskutil_handle, 0);
#endif

   rarch_input_set_default_keybind_names_for_emulator();

   menu_init();

   switch(g_console.external_launcher_support)
   {
      case EXTERN_LAUNCHER_SALAMANDER:
         g_console.mode_switch = MODE_MENU;
	 break;
#ifdef HAVE_MULTIMAN
      case EXTERN_LAUNCHER_MULTIMAN:
	 RARCH_LOG("Started from multiMAN, will auto-start game.\n");
	 strlcpy(g_console.rom_path, argv[1], sizeof(g_console.rom_path));
         rarch_settings_change(S_START_RARCH);
	 rarch_startup(default_paths.config_file);
	 break;
#endif
      default:
         break;
   }

begin_loop:
   if(g_console.mode_switch == MODE_EMULATION)
   {
      bool repeat = false;

      input_ps3.poll(NULL);

      rarch_set_auto_viewport(g_extern.frame_cache.width, g_extern.frame_cache.height);

      do{
         repeat = rarch_main_iterate();
      }while(repeat && !g_console.frame_advance_enable);
   }
   else if(g_console.mode_switch == MODE_MENU)
   {
      menu_loop();
      rarch_startup(default_paths.config_file);
   }
   else
      goto begin_shutdown;

   goto begin_loop;

begin_shutdown:
   if(path_file_exists(default_paths.config_file))
      rarch_config_save(default_paths.config_file);

   if(g_console.emulator_initialized)
      rarch_main_deinit();

   input_ps3.free(NULL);
   video_gl.stop();
   menu_free();

#ifdef HAVE_OSKUTIL
   if(g_console.oskutil_handle.is_running)
      oskutil_unload(&g_console.oskutil_handle);
#endif

#ifdef HAVE_LOGGER
   logger_shutdown();
#endif

#ifdef HAVE_SYSMODULES
   if(g_console.screenshots_enable)
      cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_SCREENSHOT);
   cellSysmoduleUnloadModule(CELL_SYSMODULE_JPGDEC);
   cellSysmoduleUnloadModule(CELL_SYSMODULE_PNGDEC);
   cellSysmoduleUnloadModule(CELL_SYSMODULE_AVCONF_EXT);
   cellSysmoduleUnloadModule(CELL_SYSMODULE_SYSUTIL_GAME);
#endif

#ifdef HAVE_HDD_CACHE_PARTITION
   int ret = cellSysCacheClear();

   if(ret != CELL_SYSCACHE_RET_OK_CLEARED)
   {
      RARCH_ERR("System cache partition could not be cleared on exit.\n");
   }
#endif

   rarch_exec();

   return 1;
}
예제 #23
0
파일: help.c 프로젝트: mjmeehan/engine9
/*
 * show the manual pages
 */
void help (int showpage)
{
    int page = showpage, menuselect = 2, y = 0;
    char title[255];
    _menu *menu;

    menu_displaytext ("Please Wait", "Loading GFX Data");

    if (page < 0 || page >= HP_max)
        page = 0;

    while (menuselect != -1 && menuselect != 1 && bman.state != GS_quit) {
        if (page == HP_howto0) {
            sprintf (title, "How To Play (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);
            menu_create_text (menu, "help", 5, 55, 53, 20, COLOR_brown,
                              "The goal of the game is to be the last one, "
                              "who is alive. You can drop bombs which will explode after "
                              "a certain time and destroy everything in horizontal and vertical "
                              "direction. So you can remove stones or kill other players. But take care. "
                              "Don't kill yourself otherwise the game will be over for you. During the "
                              "game you will find diffrenent powerups to raise your skills. If you are "
                              "running faster than your opponent and you have many bombs, you can catch "
                              "him within lots of bombs and he has no chance to escape.");

            menu_create_image (menu, "img", 450, 255, 0, gfx.players[0].menu_image, NULL);

            menu_create_text (menu, "help", 5, 255, 45, 10, COLOR_brown,
                              "You will get points for every player you have killed. "
                              "If you win the game, you can earn additional points "
                              "depending on how many players played the game. ");
        } else if (page == HP_powerup0) {
            sprintf (title, "Powerups (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 50;

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "In the game you will find some diffend kind of powerups. "
                              "There are the powerups who give you more power for the whole game "
                              "and the special powerups which will hold only for a certain time.");
            y += 75;

            menu_create_label (menu, "Permanent Powerups", -1, y, 2, COLOR_yellow);
            y += (5 + font[2].size.y);

            menu_create_image (menu, "bomb", 5, y, 0, gfx.menu_field[FT_bomb], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "Give you another bomb to drop. Maximum number of bombs is %d.", MAX_BOMBS);
            y += 40;

            menu_create_image (menu, "fire", 5, y, 1, gfx.menu_field[FT_fire], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "The range of your bombs will be increased. Maximum range is %d.", MAX_RANGE);
            y += 40;

            menu_create_image (menu, "shoe", 5, y, 1, gfx.menu_field[FT_shoe], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "This will make your player run faster. The maximum speed will be %1.2f.", MAX_SPEED);
            y += 40;

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "Depends how the game is set up, you'll lose "
                              "these powerups if you die. Other players can collect them. "
                              "In the deathmatch mode you can keep the powerups you collected, "
                              "but this depends on the Game if you drop them or not.");
            y += 40;
        } else if (page == HP_powerup1) {
            sprintf (title, "Powerups (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 45;

            menu_create_label (menu, "Special Powerups", -1, y, 2, COLOR_yellow);
            y += (5 + font[2].size.y);

            menu_create_image (menu, "kick", 5, y, 1, gfx.menu_field[FT_sp_kick], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "Allowes you to kick some bombs around the level. This will hold "
                              "just a short time of %d seconds. The maximum distance you can "
                              "kick the bombs is %d fields.", SPECIAL_KICK_TIME, SPECIAL_KICK_MAXDIST);
            y += 70;

            menu_create_image (menu, "push", 5, y, 1, gfx.menu_field[FT_sp_push], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "Push bombs one field, as long as nothing is behind this bomb.");
            y += 40;

            menu_create_image (menu, "droprow", 5, y, 1, gfx.menu_field[FT_sp_row], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "You can drop a row of that many bombs you have still left to drop.");
            y += 40;

            menu_create_image (menu, "dropliquid", 5, y, 1, gfx.menu_field[FT_sp_liquid], NULL);
            menu_create_text (menu, "help", 55, y, 48, 10, COLOR_brown,
                              "The bomb you push now won't stop moving untill they explode.");
            y += 40;

            menu_create_image (menu, "dropliquid", 5, y, 1, gfx.menu_field[FT_sp_moved], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "The bomb you push will stop moving on the next border or bomb.");
            y += 40;

            menu_create_image (menu, "dropltrigger", 5, y, 1, gfx.menu_field[FT_sp_trigger], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "You will be able to drop triggered bombs. Use "
                              "the special key to let all your bombs explode. "
                              "at the time where you want it.");
            y += 40;
        } else if (page == HP_powerup2) {
            sprintf (title, "Powerups (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 45;

            menu_create_label (menu, "Death Item", -1, y, 2, COLOR_yellow);
            y += (5 + font[2].size.y);

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "In the game you will find another type of item to collect. "
                              "This item is not a powerup at all. If you collect it you will "
                              "get a random illness. This illness will hold for %dseconds. "
                              "If you have contact to another player the other player will "
                              "get all the illnesses you have too.", ILL_TIMEOUT);
            y += 110;

            menu_create_image (menu, "pwdeath", 12, y+8, 1, gfx.menu_field[FT_death], NULL);
            menu_create_text (menu, "help", 55, y, 45, 10, COLOR_brown,
                              "This will make your player ill. We have at the moment %d diffrent "
                              "types of illnesses for you to collect. To make the game more", PI_max);
            y += 3*font[0].size.y;
            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "interesting we won't put here a list of all types there are.");
        } else if (page == HP_keyboard0) {
            sprintf (title, "Keyboard (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            y = 50;

            menu_create_label (menu, "During a Game", -1, y, 2, COLOR_yellow);
            y += font[2].size.y;

            menu_create_image (menu, "img", 450, 100, 0, gfx.players[7].menu_image, NULL);

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "Arrow Keys - Moving of the Player\n"
                              "STRG/CTRL  - Dropping bombs\n"
                              "Shift      - Special Use Key\n"
                              "F4         - Start the Game (only Server)\n"
                              "F8         - Fullscreen (not in Windows)\n"
                              "Return     - Send Entered Text Message\n"
                              "ESC        - Exit Game\n");
            y += 7*font[0].size.y;

            menu_create_label (menu, "Player Selection", -1, y, 2, COLOR_yellow);
            y += font[2].size.y;

            menu_create_text (menu, "help", 5, y, 53, 10, COLOR_brown,
                              "Left/Right - Select and Deselect a Player\n"
                              "F1	        - Mini Help Screen\n"
                              "F2         - Player Screen\n"
                              "F3         - Map and Game Settings\n"
                              "F4         - Start the Game if at last 2 Players\n"
                              "             are selected. (only Server)\n"
                              "ESC        - Exit Game\n");
        } else if (page == HP_credit0) {
            sprintf (title, "About BomberClone (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            menu_create_image (menu, "img", 15, 60, 0, gfx.players[4].menu_image, NULL);
            menu_create_text (menu, "help", 75, 50, 45, 10, COLOR_brown,
                              "If you have any problems or questions with the game you can send your questions "
                              "to the mailinglist or directly to me. Bugfixes should be send to the SourceForge "
                              "Projects page about BomberClone.");

            menu_create_label (menu, "WWW",-1, 140, 2, COLOR_yellow);
            menu_create_text (menu, "help", -1, 165, 53, 10, COLOR_brown, "http://www.bomberclone.de");

            menu_create_label (menu, "EMail",-1, 185, 2, COLOR_yellow);
            menu_create_text (menu, "help", -1, 210, 53, 10, COLOR_brown, "*****@*****.**");

            menu_create_label (menu, "Project Page",-1, 230, 2, COLOR_yellow);
            menu_create_text (menu, "help", -1, 255, 53, 10, COLOR_brown, "http://sourceforge.net/projects/bomberclone");
        } else if (page == HP_credit1) {
            sprintf (title, "People (%d/%d)", page + 1, HP_max);
            menu = menu_new (title, 500, 400);

            menu_create_image (menu, "img", 250, 100, 0, gfx.players[6].menu_image, NULL);

            y = 50;
            menu_create_label (menu, "Coding:", 5, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", 50, y, 53, 10, COLOR_brown,
                              "  Steffen Pohle\n"
                              "Patrick Wilczek\n");

            y = 100;
            menu_create_label (menu, "GFX:", 425, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", 325, y, 53, 10, COLOR_brown,
                              "TekkRat\n"
                              "Martijn de Boer\n"
                              "Steffen Pohle\n"
                              "Patrick Wilczek\n");

            y = 140;
            menu_create_label (menu, "Sound/Music:", 5, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", 50, y, 53, 10, COLOR_brown,
                              "Henrik_Enqvist\n"
                              "Cerror\n"
                              "Martijn de Boer\n");

            y = 240;
            menu_create_label (menu, "Thanks To:", -1, y, 2, COLOR_yellow);
            y += font[2].size.y;
            menu_create_text (menu, "help", -1, y, 53, 10, COLOR_brown,
                              "kitutou(coding/fixing), thaphool(tilesets), ob1kenewb(coding/fixing), "
                              "TeKkraT(website,gfx), caccola(tilesets), Digital_D(music), "
                              "dcdillon(coding), Psycho(music),\nNiklas Sj\xf6sv\xe4rd(music)");

        } else break;

        if (page > 0) menu_create_button (menu, "Previous Page", 20, 370, 150, 0);
        else if (menuselect == 0)
            menuselect = 2;
        menu_create_button (menu, "Main Menu", -1, 370, 150, 1);
        if (page < HP_max-1) menu_create_button (menu, "Next Page", 350, 370, 150, 2);

        menu_focus_id (menu, menuselect);
        menuselect = menu_loop (menu);
        if (menuselect == 0 && page > 0)
            page--;
        if (menuselect == 2 && page < HP_max - 1)
            page++;
        menu_delete (menu);
    }
};
예제 #24
0
int main(int argc, char *argv[])
{
	g_argv = argv;

	emu_ReadConfig(0, 0);
	gp2x_init();
	if (currentConfig.EmuOpt&0x10) {
		int ret = mmuhack();
		printf("squidge hack code finished and returned %i\n", ret); fflush(stdout);
		mmuhack_status = ret;
	}
	cpuctrl_init();
	// Reset940(1);
	// Pause940(1);
	if (currentConfig.EmuOpt&0x100) {
		printf("setting RAM timings.. "); fflush(stdout);
		// craigix: --trc 6 --tras 4 --twr 1 --tmrd 1 --trfc 1 --trp 2 --trcd 2
		set_RAM_Timings(6, 4, 1, 1, 1, 2, 2);
		printf("done.\n"); fflush(stdout);
	}
	emu_Init();
	menu_init();

	engineState = PGS_Menu;

	if (argc > 1)
		parse_cmd_line(argc, argv);

	for (;;)
	{
		switch (engineState)
		{
			case PGS_Menu:
				menu_loop();
				break;

			case PGS_ReloadRom:
				if (emu_ReloadRom())
					engineState = PGS_Running;
				else {
					printf("PGS_ReloadRom == 0\n");
					engineState = PGS_Menu;
				}
				break;

			case PGS_RestartRun:
				engineState = PGS_Running;

			case PGS_Running:
				emu_Loop();
				break;

			case PGS_Quit:
				goto endloop;

			default:
				printf("engine got into unknown state (%i), exitting\n", engineState);
				goto endloop;
		}
	}

	endloop:

	emu_Deinit();
	cpuctrl_deinit();
	gp2x_deinit();
	if(mmuhack_status)
		mmuunhack();

	return 0;
}
예제 #25
0
파일: game.cpp 프로젝트: jokoon/eio
void game :: init(){
    pause_drawing=false;
    glines = VertexArray(Lines);
    conf.init("conf.cfg");
    cfg=&conf;
    fps_coeff = 1.f/cfg->getfloat("timestep");

    //srand((unsigned)time(0));
    window.setKeyRepeatEnabled(false);
    wincenter.x=window.getSize().x/2;
    wincenter.y=window.getSize().y/2;
    winsize.x=window.getSize().x;
    winsize.y=window.getSize().y;
    window.setFramerateLimit(fps_coeff);

    if(cfg->getint("stick_left"))
    {
        Vec2i screen_resolution;
        cfg->SET(screen_resolution);
#ifdef __APPLE__
        screen_resolution=Vec2i(1280,800);
#endif
        Vec2i windowpos(screen_resolution.x - winsize.x-10,25);
        cout << strfy(screen_resolution) << endl;
        cout << strfy(windowpos) << endl;
        window.setPosition(windowpos);
    }
    else
        window.setPosition(Vec2i(5,25));


    {
        Vec2 cons_view_size;
        cfg->SET(cons_view_size);
        console_view.setSize(Vec2(cons_view_size.x*wsize.x,cons_view_size.y*wsize.y));
        fixedview = window.getDefaultView();
        mainview=fixedview;
    }
    wsize = winsize;
    wcenter = wincenter;
    float window_coeff = conf.getfloat("window_coeff");
    if(window_coeff!=1.0)
    {
        Vec2u resized(winsize.x*window_coeff,winsize.y*window_coeff);
        window.setSize(resized);
    }
    bg = cfg->getcolor("background");
    string path="yes/";
#ifdef __APPLE__
    path = resourcePath()+path;
#endif
    if(!cursor_tx.loadFromFile(path+"cursor4.png")) cout << "did not load cursor" << endl;
    cursor.setTexture(cursor_tx);
    cursor.setOrigin(3,3);
    window.setMouseCursorVisible(false);

    confpoint(c1,3,Color::Green);
    confpoint(c2,3,Color::Red);

    // fonts and f*****g globals
    init_font();
    font1 = &ft;
    font2 = &ft2;
    charsize=chsz;
    charsize2=chsz2;

    // console
    console = new sfconsole;
    console->numlines=conf.getint("numlines");
    console->init();
    cons=console;
    draw_console = true;

    labs=new labels;
    labs->pos=Vec2(15,winsize.y-30);
    lbs=&(labs->strings);


    win=&window;

    add_symbol_to_lambdas();

    if(cfg->getint("use_menu"))
    {
        menu_loop();
    }
    else
    {
        init_gameobj();
        loop();
    }
}