alps.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #ifndef ALPS_H_INCLUDED
  2. #define ALPS_H_INCLUDED
  3. #include "eruta.h"
  4. #include "camera.h"
  5. struct AlpsDrop_ {
  6. Point position;
  7. Point velocity;
  8. double life;
  9. };
  10. typedef struct AlpsDrop_ AlpsDrop;
  11. typedef struct AlpsShower_ AlpsShower;
  12. typedef struct AlpsParticle_ AlpsParticle;
  13. typedef struct Alps_ Alps;
  14. #define ALPS_SHOWER_DROPS 2000
  15. struct AlpsShower_ {
  16. int intensity;
  17. float abberation;
  18. Point velocity;
  19. AlpsDrop drops[ALPS_SHOWER_DROPS];
  20. /* A reference to the camera is needed because effects are generated
  21. * "in view" only.
  22. */
  23. Camera * camera;
  24. };
  25. struct AlpsParticle_ {
  26. Point position;
  27. Point velocity;
  28. Point acceleration;
  29. int type;
  30. double life;
  31. double abberation;
  32. ALLEGRO_COLOR color;
  33. ALLEGRO_BITMAP * bitmap;
  34. };
  35. void alpsshower_init
  36. (AlpsShower * rain, Camera * camera, int intensity, float abberation, Point velocity);
  37. void alpsshower_draw(AlpsShower * rain, Camera * camera);
  38. void alpsshower_update(AlpsShower * rain, double dt);
  39. /* Allegro Lighting and Particle system. Cosmetic effects.
  40. * Detail of planned effects per category:
  41. * 1) Precipitation (shower) :
  42. * - Rain
  43. * - Snow
  44. * - Hail
  45. * - Flower Petals
  46. * - Leaves
  47. * => Draw a line/circle for rain, snow, hail, or use a single
  48. * repeated bitmap for leaves or petals, or arbitrary rain-like effects.
  49. * => Motion: rain + hail fast, others slower, speed, wind effect and
  50. * "billowing" are needed.
  51. * 2) Sun Light Effects
  52. * - Sun beams
  53. * - Komorebi
  54. * => statical effects
  55. * 3) Night effects / filters
  56. * - "American night" filter / color filter
  57. * => likewise static effect.
  58. * => 1 to 3: whole screen / camera view effect
  59. *
  60. * 4) True particle effects (only now we get there)
  61. * - Explosions
  62. * - Foaming water
  63. * => effect near an emmitter / SpriteState
  64. **/
  65. struct Alps_ {
  66. struct AlpsShower_ shower;
  67. };
  68. void alps_init(Alps * self, Camera * camera);
  69. void alps_done(Alps * self);
  70. void alps_update(Alps * self, double dt);
  71. void alps_draw(Alps * self);
  72. void alps_start_shower(Alps * self);
  73. void alps_stop_shower(Alps * self);
  74. #endif