Beispiel #1
0
int
main (int argc, char *argv[])
{
  global_option_type global_option;	//!< Application global options

  global_option.server_port = DEFAULT_SERVER_PORT;
  global_option.number_player = MAX_NUMBER_PLAYER;
  global_option.type_server = LAN_PROTOCOL_TYPE;

#if defined(DEBUG)
  fprintf (stderr, "DEBUG mode is ON\n");
#endif

  if (read_arguments (argc, argv, &global_option) != 0)
    {
      fprintf (stderr, "Error reading arguments\n");
      return 2;
    }

  if (SDL_Init (0) == -1)
    {
      fprintf (stderr, "SDL_Init: %s\n", SDL_GetError ());
      return 1;
    }

  if (init_network () != 0)
    {
      fprintf (stderr, "Error initializing network\n");
      return 1;
    }

#if defined(GTK)

	if (argc == 1)
	{
		// No option given starts the GUI
		build_gtk_interface(argc, argv);
		return;
	}

#endif
  
  serve_dispatch (&global_option);

  shutdown_network ();

  SDL_Quit();

  return 0;
  
}
Beispiel #2
0
int
main (int argc, char *argv[])
{
  int error;
  error = 0;

  error = initialisation (argc, argv);



#if defined(GTK)

  if (!error)
    {
      if (game_asked ())
	{
	  while (play_game ());
	}
      else
	{
	  build_gtk_interface (argc, argv);
	}
    }

#else // not defined(GTK)

  RomSelectStart();

  if (!error)
    {
    if (game_asked ())
	{
	  while (1)
	  {
		fprintf(stderr,"EMU START:\n");
		play_game();
	    fprintf(stderr,"EMU END:\n");
	  }
	}
      else
	{
	  printf ("No game specified\n");
	}
    }
#endif
  fprintf(stderr,"HuGo says bye!\n");

  cleanup ();

  return 0;
}