torch.hpp 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // SuperTux
  2. // Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
  3. // Copyright (C) 2017 M. Teufel <mteufel@supertux.org>
  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_TORCH_HPP
  18. #define HEADER_SUPERTUX_OBJECT_TORCH_HPP
  19. #include "object/moving_sprite.hpp"
  20. #include "squirrel/exposed_object.hpp"
  21. #include "scripting/torch.hpp"
  22. class ReaderMapping;
  23. class Torch final : public MovingSprite,
  24. public ExposedObject<Torch, scripting::Torch>
  25. {
  26. public:
  27. Torch(const ReaderMapping& reader);
  28. virtual void draw(DrawingContext& context) override;
  29. virtual void update(float) override;
  30. virtual HitResponse collision(GameObject& other, const CollisionHit& ) override;
  31. static std::string class_name() { return "torch"; }
  32. virtual std::string get_class_name() const override { return class_name(); }
  33. static std::string display_name() { return _("Torch"); }
  34. virtual std::string get_display_name() const override { return display_name(); }
  35. virtual ObjectSettings get_settings() override;
  36. virtual void after_editor_set() override;
  37. virtual int get_layer() const override { return m_layer; }
  38. virtual void on_flip(float height) override;
  39. /** @name Scriptable Methods
  40. @{ */
  41. bool get_burning() const; /**< returns true if torch is lighted */
  42. void set_burning(bool burning_); /**< true: light torch, false: extinguish
  43. torch */
  44. /** @} */
  45. private:
  46. Color m_light_color;
  47. SpritePtr m_flame;
  48. SpritePtr m_flame_glow;
  49. SpritePtr m_flame_light;
  50. bool m_burning;
  51. private:
  52. Torch(const Torch&) = delete;
  53. Torch& operator=(const Torch&) = delete;
  54. };
  55. #endif
  56. /* EOF */