From 3c0fdcc8acfadb124fbfa914532868948561c351 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Fri, 13 Aug 2021 16:31:57 -0500 Subject: Use "enum class" for input enums --- tests/servers/test_physics_2d.cpp | 8 ++++---- tests/servers/test_physics_3d.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'tests/servers') 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 &p_event) { Ref 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; -- cgit v1.2.3