supertux
path_object.hpp
1 // SuperTux
2 // Copyright (C) 2018 Tobias Markus <tobbi@supertux.org>
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 
18 #ifndef HEADER_SUPERTUX_OBJECT_PATH_OBJECT_HPP
19 #define HEADER_SUPERTUX_OBJECT_PATH_OBJECT_HPP
20 
21 #include <memory>
22 
23 #include "object/path.hpp"
24 #include "object/path_walker.hpp"
25 #include "util/uid.hpp"
26 
29 {
30 public:
31  PathObject();
32  virtual ~PathObject();
33 
36  void init_path(const ReaderMapping& mapping, bool running_default);
37  void init_path_pos(const Vector& pos, bool running = false);
38 
39  Path* get_path() const;
40  PathWalker* get_walker() const { return m_walker.get(); }
41 
42  std::string get_path_ref() const;
43 
44 private:
45  UID m_path_uid;
46  std::unique_ptr<PathWalker> m_walker;
47 
48 private:
49  PathObject(const PathObject&) = delete;
50  PathObject& operator=(const PathObject&) = delete;
51 };
52 
53 #endif
54 
55 /* EOF */
A walker that travels along a path.
Definition: path_walker.hpp:29
Simple two dimensional vector.
Definition: vector.hpp:24
Definition: path.hpp:44
Definition: uid.hpp:37
A class for all objects that contain / make use of a path.
Definition: path_object.hpp:28
Definition: reader_mapping.hpp:31
void init_path(const ReaderMapping &mapping, bool running_default)
For compatibilty reasons this needs to get the GameObjects main mapping, not the (path ...
Definition: path_object.cpp:39