summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/class_db.cpp19
-rw-r--r--core/class_db.h2
-rw-r--r--core/io/json.cpp6
-rw-r--r--core/io/json.h4
-rw-r--r--core/math/a_star.cpp4
-rw-r--r--core/math/math_2d.cpp29
-rw-r--r--core/math/math_2d.h5
-rw-r--r--core/os/os.h4
-rw-r--r--core/variant_call.cpp2
9 files changed, 17 insertions, 58 deletions
diff --git a/core/class_db.cpp b/core/class_db.cpp
index 57e88044b5..edd49fe95f 100644
--- a/core/class_db.cpp
+++ b/core/class_db.cpp
@@ -1036,7 +1036,6 @@ bool ClassDB::get_property(Object *p_object, const StringName &p_property, Varia
r_value = *c;
return true;
}
- //if (check->constant_map.fin)
check = check->inherits_ptr;
}
@@ -1163,24 +1162,6 @@ bool ClassDB::has_method(StringName p_class, StringName p_method, bool p_no_inhe
return false;
}
-bool ClassDB::get_setter_and_type_for_property(const StringName &p_class, const StringName &p_prop, StringName &r_class, StringName &r_setter) {
-
- ClassInfo *type = classes.getptr(p_class);
- ClassInfo *check = type;
- while (check) {
-
- if (check->property_setget.has(p_prop)) {
- r_class = check->name;
- r_setter = check->property_setget[p_prop].setter;
- return true;
- }
-
- check = check->inherits_ptr;
- }
-
- return false;
-}
-
#ifdef DEBUG_METHODS_ENABLED
MethodBind *ClassDB::bind_methodfi(uint32_t p_flags, MethodBind *p_bind, const MethodDefinition &method_name, const Variant **p_defs, int p_defcount) {
StringName mdname = method_name.name;
diff --git a/core/class_db.h b/core/class_db.h
index b8b681301d..55fe01ec6d 100644
--- a/core/class_db.h
+++ b/core/class_db.h
@@ -349,8 +349,6 @@ public:
static StringName get_category(const StringName &p_node);
- static bool get_setter_and_type_for_property(const StringName &p_class, const StringName &p_prop, StringName &r_class, StringName &r_setter);
-
static void set_class_enabled(StringName p_class, bool p_enable);
static bool is_class_enabled(StringName p_class);
diff --git a/core/io/json.cpp b/core/io/json.cpp
index ddfc792cc7..82e938d2db 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -43,7 +43,7 @@ const char *JSON::tk_name[TK_MAX] = {
"EOF",
};
-static String _make_indent(const String& p_indent, int p_size) {
+static String _make_indent(const String &p_indent, int p_size) {
String indent_text = "";
if (!p_indent.empty()) {
@@ -53,7 +53,7 @@ static String _make_indent(const String& p_indent, int p_size) {
return indent_text;
}
-String JSON::_print_var(const Variant &p_var, const String& p_indent, int p_cur_indent, bool p_sort_keys) {
+String JSON::_print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys) {
String colon = ":";
String end_statement = "";
@@ -116,7 +116,7 @@ String JSON::_print_var(const Variant &p_var, const String& p_indent, int p_cur_
}
}
-String JSON::print(const Variant &p_var, const String& p_indent, bool p_sort_keys) {
+String JSON::print(const Variant &p_var, const String &p_indent, bool p_sort_keys) {
return _print_var(p_var, p_indent, 0, p_sort_keys);
}
diff --git a/core/io/json.h b/core/io/json.h
index 5e1a89f069..fbb7875c7c 100644
--- a/core/io/json.h
+++ b/core/io/json.h
@@ -64,7 +64,7 @@ class JSON {
static const char *tk_name[TK_MAX];
- static String _print_var(const Variant &p_var, const String& p_indent, int p_cur_indent, bool p_sort_keys);
+ static String _print_var(const Variant &p_var, const String &p_indent, int p_cur_indent, bool p_sort_keys);
static Error _get_token(const CharType *p_str, int &index, int p_len, Token &r_token, int &line, String &r_err_str);
static Error _parse_value(Variant &value, Token &token, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str);
@@ -72,7 +72,7 @@ class JSON {
static Error _parse_object(Dictionary &object, const CharType *p_str, int &index, int p_len, int &line, String &r_err_str);
public:
- static String print(const Variant &p_var, const String& p_indent = "", bool p_sort_keys = true);
+ static String print(const Variant &p_var, const String &p_indent = "", bool p_sort_keys = true);
static Error parse(const String &p_json, Variant &r_ret, String &r_err_str, int &r_err_line);
};
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 7e26761abf..4498efeb41 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -473,8 +473,8 @@ void AStar::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar::get_point_path);
ClassDB::bind_method(D_METHOD("get_id_path", "from_id", "to_id"), &AStar::get_id_path);
- BIND_VMETHOD(MethodInfo("_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
- BIND_VMETHOD(MethodInfo("_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
+ BIND_VMETHOD(MethodInfo(Variant::REAL, "_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
+ BIND_VMETHOD(MethodInfo(Variant::REAL, "_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
}
AStar::AStar() {
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index c77fe96ff2..11003c1cd5 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -222,35 +222,6 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
(2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 +
(-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3);
return out;
-
- /*
- real_t mu = p_t;
- real_t mu2 = mu*mu;
-
- Vector2 a0 = p_post_b - p_b - p_pre_a + *this;
- Vector2 a1 = p_pre_a - *this - a0;
- Vector2 a2 = p_b - p_pre_a;
- Vector2 a3 = *this;
-
- return ( a0*mu*mu2 + a1*mu2 + a2*mu + a3 );
-*/
- /*
- real_t t = p_t;
- real_t t2 = t*t;
- real_t t3 = t2*t;
-
- real_t a = 2.0*t3- 3.0*t2 + 1;
- real_t b = -2.0*t3+ 3.0*t2;
- real_t c = t3- 2.0*t2 + t;
- real_t d = t3- t2;
-
- Vector2 p_a=*this;
-
- return Vector2(
- (a * p_a.x) + (b *p_b.x) + (c * p_pre_a.x) + (d * p_post_b.x),
- (a * p_a.y) + (b *p_b.y) + (c * p_pre_a.y) + (d * p_post_b.y)
- );
-*/
}
// slide returns the component of the vector along the given plane, specified by its normal vector.
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index d788318f5e..60351445c0 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -382,6 +382,11 @@ struct Rect2 {
size = end - begin;
}
+ inline Rect2 abs() const {
+
+ return Rect2(Point2(position.x + MIN(size.x, 0), position.y + MIN(size.y, 0)), size.abs());
+ }
+
operator String() const { return String(position) + ", " + String(size); }
Rect2() {}
diff --git a/core/os/os.h b/core/os/os.h
index 4f968020cc..979ad7e92a 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -92,14 +92,16 @@ public:
bool resizable;
bool borderless_window;
bool maximized;
+ bool use_vsync;
float get_aspect() const { return (float)width / (float)height; }
- VideoMode(int p_width = 1024, int p_height = 600, bool p_fullscreen = false, bool p_resizable = true, bool p_borderless_window = false, bool p_maximized = false) {
+ VideoMode(int p_width = 1024, int p_height = 600, bool p_fullscreen = false, bool p_resizable = true, bool p_borderless_window = false, bool p_maximized = false, bool p_use_vsync = false) {
width = p_width;
height = p_height;
fullscreen = p_fullscreen;
resizable = p_resizable;
borderless_window = p_borderless_window;
maximized = p_maximized;
+ use_vsync = p_use_vsync;
}
};
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 991573e8d7..f66cce85c9 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -360,6 +360,7 @@ struct _VariantCall {
VCALL_LOCALMEM2R(Rect2, grow_margin);
VCALL_LOCALMEM4R(Rect2, grow_individual);
VCALL_LOCALMEM1R(Rect2, expand);
+ VCALL_LOCALMEM0R(Rect2, abs);
VCALL_LOCALMEM0R(Vector3, min_axis);
VCALL_LOCALMEM0R(Vector3, max_axis);
@@ -1526,6 +1527,7 @@ void register_variant_methods() {
ADDFUNC2R(RECT2, RECT2, Rect2, grow_margin, INT, "margin", REAL, "by", varray());
ADDFUNC4R(RECT2, RECT2, Rect2, grow_individual, REAL, "left", REAL, "top", REAL, "right", REAL, " bottom", varray());
ADDFUNC1R(RECT2, RECT2, Rect2, expand, VECTOR2, "to", varray());
+ ADDFUNC0R(RECT2, RECT2, Rect2, abs, varray());
ADDFUNC0R(VECTOR3, INT, Vector3, min_axis, varray());
ADDFUNC0R(VECTOR3, INT, Vector3, max_axis, varray());