#pragma once #include "tests.hpp" #include "compat/defs.hpp" #include "src/point.hpp" #include "src/object-id.hpp" #include "floormat/events.hpp" #include #include namespace floormat { struct app; struct Ns; } namespace floormat::tests { 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, 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 draw_ui(app& a, float width) = 0; virtual void update_pre(app& a, const Ns& dt) = 0; virtual void update_post(app& a, const Ns& dt) = 0; virtual ~base_test() noexcept; protected: base_test(); }; enum class Test : uint32_t { //todo add a speedometer overlay test none, path, raycast, region, walk, COUNT, }; struct tests_data final : tests_data_ { ~tests_data() noexcept override; void switch_to(Test i); static Pointer make_test_none(); static Pointer make_test_path(); static Pointer make_test_raycast(); static Pointer make_test_region(); static Pointer make_test_walk(); Pointer current_test; Test current_index = Test::none; struct test_tuple { StringView name; Test t; Pointer(*ctor)(); }; static constexpr test_tuple fields[] = { { "None"_s, Test::none, make_test_none, }, { "Path search"_s, Test::path, make_test_path, }, { "Raycasting"_s, Test::raycast, make_test_raycast }, { "Region"_s, Test::region, make_test_region }, { "Walking"_s, Test::walk, make_test_walk }, }; }; } // namespace floormat::tests