示例#1
0
int main(int argc, char* argv[])
{
	cout<<"Fluid simulation"<<endl;

	// Defaults
	logging = true;
	sequential = false;
	render = true;
	deviceType = CL_DEVICE_TYPE_ALL;
	int targetFPS = 20;

	// Parse arguments
	for(int i = 0; i < argc; i++)
	{
		if(strcmp(argv[i], "-nolog") == 0)
			logging = false;
		else if(strcmp(argv[i], "-cpu") == 0)
			deviceType = CL_DEVICE_TYPE_CPU;
		else if(strcmp(argv[i], "-gpu") == 0)
			deviceType = CL_DEVICE_TYPE_GPU;
		else if(strcmp(argv[i], "-sequential") == 0)
			sequential = true;
		else if(strcmp(argv[i], "-fps") == 0)
			targetFPS = atoi(argv[i+1]);
		else if(strcmp(argv[i], "-norender") == 0)
			render = false;
	}

	//Start simulating!
	mainProgram.initialize(targetFPS);
	mainProgram.run();
}
示例#2
0
文件: GBS.cpp 项目: tambry/GBS
s32 main(s32 argc, char* argv[])
{
	std::string log_name = get_option(argv, argc, "-l");
	std::string rom = "../bin/Ca Da.gb"; // If a ROM isn't specified on command line, then execute the ROM specified here

	if (log_name == "-")
	{
		log_name = "../bin/GBS.log"; // If a log name isn't specified, use the default
	}

	if (argc >= 2)
	{
		rom = argv[1];
	}

	if (!init_logging(log_name))
	{
		log(ERROR, "Initialization of logging failed.");
		return exit(true);
	}

	Game game;

	if (!game.load(rom))
	{
		log(ERROR, "Failed to load the ROM.");
		return exit(true);
	}

	Main* core = nullptr;

	switch (game.game_type)
	{
	case GAMEBOY_COLOR:
	case GAMEBOY: core = new GBMain(game); break;
	default: log(ERROR, "Unsupported game type: %d", game.game_type); return exit(true);
	}

	if (!core->initialize())
	{
		log(ERROR, "Failed to initialize emulation core.");
		return exit(true);
	}

	core->run();
}
示例#3
0
int32 main(int32 argc, const ansichar* argv[]) {
	struct Guard {
		Guard(Main* app) : ref(app){}
		~Guard() {
			if (ref) ref->shutdown();
		}
		Main* ref;
	};

	Main* app = Main::Startup(argc, argv);
	Guard _(app); //shutdown on main leave
	if (!app->initialize()) {
		LOG_ERROR(General, "Initialization failed.");
		return 1;
	}
	return app->execute();
}