| 1 | //  SuperTux | 
|---|
| 2 | //  Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.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 |  | 
|---|
| 17 | #ifndef HEADER_SUPERTUX_OBJECT_PATH_GAMEOBJECT_HPP | 
|---|
| 18 | #define | 
|---|
| 19 |  | 
|---|
| 20 | #include "sprite/sprite_ptr.hpp" | 
|---|
| 21 | #include "supertux/game_object.hpp" | 
|---|
| 22 |  | 
|---|
| 23 | class Path; | 
|---|
| 24 | class Vector; | 
|---|
| 25 |  | 
|---|
| 26 | enum class PathStyle | 
|---|
| 27 | { | 
|---|
| 28 | NONE, | 
|---|
| 29 | SOLID | 
|---|
| 30 | }; | 
|---|
| 31 |  | 
|---|
| 32 | class PathGameObject : public GameObject | 
|---|
| 33 | { | 
|---|
| 34 | public: | 
|---|
| 35 | PathGameObject(); | 
|---|
| 36 | PathGameObject(const Vector& pos); | 
|---|
| 37 | PathGameObject(const ReaderMapping& mapping, bool backward_compatibility_hack=false); | 
|---|
| 38 | virtual ~PathGameObject(); | 
|---|
| 39 |  | 
|---|
| 40 | virtual void update(float dt_sec) override; | 
|---|
| 41 | virtual void draw(DrawingContext& context) override; | 
|---|
| 42 |  | 
|---|
| 43 | virtual std::string get_class() const override { return "path"; } | 
|---|
| 44 | virtual std::string get_display_name() const override { return _( "Path"); } | 
|---|
| 45 |  | 
|---|
| 46 | virtual const std::string get_icon_path() const override { | 
|---|
| 47 | return "images/engine/editor/path.png"; | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 | virtual void editor_select() override; | 
|---|
| 51 | virtual void editor_deselect() override; | 
|---|
| 52 |  | 
|---|
| 53 | virtual ObjectSettings get_settings() override; | 
|---|
| 54 |  | 
|---|
| 55 | Path& get_path() { return *m_path; } | 
|---|
| 56 |  | 
|---|
| 57 | private: | 
|---|
| 58 | std::unique_ptr<Path> m_path; | 
|---|
| 59 | PathStyle m_style; | 
|---|
| 60 | SpritePtr m_edge_sprite; | 
|---|
| 61 | SpritePtr m_node_sprite; | 
|---|
| 62 |  | 
|---|
| 63 | private: | 
|---|
| 64 | PathGameObject(const PathGameObject&) = delete; | 
|---|
| 65 | PathGameObject& operator=(const PathGameObject&) = delete; | 
|---|
| 66 | }; | 
|---|
| 67 |  | 
|---|
| 68 | #endif | 
|---|
| 69 |  | 
|---|
| 70 | /* EOF */ | 
|---|
| 71 |  | 
|---|