summaryrefslogtreecommitdiffhomepage
path: root/editor/tests.cpp
blob: 04489ddcfc2c013d81271a83990fadc9e7ef3b10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "tests-private.hpp"
#include "app.hpp"
#include "floormat/events.hpp"
#include "imgui-raii.hpp"

namespace floormat {

using namespace floormat::tests;
using namespace floormat::imgui;

tests_data_::~tests_data_() noexcept = default;
tests_data_::tests_data_() = default;

tests_data::~tests_data() noexcept = default;
tests_data::tests_data() = default;

Pointer<tests_data_> tests_data_::make()
{
    return Pointer<tests_data>{InPlaceInit};
}

void app::tests_pre_update()
{
}

void app::tests_post_update()
{
}

bool app::tests_handle_mouse_click(const mouse_button_event& e)
{
    update_cursor_tile(cursor.pixel);
    auto& var = tests();

    if (e.button == mouse_button_left)
    {
        std::visit(overloaded {
            [](std::monostate) {},
            [&](path_test& t) {
                // todo
            }
        }, var);

        return true;
    }
    else if (e.button == mouse_button_right)
    {
        bool ret = false;
        std::visit(overloaded {
            [](std::monostate) {},
            [&](path_test& t) {
                ret = t.active;
                t = {};
            },
        }, var);
        return ret;
    }
    return false;
}

bool app::tests_handle_key(const key_event& e)
{
    return false;
}

bool app::tests_handle_mouse_move(const mouse_move_event& e)
{
    return false;
}

tests_data& app::tests()
{
    return static_cast<tests_data&>(*_tests);
}

void app::tests_reset_mode()
{
    if (!std::holds_alternative<std::monostate>(tests()))
        tests() = std::monostate{};
}

void app::draw_tests_pane()
{
}

void app::draw_tests_overlay()
{
}

} // namespace floormat