Advertisement
Guest User

kaoD

a guest
Apr 18th, 2008
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.27 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <windows.h>
  3.  
  4. #define DEBUG 1
  5.  
  6. #define FIN_ANIMACION 0
  7.  
  8. #define FPS 100 // Si no fuera TAN cutre dibujando (O mas bien borrando) Windows, la tasa de frames seria real
  9.  
  10. char CIRC0[] = " _";
  11. char CIRC1[] = " _\n  \\";
  12. char CIRC2[] = " _\n  \\\n  |";
  13. char CIRC3[] = " _\n  \\\n  |\n  /";
  14. char CIRC4[] = " _\n  \\\n  |\n _/";
  15. char CIRC5[] = " _\n  \\\n  |\n\\_/";
  16. char CIRC6[] = " _\n  \\\n| |\n\\_/";
  17. char CIRC7[] = " _\n/ \\\n| |\n\\_/";
  18. char CIRC8[] = "\n/ \\\n| |\n\\_/";
  19. char CIRC9[] = "\n/\n| |\n\\_/";
  20. char CIRC10[] = "\n/\n|\n\\_/";
  21. char CIRC11[] = "\n/\n|\n\\_";
  22. char CIRC12[] = "\n/\n|\n\\";
  23. char CIRC13[] = "\n/\n|";
  24. char CIRC14[] = "\n/";
  25.  
  26. char *CIRCULO[] = {CIRC0, CIRC1, CIRC2, CIRC3, CIRC4, CIRC5, CIRC6, CIRC7,
  27.                    CIRC8, CIRC9, CIRC10, CIRC11, CIRC12, CIRC13, CIRC14, FIN_ANIMACION};
  28.  
  29. void dibujar_anim(char *animacion[], int repeticiones)
  30. {
  31.  int i;
  32.  int frame = 0;
  33.  
  34.  for (i=0; i<repeticiones; i++)
  35.  {
  36.   while (animacion[frame] != FIN_ANIMACION)
  37.   {
  38.    system ("cls");
  39.  
  40.    if (DEBUG)
  41.     printf ("Frame %d (x%d)\n", frame, i);
  42.  
  43.    printf (animacion[frame]);
  44.    Sleep (1000/FPS);
  45.    frame++;
  46.   }
  47.  
  48.   frame = 0;
  49.  }
  50.  
  51.  return;
  52. }
  53.  
  54. int main (void)
  55. {
  56.  
  57.  dibujar_anim(CIRCULO, 10);
  58.  
  59.  return 0;
  60. }
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement