diff options
author | Aaron Franke <arnfranke@yahoo.com> | 2021-08-13 16:31:57 -0500 |
---|---|---|
committer | Aaron Franke <arnfranke@yahoo.com> | 2021-11-12 15:37:54 -0600 |
commit | 3c0fdcc8acfadb124fbfa914532868948561c351 (patch) | |
tree | e6d222c6488c1e4f1a9e4ffa68c1404473a00843 /tests/servers | |
parent | 4f85cad013c5469a39287e9aa474735f950e302c (diff) |
Use "enum class" for input enums
Diffstat (limited to 'tests/servers')
-rw-r--r-- | tests/servers/test_physics_2d.cpp | 8 | ||||
-rw-r--r-- | tests/servers/test_physics_3d.cpp | 4 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/servers/test_physics_2d.cpp b/tests/servers/test_physics_2d.cpp index b6360cde8a..06aa88b5c0 100644 --- a/tests/servers/test_physics_2d.cpp +++ b/tests/servers/test_physics_2d.cpp @@ -196,10 +196,10 @@ protected: if (mb->is_pressed()) { Point2 p = mb->get_position(); - if (mb->get_button_index() == 1) { + if (mb->get_button_index() == MouseButton::LEFT) { ray_to = p; _do_ray_query(); - } else if (mb->get_button_index() == 2) { + } else if (mb->get_button_index() == MouseButton::RIGHT) { ray_from = p; _do_ray_query(); } @@ -211,10 +211,10 @@ protected: if (mm.is_valid()) { Point2 p = mm->get_position(); - if (mm->get_button_mask() & MOUSE_BUTTON_MASK_LEFT) { + if ((mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) { ray_to = p; _do_ray_query(); - } else if (mm->get_button_mask() & MOUSE_BUTTON_MASK_RIGHT) { + } else if ((mm->get_button_mask() & MouseButton::MASK_RIGHT) != MouseButton::NONE) { ray_from = p; _do_ray_query(); } diff --git a/tests/servers/test_physics_3d.cpp b/tests/servers/test_physics_3d.cpp index 4e483d628d..7cb74b1ee3 100644 --- a/tests/servers/test_physics_3d.cpp +++ b/tests/servers/test_physics_3d.cpp @@ -245,12 +245,12 @@ protected: public: virtual void input_event(const Ref<InputEvent> &p_event) { Ref<InputEventMouseMotion> mm = p_event; - if (mm.is_valid() && mm->get_button_mask() & 4) { + if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_MIDDLE) != MouseButton::NONE) { ofs_y -= mm->get_relative().y / 200.0; ofs_x += mm->get_relative().x / 200.0; } - if (mm.is_valid() && mm->get_button_mask() & 1) { + if (mm.is_valid() && (mm->get_button_mask() & MouseButton::MASK_LEFT) != MouseButton::NONE) { real_t y = -mm->get_relative().y / 20.0; real_t x = mm->get_relative().x / 20.0; |