17 #ifndef HEADER_SUPERTUX_EDITOR_TOOLBOX_WIDGET_HPP 18 #define HEADER_SUPERTUX_EDITOR_TOOLBOX_WIDGET_HPP 22 #include "control/input_manager.hpp" 23 #include "editor/widget.hpp" 24 #include "math/vector.hpp" 25 #include "supertux/screen.hpp" 26 #include "supertux/tile_set.hpp" 40 enum class HoveredItem {
41 NONE, TILEGROUP, OBJECTS, TILE, TOOL
44 enum class TileScrolling {
48 enum class InputType {
56 virtual void update(
float dt_sec)
override;
58 virtual bool on_mouse_button_up(
const SDL_MouseButtonEvent& button)
override;
59 virtual bool on_mouse_button_down(
const SDL_MouseButtonEvent& button)
override;
60 virtual bool on_mouse_motion(
const SDL_MouseMotionEvent& motion)
override;
61 virtual bool on_mouse_wheel(
const SDL_MouseWheelEvent& wheel)
override;
63 virtual void setup()
override;
64 virtual void resize()
override;
66 void update_mouse_icon();
68 int get_tileselect_select_mode()
const;
69 int get_tileselect_move_mode()
const;
71 void select_tilegroup(
int id);
72 void select_objectgroup(
int id);
74 const ObjectInfo& get_object_info()
const {
return *m_object_info; }
75 InputType get_input_type()
const {
return m_input_type; }
76 void set_input_type(InputType input_type) { m_input_type = input_type; }
78 std::string get_object()
const {
return m_object; }
82 Vector get_tile_coords(
const int pos)
const;
83 int get_tile_pos(
const Vector& coords)
const;
84 Vector get_tool_coords(
const int pos)
const;
85 int get_tool_pos(
const Vector& coords)
const;
87 Rectf get_item_rect(
const HoveredItem& item)
const;
89 void update_selection();
90 Rectf normalize_selection()
const;
91 Rectf selection_draw_rect()
const;
99 std::unique_ptr<TileSelection> m_tiles;
101 std::string m_object;
102 InputType m_input_type;
104 std::unique_ptr<Tilegroup> m_active_tilegroup;
105 int m_active_objectgroup;
106 std::unique_ptr<ObjectInfo> m_object_info;
108 std::unique_ptr<ToolIcon> m_rubber;
109 std::unique_ptr<ToolIcon> m_select_mode;
110 std::unique_ptr<ToolIcon> m_move_mode;
111 std::unique_ptr<ToolIcon> m_settings_mode;
113 HoveredItem m_hovered_item;
115 TileScrolling m_tile_scrolling;
116 bool m_using_scroll_wheel;
117 int m_wheel_scroll_amount;
123 const int m_Ypos = 60;
Simple two dimensional vector.
Definition: vector.hpp:24
Definition: object_info.hpp:22
Definition: tile_selection.hpp:24
Definition: editor.hpp:45
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42