summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/os/dir_access.cpp2
-rw-r--r--core/os/input.cpp6
-rw-r--r--core/os/input.h5
-rw-r--r--core/os/os.h1
-rw-r--r--core/variant.h1
-rw-r--r--core/variant_call.cpp26
6 files changed, 40 insertions, 1 deletions
diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp
index 3ab4d4bb7f..53fe792c46 100644
--- a/core/os/dir_access.cpp
+++ b/core/os/dir_access.cpp
@@ -155,7 +155,7 @@ Error DirAccess::make_dir_recursive(String p_dir) {
full_dir=dir;
}
- int slices = full_dir.get_slice_count("/");
+ //int slices = full_dir.get_slice_count("/");
int pos = 0;
while (pos < full_dir.length()) {
diff --git a/core/os/input.cpp b/core/os/input.cpp
index 3712690cc1..4151c1b5a8 100644
--- a/core/os/input.cpp
+++ b/core/os/input.cpp
@@ -60,6 +60,7 @@ void Input::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask);
ObjectTypeDB::bind_method(_MD("set_mouse_mode","mode"),&Input::set_mouse_mode);
ObjectTypeDB::bind_method(_MD("get_mouse_mode"),&Input::get_mouse_mode);
+ ObjectTypeDB::bind_method(_MD("warp_mouse_pos","to"),&Input::warp_mouse_pos);
BIND_CONSTANT( MOUSE_MODE_VISIBLE );
BIND_CONSTANT( MOUSE_MODE_HIDDEN );
@@ -304,6 +305,11 @@ int InputDefault::get_mouse_button_mask() const {
return OS::get_singleton()->get_mouse_button_state();
}
+void InputDefault::warp_mouse_pos(const Vector2& p_to) {
+
+ OS::get_singleton()->warp_mouse_pos(p_to);
+}
+
void InputDefault::iteration(float p_step) {
diff --git a/core/os/input.h b/core/os/input.h
index b837a1f68f..1cb0f35d96 100644
--- a/core/os/input.h
+++ b/core/os/input.h
@@ -69,6 +69,8 @@ public:
virtual Point2 get_mouse_speed() const=0;
virtual int get_mouse_button_mask() const=0;
+ virtual void warp_mouse_pos(const Vector2& p_to)=0;
+
virtual Vector3 get_accelerometer()=0;
virtual void action_press(const StringName& p_action)=0;
@@ -128,6 +130,9 @@ public:
virtual Point2 get_mouse_speed() const;
virtual int get_mouse_button_mask() const;
+ virtual void warp_mouse_pos(const Vector2& p_to);
+
+
void parse_input_event(const InputEvent& p_event);
void set_accelerometer(const Vector3& p_accel);
void set_joy_axis(int p_device,int p_axis,float p_value);
diff --git a/core/os/os.h b/core/os/os.h
index 24e2b4f2d4..71f53330c7 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -136,6 +136,7 @@ public:
virtual MouseMode get_mouse_mode() const;
+ virtual void warp_mouse_pos(const Point2& p_to) {}
virtual Point2 get_mouse_pos() const=0;
virtual int get_mouse_button_state() const=0;
virtual void set_window_title(const String& p_title)=0;
diff --git a/core/variant.h b/core/variant.h
index 3cfecb9388..f651e38352 100644
--- a/core/variant.h
+++ b/core/variant.h
@@ -387,6 +387,7 @@ public:
static Variant construct(const Variant::Type,const Variant** p_args,int p_argcount,CallError &r_error);
void get_method_list(List<MethodInfo> *p_list) const;
+ bool has_method(const StringName& p_method) const;
void set_named(const StringName& p_index, const Variant& p_value, bool *r_valid=NULL);
Variant get_named(const StringName& p_index, bool *r_valid=NULL) const;
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 8fbccc87ae..e0ae7e2114 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -1012,6 +1012,32 @@ Variant Variant::construct(const Variant::Type p_type,const Variant** p_args,int
return Variant();
}
+
+bool Variant::has_method(const StringName& p_method) const {
+
+
+ if (type==OBJECT) {
+ Object *obj = operator Object*();
+ if (!obj)
+ return false;
+#ifdef DEBUG_ENABLED
+ if (ScriptDebugger::get_singleton()) {
+ if (ObjectDB::instance_validate(obj)) {
+#endif
+ return obj->has_method(p_method);
+#ifdef DEBUG_ENABLED
+
+ }
+ }
+#endif
+ }
+
+
+ const _VariantCall::TypeFunc &fd = _VariantCall::type_funcs[type];
+ return fd.functions.has(p_method);
+
+}
+
void Variant::get_method_list(List<MethodInfo> *p_list) const {