diff options
Diffstat (limited to 'editor/tests-private.hpp')
-rw-r--r-- | editor/tests-private.hpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/editor/tests-private.hpp b/editor/tests-private.hpp index 5c229696..0300c8a5 100644 --- a/editor/tests-private.hpp +++ b/editor/tests-private.hpp @@ -2,6 +2,7 @@ #include "tests.hpp" #include "compat/defs.hpp" #include "src/point.hpp" +#include "src/object-id.hpp" #include "floormat/events.hpp" #include <Corrade/Containers/StringView.h> #include <vector> @@ -19,8 +20,8 @@ struct base_test fm_DECLARE_DEFAULT_MOVE_ASSIGNMENT_(base_test); fm_DECLARE_DELETED_COPY_ASSIGNMENT(base_test); - virtual bool handle_key(app& a, const key_event& e) = 0; - virtual bool handle_mouse_click(app& a, const mouse_button_event& e) = 0; + virtual bool handle_key(app& a, const key_event& e, bool is_down) = 0; + virtual bool handle_mouse_click(app& a, const mouse_button_event& e, bool is_down) = 0; virtual bool handle_mouse_move(app& a, const mouse_move_event& e) = 0; virtual void draw_overlay(app& a) = 0; virtual void update_pre(app& a) = 0; @@ -34,16 +35,28 @@ protected: struct path_test : base_test { - bool handle_key(app& a, const key_event& e) override; - bool handle_mouse_click(app& a, const mouse_button_event& e) override; + bool handle_key(app& a, const key_event& e, bool is_down) override; + bool handle_mouse_click(app& a, const mouse_button_event& e, bool is_down) override; bool handle_mouse_move(app& a, const mouse_move_event& e) override; void draw_overlay(app& a) override; void update_pre(app& a) override; void update_post(app& a) override; - point from; - std::vector<point> path; - bool active = false; + struct pending_s + { + point from, to; + object_id own_id; + uint32_t max_dist; + Vector2ub own_size; + } pending = {}; + + struct result_s + { + point from; + std::vector<point> path; + } result; + + bool has_result : 1 = false, has_pending : 1 = false; }; using variant = std::variant<std::monostate, tests::path_test>; |