supertux
bezier_marker.hpp
1 // SuperTux
2 // Copyright (C) 2020 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 
17 #ifndef HEADER_SUPERTUX_EDITOR_BEZIER_MARKER_HPP
18 #define HEADER_SUPERTUX_EDITOR_BEZIER_MARKER_HPP
19 
20 #include "editor/marker_object.hpp"
21 #include "object/path.hpp"
22 
23 class NodeMarker;
24 
25 class BezierMarker final : public MarkerObject
26 {
27 public:
28  BezierMarker(Path::Node* node, Vector* bezier_pos);
29  virtual GameObjectClasses get_class_types() const override { return MarkerObject::get_class_types().add(typeid(BezierMarker)); }
30 
31  virtual void move_to(const Vector& pos) override;
32  virtual Vector get_point_vector() const override;
33  virtual Vector get_offset() const override;
34  virtual bool hide_if_no_offset() const override { return true; }
35  virtual bool has_settings() const override { return false; }
36  virtual void editor_update() override;
37 
38  void update_iterator(Path::Node* it, Vector* bezier_pos);
39 
40  void set_parent(UID uid) { m_parent = uid; }
41  NodeMarker* get_parent() const;
42 
43  void save_state() override;
44  void check_state() override;
45 
46 private:
47  Path::Node* m_node;
48  Vector* m_pos;
49  UID m_parent;
50 
51 private:
52  BezierMarker(const BezierMarker&) = delete;
53  BezierMarker& operator=(const BezierMarker&) = delete;
54 };
55 
56 #endif
57 
58 /* EOF */
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: marker_object.hpp:31
void save_state() override
Save/check the current state of the object.
Definition: bezier_marker.cpp:70
Definition: marker_object.hpp:26
Definition: uid.hpp:37
Definition: bezier_marker.hpp:25
Helper class that stores an individual node of a Path.
Definition: path.hpp:52
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: bezier_marker.hpp:29
A helper structure to list all the type_indexes of the classes in the type hierarchy of a given class...
Definition: game_object.hpp:57
Definition: node_marker.hpp:24
virtual bool has_settings() const override
Indicates if get_settings() is implemented.
Definition: bezier_marker.hpp:35
virtual void editor_update() override
Called each frame in the editor, used to keep linked objects together (e.g.
Definition: bezier_marker.cpp:51