17 #ifndef HEADER_SUPERTUX_EDITOR_OVERLAY_WIDGET_HPP 18 #define HEADER_SUPERTUX_EDITOR_OVERLAY_WIDGET_HPP 23 #include "control/input_manager.hpp" 24 #include "editor/tile_selection.hpp" 25 #include "editor/widget.hpp" 26 #include "math/vector.hpp" 27 #include "object/tilemap.hpp" 28 #include "supertux/timer.hpp" 29 #include "util/typed_uid.hpp" 46 static Color text_autotile_available_color;
47 static Color text_autotile_active_color;
48 static Color text_autotile_error_color;
49 static Color warning_color;
50 static Color error_color;
57 virtual void update(
float dt_sec)
override;
59 virtual bool on_mouse_button_up(
const SDL_MouseButtonEvent& button)
override;
60 virtual bool on_mouse_button_down(
const SDL_MouseButtonEvent& button)
override;
61 virtual bool on_mouse_motion(
const SDL_MouseMotionEvent& motion)
override;
62 virtual bool on_key_up(
const SDL_KeyboardEvent& key)
override;
63 virtual bool on_key_down(
const SDL_KeyboardEvent& key)
override;
64 virtual void resize()
override;
67 void delete_markers();
68 void update_node_iterators();
69 void on_level_change();
72 void reset_action_press();
75 static bool action_pressed;
76 static bool alt_pressed;
79 void input_tile(
const Vector& pos, uint32_t tile);
80 void autotile(
const Vector& pos, uint32_t tile);
81 void input_autotile(
const Vector& pos, uint32_t tile);
82 void autotile_corner(
const Vector& pos, uint32_t tile, TileMap::AutotileCornerOperation op);
83 void input_autotile_corner(
const Vector& corner, uint32_t tile,
const Vector& override_pos = Vector(-1.f, -1.f));
84 void put_tile(
const Vector& target_tile);
85 void put_next_tiles();
86 void draw_rectangle();
87 void preview_rectangle();
88 bool check_tiles_for_fill(uint32_t replace_tile, uint32_t target_tile, uint32_t third_tile)
const;
101 void select_object();
102 void add_path_node();
105 void draw_tile_grid(
DrawingContext&,
int tile_size,
bool draw_shadow)
const;
110 void process_left_click();
111 void process_right_click();
112 void process_middle_click();
115 Vector tp_to_sp(
const Vector& tp,
int tile_size = 32)
const;
116 Vector sp_to_tp(
const Vector& sp,
int tile_size = 32)
const;
117 Vector tile_screen_pos(
const Vector& tp,
int tile_size = 32)
const;
118 Vector align_to_tilemap(
const Vector& sp,
int tile_size = 32)
const;
119 bool is_position_inside_tilemap(
const TileMap* tilemap,
const Vector& pos)
const;
122 Rectf drag_rect()
const;
123 Rectf tile_drag_rect()
const;
124 Rectf selection_draw_rect()
const;
125 void update_tile_selection();
127 void set_warning(
const std::string& text,
float time);
131 Vector m_hovered_tile;
132 Vector m_hovered_tile_prev;
135 Vector m_previous_mouse_pos;
137 std::chrono::steady_clock::time_point m_time_prev_put_tile;
140 bool m_dragging_right;
150 std::unique_ptr<Tip> m_object_tip;
151 Vector m_obj_mouse_desync;
153 std::unique_ptr<TileSelection> m_rectangle_preview;
156 Timer m_warning_timer;
157 std::string m_warning_text;
159 bool m_selection_warning;
This class is responsible for: Updating and drawing the object.
Definition: game_object.hpp:83
Base class for all dynamic/moving game objects.
Definition: moving_object.hpp:35
Definition: editor.hpp:49
Definition: node_marker.hpp:24
Simple timer designed to be used in the update functions of objects.
Definition: timer.hpp:24
This class is responsible for managing an array of tiles.
Definition: tilemap.hpp:49
This class provides functions for drawing things on screen.
Definition: drawing_context.hpp:42
Definition: path_gameobject.hpp:32