78 lines
2.1 KiB

  1. /*
  2. * ttyvaders Textmode shoot'em up
  3. * Copyright (c) 2002 Sam Hocevar <sam@zoy.org>
  4. * All Rights Reserved
  5. *
  6. * $Id$
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. */
  22. #include "config.h"
  23. #include <stdlib.h>
  24. #include <math.h>
  25. #include <unistd.h>
  26. #include "common.h"
  27. void intro(void)
  28. {
  29. struct ee_sprite *foo_sprite = ee_load_sprite("data/foo_fighter");
  30. struct ee_sprite *bar_sprite = ee_load_sprite("data/bar_fighter");
  31. struct ee_sprite *baz_sprite = ee_load_sprite("data/baz_fighter");
  32. int frame = 0;
  33. while(ee_get_key() == 0)
  34. {
  35. int i, xo, yo, x[5], y[5];
  36. frame++;
  37. ee_clear();
  38. xo = ee_get_width() / 2;
  39. yo = ee_get_height() / 2;
  40. ee_set_color(EE_RED);
  41. ee_fill_ellipse(xo, yo, 16, 8, '#');
  42. ee_set_color(EE_GREEN);
  43. ee_draw_thin_ellipse(xo, yo, 16, 8);
  44. for(i = 0; i < 4; i ++)
  45. {
  46. x[i] = xo + 0.5 + 12 * cos(0.05 * frame + i * M_PI / 2);
  47. y[i] = yo + 0.5 + 6 * sin(0.05 * frame + i * M_PI / 2);
  48. }
  49. x[4] = x[0];
  50. y[4] = y[0];
  51. ee_set_color(EE_BLACK);
  52. ee_fill_triangle(x[0], y[0], x[1], y[1], x[2], y[2], '#');
  53. ee_fill_triangle(x[0], y[0], x[3], y[3], x[2], y[2], '#');
  54. ee_draw_line(x[0], y[0], x[2], y[2], '#');
  55. ee_set_color(EE_GREEN);
  56. ee_draw_thin_polyline(x, y, 4);
  57. ee_draw_sprite(xo, yo, foo_sprite, frame % 5);
  58. ee_refresh();
  59. usleep(40000);
  60. }
  61. }