supertux
resize_marker.hpp
1 // SuperTux
2 // Copyright (C) 2016 Hume2 <teratux.mail@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_EDITOR_RESIZE_MARKER_HPP
18 #define HEADER_SUPERTUX_EDITOR_RESIZE_MARKER_HPP
19 
20 #include "editor/marker_object.hpp"
21 
22 class MovingObject;
23 
24 class ResizeMarker final : public MarkerObject
25 {
26 public:
27  enum class Side {
28  NONE,
29  LEFT_UP,
30  RIGHT_DOWN
31  };
32 
33 public:
34  ResizeMarker(MovingObject* obj, Side vert, Side horz);
35  virtual GameObjectClasses get_class_types() const override { return MarkerObject::get_class_types().add(typeid(ResizeMarker)); }
36 
37  void move_to(const Vector& pos) override;
38  Vector get_point_vector() const override;
39  Vector get_offset() const override;
40  bool has_settings() const override { return false; }
41  void editor_update() override;
42 
43  void save_state() override;
44  void check_state() override;
45 
46 private:
47  void refresh_pos();
48 
49 private:
50  MovingObject* m_object;
51  Rectf* m_rect;
52  Side m_vert;
53  Side m_horz;
54 
55 private:
56  ResizeMarker(const ResizeMarker&) = delete;
57  ResizeMarker& operator=(const ResizeMarker&) = delete;
58 };
59 
60 #endif
61 
62 /* EOF */
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: resize_marker.hpp:35
virtual GameObjectClasses get_class_types() const override
List notable classes in inheritance hierarchy of class.
Definition: marker_object.hpp:31
Definition: resize_marker.hpp:24
Definition: marker_object.hpp:26
void editor_update() override
Called each frame in the editor, used to keep linked objects together (e.g.
Definition: resize_marker.cpp:32
Definition: rectf.hpp:31
void save_state() override
Save/check the current state of the object.
Definition: resize_marker.cpp:142
bool has_settings() const override
Indicates if get_settings() is implemented.
Definition: resize_marker.hpp:40
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
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