Removal of InputEvent as built-in Variant type..

this might cause bugs I haven't found yet..
This commit is contained in:
Juan Linietsky 2017-05-20 12:38:03 -03:00
parent 93f9a83062
commit 5b3709d309
206 changed files with 9547 additions and 10167 deletions

View file

@ -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();
}