| 1 | // SuperTux - Teleporter Worldmap Tile |
| 2 | // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de> |
| 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_WORLDMAP_TELEPORTER_HPP |
| 18 | #define |
| 19 | |
| 20 | #include <string> |
| 21 | |
| 22 | #include "math/vector.hpp" |
| 23 | #include "sprite/sprite_ptr.hpp" |
| 24 | #include "supertux/game_object.hpp" |
| 25 | |
| 26 | class ReaderMapping; |
| 27 | |
| 28 | namespace worldmap { |
| 29 | |
| 30 | class Teleporter final : public GameObject |
| 31 | { |
| 32 | public: |
| 33 | Teleporter(const ReaderMapping& mapping); |
| 34 | |
| 35 | virtual void draw(DrawingContext& context) override; |
| 36 | virtual void update(float dt_sec) override; |
| 37 | |
| 38 | Vector get_pos() const { return m_pos; } |
| 39 | std::string get_worldmap() const { return m_worldmap; } |
| 40 | std::string get_spawnpoint() const { return m_spawnpoint; } |
| 41 | bool is_automatic() const { return m_automatic; } |
| 42 | std::string get_message() const { return m_message; } |
| 43 | |
| 44 | private: |
| 45 | /** Position (in tiles, not pixels) */ |
| 46 | Vector m_pos; |
| 47 | |
| 48 | /** Sprite to render, or 0 for no sprite */ |
| 49 | SpritePtr m_sprite; |
| 50 | |
| 51 | /** Worldmap filename (relative to data root) to teleport to. Leave empty to use current word */ |
| 52 | std::string m_worldmap; |
| 53 | |
| 54 | /** Spawnpoint to teleport to. Leave empty to use "main" or last one */ |
| 55 | std::string m_spawnpoint; |
| 56 | |
| 57 | /** true if this teleporter does not need to be activated, but teleports Tux as soon as it's touched */ |
| 58 | bool m_automatic; |
| 59 | |
| 60 | /** optional map message to display */ |
| 61 | std::string m_message; |
| 62 | |
| 63 | private: |
| 64 | Teleporter(const Teleporter&) = delete; |
| 65 | Teleporter& operator=(const Teleporter&) = delete; |
| 66 | }; |
| 67 | |
| 68 | } // namespace worldmap |
| 69 | |
| 70 | #endif |
| 71 | |
| 72 | /* EOF */ |
| 73 | |