예제 #1
0
Move* Character::getMove(SDL_Renderer *renderer, string name, int sprite_amount)
{
    //Sprites load
    vector<Sprite*>sprites;
    string align_file_path = "assets/" + name + "/align.txt";
    ifstream align_file(align_file_path.c_str());
    for(int i=1;i<=sprite_amount;i++)
    {
        string path="assets/" + name + "/" + toString(i) + ".png";
        int align_x;
        int align_y;
        align_file>>align_x;
        align_file>>align_y;

        sprites.push_back(new Sprite(renderer,path,500,align_x,align_y));
    }

    //Cancel load
    string cancels_file_path = "assets/" + name + "/cancel.txt";
    ifstream cancels_file(cancels_file_path.c_str());
    vector<string>cancels;
    string cancel_temp;
    while(cancels_file>>cancel_temp)
    {
        cancels.push_back(cancel_temp);
    }

    return new Move(renderer,sprites,cancels);
}
예제 #2
0
파일: Character.cpp 프로젝트: Lictro/Tarea5
Move* Character::getMove(SDL_Renderer *renderer, string name, int sprite_amount)
{
    //Sprites load
    vector<Sprite*>sprites;
    string align_file_path = "assets/" + name + "/align.txt";
    ifstream align_file(align_file_path.c_str());
    for(int i=1;i<=sprite_amount;i++)
    {
        string path="assets/" + name + "/" + toString(i) + ".png";
        int align_x;
        int align_y;
        align_file>>align_x;
        align_file>>align_y;

        vector<Hitbox*>hitboxes;

        string hitbox_file_path = "assets/" + name + "/hitboxes/"+toString(i)+".txt";
        ifstream hitbox_file(hitbox_file_path.c_str());

        int x,y,w,h;
        while(hitbox_file>>x)
        {
            hitbox_file>>y;
            hitbox_file>>w;
            hitbox_file>>h;
            hitboxes.push_back(new Hitbox(x,y,w,h));
        }

        sprites.push_back(new Sprite(renderer,path,10,align_x,align_y,hitboxes));
    }

    //Cancel load
    string cancels_file_path = "assets/" + name + "/cancel.txt";
    ifstream cancels_file(cancels_file_path.c_str());
    vector<string>cancels;
    string cancel_temp;
    while(cancels_file>>cancel_temp)
    {
        cancels.push_back(cancel_temp);
    }

    string buttons_file_path = "assets/" + name + "/buttons.txt";
    ifstream buttons_file(buttons_file_path.c_str());
    vector<Button*>buttons;
    char button_temp;
    while(buttons_file>>button_temp)
    {
        buttons.push_back(new Button(button_temp));
    }

    return new Move(renderer,sprites,cancels,buttons);
}
예제 #3
0
void ExternalAligner::align_seqs_impl(Strings& seqs) const {
    std::string input = tmp_file();
    ASSERT_FALSE(input.empty());
    std::string output = tmp_file();
    ASSERT_FALSE(output.empty());
    {
        boost::shared_ptr<std::ostream> file = name_to_ostream(input);
        std::ostream& out = *file;
        for (int i = 0; i < seqs.size(); i++) {
            write_fasta(out, TO_S(i), "", seqs[i], 60);
        }
    }
    align_file(input, output);
    Strings rows;
    read_alignment(rows, output);
    ASSERT_EQ(rows.size(), seqs.size());
    seqs.swap(rows);
    if (!go("NPGE_DEBUG").as<bool>()) {
        remove_file(input);
        remove_file(output);
    }
}