Guest User

Untitled

a guest
May 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.72 KB | None | 0 0
  1.  
  2. #include <allegro.h>
  3. #include <time.h>
  4.  
  5. int main()
  6. {
  7. int longueur;
  8.  
  9.     set_uformat(U_ASCII);
  10.     allegro_init();
  11.     install_keyboard();
  12.     srand(time(NULL));
  13.  
  14.     set_color_depth(32);
  15.    
  16.     if (set_gfx_mode(GFX_AUTODETECT_WINDOWED,640,480,0,0)!=0){
  17.             allegro_message(allegro_error);
  18.             allegro_exit();
  19.             return 1;
  20.     }
  21.    
  22.        textout_ex(screen,font,"textout affiche une chaîne non formatée,",30,30,6,-1);
  23.        textout_centre_ex(screen,font,"textout_centre :",SCREEN_W/2,60,7,6);
  24.        textout_centre_ex(screen,font,"é, è, ê, Ê, î, à, ù.. il y a des accents",SCREEN_W/2,90,7,-1);
  25.        textout_right_ex(screen,font,"Textout_right :",SCREEN_W,120,8,-1);
  26.        textout_right_ex(screen,font,"La chaîne est collée à droite",SCREEN_W,150,8,-1);
  27.        textout_justify_ex(screen,font,"la chaîne est justifiée entre deux bords",
  28.        50,SCREEN_W-50,180,268,9,-1);
  29.    
  30.     longueur=text_length(font, "la chaîne est justifiée entre deux bords");
  31.    
  32.        textprintf_ex(screen, font, 30, 260, 10,5,
  33.        "textprintf : la chaîne du dessus mesure %d pixels", longueur);
  34.        textprintf_centre_ex(screen, font, SCREEN_W/2, 280, 11, -1,
  35.        "textprintf_centre : écran = %d par %d",SCREEN_W,SCREEN_H);
  36.        textprintf_right_ex(screen, font, SCREEN_W, 300, 12, -1, "text_printf_right :"\
  37.        " trois nombres tirés au hasard %d, %d, %d", rand(),rand(),rand());
  38.        textprintf_justify_ex(screen, font, 50, SCREEN_W-50, 350, 300, 13,-1,
  39.        "textprintf_justify : il fait beau... ");              
  40.    
  41.     readkey();  // fonction équivalente à getch() de conio.c ou dans cette utilisation à scanf de                    // stdio.h
  42.      
  43.        exit(EXIT_SUCCESS);
  44. }
  45. END_OF_MAIN();
Add Comment
Please, Sign In to add comment