sprite_particle.hpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // SuperTux
  2. // Copyright (C) 2006 Matthias Braun <matze@braunis.de>
  3. // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de>
  4. //
  5. // This program is free software: you can redistribute it and/or modify
  6. // it under the terms of the GNU General Public License as published by
  7. // the Free Software Foundation, either version 3 of the License, or
  8. // (at your option) any later version.
  9. //
  10. // This program is distributed in the hope that it will be useful,
  11. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. // GNU General Public License for more details.
  14. //
  15. // You should have received a copy of the GNU General Public License
  16. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. #ifndef HEADER_SUPERTUX_OBJECT_SPRITE_PARTICLE_HPP
  18. #define HEADER_SUPERTUX_OBJECT_SPRITE_PARTICLE_HPP
  19. #include "math/anchor_point.hpp"
  20. #include "sprite/sprite_ptr.hpp"
  21. #include "supertux/game_object.hpp"
  22. #include "video/color.hpp"
  23. #include "video/drawing_context.hpp"
  24. class Player;
  25. class SpriteParticle final : public GameObject
  26. {
  27. public:
  28. SpriteParticle(SpritePtr sprite, const std::string& action,
  29. const Vector& position, AnchorPoint anchor,
  30. const Vector& velocity, const Vector& acceleration,
  31. int drawing_layer = LAYER_OBJECTS-1, bool notimeout = false, Color color = Color::WHITE);
  32. SpriteParticle(const std::string& sprite_name, const std::string& action,
  33. const Vector& position, AnchorPoint anchor,
  34. const Vector& velocity, const Vector& acceleration,
  35. int drawing_layer = LAYER_OBJECTS-1, bool notimeout = false, Color color = Color::WHITE);
  36. ~SpriteParticle() override;
  37. protected:
  38. virtual void update(float dt_sec) override;
  39. virtual void draw(DrawingContext& context) override;
  40. virtual bool is_saveable() const override {
  41. return false;
  42. }
  43. private:
  44. SpritePtr sprite;
  45. Vector position;
  46. Vector velocity;
  47. Vector acceleration;
  48. int drawing_layer;
  49. SpritePtr lightsprite;
  50. bool glow;
  51. bool no_time_out;
  52. Color color;
  53. private:
  54. SpriteParticle(const SpriteParticle&) = delete;
  55. SpriteParticle& operator=(const SpriteParticle&) = delete;
  56. };
  57. #endif
  58. /* EOF */