supertux
custom_particle_system.hpp
1 // SuperTux
2 // Copyright (C) 2020 A. Semphris <semphris@protonmail.com>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef HEADER_SUPERTUX_OBJECT_CUSTOM_PARTICLE_SYSTEM_HPP
18 #define HEADER_SUPERTUX_OBJECT_CUSTOM_PARTICLE_SYSTEM_HPP
19 
20 #include "object/particlesystem_interactive.hpp"
21 
22 #include "math/easing.hpp"
23 #include "math/vector.hpp"
24 #include "object/particle_zone.hpp"
25 #include "video/surface.hpp"
26 #include "video/surface_ptr.hpp"
27 
35 {
36  friend class ParticleEditor;
37 
38 public:
39  static void register_class(ssq::VM& vm);
40 
41 public:
43  CustomParticleSystem(const ReaderMapping& reader);
44  ~CustomParticleSystem() override;
45 
46  virtual void draw(DrawingContext& context) override;
47 
48  void reinit_textures();
49  virtual void update(float dt_sec) override;
50 
51  static std::string class_name() { return "particles-custom"; }
52  virtual std::string get_class_name() const override { return class_name(); }
53  virtual std::string get_exposed_class_name() const override { return "CustomParticleSystem"; }
54  static std::string display_name() { return _("Custom Particles"); }
55  virtual std::string get_display_name() const override { return display_name(); }
57  virtual void save(Writer& writer) override;
58  virtual ObjectSettings get_settings() override;
59 
60  virtual const std::string get_icon_path() const override {
61  return "images/engine/editor/particle.png";
62  }
63 
64  //void fade_amount(int new_amount, float fade_time);
65 
66 protected:
67  virtual int collision(Particle* particle, const Vector& movement) override;
68  CollisionHit get_collision(Particle* particle, const Vector& movement);
69 
70 private:
71  struct ease_request
72  {
73  float* value;
74  float begin;
75  float end;
76  float time_total;
77  float time_remain;
78  easing func;
79  };
80 
81  // Local
82  void add_particle(float lifetime, float x, float y);
83  void spawn_particles(float lifetime);
84 
85  std::vector<ParticleZone::ZoneDetails> get_zones() const;
86 
87  float get_abs_x() const;
88  float get_abs_y() const;
89 
90  float texture_sum_odds;
91  float time_last_remaining;
92 
93 public:
94  // Scripting
95  void ease_value(float* value, float target, float time, easing func);
96 
101  void clear();
102 
109  void spawn_particles(int amount, bool instantly);
110 
115  int get_max_amount() const;
121  void set_max_amount(int amount);
122 
127  std::string get_birth_mode() const;
132  void set_birth_mode(const std::string& mode);
133 
138  std::string get_death_mode() const;
143  void set_death_mode(const std::string& mode);
144 
149  std::string get_rotation_mode() const;
154  void set_rotation_mode(const std::string& mode);
155 
160  std::string get_collision_mode() const;
165  void set_collision_mode(const std::string& mode);
166 
171  std::string get_offscreen_mode() const;
176  void set_offscreen_mode(const std::string& mode);
177 
182  bool get_cover_screen() const;
188  void set_cover_screen(bool cover);
189 
194  float get_delay() const;
200  void set_delay(float delay);
206  void fade_delay(float delay, float time);
213  void ease_delay(float delay, float time, const std::string& easing);
214 
219  float get_lifetime() const;
225  void set_lifetime(float lifetime);
231  void fade_lifetime(float lifetime, float time);
238  void ease_lifetime(float lifetime, float time, const std::string& easing);
239 
244  float get_lifetime_variation() const;
250  void set_lifetime_variation(float lifetime_variation);
256  void fade_lifetime_variation(float lifetime_variation, float time);
263  void ease_lifetime_variation(float lifetime_variation, float time, const std::string& easing);
264 
269  float get_birth_time() const;
275  void set_birth_time(float birth_time);
281  void fade_birth_time(float birth_time, float time);
288  void ease_birth_time(float birth_time, float time, const std::string& easing);
289 
294  float get_birth_time_variation() const;
300  void set_birth_time_variation(float birth_time_variation);
306  void fade_birth_time_variation(float birth_time_variation, float time);
313  void ease_birth_time_variation(float birth_time_variation, float time, const std::string& easing);
314 
319  float get_death_time() const;
325  void set_death_time(float death_time);
331  void fade_death_time(float death_time, float time);
338  void ease_death_time(float death_time, float time, const std::string& easing);
339 
344  float get_death_time_variation() const;
350  void set_death_time_variation(float death_time_variation);
356  void fade_death_time_variation(float death_time_variation, float time);
363  void ease_death_time_variation(float death_time_variation, float time, const std::string& easing);
364 
369  float get_speed_x() const;
375  void set_speed_x(float speed_x);
381  void fade_speed_x(float speed_x, float time);
388  void ease_speed_x(float speed_x, float time, const std::string& easing);
389 
394  float get_speed_y() const;
400  void set_speed_y(float speed_y);
406  void fade_speed_y(float speed_y, float time);
413  void ease_speed_y(float speed_y, float time, const std::string& easing);
414 
419  float get_speed_variation_x() const;
425  void set_speed_variation_x(float speed_variation_x);
431  void fade_speed_variation_x(float speed_variation_x, float time);
438  void ease_speed_variation_x(float speed_variation_x, float time, const std::string& easing);
439 
444  float get_speed_variation_y() const;
450  void set_speed_variation_y(float speed_variation_y);
456  void fade_speed_variation_y(float speed_variation_y, float time);
463  void ease_speed_variation_y(float speed_variation_y, float time, const std::string& easing);
464 
469  float get_acceleration_x() const;
475  void set_acceleration_x(float acceleration_x);
481  void fade_acceleration_x(float acceleration_x, float time);
488  void ease_acceleration_x(float acceleration_x, float time, const std::string& easing);
489 
494  float get_acceleration_y() const;
500  void set_acceleration_y(float acceleration_y);
506  void fade_acceleration_y(float acceleration_y, float time);
513  void ease_acceleration_y(float acceleration_y, float time, const std::string& easing);
514 
519  float get_friction_x() const;
525  void set_friction_x(float friction_x);
531  void fade_friction_x(float friction_x, float time);
538  void ease_friction_x(float friction_x, float time, const std::string& easing);
539 
544  float get_friction_y() const;
550  void set_friction_y(float friction_y);
556  void fade_friction_y(float friction_y, float time);
563  void ease_friction_y(float friction_y, float time, const std::string& easing);
564 
569  float get_feather_factor() const;
575  void set_feather_factor(float feather_factor);
581  void fade_feather_factor(float feather_factor, float time);
588  void ease_feather_factor(float feather_factor, float time, const std::string& easing);
589 
594  float get_rotation() const;
600  void set_rotation(float rotation);
606  void fade_rotation(float rotation, float time);
613  void ease_rotation(float rotation, float time, const std::string& easing);
614 
619  float get_rotation_variation() const;
625  void set_rotation_variation(float rotation_variation);
631  void fade_rotation_variation(float rotation_variation, float time);
638  void ease_rotation_variation(float rotation_variation, float time, const std::string& easing);
639 
644  float get_rotation_speed() const;
650  void set_rotation_speed(float rotation_speed);
656  void fade_rotation_speed(float rotation_speed, float time);
663  void ease_rotation_speed(float rotation_speed, float time, const std::string& easing);
664 
669  float get_rotation_speed_variation() const;
675  void set_rotation_speed_variation(float rotation_speed_variation);
681  void fade_rotation_speed_variation(float rotation_speed_variation, float time);
688  void ease_rotation_speed_variation(float rotation_speed_variation, float time, const std::string& easing);
689 
694  float get_rotation_acceleration() const;
700  void set_rotation_acceleration(float rotation_acceleration);
706  void fade_rotation_acceleration(float rotation_acceleration, float time);
713  void ease_rotation_acceleration(float rotation_acceleration, float time, const std::string& easing);
714 
719  float get_rotation_decceleration() const;
725  void set_rotation_decceleration(float rotation_decceleration);
731  void fade_rotation_decceleration(float rotation_decceleration, float time);
738  void ease_rotation_decceleration(float rotation_decceleration, float time, const std::string& easing);
739 
740 private:
741  std::vector<ease_request> script_easings;
742 
743  enum class RotationMode {
744  Fixed,
745  Facing,
746  Wiggling
747  };
748 
749  enum class FadeMode {
750  None,
751  Fade,
752  Shrink
753  };
754 
755  enum class CollisionMode {
756  Ignore,
757  Stick,
758  StickForever,
759  BounceHeavy,
760  BounceLight,
761  Destroy,
762  FadeOut
763  };
764 
765  enum class OffscreenMode {
766  Never,
767  OnlyOnExit,
768  Always
769  };
770 
771  class SpriteProperties final
772  {
773  public:
774  float likeliness;
775  Color color;
776  SurfacePtr texture;
777  Vector scale;
778  Vector hb_scale;
779  Vector hb_offset;
780 
781  SpriteProperties() :
782  likeliness(1.f),
783  color(1.f, 1.f, 1.f, 1.f),
784  texture(Surface::from_file("images/engine/editor/particle.png")),
785  scale(1.f, 1.f),
786  hb_scale(1.f, 1.f),
787  hb_offset(0.f, 0.f)
788  {
789  }
790 
791  SpriteProperties(const SurfacePtr& surface) :
792  likeliness(1.f),
793  color(1.f, 1.f, 1.f, 1.f),
794  texture(surface),
795  scale(1.f, 1.f),
796  hb_scale(1.f, 1.f),
797  hb_offset(0.f, 0.f)
798  {
799  }
800 
801  SpriteProperties(const SpriteProperties& sp, float alpha) :
802  likeliness(sp.likeliness),
803  color(sp.color.red, sp.color.green, sp.color.blue, sp.color.alpha * alpha),
804  texture(sp.texture),
805  scale(sp.scale),
806  hb_scale(sp.hb_scale),
807  hb_offset(sp.hb_offset)
808  {
809  }
810 
811  inline bool operator==(const SpriteProperties& sp)
812  {
813  return this->likeliness == sp.likeliness
814  && this->color == sp.color
815  && this->texture == sp.texture
816  && this->scale == sp.scale
817  && this->hb_scale == sp.hb_scale
818  && this->hb_offset == sp.hb_offset;
819  }
820  inline bool operator!=(const SpriteProperties& sp)
821  {
822  return !operator==(sp);
823  }
824  };
825 
826  SpriteProperties get_random_texture() const;
827 
828  class CustomParticle : public Particle
829  {
830  public:
831  SpriteProperties original_props, props;
832  float lifetime, birth_time, death_time,
833  total_birth, total_death;
834  FadeMode birth_mode, death_mode;
835  EasingMode birth_easing, death_easing;
836  bool ready_for_deletion;
837  float speedX, speedY,
838  accX, accY,
839  frictionX, frictionY;
840  float feather_factor;
841  float angle_speed, angle_acc,
842  angle_decc;
843  RotationMode angle_mode;
844  CollisionMode collision_mode;
845  OffscreenMode offscreen_mode;
846  bool has_been_on_screen;
847  bool has_been_in_life_zone;
848  bool last_life_zone_required_instakill;
849  bool stuck;
850 
851  CustomParticle() :
852  original_props(),
853  props(),
854  lifetime(),
855  birth_time(),
856  death_time(),
857  total_birth(),
858  total_death(),
859  birth_mode(),
860  death_mode(),
861  birth_easing(),
862  death_easing(),
863  ready_for_deletion(false),
864  speedX(),
865  speedY(),
866  accX(),
867  accY(),
868  frictionX(),
869  frictionY(),
870  feather_factor(),
871  angle_speed(),
872  angle_acc(),
873  angle_decc(),
874  angle_mode(),
875  collision_mode(),
876  offscreen_mode(),
877  has_been_on_screen(),
878  has_been_in_life_zone(false),
879  last_life_zone_required_instakill(false),
880  stuck(false)
881  {}
882  };
883 
884  std::vector<SpriteProperties> m_textures;
885  std::vector<std::unique_ptr<CustomParticle> > custom_particles;
886 
887  std::string m_particle_main_texture;
888 
892  int m_max_amount;
896  float m_delay;
900  float m_particle_lifetime;
904  float m_particle_lifetime_variation;
908  float m_particle_birth_time;
912  float m_particle_birth_time_variation;
916  float m_particle_death_time;
920  float m_particle_death_time_variation;
921 
922  FadeMode m_particle_birth_mode,
923  m_particle_death_mode;
924  EasingMode m_particle_birth_easing,
925  m_particle_death_easing;
926 
930  float m_particle_speed_x;
934  float m_particle_speed_y;
938  float m_particle_speed_variation_x;
942  float m_particle_speed_variation_y;
946  float m_particle_acceleration_x;
950  float m_particle_acceleration_y;
954  float m_particle_friction_x;
958  float m_particle_friction_y;
962  float m_particle_feather_factor;
966  float m_particle_rotation;
970  float m_particle_rotation_variation;
974  float m_particle_rotation_speed;
978  float m_particle_rotation_speed_variation;
982  float m_particle_rotation_acceleration;
986  float m_particle_rotation_decceleration;
987 
988  RotationMode m_particle_rotation_mode;
989  CollisionMode m_particle_collision_mode;
990  OffscreenMode m_particle_offscreen_mode;
991 
995  bool m_cover_screen;
996 
997 public:
998  // TODO: Put all those member variables in some (abstract?) class of which
999  // both CustomParticlesSystem and ParticleProbs will inherit (so that
1000  // I don't have to write all the variables 4 times just in the header)
1001 
1002  // For the particle editor
1003  class ParticleProps final
1004  {
1005  public:
1006  std::vector<SpriteProperties> m_textures;
1007  std::string m_particle_main_texture;
1008  int m_max_amount;
1009  float m_delay;
1010  float m_particle_lifetime;
1011  float m_particle_lifetime_variation;
1012  float m_particle_birth_time,
1013  m_particle_birth_time_variation,
1014  m_particle_death_time,
1015  m_particle_death_time_variation;
1016  FadeMode m_particle_birth_mode,
1017  m_particle_death_mode;
1018  EasingMode m_particle_birth_easing,
1019  m_particle_death_easing;
1020  float m_particle_speed_x,
1021  m_particle_speed_y,
1022  m_particle_speed_variation_x,
1023  m_particle_speed_variation_y,
1024  m_particle_acceleration_x,
1025  m_particle_acceleration_y,
1026  m_particle_friction_x,
1027  m_particle_friction_y;
1028  float m_particle_feather_factor;
1029  float m_particle_rotation,
1030  m_particle_rotation_variation,
1031  m_particle_rotation_speed,
1032  m_particle_rotation_speed_variation,
1033  m_particle_rotation_acceleration,
1034  m_particle_rotation_decceleration;
1035  RotationMode m_particle_rotation_mode;
1036  CollisionMode m_particle_collision_mode;
1037  OffscreenMode m_particle_offscreen_mode;
1038  bool m_cover_screen;
1039 
1040  ParticleProps() :
1041  m_textures(),
1042  m_particle_main_texture(),
1043  m_max_amount(25),
1044  m_delay(0.1f),
1045  m_particle_lifetime(5.f),
1046  m_particle_lifetime_variation(0.f),
1047  m_particle_birth_time(0.f),
1048  m_particle_birth_time_variation(0.f),
1049  m_particle_death_time(0.f),
1050  m_particle_death_time_variation(0.f),
1051  m_particle_birth_mode(),
1052  m_particle_death_mode(),
1053  m_particle_birth_easing(),
1054  m_particle_death_easing(),
1055  m_particle_speed_x(0.f),
1056  m_particle_speed_y(0.f),
1057  m_particle_speed_variation_x(0.f),
1058  m_particle_speed_variation_y(0.f),
1059  m_particle_acceleration_x(0.f),
1060  m_particle_acceleration_y(0.f),
1061  m_particle_friction_x(0.f),
1062  m_particle_friction_y(0.f),
1063  m_particle_feather_factor(0.f),
1064  m_particle_rotation(0.f),
1065  m_particle_rotation_variation(0.f),
1066  m_particle_rotation_speed(0.f),
1067  m_particle_rotation_speed_variation(0.f),
1068  m_particle_rotation_acceleration(0.f),
1069  m_particle_rotation_decceleration(0.f),
1070  m_particle_rotation_mode(),
1071  m_particle_collision_mode(),
1072  m_particle_offscreen_mode(),
1073  m_cover_screen(true)
1074  {
1075  }
1076  };
1077 
1078  std::unique_ptr<ParticleProps> get_props() const
1079  {
1080  std::unique_ptr<ParticleProps> props = std::make_unique<ParticleProps>();
1081 
1082  for (auto& texture : m_textures)
1083  props->m_textures.push_back(texture);
1084  props->m_particle_main_texture = m_particle_main_texture;
1085  props->m_max_amount = m_max_amount;
1086  props->m_delay = m_delay;
1087  props->m_particle_lifetime = m_particle_lifetime;
1088  props->m_particle_lifetime_variation = m_particle_lifetime_variation;
1089  props->m_particle_birth_time = m_particle_birth_time;
1090  props->m_particle_birth_time_variation = m_particle_birth_time_variation;
1091  props->m_particle_death_time = m_particle_death_time;
1092  props->m_particle_death_time_variation = m_particle_death_time_variation;
1093  props->m_particle_birth_mode = m_particle_birth_mode;
1094  props->m_particle_death_mode = m_particle_death_mode;
1095  props->m_particle_birth_easing = m_particle_birth_easing;
1096  props->m_particle_death_easing = m_particle_death_easing;
1097  props->m_particle_speed_x = m_particle_speed_x;
1098  props->m_particle_speed_y = m_particle_speed_y;
1099  props->m_particle_speed_variation_x = m_particle_speed_variation_x;
1100  props->m_particle_speed_variation_y = m_particle_speed_variation_y;
1101  props->m_particle_acceleration_x = m_particle_acceleration_x;
1102  props->m_particle_acceleration_y = m_particle_acceleration_y;
1103  props->m_particle_friction_x = m_particle_friction_x;
1104  props->m_particle_friction_y = m_particle_friction_y;
1105  props->m_particle_feather_factor = m_particle_feather_factor;
1106  props->m_particle_rotation = m_particle_rotation;
1107  props->m_particle_rotation_variation = m_particle_rotation_variation;
1108  props->m_particle_rotation_speed = m_particle_rotation_speed;
1109  props->m_particle_rotation_speed_variation = m_particle_rotation_speed_variation;
1110  props->m_particle_rotation_acceleration = m_particle_rotation_acceleration;
1111  props->m_particle_rotation_decceleration = m_particle_rotation_decceleration;
1112  props->m_particle_rotation_mode = m_particle_rotation_mode;
1113  props->m_particle_collision_mode = m_particle_collision_mode;
1114  props->m_particle_offscreen_mode = m_particle_offscreen_mode;
1115  props->m_cover_screen = m_cover_screen;
1116 
1117  return props;
1118  }
1119 
1120  void set_props(ParticleProps* props)
1121  {
1122  m_textures.clear();
1123  for (auto& texture : props->m_textures)
1124  m_textures.push_back(texture);
1125  m_particle_main_texture = props->m_particle_main_texture;
1126  m_max_amount = props->m_max_amount;
1127  m_delay = props->m_delay;
1128  m_particle_lifetime = props->m_particle_lifetime;
1129  m_particle_lifetime_variation = props->m_particle_lifetime_variation;
1130  m_particle_birth_time = props->m_particle_birth_time;
1131  m_particle_birth_time_variation = props->m_particle_birth_time_variation;
1132  m_particle_death_time = props->m_particle_death_time;
1133  m_particle_death_time_variation = props->m_particle_death_time_variation;
1134  m_particle_birth_mode = props->m_particle_birth_mode;
1135  m_particle_death_mode = props->m_particle_death_mode;
1136  m_particle_birth_easing = props->m_particle_birth_easing;
1137  m_particle_death_easing = props->m_particle_death_easing;
1138  m_particle_speed_x = props->m_particle_speed_x;
1139  m_particle_speed_y = props->m_particle_speed_y;
1140  m_particle_speed_variation_x = props->m_particle_speed_variation_x;
1141  m_particle_speed_variation_y = props->m_particle_speed_variation_y;
1142  m_particle_acceleration_x = props->m_particle_acceleration_x;
1143  m_particle_acceleration_y = props->m_particle_acceleration_y;
1144  m_particle_friction_x = props->m_particle_friction_x;
1145  m_particle_friction_y = props->m_particle_friction_y;
1146  m_particle_feather_factor = props->m_particle_feather_factor;
1147  m_particle_rotation = props->m_particle_rotation;
1148  m_particle_rotation_variation = props->m_particle_rotation_variation;
1149  m_particle_rotation_speed = props->m_particle_rotation_speed;
1150  m_particle_rotation_speed_variation = props->m_particle_rotation_speed_variation;
1151  m_particle_rotation_acceleration = props->m_particle_rotation_acceleration;
1152  m_particle_rotation_decceleration = props->m_particle_rotation_decceleration;
1153  m_particle_rotation_mode = props->m_particle_rotation_mode;
1154  m_particle_collision_mode = props->m_particle_collision_mode;
1155  m_particle_offscreen_mode = props->m_particle_offscreen_mode;
1156  m_cover_screen = props->m_cover_screen;
1157  }
1158 
1159 
1160 private:
1161  CustomParticleSystem(const CustomParticleSystem&) = delete;
1162  CustomParticleSystem& operator=(const CustomParticleSystem&) = delete;
1163 };
1164 
1165 #endif
1166 
1167 /* EOF */
float get_rotation_acceleration() const
Definition: custom_particle_system.cpp:2014
void ease_acceleration_y(float acceleration_y, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1808
Definition: particle_editor.hpp:38
float get_feather_factor() const
Definition: custom_particle_system.cpp:1874
void set_birth_mode(const std::string &mode)
Definition: custom_particle_system.cpp:1308
Definition: custom_particle_system.hpp:1003
void fade_speed_variation_x(float speed_variation_x, float time)
Definition: custom_particle_system.cpp:1718
void ease_rotation(float rotation, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1920
float get_rotation_variation() const
Definition: custom_particle_system.cpp:1930
void ease_speed_variation_y(float speed_variation_y, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1752
This is an alternative class for particle systems.
Definition: particlesystem_interactive.hpp:39
void fade_lifetime(float lifetime, float time)
Definition: custom_particle_system.cpp:1493
float get_acceleration_y() const
Definition: custom_particle_system.cpp:1790
void fade_delay(float delay, float time)
Definition: custom_particle_system.cpp:1465
void set_rotation_speed_variation(float rotation_speed_variation)
Definition: custom_particle_system.cpp:1992
void set_rotation_variation(float rotation_variation)
Definition: custom_particle_system.cpp:1936
void ease_rotation_speed_variation(float rotation_speed_variation, float time, const std::string &easing)
Definition: custom_particle_system.cpp:2004
float get_speed_x() const
Definition: custom_particle_system.cpp:1650
void set_speed_y(float speed_y)
Definition: custom_particle_system.cpp:1684
void fade_death_time(float death_time, float time)
Definition: custom_particle_system.cpp:1605
float get_birth_time() const
Definition: custom_particle_system.cpp:1537
float get_delay() const
Definition: custom_particle_system.cpp:1453
float get_birth_time_variation() const
Definition: custom_particle_system.cpp:1565
void fade_rotation_variation(float rotation_variation, float time)
Definition: custom_particle_system.cpp:1942
void set_max_amount(int amount)
Definition: custom_particle_system.cpp:1274
void fade_acceleration_y(float acceleration_y, float time)
Definition: custom_particle_system.cpp:1802
virtual void update(float dt_sec) override
This function is called once per frame and allows the object to update it&#39;s state.
Definition: custom_particle_system.cpp:537
void fade_friction_y(float friction_y, float time)
Definition: custom_particle_system.cpp:1858
void set_speed_variation_y(float speed_variation_y)
Definition: custom_particle_system.cpp:1740
void fade_lifetime_variation(float lifetime_variation, float time)
Definition: custom_particle_system.cpp:1521
float get_speed_variation_x() const
Definition: custom_particle_system.cpp:1706
float get_rotation_speed_variation() const
Definition: custom_particle_system.cpp:1986
float get_speed_y() const
Definition: custom_particle_system.cpp:1678
Definition: particlesystem.hpp:86
float get_rotation_speed() const
Definition: custom_particle_system.cpp:1958
void set_offscreen_mode(const std::string &mode)
Definition: custom_particle_system.cpp:1436
float get_death_time_variation() const
Definition: custom_particle_system.cpp:1622
void fade_birth_time_variation(float birth_time_variation, float time)
Definition: custom_particle_system.cpp:1577
std::string get_offscreen_mode() const
Returns "Never", "OnlyOnExit", "Always".
Definition: custom_particle_system.cpp:1420
void set_speed_variation_x(float speed_variation_x)
Definition: custom_particle_system.cpp:1712
std::string get_death_mode() const
Returns "None", "Fade", "Shrink".
Definition: custom_particle_system.cpp:1321
void ease_rotation_decceleration(float rotation_decceleration, float time, const std::string &easing)
Definition: custom_particle_system.cpp:2060
Definition: object_settings.hpp:39
void fade_rotation_speed(float rotation_speed, float time)
Definition: custom_particle_system.cpp:1970
void fade_speed_x(float speed_x, float time)
Definition: custom_particle_system.cpp:1662
void set_birth_time_variation(float birth_time_variation)
Definition: custom_particle_system.cpp:1571
void set_acceleration_x(float acceleration_x)
Definition: custom_particle_system.cpp:1768
void fade_feather_factor(float feather_factor, float time)
Definition: custom_particle_system.cpp:1886
A ""CustomParticleSystem"" that was given a name can be controlled by scripts.
Definition: custom_particle_system.hpp:34
Definition: collision.cpp:24
void set_delay(float delay)
Definition: custom_particle_system.cpp:1459
std::string get_collision_mode() const
Returns "Ignore", "Stick", "StickForever", "BounceHeavy", "BounceLight", "Destroy".
Definition: custom_particle_system.cpp:1379
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: particlesystem_interactive.hpp:50
void set_birth_time(float birth_time)
Definition: custom_particle_system.cpp:1543
float get_friction_y() const
Definition: custom_particle_system.cpp:1846
void fade_acceleration_x(float acceleration_x, float time)
Definition: custom_particle_system.cpp:1774
void set_acceleration_y(float acceleration_y)
Definition: custom_particle_system.cpp:1796
void set_friction_x(float friction_x)
Definition: custom_particle_system.cpp:1824
void set_lifetime(float lifetime)
Definition: custom_particle_system.cpp:1487
void ease_death_time_variation(float death_time_variation, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1640
void set_rotation(float rotation)
Definition: custom_particle_system.cpp:1908
void ease_rotation_acceleration(float rotation_acceleration, float time, const std::string &easing)
Definition: custom_particle_system.cpp:2032
float get_lifetime_variation() const
Definition: custom_particle_system.cpp:1509
void ease_birth_time(float birth_time, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1555
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: custom_particle_system.hpp:56
void ease_lifetime_variation(float lifetime_variation, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1527
void set_rotation_mode(const std::string &mode)
Definition: custom_particle_system.cpp:1366
virtual std::string get_display_name() const override
Returns the display name of the object, translated to the user&#39;s locale.
Definition: custom_particle_system.hpp:55
void fade_death_time_variation(float death_time_variation, float time)
Definition: custom_particle_system.cpp:1634
int get_max_amount() const
Definition: custom_particle_system.cpp:1268
void ease_friction_x(float friction_x, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1836
void fade_speed_y(float speed_y, float time)
Definition: custom_particle_system.cpp:1690
void set_lifetime_variation(float lifetime_variation)
Definition: custom_particle_system.cpp:1515
float get_friction_x() const
Definition: custom_particle_system.cpp:1818
void set_rotation_decceleration(float rotation_decceleration)
Definition: custom_particle_system.cpp:2048
void ease_birth_time_variation(float birth_time_variation, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1583
void fade_rotation(float rotation, float time)
Definition: custom_particle_system.cpp:1914
void set_death_mode(const std::string &mode)
Definition: custom_particle_system.cpp:1337
float get_death_time() const
Definition: custom_particle_system.cpp:1593
void set_speed_x(float speed_x)
Definition: custom_particle_system.cpp:1656
void ease_speed_variation_x(float speed_variation_x, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1724
void ease_rotation_variation(float rotation_variation, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1948
void ease_speed_x(float speed_x, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1668
float get_rotation() const
Definition: custom_particle_system.cpp:1902
void clear()
Instantly removes all particles of that type on the screen.
Definition: custom_particle_system.cpp:1228
void set_cover_screen(bool cover)
Definition: custom_particle_system.cpp:1286
float get_rotation_decceleration() const
Definition: custom_particle_system.cpp:2042
void ease_rotation_speed(float rotation_speed, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1976
Definition: color.hpp:26
void ease_friction_y(float friction_y, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1864
void fade_rotation_acceleration(float rotation_acceleration, float time)
Definition: custom_particle_system.cpp:2026
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
virtual void draw(DrawingContext &context) override
The GameObject should draw itself onto the provided DrawingContext if this function is called...
Definition: custom_particle_system.cpp:852
void ease_acceleration_x(float acceleration_x, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1780
void fade_rotation_decceleration(float rotation_decceleration, float time)
Definition: custom_particle_system.cpp:2054
void set_friction_y(float friction_y)
Definition: custom_particle_system.cpp:1852
void ease_delay(float delay, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1471
std::string get_rotation_mode() const
Returns "Fixed", "Facing", "Wiggling".
Definition: custom_particle_system.cpp:1350
void ease_death_time(float death_time, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1611
bool get_cover_screen() const
Definition: custom_particle_system.cpp:1280
std::string get_birth_mode() const
Returns "None", "Fade", "Shrink".
Definition: custom_particle_system.cpp:1292
void ease_feather_factor(float feather_factor, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1892
float get_acceleration_x() const
Definition: custom_particle_system.cpp:1762
void set_death_time_variation(float death_time_variation)
Definition: custom_particle_system.cpp:1628
void ease_speed_y(float speed_y, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1696
void fade_speed_variation_y(float speed_variation_y, float time)
Definition: custom_particle_system.cpp:1746
void fade_rotation_speed_variation(float rotation_speed_variation, float time)
Definition: custom_particle_system.cpp:1998
virtual void save(Writer &writer) override
This function saves the object.
Definition: custom_particle_system.cpp:397
Definition: reader_mapping.hpp:32
void set_collision_mode(const std::string &mode)
Definition: custom_particle_system.cpp:1401
float get_lifetime() const
Definition: custom_particle_system.cpp:1481
void set_rotation_speed(float rotation_speed)
Definition: custom_particle_system.cpp:1964
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
void fade_friction_x(float friction_x, float time)
Definition: custom_particle_system.cpp:1830
void fade_birth_time(float birth_time, float time)
Definition: custom_particle_system.cpp:1549
void set_death_time(float death_time)
Definition: custom_particle_system.cpp:1599
Definition: writer.cpp:23
void set_rotation_acceleration(float rotation_acceleration)
Definition: custom_particle_system.cpp:2020
float get_speed_variation_y() const
Definition: custom_particle_system.cpp:1734
This class collects data about a collision.
Definition: collision_hit.hpp:44
void set_feather_factor(float feather_factor)
Definition: custom_particle_system.cpp:1880
void ease_lifetime(float lifetime, float time, const std::string &easing)
Definition: custom_particle_system.cpp:1499