From c84d618b4ea944e5c386d21f45265f9cb6fa783e Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Thu, 12 Jan 2017 00:12:54 -0300 Subject: [PATCH] Made InputEvent use floating point coordinates. --- core/os/input_event.h | 12 ++++++------ core/variant_op.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/os/input_event.h b/core/os/input_event.h index 3947d8628511..1af4ef20c2eb 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -205,8 +205,8 @@ struct InputEventMouse { InputModifierState mod; int button_mask; - int x,y; - int global_x,global_y; + float x,y; + float global_x,global_y; int pointer_index; }; @@ -221,7 +221,7 @@ struct InputEventMouseButton : public InputEventMouse { struct InputEventMouseMotion : public InputEventMouse { - int relative_x,relative_y; + float relative_x,relative_y; float speed_x,speed_y; }; @@ -241,14 +241,14 @@ struct InputEventJoypadButton { struct InputEventScreenTouch { int index; - int x,y; + float x,y; bool pressed; }; struct InputEventScreenDrag { int index; - int x,y; - int relative_x,relative_y; + float x,y; + float relative_x,relative_y; float speed_x,speed_y; }; diff --git a/core/variant_op.cpp b/core/variant_op.cpp index 3924d3af77a9..50f0b967157b 100644 --- a/core/variant_op.cpp +++ b/core/variant_op.cpp @@ -2836,18 +2836,18 @@ void Variant::get_property_list(List *p_list) const { if (ie.type==InputEvent::MOUSE_MOTION || ie.type==InputEvent::MOUSE_BUTTON) { p_list->push_back( PropertyInfo(Variant::INT,"button_mask") ); - p_list->push_back( PropertyInfo(Variant::INT,"x") ); - p_list->push_back( PropertyInfo(Variant::INT,"y") ); + p_list->push_back( PropertyInfo(Variant::REAL,"x") ); + p_list->push_back( PropertyInfo(Variant::REAL,"y") ); p_list->push_back( PropertyInfo(Variant::VECTOR2,"pos") ); - p_list->push_back( PropertyInfo(Variant::INT,"global_x") ); - p_list->push_back( PropertyInfo(Variant::INT,"global_y") ); + p_list->push_back( PropertyInfo(Variant::REAL,"global_x") ); + p_list->push_back( PropertyInfo(Variant::REAL,"global_y") ); p_list->push_back( PropertyInfo(Variant::VECTOR2,"global_pos") ); if (ie.type==InputEvent::MOUSE_MOTION) { - p_list->push_back( PropertyInfo(Variant::INT,"relative_x") ); - p_list->push_back( PropertyInfo(Variant::INT,"relative_y") ); + p_list->push_back( PropertyInfo(Variant::REAL,"relative_x") ); + p_list->push_back( PropertyInfo(Variant::REAL,"relative_y") ); p_list->push_back( PropertyInfo(Variant::VECTOR2,"relative_pos") ); p_list->push_back( PropertyInfo(Variant::REAL,"speed_x") ); p_list->push_back( PropertyInfo(Variant::REAL,"speed_y") );