コード例 #1
0
ファイル: loop.c プロジェクト: tmerlier/2048
static int		exec_key(t_env *env, int key)
{
	int			ret_move;
	int			ret_end;

	if (key == 27)
		return (1);
	else if (key == KEY_UP || key == KEY_LEFT
			|| key == KEY_RIGHT || key == KEY_DOWN)
	{
		ret_move = move_plate(env, key);
		if (ret_move != -1)
		{
			env->score += ret_move;
			pop_new(env->plate, env->size);
		}
		ret_end = check_end(env);
		if (ret_end == -1)
			return (1);
	}
	else if (key == 'u' && env->undo-- > 0)
		dup_plate(env->plate, env->last_plate, env->size);
	else if (key == KEY_F(1))
		save_plate(env);
	else if (env->ascii.ascii_on && key >= '1' && key <= MAX_ASCII + '0')
		load_ascii(env, key - '0');
	return (0);
}
コード例 #2
0
ファイル: load.hpp プロジェクト: fengwang/larbed-refinement
 bool load( const char* const file_name )
 {
     /*
      * TODO:
      * 1) trim right of file name
      * 2) if file name with '.mat' extension
      *        call load_mat
      * 3) else
      *        call load_ascii
      */
     return load_ascii( file_name );
 }
コード例 #3
0
ファイル: io.c プロジェクト: jpcoles/cello
int load_timestep()
{
    switch (env.cfg.input_filetype)
    {
        case TIPSY_STANDARD:
            load_standard_tipsy(env.cfg.base_input_filename);
            break;
        case TIPSY_NATIVE:
            load_native_tipsy(env.cfg.base_input_filename);
            break;
        case ASCII:
            load_ascii(env.cfg.base_input_filename);
            break;
        case MEM_FILE:
            load_memfile(env.cfg.base_input_filename);
            break;
        default:
            myassert(0, "Tried to load file, but the filetype is wrong.");
            break;
    }

    return 0;
}
コード例 #4
0
ファイル: init.c プロジェクト: tmerlier/2048
void				main_init(t_env *env, int *argc, char ***argv)
{
	int					i;

	env->tsize = NULL;
	env->score = 0;
	env->undo = 0;
	env->ascii.ascii_on = 0;
	env->win = 0;
	env->load = 0;
	i = -1;
	while (++i < MAX_SCORE)
	{
		env->scoreboard[i].player = NULL;
		env->scoreboard[i].score = 0;
	}
	init_opt(env, argc, argv);
	load_ascii(env, 2);
	init_ncurses(env);
	init_game(env);
	signal(SIGINT, handle_sigint);
	signal(SIGQUIT, handle_sigint);
}
コード例 #5
0
ファイル: base.C プロジェクト: SALAM2016/orbiter
void base::load_file(char *fname)
// read in ASCII text format (uuencoded like) from the file.
{
	ifstream f(fname);
	load_ascii(f);
}