示例#1
0
static int setup(void * owner)
{
	int i,j;
	char cbuf[200];
	for (i=0;i<MAXTEAMS;i++){
		for (j=0;j<MAXPLAYERINTEAMS;j++){

			sprintf(cbuf,"planes/plane-%d-%d.png", i,j);
			CRITICAL(right_anim[i][j] = animation_load(path_to_data(cbuf),64,1,100));
			animation_make_loop(right_anim[i][j]);
			right_anim[i][j]->trigger = frame_trigger;

		}
	}

	for (j=0;j<MAXPLAYERINTEAMS;j++){
		sprintf(cbuf,"planes/plane-%d-wreck.png", j);
		CRITICAL(crashing[j] = animation_load(path_to_data(cbuf),64,1,180));
		animation_make_loop(crashing[j]);
		crashing[j]->trigger = crashing_trigger;
	}

	//NYANCAT

	sprintf(cbuf,"planes/nyan-cat.png");
	CRITICAL(right_anim[MAXTEAMS][0] = animation_load(path_to_data(cbuf),64,1,100));
	sprintf(cbuf,"planes/nyan-cat.png");
	CRITICAL(crashing[MAXPLAYERINTEAMS] = animation_load(path_to_data(cbuf),64,1,180));

	animation_make_loop(right_anim[MAXTEAMS][0]);
	animation_make_loop(crashing[MAXPLAYERINTEAMS]);
	right_anim[MAXTEAMS][0]->trigger = frame_trigger;
	crashing[MAXPLAYERINTEAMS]->trigger = crashing_trigger;



	engine_strength = cfgnum("blueplane.engine_strength",5);
	turn_amount = cfgnum("blueplane.turn_amount",0.02);
	bomb_delay = cfgnum("blueplane.bomb_delay",1000);
	bullet_delay = cfgnum("blueplane.bullet_delay",140);
	hitpoints = cfgnum("blueplane.hitpoints",15);
	mass = cfgnum("blueplane.mass",1);
	air_isotropic = cfgnum("blueplane.air_isotropic",0.00005);
	air_turnrate = cfgnum("blueplane.air_turnrate",0.00005);
	air_normal = cfgnum("blueplane.air_normal",0.001);
	nr_bombs = cfgnum("blueplane.nr_bombs",5);
	crash_point = cfgnum("blueplane.crash_point",20);
	return 0;

}
示例#2
0
static int setup()
{
    assert(anim = animation_load(path_to_data("mark.png"),
                                 1,16,40));
    animation_last_frame(anim)->trigger = frame_trigger;
    return 0;
}
示例#3
0
Identifier::Identifier(
    const proto::ContactItemType type,
    const proto::HDPath& path)
    : ot_super()
{
    CalculateDigest(path_to_data(type, path), DefaultType);
}
示例#4
0
static int setup()
{
  CRITICAL(grow = animation_load(path_to_data("whitesmoke.png"),
				 1,32,100));
  animation_set_alpha(grow,128);
  //animation_set_alpha(dissolve,128);
  // animation_last_frame(grow)->next_frame = dissolve;
  animation_last_frame(grow)->trigger = frame_trigger;
  return 0;
}
示例#5
0
static int general_setup(void)
{
	int i;

	maths_setup();
	config_setup();

	screen_w = cfgnum("screen.width", 800);
	screen_h = cfgnum("screen.height", 600);
	if (cfgnum("fullscreen", 0) == 1)
		displayflags |= SDL_FULLSCREEN;

	sprite_global.opt_alpha = cfgnum("alpha", 0);

	i = SDL_Init(SDL_INITFLAGS);
	assert(i == 0);

	atexit(atexit_cleanup);

	SDL_WM_SetCaption(VERSIONSTRING, 0);

	sprite_global.display = SDL_SetVideoMode(screen_w, screen_h, 0, displayflags);
	assert(sprite_global.display);
	SDL_ShowCursor(SDL_DISABLE);

	if (cfgnum("sound", 0) == 1)
	{
		sound_setup();
		/* place the ear on the ground, in the center */
		sound_move_ear(screen_w / 2, screen_h);
	}
	sprite_setup();
	text_setup();
	console_setup();
	console_set_pos(9, 254);
	console_load_bg(path_to_data("console-bg.png"));
	sprite_types_setup();

	char bg1[255];
	char bg2[255];
	sprintf(bg1,"data/bg%d.png",screen_w);
	sprintf(bg2,"data/bgmask%d.png",screen_w);

	sprite_background_load(bg1, bg2);

	level_setup();
	winds_setup();

	return 0;
}
示例#6
0
static int setup()
{
	/*assert(anim = animation_load(path_to_data("gauge.png"),
			16,1,4000000));*/
	char cbuf[200];
	int i;

	for (i=0;i<MAXTEAMS;i++){
		sprintf(cbuf,"planes/plane-%d-0.png", i);
		CRITICAL(anim[i] = animation_load(path_to_data(cbuf),64,1,100));
	}


	return 0;
}
示例#7
0
void about_mode(char *filename)
{
	FILE *message = fopen(path_to_data(filename), "r");
	char cbuf[2001];
	size_t n;

	if (message)
	{
		n = fread(cbuf, 1, 2000, message);
		cbuf[n] = 0;
		fclose(message);
	}
	else
	{
		sprintf(cbuf, "Error: could not open '%s'.", filename);
	}
	message_mode(cbuf);
}
示例#8
0
int main(int argc, char *argv[]) {

    // Initialize options to default values
    double* step_size = new double;
    TrainingOptions training_options = initDefaultTrainingOptions(step_size);
    BenchmarkOptions benchmark_options = initDefaultBenchmarkOptions();
    std::string path_to_data("data");

    // Parse arguments to adjust options
    parse_command_line_args(argc, argv, &training_options, &benchmark_options, &path_to_data);

    printf("in main error goal is %f\n",benchmark_options.error_goal);
    printf("in main run number is %d\n",benchmark_options.num_runs);
    printf("in main step size is %f \n",*training_options.step_size);

    // Model variables
    FeatureType* data_points = new FeatureType[DATA_SET_SIZE]; // Data points
    LabelType* labels = new LabelType[NUM_SAMPLES]; // Labels
    FeatureType* parameter_vector = new FeatureType[PARAMETER_SIZE]; // Model parameters


    //build train file path
    std::string str_train_points_filepath(path_to_data + 
    						std::string("/train-images-idx3-ubyte"));
    const char* train_points_filepath = str_train_points_filepath.c_str();
    std::string str_train_labels_filepath(path_to_data + 
    						std::string("/train-labels-idx1-ubyte"));
    const char* train_labels_filepath = str_train_labels_filepath.c_str();
    //build test file path
    std::string str_test_points_filepath(path_to_data + 
    						std::string("/t10k-images-idx3-ubyte"));
    const char* test_points_filepath = str_test_points_filepath.c_str();
    std::string str_test_labels_filepath(path_to_data + 
    						std::string("/t10k-labels-idx1-ubyte"));
    const char* test_labels_filepath = str_test_labels_filepath.c_str();


    // Read train data from files and insert into variables
    if( readImageData (TRAIN_SET_SIZE, train_points_filepath, 
    								data_points) != TRAIN_SET_SIZE) 
                                        return EXIT_FAILURE;
    if( readImageLables(NUM_TRAINING, train_labels_filepath, 
    								labels) != NUM_TRAINING)   
                                        return EXIT_FAILURE;
    //Read test data from files and insert behind
    if(readImageData(TEST_SET_SIZE, test_points_filepath,
				&data_points[TRAIN_SET_SIZE])!= TEST_SET_SIZE)  
                                        return EXIT_FAILURE;
    if(readImageLables(NUM_TESTING, test_labels_filepath,
						 &labels[NUM_TRAINING])!= NUM_TESTING)    
                                        return EXIT_FAILURE;
    
    cout<<"read mnist data success"<<endl;

    // Initialize data set and options structs
    DataSet data_set;
    data_set.data_points = data_points;
    data_set.labels = labels;
    data_set.parameter_vector = parameter_vector;
    data_set.num_data_points = NUM_SAMPLES;
    data_set.num_features = NUM_FEATURES;

    // Initial shuffle of the data set to mix spam with ham
    // shuffleKeyValue(data_points, labels, NUM_SAMPLES, NUM_FEATURES);



   //  runConvergenceRate(data_set, training_options, benchmark_options);
   // runTrainAndTest(data_set, training_options, benchmark_options);
      runConvergenceTime(data_set, training_options, benchmark_options);


    // Free memory and exit
    delete   step_size;
    delete[] data_points;
    delete[] labels;
    delete[] parameter_vector;

    return 0;
}
示例#9
0
static int setup()
{
  assert(anim = animation_load(path_to_data("missile.png"),
				     64,1,1000000));
  return 0;
}