diff options
Diffstat (limited to 'main/tests/test_physics_2d.cpp')
-rw-r--r-- | main/tests/test_physics_2d.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp index d8a00a589a..5f57275503 100644 --- a/main/tests/test_physics_2d.cpp +++ b/main/tests/test_physics_2d.cpp @@ -208,35 +208,36 @@ class TestPhysics2DMainLoop : public MainLoop { } protected: - void input_event(const InputEvent &p_event) { + void input_event(const Ref<InputEvent> &p_event) { - if (p_event.type == InputEvent::MOUSE_BUTTON) { + Ref<InputEventMouseButton> mb = p_event; - const InputEventMouseButton &mb = p_event.mouse_button; + if (mb.is_valid()) { - if (mb.pressed) { + if (mb->is_pressed()) { - Point2 p(mb.x, mb.y); + Point2 p(mb->get_pos().x, mb->get_pos().y); - if (mb.button_index == 1) { + if (mb->get_button_index() == 1) { ray_to = p; _do_ray_query(); - } else if (mb.button_index == 2) { + } else if (mb->get_button_index() == 2) { ray_from = p; _do_ray_query(); } } } - if (p_event.type == InputEvent::MOUSE_MOTION) { - const InputEventMouseMotion &mm = p_event.mouse_motion; + Ref<InputEventMouseMotion> mm = p_event; - Point2 p(mm.x, mm.y); + if (mm.is_valid()) { - if (mm.button_mask & BUTTON_MASK_LEFT) { + Point2 p = mm->get_pos(); + + if (mm->get_button_mask() & BUTTON_MASK_LEFT) { ray_to = p; _do_ray_query(); - } else if (mm.button_mask & BUTTON_MASK_RIGHT) { + } else if (mm->get_button_mask() & BUTTON_MASK_RIGHT) { ray_from = p; _do_ray_query(); } |