void Param::lire_Texte(std::ifstream &fichier, sf::String &destination, sf::Font &myFont) { std::string ligne; int x, y, z; lire_string(fichier, ligne); destination.SetText(traduire(ligne.c_str())); lire_position(fichier, x, y); destination.SetPosition(x, y); lire_string(fichier, ligne); if(ligne != "default" && !myFont.LoadFromFile(ligne)) { std::cerr << "Erreur lors du chargement de la police '" << ligne << "'" << std::endl; myFont = sf::Font::GetDefaultFont(); } else if(ligne == "default") myFont = sf::Font::GetDefaultFont(); lire_int(fichier, x); destination.SetSize(x); lire_string(fichier, ligne); set_police(destination, ligne.c_str()); lire_couleur(fichier, x, y, z); destination.SetColor(sf::Color(x, y, z)); lire_int(fichier, x); destination.SetRotation(x); }
int main(int argc, char **argv) { int meshversion, keyword, dim; char *source_name; FILE *input_handle; if(argc == 2) source_name = *argv[2]; else { puts("Source filename missing."); exit(1); } /* Open a mesh file for reading */ if(!(input_handle = ouvrir_mesh(source_name, "r", &meshversion))) { puts("Cannot open source file."); exit(1); } if(meshversion < 1) { puts("Bad mesh version."); exit(1); } /* Create a patran bulk file */ if(!(output_handle = fopen(strcat(source_name, ".dat"), "w"))) { puts("Cannot create destination file."); exit(1); } /*---------------------------------------------------*/ /* scan for keywords and sizes for memory allocation */ /*---------------------------------------------------*/ do { keyword = mot_clef_suivant(input_handle); switch(keyword) { case MeshDimension : { dim = lire_int(input_handle); if(dim != 3) { puts("Not a 3 dimensions mesh."); exit(1); } }break; case Vertices : { nb = lire_int(input_handle); for(i=1;i<=nb;i++) { x = lire_reel(input_handle); y = lire_reel(input_handle); z = lire_reel(input_handle); ref = lire_int(input_handle); fprintf(output_handle, "GRID* %25d",i, x,y,z } }break; } }while(keyword != End); }