lit_object.hpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // SuperTux
  2. // Copyright (C) 2022 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. #ifndef HEADER_SUPERTUX_OBJECT_LIT_OBJECT_HPP
  17. #define HEADER_SUPERTUX_OBJECT_LIT_OBJECT_HPP
  18. #include "object/moving_sprite.hpp"
  19. #include "squirrel/exposed_object.hpp"
  20. #include "scripting/lit_object.hpp"
  21. class ReaderMapping;
  22. class LitObject final : public MovingSprite,
  23. public ExposedObject<LitObject, scripting::LitObject>
  24. {
  25. public:
  26. LitObject(const ReaderMapping& reader);
  27. virtual void draw(DrawingContext& context) override;
  28. virtual void update(float) override;
  29. virtual HitResponse collision(GameObject&, const CollisionHit&) override { return ABORT_MOVE; }
  30. static std::string class_name() { return "lit-object"; }
  31. virtual std::string get_class_name() const override { return class_name(); }
  32. static std::string display_name() { return _("Lit object"); }
  33. virtual std::string get_display_name() const override { return display_name(); }
  34. virtual ObjectSettings get_settings() override;
  35. virtual void after_editor_set() override;
  36. virtual int get_layer() const override { return m_layer; }
  37. virtual void on_flip(float height) override;
  38. const std::string& get_action() const;
  39. const std::string& get_light_action() const;
  40. void set_light_action(const std::string& action);
  41. private:
  42. Vector m_light_offset;
  43. std::string m_light_sprite_name;
  44. std::string m_sprite_action;
  45. std::string m_light_sprite_action;
  46. SpritePtr m_light_sprite;
  47. private:
  48. LitObject(const LitObject&) = delete;
  49. LitObject& operator=(const LitObject&) = delete;
  50. };
  51. #endif
  52. /* EOF */