| 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 |  | 
|---|
| 18 | #ifndef HEADER_SUPERTUX_OBJECT_TORCH_HPP | 
|---|
| 19 | #define | 
|---|
| 20 |  | 
|---|
| 21 | #include "squirrel/exposed_object.hpp" | 
|---|
| 22 | #include "scripting/torch.hpp" | 
|---|
| 23 | #include "sprite/sprite_ptr.hpp" | 
|---|
| 24 | #include "supertux/moving_object.hpp" | 
|---|
| 25 |  | 
|---|
| 26 | class ReaderMapping; | 
|---|
| 27 |  | 
|---|
| 28 | class Torch final : | 
|---|
| 29 | public MovingObject, | 
|---|
| 30 | public ExposedObject<Torch, scripting::Torch> | 
|---|
| 31 | { | 
|---|
| 32 | public: | 
|---|
| 33 | Torch(const ReaderMapping& reader); | 
|---|
| 34 |  | 
|---|
| 35 | virtual void draw(DrawingContext& context) override; | 
|---|
| 36 | virtual void update(float) override; | 
|---|
| 37 |  | 
|---|
| 38 | virtual HitResponse collision(GameObject& other, const CollisionHit& ) override; | 
|---|
| 39 |  | 
|---|
| 40 | virtual std::string get_class() const override { return "torch"; } | 
|---|
| 41 | virtual std::string get_display_name() const override { return _( "Torch"); } | 
|---|
| 42 |  | 
|---|
| 43 | virtual ObjectSettings get_settings() override; | 
|---|
| 44 | virtual void after_editor_set() override; | 
|---|
| 45 |  | 
|---|
| 46 | /** @name Scriptable Methods | 
|---|
| 47 | @{ */ | 
|---|
| 48 | bool get_burning() const; /**< returns true if torch is lighted */ | 
|---|
| 49 | void set_burning(bool burning_); /**< true: light torch, false: extinguish | 
|---|
| 50 | torch */ | 
|---|
| 51 | /** @} */ | 
|---|
| 52 |  | 
|---|
| 53 | private: | 
|---|
| 54 | SpritePtr m_torch; | 
|---|
| 55 | SpritePtr m_flame; | 
|---|
| 56 | SpritePtr m_flame_glow; | 
|---|
| 57 | SpritePtr m_flame_light; | 
|---|
| 58 | bool m_burning; | 
|---|
| 59 | std::string sprite_name; | 
|---|
| 60 |  | 
|---|
| 61 | private: | 
|---|
| 62 | Torch(const Torch&) = delete; | 
|---|
| 63 | Torch& operator=(const Torch&) = delete; | 
|---|
| 64 | }; | 
|---|
| 65 |  | 
|---|
| 66 | #endif | 
|---|
| 67 |  | 
|---|
| 68 | /* EOF */ | 
|---|
| 69 |  | 
|---|