diff options
243 files changed, 6952 insertions, 5694 deletions
diff --git a/.gitattributes b/.gitattributes index 1df99d85bf..f8959dd2d1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,7 @@ drivers/* linguist-vendored *.cpp eol=lf +*.mm eol=lf *.h eol=lf *.py eol=lf *.hpp eol=lf diff --git a/.gitignore b/.gitignore index cdf277dd71..537ed7d32a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,30 +1,31 @@ # Godot auto generated files -platform/server/logo.h -platform/android/logo.h -platform/bb10/logo.h -platform/iphone/logo.h -platform/javascript/logo.h -platform/osx/logo.h -platform/windows/logo.h -platform/x11/logo.h -drivers/gles2/shaders/*.h -drivers/gles3/shaders/*.h -modules/register_module_types.cpp -core/version.h -core/method_bind.inc +core/global_defaults.cpp core/method_bind_ext.inc +core/method_bind.inc core/script_encryption_key.cpp -core/global_defaults.cpp +core/version_generated.h +drivers/gles2/shaders/*.h +drivers/gles3/shaders/*.h drivers/unix/os_unix_global_settings_path.cpp -editor/register_exporters.cpp -editor/doc_data_compressed.h +editor/builtin_fonts.h editor/certs_compressed.h +editor/doc_data_compressed.h editor/editor_icons.cpp +editor/register_exporters.cpp editor/translations.h -editor/builtin_fonts.h -.fscache -make.bat log.txt +main/app_icon.h +main/splash.h +make.bat +modules/register_module_types.cpp +platform/android/logo.h +platform/bb10/logo.h +platform/iphone/logo.h +platform/javascript/logo.h +platform/osx/logo.h +platform/server/logo.h +platform/windows/logo.h +platform/x11/logo.h # Documentation generated by doxygen or from classes.xml doc/_build/ @@ -306,6 +307,6 @@ godot.creator.* projects/ platform/windows/godot_res.res -# Visual Studio Code folder (and files) that are created -# when the C/C++ extension (https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) is used +# Visual Studio 2017 and Visual Studio Code workspace folder +/.vs /.vscode diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 21ce52d6e3..23ab874a2e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -90,7 +90,7 @@ The Godot Engine community has [many communication channels](https://godotengine To communicate with developers (e.g. to discuss a feature you want to implement or a bug you want to fix), the following channels can be used: - [GitHub issues](https://github.com/godotengine/godot/issues): If there is an existing issue about a topic you want to discuss, just add a comment to it - all developers watch the repository and will get an email notification. You can also create a new issue - please keep in mind to create issues only to discuss quite specific points about the development, and not general user feedback or support requests. -- [#godotengine-devel IRC channel on Freenode](http://webchat.freenode.net/?channels=godotengine-devel): You will find most core developers there, so it's the go-to channel for direct chat about Godot Engine development. Feel free to start discussing something there to get some early feedback before writing up a detailed proposal in a GitHub issue. +- [#godotengine-devel IRC channel on Freenode](https://webchat.freenode.net/?channels=godotengine-devel): You will find most core developers there, so it's the go-to channel for direct chat about Godot Engine development. Feel free to start discussing something there to get some early feedback before writing up a detailed proposal in a GitHub issue. - [devel@godotengine.org mailing list](https://listengine.tuxfamily.org/godotengine.org/devel/): Mailing list for Godot developers, used primarily to announce developer meetings on IRC and other important discussions that need to reach people directly in their mailbox. See the [index page](https://listengine.tuxfamily.org/godotengine.org/devel/) for subscription instructions. Thanks! diff --git a/SConstruct b/SConstruct index 85075c6c79..c07baa2709 100644 --- a/SConstruct +++ b/SConstruct @@ -275,7 +275,7 @@ if selected_platform in platform_list: # TODO: Add support to specify different levels of warning, e.g. only critical/significant, instead of on/off if (env["warnings"] == "yes"): if (os.name == "nt" and os.getenv("VSINSTALLDIR")): # MSVC, needs to stand out of course - env.Append(CCFLAGS=['/W4']) + pass# env.Append(CCFLAGS=['/W2']) else: # Rest of the world env.Append(CCFLAGS=['-Wall']) else: diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 8c57f49069..bd41e48a30 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -163,9 +163,9 @@ _ResourceSaver::_ResourceSaver() { /////////////////OS -Point2 _OS::get_mouse_pos() const { +Point2 _OS::get_mouse_position() const { - return OS::get_singleton()->get_mouse_pos(); + return OS::get_singleton()->get_mouse_position(); } void _OS::set_window_title(const String &p_title) { @@ -954,7 +954,7 @@ _OS *_OS::singleton = NULL; void _OS::_bind_methods() { - //ClassDB::bind_method(D_METHOD("get_mouse_pos"),&_OS::get_mouse_pos); + //ClassDB::bind_method(D_METHOD("get_mouse_position"),&_OS::get_mouse_position); //ClassDB::bind_method(D_METHOD("is_mouse_grab_enabled"),&_OS::is_mouse_grab_enabled); ClassDB::bind_method(D_METHOD("set_clipboard", "clipboard"), &_OS::set_clipboard); @@ -2367,6 +2367,23 @@ Array _ClassDB::get_property_list(StringName p_class, bool p_no_inheritance) con return ret; } +Variant _ClassDB::get_property(Object *p_object, const StringName &p_property) const { + Variant ret; + ClassDB::get_property(p_object, p_property, ret); + return ret; +} + +Error _ClassDB::set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const { + Variant ret; + bool valid; + if (!ClassDB::set_property(p_object, p_property, p_value, &valid)) { + return ERR_UNAVAILABLE; + } else if (!valid) { + return ERR_INVALID_DATA; + } + return OK; +} + bool _ClassDB::has_method(StringName p_class, StringName p_method, bool p_no_inheritance) const { return ClassDB::has_method(p_class, p_method, p_no_inheritance); @@ -2439,6 +2456,8 @@ void _ClassDB::_bind_methods() { ClassDB::bind_method(D_METHOD("class_get_signal_list", "class", "no_inheritance"), &_ClassDB::get_signal_list, DEFVAL(false)); ClassDB::bind_method(D_METHOD("class_get_property_list", "class", "no_inheritance"), &_ClassDB::get_property_list, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("class_get_property:Variant", "object", "property"), &_ClassDB::get_property); + ClassDB::bind_method(D_METHOD("class_set_property:Error", "object", "property", "value"), &_ClassDB::set_property); ClassDB::bind_method(D_METHOD("class_has_method", "class", "method", "no_inheritance"), &_ClassDB::has_method, DEFVAL(false)); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 13956c3373..222339bce1 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -120,7 +120,7 @@ public: MONTH_DECEMBER }; - Point2 get_mouse_pos() const; + Point2 get_mouse_position() const; void set_window_title(const String &p_title); int get_mouse_button_state() const; @@ -587,6 +587,8 @@ public: Array get_signal_list(StringName p_class, bool p_no_inheritance = false) const; Array get_property_list(StringName p_class, bool p_no_inheritance = false) const; + Variant get_property(Object *p_object, const StringName &p_property) const; + Error set_property(Object *p_object, const StringName &p_property, const Variant &p_value) const; bool has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false) const; diff --git a/core/global_config.cpp b/core/global_config.cpp index d37c67c84a..f9a0877c23 100644 --- a/core/global_config.cpp +++ b/core/global_config.cpp @@ -53,6 +53,11 @@ String GlobalConfig::get_resource_path() const { return resource_path; }; +String GlobalConfig::get_project_file_name() const { + + return project_file_name; +} + String GlobalConfig::localize_path(const String &p_path) const { if (resource_path == "") @@ -236,13 +241,43 @@ bool GlobalConfig::_load_resource_pack(const String &p_pack) { return true; } +static String _find_project_file(DirAccess *p_diraccess, bool p_res = false) { + p_diraccess->list_dir_begin(); + String ret = ""; + while (true) { + bool isdir; + String file = p_diraccess->get_next(&isdir); + if (file == "") + break; + + if (!isdir) { + if (file.get_extension() == "godot") { + + if (p_res) { + ret = "res://" + file; + } else { + ret = p_diraccess->get_current_dir() + "/" + file; + } + } + } + } + p_diraccess->list_dir_end(); + return ret; +} + +static String _find_project_file() { + DirAccess *dir = DirAccess::create(DirAccess::ACCESS_RESOURCES); + String ret = _find_project_file(dir, true); + memdelete(dir); + return ret; +} + Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { //If looking for files in network, just use network! - if (FileAccessNetworkClient::get_singleton()) { - - if (_load_settings("res://godot.cfg") == OK || _load_settings_binary("res://godot.cfb") == OK) { + String gdproj = _find_project_file(); + if (_load_settings(gdproj) == OK || _load_settings_binary("res://godot.cfb") == OK) { _load_settings("res://override.cfg"); } @@ -258,8 +293,8 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { bool ok = _load_resource_pack(p_main_pack); ERR_FAIL_COND_V(!ok, ERR_CANT_OPEN); - - if (_load_settings("res://godot.cfg") == OK || _load_settings_binary("res://godot.cfb") == OK) { + String gdproj = _find_project_file(); + if (_load_settings(gdproj) == OK || _load_settings_binary("res://godot.cfb") == OK) { //load override from location of the main pack _load_settings(p_main_pack.get_base_dir().plus_file("override.cfg")); } @@ -272,7 +307,8 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { if (_load_resource_pack(exec_path.get_basename() + ".pck")) { - if (_load_settings("res://godot.cfg") == OK || _load_settings_binary("res://godot.cfb") == OK) { + String gdproj = _find_project_file(); + if (_load_settings(gdproj) == OK || _load_settings_binary("res://godot.cfb") == OK) { //load override from location of executable _load_settings(exec_path.get_base_dir().plus_file("override.cfg")); } @@ -292,15 +328,15 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { // data.pck and data.zip are deprecated and no longer supported, apologies. // make sure this is loaded from the resource path - - if (_load_settings("res://godot.cfg") == OK || _load_settings_binary("res://godot.cfb") == OK) { + String gdproj = _find_project_file(); + if (_load_settings(gdproj) == OK || _load_settings_binary("res://godot.cfb") == OK) { _load_settings("res://override.cfg"); } return OK; } - //Nothing was found, try to find a godot.cfg somewhere! + //Nothing was found, try to find a *.godot somewhere! DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); ERR_FAIL_COND_V(!d, ERR_CANT_CREATE); @@ -313,8 +349,8 @@ Error GlobalConfig::setup(const String &p_path, const String &p_main_pack) { while (true) { //try to load settings in ascending through dirs shape! - - if (_load_settings(current_dir + "/godot.cfg") == OK || _load_settings_binary(current_dir + "/godot.cfb") == OK) { + String gdproj = _find_project_file(d); + if (_load_settings(gdproj) == OK || _load_settings_binary(current_dir + "/godot.cfb") == OK) { _load_settings(current_dir + "/override.cfg"); candidate = current_dir; @@ -428,6 +464,7 @@ Error GlobalConfig::_load_settings(const String p_path) { err = VariantParser::parse_tag_assign_eof(&stream, lines, error_text, next_tag, assign, value, NULL, true); if (err == ERR_FILE_EOF) { memdelete(f); + project_file_name = p_path.get_file(); return OK; } else if (err != OK) { ERR_PRINTS("GlobalConfig::load - " + p_path + ":" + itos(lines) + " error: " + error_text); @@ -449,6 +486,7 @@ Error GlobalConfig::_load_settings(const String p_path) { } } + project_file_name = p_path.get_file(); memdelete(f); return OK; @@ -474,7 +512,12 @@ void GlobalConfig::clear(const String &p_name) { Error GlobalConfig::save() { - return save_custom(get_resource_path() + "/godot.cfg"); + if (project_file_name.empty()) { + String name = ((String)get("application/name")).replace(" ", "_"); + return save_custom(get_resource_path() + "/" + name + ".godot"); + } else { + return save_custom(get_resource_path() + "/" + project_file_name); + } } Error GlobalConfig::_save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom) { @@ -483,7 +526,7 @@ Error GlobalConfig::_save_settings_binary(const String &p_file, const Map<String FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err); if (err != OK) { - ERR_EXPLAIN("Coudln't save godot.cfb at " + p_file); + ERR_EXPLAIN("Couldn't save godot.cfb at " + p_file); ERR_FAIL_COND_V(err, err) } @@ -548,7 +591,7 @@ Error GlobalConfig::_save_settings_text(const String &p_file, const Map<String, FileAccess *file = FileAccess::open(p_file, FileAccess::WRITE, &err); if (err) { - ERR_EXPLAIN("Coudln't save godot.cfg - " + p_file); + ERR_EXPLAIN("Couldn't save project file - " + p_file); ERR_FAIL_COND_V(err, err) } @@ -658,7 +701,7 @@ Error GlobalConfig::save_custom(const String &p_path, const CustomMap &p_custom, props[category].push_back(name); } - if (p_path.ends_with(".cfg")) + if (p_path.ends_with(".godot")) return _save_settings_text(p_path, props, p_custom); else if (p_path.ends_with(".cfb")) return _save_settings_binary(p_path, props, p_custom); @@ -828,6 +871,7 @@ void GlobalConfig::_bind_methods() { ClassDB::bind_method(D_METHOD("clear", "name"), &GlobalConfig::clear); ClassDB::bind_method(D_METHOD("localize_path", "path"), &GlobalConfig::localize_path); ClassDB::bind_method(D_METHOD("globalize_path", "path"), &GlobalConfig::globalize_path); + ClassDB::bind_method(D_METHOD("get_project_file_name"), &GlobalConfig::get_project_file_name); ClassDB::bind_method(D_METHOD("save"), &GlobalConfig::save); ClassDB::bind_method(D_METHOD("has_singleton", "name"), &GlobalConfig::has_singleton); ClassDB::bind_method(D_METHOD("get_singleton", "name"), &GlobalConfig::get_singleton_object); diff --git a/core/global_config.h b/core/global_config.h index d0f64dc23c..5148c4377e 100644 --- a/core/global_config.h +++ b/core/global_config.h @@ -111,6 +111,8 @@ protected: void _add_property_info_bind(const Dictionary &p_info); + String project_file_name; + protected: static void _bind_methods(); @@ -124,6 +126,7 @@ public: Variant property_get_revert(const String &p_name); String get_resource_path() const; + String get_project_file_name() const; static GlobalConfig *get_singleton(); diff --git a/core/hashfuncs.h b/core/hashfuncs.h index fbd2e161b3..8392984565 100644 --- a/core/hashfuncs.h +++ b/core/hashfuncs.h @@ -81,24 +81,6 @@ static inline uint32_t hash_one_uint64(const uint64_t p_int) { return (int)v; } -static inline uint32_t hash_djb2_one_float(float p_in, uint32_t p_prev = 5381) { - union { - float f; - uint32_t i; - } u; - - // Normalize +/- 0.0 and NaN values so they hash the same. - if (p_in == 0.0f) - u.f = 0.0; - else if (Math::is_nan(p_in)) - u.f = Math_NAN; - else - u.f = p_in; - - return ((p_prev << 5) + p_prev) + u.i; -} - -// Overload for real_t size changes static inline uint32_t hash_djb2_one_float(double p_in, uint32_t p_prev = 5381) { union { double d; diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index 3889c8f3ae..5e66b7f7f5 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -862,7 +862,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len) { } else { if (buf) { - encode_double(p_variant.operator float(), buf); + encode_float(p_variant.operator float(), buf); } r_len += 4; diff --git a/core/math/geometry.h b/core/math/geometry.h index 2469e799a0..909d8164c3 100644 --- a/core/math/geometry.h +++ b/core/math/geometry.h @@ -105,23 +105,23 @@ public: } static void get_closest_points_between_segments(const Vector3 &p1, const Vector3 &p2, const Vector3 &q1, const Vector3 &q2, Vector3 &c1, Vector3 &c2) { -#if 0 - //do the function 'd' as defined by pb. I think is is dot product of some sort +#if 1 +//do the function 'd' as defined by pb. I think is is dot product of some sort #define d_of(m, n, o, p) ((m.x - n.x) * (o.x - p.x) + (m.y - n.y) * (o.y - p.y) + (m.z - n.z) * (o.z - p.z)) //calculate the parametric position on the 2 curves, mua and mub - real_t mua = ( d_of(p1,q1,q2,q1) * d_of(q2,q1,p2,p1) - d_of(p1,q1,p2,p1) * d_of(q2,q1,q2,q1) ) / ( d_of(p2,p1,p2,p1) * d_of(q2,q1,q2,q1) - d_of(q2,q1,p2,p1) * d_of(q2,q1,p2,p1) ); - real_t mub = ( d_of(p1,q1,q2,q1) + mua * d_of(q2,q1,p2,p1) ) / d_of(q2,q1,q2,q1); + real_t mua = (d_of(p1, q1, q2, q1) * d_of(q2, q1, p2, p1) - d_of(p1, q1, p2, p1) * d_of(q2, q1, q2, q1)) / (d_of(p2, p1, p2, p1) * d_of(q2, q1, q2, q1) - d_of(q2, q1, p2, p1) * d_of(q2, q1, p2, p1)); + real_t mub = (d_of(p1, q1, q2, q1) + mua * d_of(q2, q1, p2, p1)) / d_of(q2, q1, q2, q1); //clip the value between [0..1] constraining the solution to lie on the original curves if (mua < 0) mua = 0; if (mub < 0) mub = 0; if (mua > 1) mua = 1; if (mub > 1) mub = 1; - c1 = p1.linear_interpolate(p2,mua); - c2 = q1.linear_interpolate(q2,mub); -#endif - + c1 = p1.linear_interpolate(p2, mua); + c2 = q1.linear_interpolate(q2, mub); +#else + //this is broken do not use Vector3 u = p2 - p1; Vector3 v = q2 - q1; Vector3 w = p1 - q1; @@ -144,8 +144,9 @@ public: c1 = w + sc * u; c2 = w + tc * v; - // get the difference of the two closest points - //Vector dP = w + (sc * u) - (tc * v); // = L1(sc) - L2(tc) +// get the difference of the two closest points +//Vector dP = w + (sc * u) - (tc * v); // = L1(sc) - L2(tc) +#endif } static real_t get_closest_distance_between_segments(const Vector3 &p_from_a, const Vector3 &p_to_a, const Vector3 &p_from_b, const Vector3 &p_to_b) { diff --git a/core/math/math_funcs.cpp b/core/math/math_funcs.cpp index 6a46b9fbe3..9f5a9c193a 100644 --- a/core/math/math_funcs.cpp +++ b/core/math/math_funcs.cpp @@ -30,7 +30,7 @@ #include "math_funcs.h" #include "core/os/os.h" -pcg32_random_t Math::default_pcg = { 1, PCG_DEFAULT_INC_64 }; +pcg32_random_t Math::default_pcg = { 12047754176567800795ULL, PCG_DEFAULT_INC_64 }; #define PHI 0x9e3779b9 @@ -51,9 +51,7 @@ void Math::seed(uint64_t x) { } void Math::randomize() { - - OS::Time time = OS::get_singleton()->get_time(); - seed(OS::get_singleton()->get_ticks_usec() * (time.hour + 1) * (time.min + 1) * (time.sec + 1) * rand()); // TODO: can be simplified. + seed(OS::get_singleton()->get_ticks_usec() * default_pcg.state + PCG_DEFAULT_INC_64); } uint32_t Math::rand() { diff --git a/core/math/math_funcs.h b/core/math/math_funcs.h index 10426c9243..d71d9bd792 100644 --- a/core/math/math_funcs.h +++ b/core/math/math_funcs.h @@ -157,7 +157,7 @@ public: static uint32_t larger_prime(uint32_t p_val); - static void seed(uint64_t x = 0); + static void seed(uint64_t x); static void randomize(); static uint32_t rand_from_seed(uint64_t *seed); static uint32_t rand(); diff --git a/core/os/input.cpp b/core/os/input.cpp index 6215ad3732..bc388d0bca 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -75,7 +75,7 @@ void Input::_bind_methods() { ClassDB::bind_method(D_METHOD("get_accelerometer"), &Input::get_accelerometer); ClassDB::bind_method(D_METHOD("get_magnetometer"), &Input::get_magnetometer); ClassDB::bind_method(D_METHOD("get_gyroscope"), &Input::get_gyroscope); - //ClassDB::bind_method(D_METHOD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want + //ClassDB::bind_method(D_METHOD("get_mouse_position"),&Input::get_mouse_position); - this is not the function you want ClassDB::bind_method(D_METHOD("get_last_mouse_speed"), &Input::get_last_mouse_speed); ClassDB::bind_method(D_METHOD("get_mouse_button_mask"), &Input::get_mouse_button_mask); ClassDB::bind_method(D_METHOD("set_mouse_mode", "mode"), &Input::set_mouse_mode); diff --git a/core/os/input.h b/core/os/input.h index 4b297a7eef..4f26f097c2 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -77,7 +77,7 @@ public: virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0) = 0; virtual void stop_joy_vibration(int p_device) = 0; - virtual Point2 get_mouse_pos() const = 0; + virtual Point2 get_mouse_position() const = 0; virtual Point2 get_last_mouse_speed() const = 0; virtual int get_mouse_button_mask() const = 0; diff --git a/core/os/os.cpp b/core/os/os.cpp index ab03bb8016..e323e03829 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -507,7 +507,6 @@ OS::OS() { _render_thread_mode = RENDER_THREAD_SAFE; _allow_hidpi = true; - Math::seed(1234567); } OS::~OS() { diff --git a/core/os/os.h b/core/os/os.h index 0abc91e35e..ff2a24f40d 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -144,7 +144,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 Point2 get_mouse_position() 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.cpp b/core/variant.cpp index 6e675d07de..67ce8af483 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -2839,7 +2839,7 @@ uint32_t Variant::hash() const { } #define hash_compare_scalar(p_lhs, p_rhs) \ - ((p_lhs) == (p_rhs)) || (Math::is_nan(p_lhs) == Math::is_nan(p_rhs)) + ((p_lhs) == (p_rhs)) || (Math::is_nan(p_lhs) && Math::is_nan(p_rhs)) #define hash_compare_vector2(p_lhs, p_rhs) \ (hash_compare_scalar((p_lhs).x, (p_rhs).x)) && \ diff --git a/doc/base/classes.xml b/doc/base/classes.xml index f108a48310..9b1f8c788b 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -2985,7 +2985,7 @@ Return the default blend time between animations. </description> </method> - <method name="get_pos" qualifiers="const"> + <method name="get_position" qualifiers="const"> <return type="float"> </return> <description> @@ -6005,7 +6005,7 @@ <description> </description> </method> - <method name="get_pos"> + <method name="get_position"> <return type="float"> </return> <description> @@ -6929,7 +6929,7 @@ <argument index="1" name="phi" type="float"> </argument> <description> - Introduce an additional rotation around the given axis by phi. Only relevant when the matrix is being used as a part of [Transform]. The axis must be a normalized vector. + Introduce an additional rotation around the given axis by phi (radians). Only relevant when the matrix is being used as a part of [Transform]. The axis must be a normalized vector. </description> </method> <method name="scaled"> @@ -8333,7 +8333,7 @@ <argument index="0" name="state" type="Variant"> </argument> <description> - Set the transform state of this CanvasItem. For [Node2D], this is an [Array] with (in order) a [Vector2] for position, a float for rotation and another [Vector2] for scale. For [Control] this is a [Rect2] with the position and size. + Set the transform state of this CanvasItem. For [Node2D], this is an [Array] with (in order) a [Vector2] for position, a float for rotation (radians) and another [Vector2] for scale. For [Control] this is a [Rect2] with the position and size. </description> </method> <method name="get_canvas" qualifiers="const"> @@ -8357,7 +8357,7 @@ Get the transform matrix of this item's canvas. </description> </method> - <method name="get_global_mouse_pos" qualifiers="const"> + <method name="get_global_mouse_position" qualifiers="const"> <return type="Vector2"> </return> <description> @@ -8708,14 +8708,14 @@ <return type="float"> </return> <description> - Return the base rotation for this layer (helper). + Return the base rotation for this layer in radians (helper). </description> </method> <method name="get_rotationd" qualifiers="const"> <return type="float"> </return> <description> - Get rotation of the layer in degree. + Return the base rotation for this layer in degrees. </description> </method> <method name="get_scale" qualifiers="const"> @@ -8763,14 +8763,14 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Set the base rotation for this layer (helper). + Set the base rotation for this layer in radians (helper). </description> </method> <method name="set_rotationd"> <argument index="0" name="degrees" type="float"> </argument> <description> - Set rotation of the layer in degree. + Set the base rotation for this layer in degrees (helper). </description> </method> <method name="set_scale"> @@ -10847,7 +10847,7 @@ <description> </description> </method> - <method name="get_pos" qualifiers="const"> + <method name="get_position" qualifiers="const"> <return type="Vector2"> </return> <description> @@ -10865,12 +10865,14 @@ <return type="float"> </return> <description> + Return the rotation (in radians) </description> </method> <method name="get_rotation_deg" qualifiers="const"> <return type="float"> </return> <description> + Return the rotation (in degrees) </description> </method> <method name="get_scale" qualifiers="const"> @@ -11174,7 +11176,7 @@ Set when the control is ignoring mouse events (even touchpad events send mouse events). (see the MOUSE_FILTER_* constants) </description> </method> - <method name="set_pos"> + <method name="set_position"> <argument index="0" name="pos" type="Vector2"> </argument> <description> @@ -11185,12 +11187,14 @@ <argument index="0" name="radians" type="float"> </argument> <description> + Set the rotation (in radians). </description> </method> <method name="set_rotation_deg"> <argument index="0" name="degrees" type="float"> </argument> <description> + Set the rotation (in degrees). </description> </method> <method name="set_scale"> @@ -14872,7 +14876,7 @@ Get a [String] saved in Pascal format from the file. </description> </method> - <method name="get_pos" qualifiers="const"> + <method name="get_position" qualifiers="const"> <return type="int"> </return> <description> @@ -16414,7 +16418,7 @@ Contains global variables accessible from everywhere. </brief_description> <description> - Contains global variables accessible from everywhere. Use the normal [Object] API, such as "Globals.get(variable)", "Globals.set(variable,value)" or "Globals.has(variable)" to access them. Variables stored in godot.cfg are also loaded into globals, making this object very useful for reading custom game configuration options. + Contains global variables accessible from everywhere. Use the normal [Object] API, such as "Globals.get(variable)", "Globals.set(variable,value)" or "Globals.has(variable)" to access them. Variables stored in the project file (*.godot) are also loaded into globals, making this object very useful for reading custom game configuration options. </description> <methods> <method name="add_property_info"> @@ -25812,7 +25816,7 @@ <argument index="0" name="radians" type="float"> </argument> <description> - Apply a 'radians' rotation to the 2D node, starting from its current rotation. + Apply a rotation (in radians) to the 2D node, starting from its current rotation. </description> </method> <method name="scale"> @@ -39597,12 +39601,14 @@ <return type="Vector3"> </return> <description> + Return the rotation (in radians). </description> </method> <method name="get_rotation_deg" qualifiers="const"> <return type="Vector3"> </return> <description> + Return the rotation (in degrees). </description> </method> <method name="get_scale" qualifiers="const"> @@ -39771,12 +39777,14 @@ <argument index="0" name="rotation_rad" type="Vector3"> </argument> <description> + Set the rotation (in radians). </description> </method> <method name="set_rotation_deg"> <argument index="0" name="rotation_deg" type="Vector3"> </argument> <description> + Set the rotation (in degrees). </description> </method> <method name="set_scale"> @@ -41788,7 +41796,7 @@ <description> </description> </method> - <method name="get_pos" qualifiers="const"> + <method name="get_position" qualifiers="const"> <return type="int"> </return> <description> @@ -46106,6 +46114,7 @@ <return type="float"> </return> <description> + Return the rotation (in radians). </description> </method> <method name="get_scale"> @@ -48386,6 +48395,7 @@ do_property]. <return type="float"> </return> <description> + Return the steering angle (in radians). </description> </method> <method name="set_brake"> @@ -48416,6 +48426,7 @@ do_property]. <argument index="0" name="steering" type="float"> </argument> <description> + Set the steering angle (in radians). </description> </method> </methods> @@ -48846,7 +48857,7 @@ do_property]. Get whether the rendered texture has filters enabled. </description> </method> - <method name="get_mouse_pos" qualifiers="const"> + <method name="get_mouse_position" qualifiers="const"> <return type="Vector2"> </return> <description> diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp index a7349695db..4214ee5a6d 100644 --- a/drivers/gles3/rasterizer_gles3.cpp +++ b/drivers/gles3/rasterizer_gles3.cpp @@ -271,6 +271,62 @@ void RasterizerGLES3::clear_render_target(const Color &p_color) { storage->frame.clear_request_color = p_color; } +void RasterizerGLES3::set_boot_image(const Image &p_image, const Color &p_color, bool p_scale) { + + if (p_image.empty()) + return; + + begin_frame(); + + int window_w = OS::get_singleton()->get_video_mode(0).width; + int window_h = OS::get_singleton()->get_video_mode(0).height; + + glBindFramebuffer(GL_FRAMEBUFFER, RasterizerStorageGLES3::system_fbo); + glViewport(0, 0, window_w, window_h); + glDisable(GL_BLEND); + glDepthMask(GL_FALSE); + glClearColor(p_color.r, p_color.g, p_color.b, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + canvas->canvas_begin(); + + RID texture = storage->texture_create(); + storage->texture_allocate(texture, p_image.get_width(), p_image.get_height(), p_image.get_format(), VS::TEXTURE_FLAG_FILTER); + storage->texture_set_data(texture, p_image); + + Rect2 imgrect(0, 0, p_image.get_width(), p_image.get_height()); + Rect2 screenrect; + if (p_scale) { + + if (window_w > window_h) { + //scale horizontally + screenrect.size.y = window_h; + screenrect.size.x = imgrect.size.x * window_h / imgrect.size.y; + screenrect.pos.x = (window_w - screenrect.size.x) / 2; + + } else { + //scale vertically + screenrect.size.x = window_w; + screenrect.size.y = imgrect.size.y * window_w / imgrect.size.x; + screenrect.pos.y = (window_h - screenrect.size.y) / 2; + } + } else { + + screenrect = imgrect; + screenrect.pos += ((Size2(window_w, window_h) - screenrect.size) / 2.0).floor(); + } + + RasterizerStorageGLES3::Texture *t = storage->texture_owner.get(texture); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, t->tex_id); + canvas->draw_generic_textured_rect(screenrect, Rect2(0, 0, 1, 1)); + glBindTexture(GL_TEXTURE_2D, 0); + canvas->canvas_end(); + + storage->free(texture); // free since it's only one frame that stays there + + OS::get_singleton()->swap_buffers(); +} + void RasterizerGLES3::blit_render_target_to_screen(RID p_render_target, const Rect2 &p_screen_rect, int p_screen) { ERR_FAIL_COND(storage->frame.current_rt); diff --git a/drivers/gles3/rasterizer_gles3.h b/drivers/gles3/rasterizer_gles3.h index ba3715b805..12014cd814 100644 --- a/drivers/gles3/rasterizer_gles3.h +++ b/drivers/gles3/rasterizer_gles3.h @@ -48,6 +48,8 @@ public: virtual RasterizerCanvas *get_canvas(); virtual RasterizerScene *get_scene(); + virtual void set_boot_image(const Image &p_image, const Color &p_color, bool p_scale); + virtual void initialize(); virtual void begin_frame(); virtual void set_current_render_target(RID p_render_target); diff --git a/drivers/gles3/rasterizer_scene_gles3.cpp b/drivers/gles3/rasterizer_scene_gles3.cpp index 0e97e2d459..9cb44349bf 100644 --- a/drivers/gles3/rasterizer_scene_gles3.cpp +++ b/drivers/gles3/rasterizer_scene_gles3.cpp @@ -1216,7 +1216,26 @@ bool RasterizerSceneGLES3::_setup_material(RasterizerStorageGLES3::Material *p_m return rebind; } -void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { +struct RasterizerGLES3Particle { + + float color[4]; + float velocity_active[4]; + float custom[4]; + float xform_1[4]; + float xform_2[4]; + float xform_3[4]; +}; + +struct RasterizerGLES3ParticleSort { + + Vector3 z_dir; + bool operator()(const RasterizerGLES3Particle &p_a, const RasterizerGLES3Particle &p_b) const { + + return z_dir.dot(Vector3(p_a.xform_1[3], p_a.xform_2[3], p_a.xform_3[3])) < z_dir.dot(Vector3(p_b.xform_1[3], p_b.xform_2[3], p_b.xform_3[3])); + } +}; + +void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e, const Transform &p_view_transform) { switch (e->instance->base_type) { @@ -1289,28 +1308,54 @@ void RasterizerSceneGLES3::_setup_geometry(RenderList::Element *e) { RasterizerStorageGLES3::Particles *particles = static_cast<RasterizerStorageGLES3::Particles *>(e->owner); RasterizerStorageGLES3::Surface *s = static_cast<RasterizerStorageGLES3::Surface *>(e->geometry); - glBindVertexArray(s->instancing_array_id); // use the instancing array ID - glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]); //modify the buffer + if (particles->draw_order == VS::PARTICLES_DRAW_ORDER_VIEW_DEPTH && particles->particle_valid_histories[1]) { + + glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffer_histories[1]); //modify the buffer, this was used 2 frames ago so it should be good enough for flushing + RasterizerGLES3Particle *particle_array = (RasterizerGLES3Particle *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 24 * sizeof(float), GL_MAP_READ_BIT | GL_MAP_WRITE_BIT); + + SortArray<RasterizerGLES3Particle, RasterizerGLES3ParticleSort> sorter; + + if (particles->use_local_coords) { + sorter.compare.z_dir = e->instance->transform.affine_inverse().xform(p_view_transform.basis.get_axis(2)).normalized(); + } else { + sorter.compare.z_dir = p_view_transform.basis.get_axis(2).normalized(); + } + + sorter.sort(particle_array, particles->amount); + + glUnmapBuffer(GL_ARRAY_BUFFER); + + glBindVertexArray(s->instancing_array_id); // use the instancing array ID + glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffer_histories[1]); //modify the buffer + + } else { + + glBindVertexArray(s->instancing_array_id); // use the instancing array ID + glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]); //modify the buffer + } int stride = sizeof(float) * 4 * 6; //transform - glEnableVertexAttribArray(8); //xform x - glVertexAttribPointer(8, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 3); - glVertexAttribDivisor(8, 1); - glEnableVertexAttribArray(9); //xform y - glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 4); - glVertexAttribDivisor(9, 1); - glEnableVertexAttribArray(10); //xform z - glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 5); - glVertexAttribDivisor(10, 1); - glEnableVertexAttribArray(11); //color - glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + 0); - glVertexAttribDivisor(11, 1); - glEnableVertexAttribArray(12); //custom - glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 2); - glVertexAttribDivisor(12, 1); + if (particles->draw_order != VS::PARTICLES_DRAW_ORDER_LIFETIME) { + + glEnableVertexAttribArray(8); //xform x + glVertexAttribPointer(8, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 3); + glVertexAttribDivisor(8, 1); + glEnableVertexAttribArray(9); //xform y + glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 4); + glVertexAttribDivisor(9, 1); + glEnableVertexAttribArray(10); //xform z + glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 5); + glVertexAttribDivisor(10, 1); + glEnableVertexAttribArray(11); //color + glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + 0); + glVertexAttribDivisor(11, 1); + glEnableVertexAttribArray(12); //custom + glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 2); + glVertexAttribDivisor(12, 1); + } } break; } @@ -1491,17 +1536,88 @@ void RasterizerSceneGLES3::_render_geometry(RenderList::Element *e) { int amount = particles->amount; - if (s->index_array_len > 0) { + if (particles->draw_order == VS::PARTICLES_DRAW_ORDER_LIFETIME) { + //split + + int stride = sizeof(float) * 4 * 6; + int split = int(Math::ceil(particles->phase * particles->amount)); + + if (amount - split > 0) { + glEnableVertexAttribArray(8); //xform x + glVertexAttribPointer(8, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + stride * split + sizeof(float) * 4 * 3); + glVertexAttribDivisor(8, 1); + glEnableVertexAttribArray(9); //xform y + glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + stride * split + sizeof(float) * 4 * 4); + glVertexAttribDivisor(9, 1); + glEnableVertexAttribArray(10); //xform z + glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + stride * split + sizeof(float) * 4 * 5); + glVertexAttribDivisor(10, 1); + glEnableVertexAttribArray(11); //color + glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + stride * split + 0); + glVertexAttribDivisor(11, 1); + glEnableVertexAttribArray(12); //custom + glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + stride * split + sizeof(float) * 4 * 2); + glVertexAttribDivisor(12, 1); - glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, amount); + if (s->index_array_len > 0) { - storage->info.render_vertices_count += s->index_array_len * amount; + glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, amount - split); + + storage->info.render_vertices_count += s->index_array_len * (amount - split); + + } else { + + glDrawArraysInstanced(gl_primitive[s->primitive], 0, s->array_len, amount - split); + + storage->info.render_vertices_count += s->array_len * (amount - split); + } + } + + if (split > 0) { + glEnableVertexAttribArray(8); //xform x + glVertexAttribPointer(8, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 3); + glVertexAttribDivisor(8, 1); + glEnableVertexAttribArray(9); //xform y + glVertexAttribPointer(9, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 4); + glVertexAttribDivisor(9, 1); + glEnableVertexAttribArray(10); //xform z + glVertexAttribPointer(10, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 5); + glVertexAttribDivisor(10, 1); + glEnableVertexAttribArray(11); //color + glVertexAttribPointer(11, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + 0); + glVertexAttribDivisor(11, 1); + glEnableVertexAttribArray(12); //custom + glVertexAttribPointer(12, 4, GL_FLOAT, GL_FALSE, stride, ((uint8_t *)NULL) + sizeof(float) * 4 * 2); + glVertexAttribDivisor(12, 1); + + if (s->index_array_len > 0) { + + glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, split); + + storage->info.render_vertices_count += s->index_array_len * split; + + } else { + + glDrawArraysInstanced(gl_primitive[s->primitive], 0, s->array_len, split); + + storage->info.render_vertices_count += s->array_len * split; + } + } } else { - glDrawArraysInstanced(gl_primitive[s->primitive], 0, s->array_len, amount); + if (s->index_array_len > 0) { - storage->info.render_vertices_count += s->array_len * amount; + glDrawElementsInstanced(gl_primitive[s->primitive], s->index_array_len, (s->array_len >= (1 << 16)) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT, 0, amount); + + storage->info.render_vertices_count += s->index_array_len * amount; + + } else { + + glDrawArraysInstanced(gl_primitive[s->primitive], 0, s->array_len, amount); + + storage->info.render_vertices_count += s->array_len * amount; + } } } break; @@ -1841,7 +1957,7 @@ void RasterizerSceneGLES3::_render_list(RenderList::Element **p_elements, int p_ if (e->owner != prev_owner || prev_base_type != e->instance->base_type || prev_geometry != e->geometry) { - _setup_geometry(e); + _setup_geometry(e, p_view_transform); storage->info.render_surface_switch_count++; } diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h index 10136ff8d7..33698fc267 100644 --- a/drivers/gles3/rasterizer_scene_gles3.h +++ b/drivers/gles3/rasterizer_scene_gles3.h @@ -692,7 +692,7 @@ public: _FORCE_INLINE_ void _set_cull(bool p_front, bool p_reverse_cull); _FORCE_INLINE_ bool _setup_material(RasterizerStorageGLES3::Material *p_material, bool p_alpha_pass); - _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e); + _FORCE_INLINE_ void _setup_geometry(RenderList::Element *e, const Transform &p_view_transform); _FORCE_INLINE_ void _render_geometry(RenderList::Element *e); _FORCE_INLINE_ void _setup_light(RenderList::Element *e, const Transform &p_view_transform); diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp index 7fc2185e9a..9316b025eb 100644 --- a/drivers/gles3/rasterizer_storage_gles3.cpp +++ b/drivers/gles3/rasterizer_storage_gles3.cpp @@ -3005,6 +3005,7 @@ void RasterizerStorageGLES3::mesh_set_custom_aabb(RID p_mesh, const Rect3 &p_aab mesh->custom_aabb = p_aabb; } + Rect3 RasterizerStorageGLES3::mesh_get_custom_aabb(RID p_mesh) const { const Mesh *mesh = mesh_owner.getornull(p_mesh); @@ -4883,6 +4884,22 @@ void RasterizerStorageGLES3::particles_set_amount(RID p_particles, int p_amount) } } + if (particles->histories_enabled) { + + for (int i = 0; i < 2; i++) { + glBindVertexArray(particles->particle_vao_histories[i]); + + glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffer_histories[i]); + glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), data, GL_DYNAMIC_COPY); + + for (int j = 0; j < 6; j++) { + glEnableVertexAttribArray(j); + glVertexAttribPointer(j, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (j * 16)); + } + particles->particle_valid_histories[i] = false; + } + } + glBindVertexArray(0); particles->prev_ticks = 0; @@ -4917,18 +4934,61 @@ void RasterizerStorageGLES3::particles_set_randomness_ratio(RID p_particles, flo ERR_FAIL_COND(!particles); particles->randomness = p_ratio; } + +void RasterizerStorageGLES3::_particles_update_histories(Particles *particles) { + + bool needs_histories = particles->draw_order == VS::PARTICLES_DRAW_ORDER_VIEW_DEPTH; + + if (needs_histories == particles->histories_enabled) + return; + + particles->histories_enabled = needs_histories; + + int floats = particles->amount * 24; + + if (!needs_histories) { + + glDeleteBuffers(2, particles->particle_buffer_histories); + glDeleteVertexArrays(2, particles->particle_vao_histories); + + } else { + + glGenBuffers(2, particles->particle_buffer_histories); + glGenVertexArrays(2, particles->particle_vao_histories); + + for (int i = 0; i < 2; i++) { + glBindVertexArray(particles->particle_vao_histories[i]); + + glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffer_histories[i]); + glBufferData(GL_ARRAY_BUFFER, floats * sizeof(float), NULL, GL_DYNAMIC_COPY); + + for (int j = 0; j < 6; j++) { + glEnableVertexAttribArray(j); + glVertexAttribPointer(j, 4, GL_FLOAT, GL_FALSE, sizeof(float) * 4 * 6, ((uint8_t *)0) + (j * 16)); + } + + particles->particle_valid_histories[i] = false; + } + } + + particles->clear = true; +} + void RasterizerStorageGLES3::particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) { Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); particles->custom_aabb = p_aabb; + _particles_update_histories(particles); + particles->instance_change_notify(); } -void RasterizerStorageGLES3::particles_set_gravity(RID p_particles, const Vector3 &p_gravity) { + +void RasterizerStorageGLES3::particles_set_speed_scale(RID p_particles, float p_scale) { Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND(!particles); - particles->gravity = p_gravity; + particles->speed_scale = p_scale; } void RasterizerStorageGLES3::particles_set_use_local_coordinates(RID p_particles, bool p_enable) { @@ -4968,6 +5028,7 @@ void RasterizerStorageGLES3::particles_set_draw_order(RID p_particles, VS::Parti ERR_FAIL_COND(!particles); particles->draw_order = p_order; + _particles_update_histories(particles); } void RasterizerStorageGLES3::particles_set_draw_passes(RID p_particles, int p_passes) { @@ -5001,7 +5062,39 @@ Rect3 RasterizerStorageGLES3::particles_get_current_aabb(RID p_particles) { const Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND_V(!particles, Rect3()); - return particles->computed_aabb; + glBindBuffer(GL_ARRAY_BUFFER, particles->particle_buffers[0]); + + float *data = (float *)glMapBufferRange(GL_ARRAY_BUFFER, 0, particles->amount * 16 * 6, GL_MAP_READ_BIT); + Rect3 aabb; + + Transform inv = particles->emission_transform.affine_inverse(); + + for (int i = 0; i < particles->amount; i++) { + int ofs = i * 24; + Vector3 pos = Vector3(data[ofs + 15], data[ofs + 19], data[ofs + 23]); + if (!particles->use_local_coords) { + pos = inv.xform(pos); + } + if (i == 0) + aabb.pos = pos; + else + aabb.expand_to(pos); + } + + glUnmapBuffer(GL_ARRAY_BUFFER); + glBindBuffer(GL_ARRAY_BUFFER, 0); + + float longest_axis = 0; + for (int i = 0; i < particles->draw_passes.size(); i++) { + if (particles->draw_passes[i].is_valid()) { + Rect3 maabb = mesh_get_aabb(particles->draw_passes[i], RID()); + longest_axis = MAX(maabb.get_longest_axis_size(), longest_axis); + } + } + + aabb.grow_by(longest_axis); + + return aabb; } Rect3 RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const { @@ -5009,7 +5102,7 @@ Rect3 RasterizerStorageGLES3::particles_get_aabb(RID p_particles) const { const Particles *particles = particles_owner.getornull(p_particles); ERR_FAIL_COND_V(!particles, Rect3()); - return Rect3(Vector3(-1, -1, -1), Vector3(2, 2, 2)); + return particles->custom_aabb; } void RasterizerStorageGLES3::particles_set_emission_transform(RID p_particles, const Transform &p_transform) { @@ -5022,7 +5115,7 @@ void RasterizerStorageGLES3::particles_set_emission_transform(RID p_particles, c void RasterizerStorageGLES3::_particles_process(Particles *particles, float p_delta) { - float new_phase = Math::fmod((float)particles->phase + (p_delta / particles->lifetime), (float)1.0); + float new_phase = Math::fmod((float)particles->phase + (p_delta / particles->lifetime) * particles->speed_scale, (float)1.0); if (particles->clear) { particles->cycle_number = 0; @@ -5034,7 +5127,7 @@ void RasterizerStorageGLES3::_particles_process(Particles *particles, float p_de shaders.particles.set_uniform(ParticlesShaderGLES3::PREV_SYSTEM_PHASE, particles->phase); particles->phase = new_phase; - shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta); + shaders.particles.set_uniform(ParticlesShaderGLES3::DELTA, p_delta * particles->speed_scale); shaders.particles.set_uniform(ParticlesShaderGLES3::CLEAR, particles->clear); if (particles->use_local_coords) shaders.particles.set_uniform(ParticlesShaderGLES3::EMISSION_TRANSFORM, Transform()); @@ -5154,7 +5247,6 @@ void RasterizerStorageGLES3::update_particles() { shaders.particles.set_uniform(ParticlesShaderGLES3::TIME, Color(frame.time[0], frame.time[1], frame.time[2], frame.time[3])); shaders.particles.set_uniform(ParticlesShaderGLES3::EXPLOSIVENESS, particles->explosiveness); shaders.particles.set_uniform(ParticlesShaderGLES3::LIFETIME, particles->lifetime); - shaders.particles.set_uniform(ParticlesShaderGLES3::GRAVITY, particles->gravity); shaders.particles.set_uniform(ParticlesShaderGLES3::ATTRACTOR_COUNT, 0); shaders.particles.set_uniform(ParticlesShaderGLES3::EMITTING, particles->emitting); shaders.particles.set_uniform(ParticlesShaderGLES3::RANDOMNESS, particles->randomness); @@ -5201,6 +5293,20 @@ void RasterizerStorageGLES3::update_particles() { } particle_update_list.remove(particle_update_list.first()); + + if (particles->histories_enabled) { + + SWAP(particles->particle_buffer_histories[0], particles->particle_buffer_histories[1]); + SWAP(particles->particle_vao_histories[0], particles->particle_vao_histories[1]); + SWAP(particles->particle_valid_histories[0], particles->particle_valid_histories[1]); + + //copy + glBindBuffer(GL_COPY_READ_BUFFER, particles->particle_buffers[0]); + glBindBuffer(GL_COPY_WRITE_BUFFER, particles->particle_buffer_histories[0]); + glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, particles->amount * 24 * sizeof(float)); + + particles->particle_valid_histories[0] = true; + } } glDisable(GL_RASTERIZER_DISCARD); @@ -5427,8 +5533,8 @@ void RasterizerStorageGLES3::_render_target_allocate(RenderTarget *rt) { glGenTextures(1, &rt->depth); glBindTexture(GL_TEXTURE_2D, rt->depth); - glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, rt->width, rt->height, 0, - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH24_STENCIL8, rt->width, rt->height, 0, + GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); @@ -6394,6 +6500,7 @@ void RasterizerStorageGLES3::initialize() { frame.count = 0; frame.prev_tick = 0; frame.delta = 0; + frame.current_rt = NULL; config.keep_original_textures = false; } diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h index 6ae9fd18a2..bb4a7e23a1 100644 --- a/drivers/gles3/rasterizer_storage_gles3.h +++ b/drivers/gles3/rasterizer_storage_gles3.h @@ -995,7 +995,6 @@ public: float explosiveness; float randomness; Rect3 custom_aabb; - Vector3 gravity; bool use_local_coords; RID process_material; @@ -1003,11 +1002,14 @@ public: Vector<RID> draw_passes; - Rect3 computed_aabb; - GLuint particle_buffers[2]; GLuint particle_vaos[2]; + GLuint particle_buffer_histories[2]; + GLuint particle_vao_histories[2]; + bool particle_valid_histories[2]; + bool histories_enabled; + SelfList<Particles> particle_element; float phase; @@ -1016,6 +1018,8 @@ public: uint32_t cycle_number; + float speed_scale; + int fixed_fps; bool fractional_delta; float frame_remainder; @@ -1037,6 +1041,10 @@ public: fixed_fps = 0; fractional_delta = false; frame_remainder = 0; + histories_enabled = false; + speed_scale = 1.0; + + custom_aabb = Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8)); draw_order = VS::PARTICLES_DRAW_ORDER_INDEX; particle_buffers[0] = 0; @@ -1054,6 +1062,10 @@ public: glDeleteBuffers(2, particle_buffers); glDeleteVertexArrays(2, particle_vaos); + if (histories_enabled) { + glDeleteBuffers(2, particle_buffer_histories); + glDeleteVertexArrays(2, particle_vao_histories); + } } }; @@ -1072,7 +1084,7 @@ public: virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio); virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio); virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb); - virtual void particles_set_gravity(RID p_particles, const Vector3 &p_gravity); + virtual void particles_set_speed_scale(RID p_particles, float p_scale); virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable); virtual void particles_set_process_material(RID p_particles, RID p_material); virtual void particles_set_fixed_fps(RID p_particles, int p_fps); @@ -1087,6 +1099,8 @@ public: virtual Rect3 particles_get_current_aabb(RID p_particles); virtual Rect3 particles_get_aabb(RID p_particles) const; + virtual void _particles_update_histories(Particles *particles); + virtual void particles_set_emission_transform(RID p_particles, const Transform &p_transform); void _particles_process(Particles *p_particles, float p_delta); diff --git a/drivers/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl index 347b15d639..fa12dd7408 100644 --- a/drivers/gles3/shaders/particles.glsl +++ b/drivers/gles3/shaders/particles.glsl @@ -30,7 +30,7 @@ uniform float explosiveness; uniform float randomness; uniform vec4 time; uniform float delta; -uniform vec3 gravity; + uniform int attractor_count; uniform Attractor attractors[MAX_ATTRACTORS]; uniform bool clear; @@ -69,9 +69,19 @@ uint hash(uint x) { void main() { +#ifdef PARTICLES_COPY + + out_color=color; + out_velocity_active=velocity_active; + out_custom = custom; + out_xform_1 = xform_1; + out_xform_2 = xform_2; + out_xform_3 = xform_3; + +#else + bool apply_forces=true; bool apply_velocity=true; - vec3 current_gravity = gravity; float local_delta=delta; float mass = 1.0; @@ -91,7 +101,7 @@ void main() { restart_phase*= (1.0-explosiveness); bool restart=false; - bool active = velocity_active.a > 0.5; + bool shader_active = velocity_active.a > 0.5; if (system_phase > prev_system_phase) { if (prev_system_phase < restart_phase && system_phase >= restart_phase) { @@ -124,7 +134,7 @@ void main() { uint particle_number = current_cycle * uint(total_particles) + uint(gl_VertexID); if (restart) { - active=emitting; + shader_active=emitting; } mat4 xform; @@ -138,7 +148,7 @@ void main() { out_velocity_active=vec4(0.0); out_custom=vec4(0.0); if (!restart) - active=false; + shader_active=false; xform = mat4( vec4(1.0,0.0,0.0,0.0), @@ -153,7 +163,7 @@ void main() { xform = transpose(mat4(xform_1,xform_2,xform_3,vec4(vec3(0.0),1.0))); } - if (active) { + if (shader_active) { //execute shader { @@ -164,11 +174,11 @@ VERTEX_SHADER_CODE if (true) { - vec3 force = current_gravity; + vec3 force = vec3(0.0); for(int i=0;i<attractor_count;i++) { vec3 rel_vec = xform[3].xyz - attractors[i].pos; - float dist = rel_vec.length(); + float dist = length(rel_vec); if (attractors[i].radius < dist) continue; if (attractors[i].eat_radius>0 && attractors[i].eat_radius > dist) { @@ -205,12 +215,13 @@ VERTEX_SHADER_CODE xform = transpose(xform); - out_velocity_active.a = mix(0.0,1.0,active); + out_velocity_active.a = mix(0.0,1.0,shader_active); out_xform_1 = xform[0]; out_xform_2 = xform[1]; out_xform_3 = xform[2]; +#endif //PARTICLES_COPY } diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 206559ab3d..67eb5cefdf 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -76,7 +76,7 @@ public: //virtual void set_mouse_show(bool p_show); //virtual void set_mouse_grab(bool p_grab); //virtual bool is_mouse_grab_enabled() const = 0; - //virtual void get_mouse_pos(int &x, int &y) const; + //virtual void get_mouse_position(int &x, int &y) const; //virtual void set_window_title(const String& p_title); //virtual void set_video_mode(const VideoMode& p_video_mode); diff --git a/editor/animation_editor.cpp b/editor/animation_editor.cpp index 16606b5d12..447f57a73f 100644 --- a/editor/animation_editor.cpp +++ b/editor/animation_editor.cpp @@ -1724,7 +1724,7 @@ bool AnimationKeyEditor::_edit_if_single_selection() { curve_edit->set_transition(animation->track_get_key_transition(idx, key)); /*key_edit_dialog->set_size( Size2( 200,200) ); - key_edit_dialog->set_pos( track_editor->get_global_pos() + ofs + mpos +Point2(-100,20)); + key_edit_dialog->set_position( track_editor->get_global_position() + ofs + mpos +Point2(-100,20)); key_edit_dialog->popup();*/ } @@ -1983,7 +1983,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { track_menu->add_item(TTR("Duplicate Transposed"), RIGHT_MENU_DUPLICATE_TRANSPOSE); track_menu->add_item(TTR("Remove Selection"), RIGHT_MENU_REMOVE); - track_menu->set_pos(te->get_global_pos() + mpos); + track_menu->set_position(te->get_global_position() + mpos); interp_editing = -1; cont_editing = -1; @@ -2064,7 +2064,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { Rect2 area(ofs.x, ofs.y + ((int(mpos.y) / h) + 1) * h, name_limit, h); track_name->set_text(animation->track_get_path(idx)); - track_name->set_pos(te->get_global_pos() + area.pos); + track_name->set_position(te->get_global_position() + area.pos); track_name->set_size(area.size); track_name->show_modal(); track_name->grab_focus(); @@ -2214,7 +2214,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h; int popup_x = size.width - track_ofs[1]; - track_menu->set_pos(te->get_global_pos() + Point2(popup_x, popup_y)); + track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y)); wrap_editing = idx; interp_editing = -1; @@ -2237,7 +2237,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h; int popup_x = size.width - track_ofs[2]; - track_menu->set_pos(te->get_global_pos() + Point2(popup_x, popup_y)); + track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y)); interp_editing = idx; cont_editing = -1; @@ -2260,7 +2260,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { int popup_y = ofs.y + ((int(mpos.y) / h) + 2) * h; int popup_x = size.width - track_ofs[3]; - track_menu->set_pos(te->get_global_pos() + Point2(popup_x, popup_y)); + track_menu->set_position(te->get_global_position() + Point2(popup_x, popup_y)); interp_editing = -1; wrap_editing = -1; @@ -2309,7 +2309,7 @@ void AnimationKeyEditor::_track_editor_gui_input(const InputEvent &p_input) { cvi_track = idx; cvi_pos = pos; - type_menu->set_pos(get_global_pos() + mpos + ofs); + type_menu->set_position(get_global_position() + mpos + ofs); type_menu->popup(); return; } @@ -3749,7 +3749,7 @@ AnimationKeyEditor::AnimationKeyEditor() { root = NULL; //menu = memnew( MenuButton ); //menu->set_flat(true); - //menu->set_pos(Point2()); + //menu->set_position(Point2()); //add_child(menu); zoomicon = memnew(TextureRect); @@ -3891,7 +3891,7 @@ AnimationKeyEditor::AnimationKeyEditor() { /* l = memnew( Label ); l->set_text("Base: "); - l->set_pos(Point2(0,3)); + l->set_position(Point2(0,3)); //dr_panel->add_child(l);*/ //menu->get_popup()->connect("id_pressed",this,"_menu_callback"); diff --git a/editor/call_dialog.cpp b/editor/call_dialog.cpp index d2b46863b0..8cf9ed6ef4 100644 --- a/editor/call_dialog.cpp +++ b/editor/call_dialog.cpp @@ -290,8 +290,8 @@ CallDialog::CallDialog() { property_editor->hide_top_label(); add_child(property_editor); - method_label = memnew( Label ); - method_label->set_pos( Point2( 15,25) ); + method_label = memnew(Label); + method_label->set_position(Point2( 15,25)); method_label->set_text(TTR("Method List:")); add_child(method_label); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index cc20912612..4ec2a3c391 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -64,7 +64,7 @@ GotoLineDialog::GotoLineDialog() { set_title(TTR("Go to Line")); Label *l = memnew(Label); l->set_text(TTR("Line Number:")); - l->set_pos(Point2(5, 5)); + l->set_position(Point2(5, 5)); add_child(l); line = memnew(LineEdit); @@ -1071,7 +1071,8 @@ void CodeTextEditor::update_editor_settings() { text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); text_editor->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); - text_editor->set_tab_size(EditorSettings::get_singleton()->get("text_editor/indent/tab_size")); + text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type") == "Tabs" ? 0 : 1); + text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); text_editor->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/line_numbers/line_numbers_zero_padded")); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index 67d9977149..6ef32a6afd 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -342,7 +342,7 @@ void EditorAudioBus::_effect_edited() { if (effect->get_metadata(0) == Variant()) { Rect2 area = effects->get_item_rect(effect); - effect_options->set_pos(effects->get_global_pos() + area.pos + Vector2(0, area.size.y)); + effect_options->set_position(effects->get_global_position() + area.pos + Vector2(0, area.size.y)); effect_options->popup(); //add effect } else { @@ -394,7 +394,7 @@ void EditorAudioBus::_gui_input(const InputEvent &p_event) { if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index == 2 && p_event.mouse_button.pressed) { Vector2 pos = Vector2(p_event.mouse_button.x, p_event.mouse_button.y); - delete_popup->set_pos(get_global_pos() + pos); + delete_popup->set_position(get_global_position() + pos); delete_popup->popup(); } } @@ -420,7 +420,7 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) { c->add_child(p); p->add_style_override("panel", get_stylebox("focus", "Button")); p->set_size(get_size()); - p->set_pos(-p_point); + p->set_position(-p_point); set_drag_preview(c); Dictionary d; d["type"] = "move_audio_bus"; @@ -576,7 +576,7 @@ void EditorAudioBus::_effect_rmb(const Vector2 &p_pos) { if (item->get_metadata(0).get_type() != Variant::INT) return; - delete_effect_popup->set_pos(get_global_mouse_pos()); + delete_effect_popup->set_position(get_global_mouse_position()); delete_effect_popup->popup(); } diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 2612a2af16..3fb2923696 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -487,6 +487,22 @@ bool EditorFileSystem::_check_missing_imported_files(const String &p_path) { return true; } +static bool _find_project(const String &p_path) { + DirAccess *dir_access = DirAccess::create_for_path(p_path); + bool ret = false; + while (true) { + bool is_dir; + String file = dir_access->get_next(&is_dir); + if (file == "") + break; + if (file.ends_with(".godot")) { + ret = true; + } + } + memdelete(dir_access); + return ret; +} + void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess *da, const ScanProgress &p_progress) { List<String> dirs; @@ -509,8 +525,9 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess if (f.begins_with(".")) //ignore hidden and . / .. continue; - if (FileAccess::exists(cd.plus_file(f).plus_file("godot.cfg"))) // skip if another project inside this + if (_find_project(cd.plus_file(f))) { continue; + } dirs.push_back(f); @@ -676,34 +693,35 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const while (true) { bool isdir; - String f = da->get_next(&isdir); - if (f == "") + String file = da->get_next(&isdir); + if (file == "") break; if (isdir) { - if (f.begins_with(".")) //ignore hidden and . / .. + if (file.begins_with(".")) //ignore hidden and . / .. continue; - int idx = p_dir->find_dir_index(f); + int idx = p_dir->find_dir_index(file); if (idx == -1) { - if (FileAccess::exists(cd.plus_file(f).plus_file("godot.cfg"))) // skip if another project inside this + if (_find_project(cd.plus_file(file))) { continue; + } EditorFileSystemDirectory *efd = memnew(EditorFileSystemDirectory); efd->parent = p_dir; - efd->name = f; + efd->name = file; DirAccess *d = DirAccess::create(DirAccess::ACCESS_RESOURCES); - d->change_dir(cd.plus_file(f)); + d->change_dir(cd.plus_file(file)); _scan_new_dir(efd, d, p_progress.get_sub(1, 1)); memdelete(d); ItemAction ia; ia.action = ItemAction::ACTION_DIR_ADD; ia.dir = p_dir; - ia.file = f; + ia.file = file; ia.new_dir = efd; scan_actions.push_back(ia); } else { @@ -711,16 +729,16 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const } } else { - String ext = f.get_extension().to_lower(); + String ext = file.get_extension().to_lower(); if (!valid_extensions.has(ext)) continue; //invalid - int idx = p_dir->find_file_index(f); + int idx = p_dir->find_file_index(file); if (idx == -1) { //never seen this file, add actition to add it EditorFileSystemDirectory::FileInfo *fi = memnew(EditorFileSystemDirectory::FileInfo); - fi->file = f; + fi->file = file; String path = cd.plus_file(fi->file); fi->modified_time = FileAccess::get_modified_time(path); @@ -731,7 +749,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const ItemAction ia; ia.action = ItemAction::ACTION_FILE_ADD; ia.dir = p_dir; - ia.file = f; + ia.file = file; ia.new_file = fi; scan_actions.push_back(ia); } @@ -739,14 +757,14 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const if (import_extensions.has(ext)) { //if it can be imported, and it was added, it needs to be reimported print_line("REIMPORT: file was not found before, reimport"); - print_line("at dir: " + p_dir->get_path() + " file: " + f); + print_line("at dir: " + p_dir->get_path() + " file: " + file); for (int i = 0; i < p_dir->files.size(); i++) { print_line(itos(i) + ": " + p_dir->files[i]->file); } ItemAction ia; ia.action = ItemAction::ACTION_FILE_REIMPORT; ia.dir = p_dir; - ia.file = f; + ia.file = file; scan_actions.push_back(ia); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 1bd91d753f..cc7ee44902 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -236,7 +236,7 @@ void EditorNode::_notification(int p_what) { Rect2 grect = scene_root_base->get_global_rect(); Rect2 grectsrp = scene_root_parent->get_global_rect(); if (grect!=grectsrp) { - scene_root_parent->set_pos(grect.pos); + scene_root_parent->set_position(grect.pos); scene_root_parent->set_size(grect.size); } } @@ -447,18 +447,6 @@ void EditorNode::_sources_changed(bool p_exist) { void EditorNode::_vp_resized() { } -void EditorNode::_rebuild_import_menu() { - PopupMenu *p = import_menu->get_popup(); - p->clear(); -//p->add_item(TTR("Node From Scene"), FILE_IMPORT_SUBSCENE); -//p->add_separator(); -#if 0 - for (int i = 0; i < editor_import_export->get_import_plugin_count(); i++) { - p->add_item(editor_import_export->get_import_plugin(i)->get_visible_name(), IMPORT_PLUGIN_BASE + i); - } -#endif -} - void EditorNode::_node_renamed() { if (property_editor) @@ -2815,7 +2803,7 @@ void EditorNode::set_addon_plugin_enabled(const String &p_addon, bool p_enabled) } if (!script->is_tool()) { - show_warning("Unable to load addon script from path: '" + path + "' Script is does not support tool mode."); + show_warning("Unable to load addon script from path: '" + path + "' Script is not in tool mode."); return; } @@ -4469,7 +4457,7 @@ Variant EditorNode::drag_resource(const Ref<Resource> &p_res, Control *p_from) { p_from->set_drag_preview(drag_control); //wait until it enters scene - label->set_pos(Point2((preview->get_width() - label->get_minimum_size().width) / 2, preview->get_height())); + label->set_position(Point2((preview->get_width() - label->get_minimum_size().width) / 2, preview->get_height())); Dictionary drag_data; drag_data["type"] = "resource"; @@ -5152,7 +5140,7 @@ EditorNode::EditorNode() { //left_menu_hb->add_child( prev_scene ); prev_scene->connect("pressed", this, "_menu_option", make_binds(FILE_OPEN_PREV)); gui_base->add_child(prev_scene); - prev_scene->set_pos(Point2(3, 24)); + prev_scene->set_position(Point2(3, 24)); prev_scene->hide(); ED_SHORTCUT("editor/next_tab", TTR("Next tab"), KEY_MASK_CMD + KEY_TAB); @@ -5232,7 +5220,7 @@ EditorNode::EditorNode() { #if 0 node_menu = memnew( MenuButton ); node_menu->set_text("Node"); - node_menu->set_pos( Point2( 50,0) ); + node_menu->set_position( Point2( 50,0) ); menu_panel->add_child( node_menu ); p=node_menu->get_popup(); @@ -5253,19 +5241,10 @@ EditorNode::EditorNode() { resource_menu = memnew( MenuButton ); resource_menu->set_text("Resource"); - resource_menu->set_pos( Point2( 90,0) ); + resource_menu->set_position( Point2( 90,0) ); menu_panel->add_child( resource_menu ); #endif - import_menu = memnew(MenuButton); - import_menu->set_tooltip(TTR("Import assets to the project.")); - import_menu->set_text(TTR("Import")); - //import_menu->set_icon(gui_base->get_icon("Save","EditorIcons")); - left_menu_hb->add_child(import_menu); - - p = import_menu->get_popup(); - p->connect("id_pressed", this, "_menu_option"); - tool_menu = memnew(MenuButton); tool_menu->set_tooltip(TTR("Miscellaneous project or scene-wide tools.")); tool_menu->set_text(TTR("Tools")); @@ -5288,7 +5267,7 @@ EditorNode::EditorNode() { //Separator *s1 = memnew( VSeparator ); //menu_panel->add_child(s1); - //s1->set_pos(Point2(210,4)); + //s1->set_position(Point2(210,4)); //s1->set_size(Point2(10,15)); play_cc = memnew(CenterContainer); @@ -5403,7 +5382,7 @@ EditorNode::EditorNode() { /* run_settings_button = memnew( ToolButton ); menu_panel->add_child(run_settings_button); - run_settings_button->set_pos(Point2(305,0)); + run_settings_button->set_position(Point2(305,0)); run_settings_button->set_focus_mode(Control::FOCUS_NONE); run_settings_button->set_icon(gui_base->get_icon("Run","EditorIcons")); run_settings_button->connect("pressed", this,"_menu_option",make_binds(RUN_SETTINGS)); @@ -5496,7 +5475,7 @@ EditorNode::EditorNode() { /* Separator *s2 = memnew( VSeparator ); menu_panel->add_child(s2); - s2->set_pos(Point2(338,4)); + s2->set_position(Point2(338,4)); s2->set_size(Point2(10,15)); */ @@ -5728,7 +5707,7 @@ EditorNode::EditorNode() { /* animation_menu = memnew( ToolButton ); - animation_menu->set_pos(Point2(500,0)); + animation_menu->set_position(Point2(500,0)); animation_menu->set_size(Size2(20,20)); animation_menu->set_toggle_mode(true); animation_menu->set_focus_mode(Control::FOCUS_NONE); @@ -5960,8 +5939,6 @@ EditorNode::EditorNode() { circle_step_frame = Engine::get_singleton()->get_frames_drawn(); circle_step = 0; - _rebuild_import_menu(); - editor_plugin_screen = NULL; editor_plugins_over = memnew(EditorPluginList); diff --git a/editor/editor_node.h b/editor/editor_node.h index e7f4085fc5..7de713eae9 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -242,7 +242,6 @@ private: HBoxContainer *menu_hb; Control *viewport; MenuButton *file_menu; - MenuButton *import_menu; MenuButton *tool_menu; ToolButton *export_button; ToolButton *prev_scene; @@ -447,8 +446,6 @@ private: void _show_messages(); void _vp_resized(); - void _rebuild_import_menu(); - void _save_scene(String p_file, int idx = -1); void _instance_request(const Vector<String> &p_files); diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index 33dc30fb73..98e0808ba5 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -80,7 +80,7 @@ void EditorPath::_gui_input(const InputEvent &p_event) { objects.clear(); popup->clear(); _add_children_to_popup(obj); - popup->set_pos(get_global_pos() + Vector2(0, get_size().height)); + popup->set_position(get_global_position() + Vector2(0, get_size().height)); popup->set_size(Size2(get_size().width, 1)); popup->popup(); } diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 8ea5d16bbf..35373eb815 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -506,7 +506,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("interface/dim_editor_on_dialog_popup", true); set("interface/dim_amount", 0.6f); hints["interface/dim_amount"] = PropertyInfo(Variant::REAL, "interface/dim_amount", PROPERTY_HINT_RANGE, "0,1,0.01", PROPERTY_USAGE_DEFAULT); - set("interface/dim_transition_time", 0.11f); + set("interface/dim_transition_time", 0.08f); hints["interface/dim_transition_time"] = PropertyInfo(Variant::REAL, "interface/dim_transition_time", PROPERTY_HINT_RANGE, "0,1,0.001", PROPERTY_USAGE_DEFAULT); set("filesystem/directories/autoscan_project_path", ""); @@ -529,8 +529,11 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/highlighting/highlight_all_occurrences", true); set("text_editor/cursor/scroll_past_end_of_file", false); - set("text_editor/indent/tab_size", 4); - hints["text_editor/indent/tab_size"] = PropertyInfo(Variant::INT, "text_editor/indent/tab_size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes. + set("text_editor/indent/type", 0); + hints["text_editor/indent/type"] = PropertyInfo(Variant::STRING, "text_editor/indent/type", PROPERTY_HINT_ENUM, "Tabs,Spaces"); + set("text_editor/indent/size", 4); + hints["text_editor/indent/size"] = PropertyInfo(Variant::INT, "text_editor/indent/size", PROPERTY_HINT_RANGE, "1, 64, 1"); // size of 0 crashes. + set("text_editor/indent/convert_indent_on_save", false); set("text_editor/indent/draw_tabs", true); set("text_editor/line_numbers/show_line_numbers", true); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 79bce2c150..9d10117418 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1102,7 +1102,7 @@ void FileSystemDock::_dir_rmb_pressed(const Vector2 &p_pos) { folder_options->add_item(TTR("Expand all"), FOLDER_EXPAND_ALL); folder_options->add_item(TTR("Collapse all"), FOLDER_COLLAPSE_ALL); - folder_options->set_pos(tree->get_global_pos() + p_pos); + folder_options->set_position(tree->get_global_position() + p_pos); folder_options->popup(); } @@ -1526,7 +1526,7 @@ void FileSystemDock::_files_list_rmb_select(int p_item, const Vector2 &p_pos) { */ } - file_options->set_pos(files->get_global_pos() + p_pos); + file_options->set_position(files->get_global_position() + p_pos); file_options->popup(); } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index c79bdef71d..0be7b202a8 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -87,7 +87,7 @@ void AnimationPlayerEditor::_notification(int p_what) { } last_active = player->is_playing(); - //seek->set_val(player->get_pos()); + //seek->set_val(player->get_position()); updating = false; } @@ -1386,13 +1386,13 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor) { add_child(name_dialog); name = memnew(LineEdit); name_dialog->add_child(name); - name->set_pos(Point2(18, 30)); + name->set_position(Point2(18, 30)); name->set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 10); name_dialog->register_text_enter(name); l = memnew(Label); l->set_text(TTR("Animation Name:")); - l->set_pos(Point2(10, 10)); + l->set_position(Point2(10, 10)); name_dialog->add_child(l); name_title = l; diff --git a/editor/plugins/animation_tree_editor_plugin.cpp b/editor/plugins/animation_tree_editor_plugin.cpp index eb669f95b5..e126cdf40f 100644 --- a/editor/plugins/animation_tree_editor_plugin.cpp +++ b/editor/plugins/animation_tree_editor_plugin.cpp @@ -261,12 +261,12 @@ void AnimationTreeEditor::_popup_edit_dialog() { Ref<StyleBox> style = get_stylebox("panel", "PopupMenu"); Size2 size = get_node_size(edited_node); Point2 popup_pos(pos.x + style->get_margin(MARGIN_LEFT), pos.y + size.y - style->get_margin(MARGIN_BOTTOM)); - popup_pos += get_global_pos(); + popup_pos += get_global_position(); if (renaming_edit) { edit_label[0]->set_text(TTR("New name:")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_line[0]->set_begin(Point2(15, 25)); edit_line[0]->set_text(edited_node); @@ -294,18 +294,18 @@ void AnimationTreeEditor::_popup_edit_dialog() { master_anim_popup->add_item(E->get()); } - master_anim_popup->set_pos(popup_pos); + master_anim_popup->set_position(popup_pos); master_anim_popup->popup(); } else { property_editor->edit(this, "", Variant::OBJECT, anim_tree->animation_node_get_animation(edited_node), PROPERTY_HINT_RESOURCE_TYPE, "Animation"); - property_editor->set_pos(popup_pos); + property_editor->set_position(popup_pos); property_editor->popup(); updating_edit = false; } return; case AnimationTreePlayer::NODE_TIMESCALE: edit_label[0]->set_text(TTR("Scale:")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_line[0]->set_begin(Point2(15, 25)); edit_line[0]->set_text(rtos(anim_tree->timescale_node_get_scale(edited_node))); @@ -314,13 +314,13 @@ void AnimationTreeEditor::_popup_edit_dialog() { break; case AnimationTreePlayer::NODE_ONESHOT: edit_label[0]->set_text(TTR("Fade In (s):")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_line[0]->set_begin(Point2(15, 25)); edit_line[0]->set_text(rtos(anim_tree->oneshot_node_get_fadein_time(edited_node))); edit_line[0]->show(); edit_label[1]->set_text(TTR("Fade Out (s):")); - edit_label[1]->set_pos(Point2(5, 55)); + edit_label[1]->set_position(Point2(5, 55)); edit_label[1]->show(); edit_line[1]->set_begin(Point2(15, 75)); edit_line[1]->set_text(rtos(anim_tree->oneshot_node_get_fadeout_time(edited_node))); @@ -340,13 +340,13 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_check->show(); edit_label[2]->set_text(TTR("Restart (s):")); - edit_label[2]->set_pos(Point2(5, 145)); + edit_label[2]->set_position(Point2(5, 145)); edit_label[2]->show(); edit_line[2]->set_begin(Point2(15, 165)); edit_line[2]->set_text(rtos(anim_tree->oneshot_node_get_autorestart_delay(edited_node))); edit_line[2]->show(); edit_label[3]->set_text(TTR("Random Restart (s):")); - edit_label[3]->set_pos(Point2(5, 195)); + edit_label[3]->set_position(Point2(5, 195)); edit_label[3]->show(); edit_line[3]->set_begin(Point2(15, 215)); edit_line[3]->set_text(rtos(anim_tree->oneshot_node_get_autorestart_random_delay(edited_node))); @@ -367,7 +367,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { case AnimationTreePlayer::NODE_MIX: edit_label[0]->set_text(TTR("Amount:")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_scroll[0]->set_min(0); edit_scroll[0]->set_max(1); @@ -379,7 +379,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { break; case AnimationTreePlayer::NODE_BLEND2: edit_label[0]->set_text(TTR("Blend:")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_scroll[0]->set_min(0); edit_scroll[0]->set_max(1); @@ -394,7 +394,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { case AnimationTreePlayer::NODE_BLEND3: edit_label[0]->set_text(TTR("Blend:")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_scroll[0]->set_min(-1); edit_scroll[0]->set_max(1); @@ -407,7 +407,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { case AnimationTreePlayer::NODE_BLEND4: edit_label[0]->set_text(TTR("Blend 0:")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_scroll[0]->set_min(0); edit_scroll[0]->set_max(1); @@ -415,7 +415,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { edit_scroll[0]->set_begin(Point2(15, 25)); edit_scroll[0]->show(); edit_label[1]->set_text(TTR("Blend 1:")); - edit_label[1]->set_pos(Point2(5, 55)); + edit_label[1]->set_position(Point2(5, 55)); edit_label[1]->show(); edit_scroll[1]->set_min(0); edit_scroll[1]->set_max(1); @@ -429,14 +429,14 @@ void AnimationTreeEditor::_popup_edit_dialog() { case AnimationTreePlayer::NODE_TRANSITION: { edit_label[0]->set_text(TTR("X-Fade Time (s):")); - edit_label[0]->set_pos(Point2(5, 5)); + edit_label[0]->set_position(Point2(5, 5)); edit_label[0]->show(); edit_line[0]->set_begin(Point2(15, 25)); edit_line[0]->set_text(rtos(anim_tree->transition_node_get_xfade_time(edited_node))); edit_line[0]->show(); edit_label[1]->set_text(TTR("Current:")); - edit_label[1]->set_pos(Point2(5, 55)); + edit_label[1]->set_position(Point2(5, 55)); edit_label[1]->show(); edit_option->set_begin(Point2(15, 75)); @@ -455,7 +455,7 @@ void AnimationTreeEditor::_popup_edit_dialog() { } } - edit_dialog->set_pos(popup_pos); + edit_dialog->set_position(popup_pos); edit_dialog->popup(); updating_edit = false; @@ -727,8 +727,8 @@ void AnimationTreeEditor::_node_edit_property(const StringName& p_node) { property_editor->edit(NULL,ph.name,ph.type,anim_tree->node_get_param(p_node),ph.hint,ph.hint_string); Point2 popup_pos=Point2( pos.x+(size.width-property_editor->get_size().width)/2.0,pos.y+(size.y-style->get_margin(MARGIN_BOTTOM))).floor(); - popup_pos+=get_global_pos(); - property_editor->set_pos(popup_pos); + popup_pos+=get_global_position(); + property_editor->set_position(popup_pos); property_editor->popup(); @@ -797,7 +797,7 @@ void AnimationTreeEditor::_gui_input(InputEvent p_event) { } } - node_popup->set_pos(rclick_pos + get_global_pos()); + node_popup->set_position(rclick_pos + get_global_position()); node_popup->popup(); } @@ -807,7 +807,7 @@ void AnimationTreeEditor::_gui_input(InputEvent p_event) { node_popup->add_item(TTR("Remove"), NODE_ERASE); if (anim_tree->node_get_type(rclick_node) == AnimationTreePlayer::NODE_TRANSITION) node_popup->add_item(TTR("Add Input"), NODE_ADD_INPUT); - node_popup->set_pos(rclick_pos + get_global_pos()); + node_popup->set_position(rclick_pos + get_global_position()); node_popup->popup(); } } @@ -1302,7 +1302,7 @@ AnimationTreeEditor::AnimationTreeEditor() { add_menu = memnew(MenuButton); //add_menu->set_ - add_menu->set_pos(Point2(0, 0)); + add_menu->set_position(Point2(0, 0)); add_menu->set_size(Point2(25, 15)); add_child(add_menu); @@ -1324,7 +1324,7 @@ AnimationTreeEditor::AnimationTreeEditor() { p->connect("id_pressed", this, "_add_menu_item"); play_button = memnew(Button); - play_button->set_pos(Point2(25, 0)); + play_button->set_position(Point2(25, 0)); play_button->set_size(Point2(25, 15)); add_child(play_button); play_button->set_toggle_mode(true); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 0c32671acc..1a533dce32 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -186,17 +186,17 @@ void CanvasItemEditor::_edit_set_pivot(const Vector2 &mouse_pos) { Vector2 motion_ofs = gpos - local_mouse_pos; - undo_redo->add_do_method(n2d, "set_global_pos", local_mouse_pos); + undo_redo->add_do_method(n2d, "set_global_position", local_mouse_pos); undo_redo->add_do_method(n2d, "edit_set_pivot", offset + n2d->get_global_transform().affine_inverse().basis_xform(motion_ofs)); - undo_redo->add_undo_method(n2d, "set_global_pos", gpos); + undo_redo->add_undo_method(n2d, "set_global_position", gpos); undo_redo->add_undo_method(n2d, "edit_set_pivot", offset); for (int i = 0; i < n2d->get_child_count(); i++) { Node2D *n2dc = n2d->get_child(i)->cast_to<Node2D>(); if (!n2dc) continue; - undo_redo->add_do_method(n2dc, "set_global_pos", n2dc->get_global_position()); - undo_redo->add_undo_method(n2dc, "set_global_pos", n2dc->get_global_position()); + undo_redo->add_do_method(n2dc, "set_global_position", n2dc->get_global_position()); + undo_redo->add_undo_method(n2dc, "set_global_position", n2dc->get_global_position()); } } } @@ -666,7 +666,7 @@ void CanvasItemEditor::_key_move(const Vector2 &p_dir, bool p_snap, KeyMoveMODE } else if (Control *control = canvas_item->cast_to<Control>()) { - control->set_pos(control->get_pos() + drag); + control->set_position(control->get_position() + drag); } } } @@ -1014,7 +1014,7 @@ void CanvasItemEditor::_list_select(const InputEventMouseButton &b) { additive_selection = b.mod.shift; - selection_menu->set_global_pos(Vector2(b.global_x, b.global_y)); + selection_menu->set_global_position(Vector2(b.global_x, b.global_y)); selection_menu->popup(); selection_menu->call_deferred("grab_click_focus"); selection_menu->set_invalidate_click_until_motion(); @@ -1135,7 +1135,7 @@ void CanvasItemEditor::_viewport_gui_input(const InputEvent &p_event) { Node* scene = get_scene()->get_root_node()->cast_to<EditorNode>()->get_edited_scene(); if ( scene ) ref_item =_select_canvas_item_at_pos( Point2( b.x, b.y ), scene, transform ); #endif - //popup->set_pos(Point2(b.x,b.y)); + //popup->set_position(Point2(b.x,b.y)); //popup->popup(); } return; @@ -2703,7 +2703,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { Control *ctrl = canvas_item->cast_to<Control>(); if (key_pos) - AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl, "rect/pos", ctrl->get_pos(), existing); + AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl, "rect/pos", ctrl->get_position(), existing); if (key_scale) AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl, "rect/size", ctrl->get_size(), existing); } @@ -2789,10 +2789,10 @@ void CanvasItemEditor::_popup_callback(int p_op) { Node2D *n2d = o->cast_to<Node2D>(); if (!n2d) continue; - undo_redo->add_do_method(n2d, "set_pos", E->get().pos); + undo_redo->add_do_method(n2d, "set_position", E->get().pos); undo_redo->add_do_method(n2d, "set_rot", E->get().rot); undo_redo->add_do_method(n2d, "set_scale", E->get().scale); - undo_redo->add_undo_method(n2d, "set_pos", n2d->get_position()); + undo_redo->add_undo_method(n2d, "set_position", n2d->get_position()); undo_redo->add_undo_method(n2d, "set_rot", n2d->get_rotation()); undo_redo->add_undo_method(n2d, "set_scale", n2d->get_scale()); } @@ -2826,7 +2826,7 @@ void CanvasItemEditor::_popup_callback(int p_op) { Control *ctrl = canvas_item->cast_to<Control>(); if (key_pos) - ctrl->set_pos(Point2()); + ctrl->set_position(Point2()); /* if (key_scale) AnimationPlayerEditor::singleton->get_key_editor()->insert_node_value_key(ctrl,"rect/size",ctrl->get_size()); @@ -3354,7 +3354,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { Label *l = memnew(Label); l->set_text(TTR("Snap (Pixels):")); - l->set_pos(Point2(5, 5)); + l->set_position(Point2(5, 5)); value_dialog->add_child(l); dialog_label = l; @@ -3474,8 +3474,8 @@ void CanvasItemEditorViewport::_on_change_type() { } void CanvasItemEditorViewport::_create_preview(const Vector<String> &files) const { - label->set_pos(get_global_pos() + Point2(14, 14)); - label_desc->set_pos(label->get_pos() + Point2(0, label->get_size().height)); + label->set_position(get_global_position() + Point2(14, 14)); + label_desc->set_position(label->get_position() + Point2(0, label->get_size().height)); for (int i = 0; i < files.size(); i++) { String path = files[i]; RES res = ResourceLoader::load(path); @@ -3576,8 +3576,8 @@ void CanvasItemEditorViewport::_create_nodes(Node *parent, Node *child, String & // locate at preview position Point2 pos; - if (parent->has_method("get_global_pos")) { - pos = parent->call("get_global_pos"); + if (parent->has_method("get_global_position")) { + pos = parent->call("get_global_position"); } Transform2D trans = canvas->get_canvas_transform(); Point2 target_pos = (p_point - trans.get_origin()) / trans.get_scale().x - pos; @@ -3626,7 +3626,7 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons } else { Control *parent_control = parent->cast_to<Control>(); if (parent_control) { - pos = parent_control->get_global_pos(); + pos = parent_control->get_global_position(); } } Transform2D trans = canvas->get_canvas_transform(); @@ -3834,7 +3834,7 @@ CanvasItemEditorViewport::CanvasItemEditorViewport(EditorNode *p_node, CanvasIte for (int i = 0; i < types.size(); i++) { CheckBox *check = memnew(CheckBox); check->set_text(types[i]); - check->connect("button_selected", this, "_on_select_type", varray(check)); + check->connect("button_down", this, "_on_select_type", varray(check)); btn_group->add_child(check); check->set_button_group(button_group); } diff --git a/editor/plugins/cube_grid_theme_editor_plugin.cpp b/editor/plugins/cube_grid_theme_editor_plugin.cpp index 4633d5fe33..17149ef868 100644 --- a/editor/plugins/cube_grid_theme_editor_plugin.cpp +++ b/editor/plugins/cube_grid_theme_editor_plugin.cpp @@ -303,7 +303,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) { add_child(panel); MenuButton * options = memnew( MenuButton ); panel->add_child(options); - options->set_pos(Point2(1,1)); + options->set_position(Point2(1,1)); options->set_text("Theme"); options->get_popup()->add_item(TTR("Add Item"),MENU_OPTION_ADD_ITEM); options->get_popup()->add_item(TTR("Remove Selected Item"),MENU_OPTION_REMOVE_ITEM); diff --git a/editor/plugins/gradient_texture_editor_plugin.cpp b/editor/plugins/gradient_texture_editor_plugin.cpp index 1e82a1105a..9551fe19fa 100644 --- a/editor/plugins/gradient_texture_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_editor_plugin.cpp @@ -39,7 +39,7 @@ void GradientTextureEdit::_show_color_picker() { return; Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10); picker->set_pick_color(points[grabbed].color); - popup->set_pos(get_global_pos() - Vector2(ms.width - get_size().width, ms.height)); + popup->set_position(get_global_position() - Vector2(ms.width - get_size().width, ms.height)); popup->set_size(ms); popup->popup(); } diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 2b8189336b..4c84e831c1 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -113,48 +113,7 @@ void ParticlesEditor::_menu_option(int p_option) { switch (p_option) { case MENU_OPTION_GENERATE_AABB: { -#if 0 - Transform globalizer = node->get_global_transform(); - ParticleSystemSW pssw; - for (int i = 0; i < VS::PARTICLE_VAR_MAX; i++) { - - pssw.particle_vars[i] = node->get_variable((Particles::Variable)i); - pssw.particle_randomness[i] = node->get_randomness((Particles::Variable)i); - } - - pssw.emission_half_extents = node->get_emission_half_extents(); - pssw.emission_points = node->get_emission_points(); - pssw.emission_base_velocity = node->get_emission_base_velocity(); - pssw.amount = node->get_amount(); - pssw.gravity_normal = node->get_gravity_normal(); - pssw.emitting = true; - pssw.height_from_velocity = node->has_height_from_velocity(); - pssw.color_phase_count = 1; - - ParticleSystemProcessSW pp; - float delta = 0.01; - float lifetime = pssw.particle_vars[VS::PARTICLE_LIFETIME]; - - Transform localizer = globalizer.affine_inverse(); - AABB aabb; - for (float t = 0; t < lifetime; t += delta) { - - pp.process(&pssw, globalizer, delta); - for (int i = 0; i < pp.particle_data.size(); i++) { - - Vector3 p = localizer.xform(pp.particle_data[i].pos); - - if (t == 0 && i == 0) - aabb.pos = p; - else - aabb.expand_to(p); - } - } - - aabb.grow_by(aabb.get_longest_axis_size() * 0.2); - - node->set_visibility_aabb(aabb); -#endif + generate_aabb->popup_centered_minsize(); } break; case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_MESH: { @@ -186,6 +145,33 @@ void ParticlesEditor::_menu_option(int p_option) { } } +void ParticlesEditor::_generate_aabb() { + + float time = generate_seconds->get_value(); + + float running = 0.0; + + EditorProgress ep("gen_aabb", TTR("Generating AABB"), int(time)); + + Rect3 rect; + while (running < time) { + + uint64_t ticks = OS::get_singleton()->get_ticks_usec(); + ep.step("Generating..", int(running), true); + OS::get_singleton()->delay_usec(1000); + + Rect3 capture = node->capture_aabb(); + if (rect == Rect3()) + rect = capture; + else + rect.merge_with(capture); + + running += (OS::get_singleton()->get_ticks_usec() - ticks) / 1000000.0; + } + + node->set_visibility_aabb(rect); +} + void ParticlesEditor::edit(Particles *p_particles) { node = p_particles; @@ -392,6 +378,7 @@ void ParticlesEditor::_bind_methods() { ClassDB::bind_method("_resource_seleted", &ParticlesEditor::_resource_seleted); ClassDB::bind_method("_node_selected", &ParticlesEditor::_node_selected); ClassDB::bind_method("_generate_emission_points", &ParticlesEditor::_generate_emission_points); + ClassDB::bind_method("_generate_aabb", &ParticlesEditor::_generate_aabb); //ClassDB::bind_method("_populate",&ParticlesEditor::_populate); } @@ -456,6 +443,20 @@ ParticlesEditor::ParticlesEditor() { emission_file_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE); + generate_aabb = memnew(ConfirmationDialog); + generate_aabb->set_title(TTR("Generate Visibility AABB")); + VBoxContainer *genvb = memnew(VBoxContainer); + generate_aabb->add_child(genvb); + generate_seconds = memnew(SpinBox); + genvb->add_margin_child(TTR("Generation Time (sec):"), generate_seconds); + generate_seconds->set_min(0.1); + generate_seconds->set_max(25); + generate_seconds->set_value(2); + + add_child(generate_aabb); + + generate_aabb->connect("confirmed", this, "_generate_aabb"); + //options->set_anchor(MARGIN_LEFT,Control::ANCHOR_END); //options->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END); } diff --git a/editor/plugins/particles_editor_plugin.h b/editor/plugins/particles_editor_plugin.h index 15881fe6a1..e9f9f43468 100644 --- a/editor/plugins/particles_editor_plugin.h +++ b/editor/plugins/particles_editor_plugin.h @@ -57,6 +57,9 @@ class ParticlesEditor : public Control { SpinBox *emission_amount; OptionButton *emission_fill; + ConfirmationDialog *generate_aabb; + SpinBox *generate_seconds; + enum Menu { MENU_OPTION_GENERATE_AABB, @@ -68,6 +71,7 @@ class ParticlesEditor : public Control { PoolVector<Face3> geometry; + void _generate_aabb(); void _generate_emission_points(); void _resource_seleted(const String &p_res); void _node_selected(const NodePath &p_path); diff --git a/editor/plugins/sample_editor_plugin.cpp b/editor/plugins/sample_editor_plugin.cpp index 0c4a85230c..a9af5823e3 100644 --- a/editor/plugins/sample_editor_plugin.cpp +++ b/editor/plugins/sample_editor_plugin.cpp @@ -381,14 +381,14 @@ SampleEditor::SampleEditor() { play = memnew( Button ); - play->set_pos(Point2( 5, 5 )); + play->set_position(Point2( 5, 5 )); play->set_size( Size2(1,1 ) ); play->set_toggle_mode(true); add_child(play); stop = memnew( Button ); - stop->set_pos(Point2( 35, 5 )); + stop->set_position(Point2( 35, 5 )); stop->set_size( Size2(1,1 ) ); stop->set_toggle_mode(true); add_child(stop); diff --git a/editor/plugins/sample_library_editor_plugin.cpp b/editor/plugins/sample_library_editor_plugin.cpp index 17f24d1a6b..9eb1af70d1 100644 --- a/editor/plugins/sample_library_editor_plugin.cpp +++ b/editor/plugins/sample_library_editor_plugin.cpp @@ -436,7 +436,7 @@ SampleLibraryEditor::SampleLibraryEditor() { load = memnew( Button ); - load->set_pos(Point2( 5, 5 )); + load->set_position(Point2( 5, 5 )); load->set_size( Size2(1,1 ) ); add_child(load); diff --git a/editor/plugins/sample_player_editor_plugin.cpp b/editor/plugins/sample_player_editor_plugin.cpp index 944f41637f..25f1fe9e17 100644 --- a/editor/plugins/sample_player_editor_plugin.cpp +++ b/editor/plugins/sample_player_editor_plugin.cpp @@ -118,7 +118,7 @@ SamplePlayerEditor::SamplePlayerEditor() { play = memnew( Button ); - play->set_pos(Point2( 5, 5 )); + play->set_position(Point2( 5, 5 )); play->set_toggle_mode(true); play->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,250); play->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,230); @@ -129,7 +129,7 @@ SamplePlayerEditor::SamplePlayerEditor() { stop = memnew( Button ); - stop->set_pos(Point2( 35, 5 )); + stop->set_position(Point2( 35, 5 )); stop->set_toggle_mode(true); stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,220); stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,200); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 20ded1d8fd..a99cd7a2d6 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -530,6 +530,15 @@ void ScriptEditor::_resave_scripts(const String &p_str) { if (trim_trailing_whitespace_on_save) { se->trim_trailing_whitespace(); } + + if (convert_indent_on_save) { + if (use_space_indentation) { + se->convert_indent_to_spaces(); + } else { + se->convert_indent_to_tabs(); + } + } + editor->save_resource(script); se->tag_saved_version(); } @@ -795,12 +804,28 @@ void ScriptEditor::_menu_option(int p_option) { if (trim_trailing_whitespace_on_save) current->trim_trailing_whitespace(); + + if (convert_indent_on_save) { + if (use_space_indentation) { + current->convert_indent_to_spaces(); + } else { + current->convert_indent_to_tabs(); + } + } editor->save_resource(current->get_edited_script()); } break; case FILE_SAVE_AS: { current->trim_trailing_whitespace(); + + if (convert_indent_on_save) { + if (use_space_indentation) { + current->convert_indent_to_spaces(); + } else { + current->convert_indent_to_tabs(); + } + } editor->push_item(current->get_edited_script()->cast_to<Object>()); editor->save_resource_as(current->get_edited_script()); @@ -878,28 +903,29 @@ void ScriptEditor::_menu_option(int p_option) { } } } - } + } else { - EditorHelp *help = tab_container->get_current_tab_control()->cast_to<EditorHelp>(); - if (help) { + EditorHelp *help = tab_container->get_current_tab_control()->cast_to<EditorHelp>(); + if (help) { - switch (p_option) { + switch (p_option) { - case HELP_SEARCH_FIND: { - help->popup_search(); - } break; - case HELP_SEARCH_FIND_NEXT: { - help->search_again(); - } break; - case FILE_CLOSE: { - _close_current_tab(); - } break; - case CLOSE_DOCS: { - _close_docs_tab(); - } break; - case CLOSE_ALL: { - _close_all_tabs(); - } break; + case HELP_SEARCH_FIND: { + help->popup_search(); + } break; + case HELP_SEARCH_FIND_NEXT: { + help->search_again(); + } break; + case FILE_CLOSE: { + _close_current_tab(); + } break; + case CLOSE_DOCS: { + _close_docs_tab(); + } break; + case CLOSE_ALL: { + _close_all_tabs(); + } break; + } } } } @@ -1515,6 +1541,14 @@ void ScriptEditor::save_all_scripts() { se->trim_trailing_whitespace(); } + if (convert_indent_on_save) { + if (use_space_indentation) { + se->convert_indent_to_spaces(); + } else { + se->convert_indent_to_tabs(); + } + } + Ref<Script> script = se->get_edited_script(); if (script.is_valid()) se->apply_code(); @@ -1614,6 +1648,9 @@ void ScriptEditor::_save_layout() { void ScriptEditor::_editor_settings_changed() { trim_trailing_whitespace_on_save = EditorSettings::get_singleton()->get("text_editor/files/trim_trailing_whitespace_on_save"); + convert_indent_on_save = EditorSettings::get_singleton()->get("text_editor/indent/convert_indent_on_save"); + use_space_indentation = EditorSettings::get_singleton()->get("text_editor/indent/type") == "Tabs" ? 0 : 1; + float autosave_time = EditorSettings::get_singleton()->get("text_editor/files/autosave_interval_secs"); if (autosave_time > 0) { autosave_timer->set_wait_time(autosave_time); @@ -2186,6 +2223,8 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { edit_pass = 0; trim_trailing_whitespace_on_save = false; + convert_indent_on_save = false; + use_space_indentation = false; ScriptServer::edit_request_func = _open_script_request; } diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index f3bb5b5546..6a54609167 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -91,6 +91,8 @@ public: virtual void set_edit_state(const Variant &p_state) = 0; virtual void goto_line(int p_line, bool p_with_error = false) = 0; virtual void trim_trailing_whitespace() = 0; + virtual void convert_indent_to_spaces() = 0; + virtual void convert_indent_to_tabs() = 0; virtual void ensure_focus() = 0; virtual void tag_saved_version() = 0; virtual void reload(bool p_soft) = 0; @@ -251,6 +253,8 @@ class ScriptEditor : public VBoxContainer { void _res_saved_callback(const Ref<Resource> &p_res); bool trim_trailing_whitespace_on_save; + bool use_space_indentation; + bool convert_indent_on_save; void _trim_trailing_whitespace(TextEdit *tx); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 8119acac53..052c19f34e 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -270,6 +270,96 @@ void ScriptTextEditor::trim_trailing_whitespace() { } } +void ScriptTextEditor::convert_indent_to_spaces() { + TextEdit *tx = code_editor->get_text_edit(); + Ref<Script> scr = get_edited_script(); + + if (scr.is_null()) { + return; + } + + int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); + String indent = ""; + + for (int i = 0; i < indent_size; i++) { + indent += " "; + } + + bool changed_indentation = false; + for (int i = 0; i < tx->get_line_count(); i++) { + String line = tx->get_line(i); + + if (line.length() <= 0) { + continue; + } + + int j = 0; + while (j < line.length() && (line[j] == ' ' || line[j] == '\t')) { + if (line[j] == '\t') { + if (!changed_indentation) { + tx->begin_complex_operation(); + changed_indentation = true; + } + line = line.left(j) + indent + line.right(j + 1); + } + j++; + } + tx->set_line(i, line); + } + if (changed_indentation) { + tx->end_complex_operation(); + tx->update(); + } +} + +void ScriptTextEditor::convert_indent_to_tabs() { + TextEdit *tx = code_editor->get_text_edit(); + Ref<Script> scr = get_edited_script(); + + if (scr.is_null()) { + return; + } + + int indent_size = EditorSettings::get_singleton()->get("text_editor/indent/size"); + indent_size -= 1; + + bool changed_indentation = false; + for (int i = 0; i < tx->get_line_count(); i++) { + String line = tx->get_line(i); + + if (line.length() <= 0) { + continue; + } + + int j = 0; + int space_count = -1; + while (j < line.length() && (line[j] == ' ' || line[j] == '\t')) { + if (line[j] != '\t') { + space_count++; + + if (space_count == indent_size) { + if (!changed_indentation) { + tx->begin_complex_operation(); + changed_indentation = true; + } + + line = line.left(j - indent_size) + "\t" + line.right(j + 1); + j = 0; + space_count = -1; + } + } else { + space_count = -1; + } + j++; + } + tx->set_line(i, line); + } + if (changed_indentation) { + tx->end_complex_operation(); + tx->update(); + } +} + void ScriptTextEditor::tag_saved_version() { code_editor->get_text_edit()->tag_saved_version(); @@ -807,6 +897,12 @@ void ScriptTextEditor::_edit_option(int p_op) { case EDIT_TRIM_TRAILING_WHITESAPCE: { trim_trailing_whitespace(); } break; + case EDIT_CONVERT_INDENT_TO_SPACES: { + convert_indent_to_spaces(); + } break; + case EDIT_CONVERT_INDENT_TO_TABS: { + convert_indent_to_tabs(); + } break; case EDIT_PICK_COLOR: { color_panel->popup(); } break; @@ -1075,8 +1171,8 @@ void ScriptTextEditor::_text_edit_gui_input(const InputEvent &ev) { int col, row; TextEdit *tx = code_editor->get_text_edit(); - tx->_get_mouse_pos(Point2i(mb.global_x, mb.global_y) - tx->get_global_pos(), row, col); - Vector2 mpos = Vector2(mb.global_x, mb.global_y) - tx->get_global_pos(); + tx->_get_mouse_pos(Point2i(mb.global_x, mb.global_y) - tx->get_global_position(), row, col); + Vector2 mpos = Vector2(mb.global_x, mb.global_y) - tx->get_global_position(); bool have_selection = (tx->get_selection_text().length() > 0); bool have_color = (tx->get_word_at_pos(mpos) == "Color"); if (have_color) { @@ -1104,7 +1200,7 @@ void ScriptTextEditor::_text_edit_gui_input(const InputEvent &ev) { float alpha = color.size() > 3 ? color[3] : 1.0f; color_picker->set_pick_color(Color(color[0], color[1], color[2], alpha)); } - color_panel->set_pos(get_global_transform().xform(get_local_mouse_pos())); + color_panel->set_position(get_global_transform().xform(get_local_mouse_pos())); Size2 ms = Size2(300, color_picker->get_combined_minimum_size().height + 10); color_panel->set_size(ms); } else { @@ -1154,7 +1250,7 @@ void ScriptTextEditor::_make_context_menu(bool p_selection, bool p_color) { context_menu->add_separator(); context_menu->add_item(TTR("Pick Color"), EDIT_PICK_COLOR); } - context_menu->set_pos(get_global_transform().xform(get_local_mouse_pos())); + context_menu->set_position(get_global_transform().xform(get_local_mouse_pos())); context_menu->set_size(Vector2(1, 1)); context_menu->popup(); } @@ -1217,6 +1313,8 @@ ScriptTextEditor::ScriptTextEditor() { edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/complete_symbol"), EDIT_COMPLETE); #endif edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/trim_trailing_whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_spaces"), EDIT_CONVERT_INDENT_TO_SPACES); + edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/convert_indent_to_tabs"), EDIT_CONVERT_INDENT_TO_TABS); edit_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/auto_indent"), EDIT_AUTO_INDENT); edit_menu->get_popup()->connect("id_pressed", this, "_edit_option"); edit_menu->get_popup()->add_separator(); @@ -1285,6 +1383,8 @@ void ScriptTextEditor::register_editor() { ED_SHORTCUT("script_text_editor/complete_symbol", TTR("Complete Symbol"), KEY_MASK_CMD | KEY_SPACE); #endif ED_SHORTCUT("script_text_editor/trim_trailing_whitespace", TTR("Trim Trailing Whitespace"), KEY_MASK_CTRL | KEY_MASK_ALT | KEY_T); + ED_SHORTCUT("script_text_editor/convert_indent_to_spaces", TTR("Convert Indent To Spaces"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_Y); + ED_SHORTCUT("script_text_editor/convert_indent_to_tabs", TTR("Convert Indent To Tabs"), KEY_MASK_CTRL | KEY_MASK_SHIFT | KEY_X); ED_SHORTCUT("script_text_editor/auto_indent", TTR("Auto Indent"), KEY_MASK_CMD | KEY_I); ED_SHORTCUT("script_text_editor/toggle_breakpoint", TTR("Toggle Breakpoint"), KEY_F9); diff --git a/editor/plugins/script_text_editor.h b/editor/plugins/script_text_editor.h index 4bf525e2d1..8e089e1ebf 100644 --- a/editor/plugins/script_text_editor.h +++ b/editor/plugins/script_text_editor.h @@ -67,6 +67,8 @@ class ScriptTextEditor : public ScriptEditorBase { EDIT_COMPLETE, EDIT_AUTO_INDENT, EDIT_TRIM_TRAILING_WHITESAPCE, + EDIT_CONVERT_INDENT_TO_SPACES, + EDIT_CONVERT_INDENT_TO_TABS, EDIT_TOGGLE_COMMENT, EDIT_MOVE_LINE_UP, EDIT_MOVE_LINE_DOWN, @@ -125,6 +127,8 @@ public: virtual void set_edit_state(const Variant &p_state); virtual void ensure_focus(); virtual void trim_trailing_whitespace(); + virtual void convert_indent_to_spaces(); + virtual void convert_indent_to_tabs(); virtual void tag_saved_version(); virtual void goto_line(int p_line, bool p_with_error = false); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index dcb126a754..b5edd12b9c 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -370,7 +370,8 @@ void ShaderEditor::_editor_settings_changed() { shader_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete")); shader_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/cursor/scroll_past_end_of_file")); - shader_editor->get_text_edit()->set_tab_size(EditorSettings::get_singleton()->get("text_editor/indent/tab_size")); + shader_editor->get_text_edit()->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size")); + shader_editor->get_text_edit()->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type") == "Tabs" ? 0 : 1); shader_editor->get_text_edit()->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs")); shader_editor->get_text_edit()->set_show_line_numbers(EditorSettings::get_singleton()->get("text_editor/line_numbers/show_line_numbers")); shader_editor->get_text_edit()->set_syntax_coloring(EditorSettings::get_singleton()->get("text_editor/highlighting/syntax_highlighting")); @@ -445,7 +446,7 @@ ShaderEditor::ShaderEditor() { edit_menu = memnew(MenuButton); hbc->add_child(edit_menu); - edit_menu->set_pos(Point2(5, -1)); + edit_menu->set_position(Point2(5, -1)); edit_menu->set_text(TTR("Edit")); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/undo", TTR("Undo"), KEY_MASK_CMD | KEY_Z), EDIT_UNDO); edit_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/redo", TTR("Redo"), KEY_MASK_CMD | KEY_Y), EDIT_REDO); @@ -459,7 +460,7 @@ ShaderEditor::ShaderEditor() { search_menu = memnew(MenuButton); hbc->add_child(search_menu); - search_menu->set_pos(Point2(38, -1)); + search_menu->set_position(Point2(38, -1)); search_menu->set_text(TTR("Search")); search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find", TTR("Find.."), KEY_MASK_CMD | KEY_F), SEARCH_FIND); search_menu->get_popup()->add_shortcut(ED_SHORTCUT("script_editor/find_next", TTR("Find Next"), KEY_F3), SEARCH_FIND_NEXT); diff --git a/editor/plugins/shader_graph_editor_plugin.cpp b/editor/plugins/shader_graph_editor_plugin.cpp index 04dae641bc..0fd28a0b59 100644 --- a/editor/plugins/shader_graph_editor_plugin.cpp +++ b/editor/plugins/shader_graph_editor_plugin.cpp @@ -60,7 +60,7 @@ void GraphColorRampEdit::_gui_input(const InputEvent& p_event) { return; Size2 ms = Size2(350, picker->get_combined_minimum_size().height+10); picker->set_color(points[grabbed].color); - popup->set_pos(get_global_pos()-Size2(0,ms.height)); + popup->set_position(get_global_position()-Size2(0,ms.height)); popup->set_size(ms); popup->popup(); return; @@ -840,7 +840,7 @@ void ShaderGraphView::_xform_input_changed(int p_id, Node *p_button){ ToolButton *tb = p_button->cast_to<ToolButton>(); - ped_popup->set_pos(tb->get_global_pos()+Vector2(0,tb->get_size().height)); + ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); ped_popup->set_size(tb->get_size()); edited_id=p_id; edited_def=-1; @@ -851,7 +851,7 @@ void ShaderGraphView::_xform_input_changed(int p_id, Node *p_button){ void ShaderGraphView::_xform_const_changed(int p_id, Node *p_button){ ToolButton *tb = p_button->cast_to<ToolButton>(); - ped_popup->set_pos(tb->get_global_pos()+Vector2(0,tb->get_size().height)); + ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); ped_popup->set_size(tb->get_size()); edited_id=p_id; edited_def=-1; @@ -1075,7 +1075,7 @@ void ShaderGraphView::_input_name_changed(const String& p_name, int p_id, Node * void ShaderGraphView::_tex_edited(int p_id,Node* p_button) { ToolButton *tb = p_button->cast_to<ToolButton>(); - ped_popup->set_pos(tb->get_global_pos()+Vector2(0,tb->get_size().height)); + ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); ped_popup->set_size(tb->get_size()); edited_id=p_id; edited_def=-1; @@ -1085,7 +1085,7 @@ void ShaderGraphView::_tex_edited(int p_id,Node* p_button) { void ShaderGraphView::_cube_edited(int p_id,Node* p_button) { ToolButton *tb = p_button->cast_to<ToolButton>(); - ped_popup->set_pos(tb->get_global_pos()+Vector2(0,tb->get_size().height)); + ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); ped_popup->set_size(tb->get_size()); edited_id=p_id; edited_def=-1; @@ -1300,7 +1300,7 @@ void ShaderGraphView::_delete_nodes_request() void ShaderGraphView::_default_changed(int p_id, Node *p_button, int p_param, int v_type, String p_hint) { ToolButton *tb = p_button->cast_to<ToolButton>(); - ped_popup->set_pos(tb->get_global_pos()+Vector2(0,tb->get_size().height)); + ped_popup->set_position(tb->get_global_position()+Vector2(0,tb->get_size().height)); ped_popup->set_size(tb->get_size()); edited_id=p_id; edited_def=p_param; @@ -2751,7 +2751,7 @@ ShaderGraphView::ShaderGraphView(ShaderGraph::ShaderType p_type) { graph_edit->get_top_layer()->add_child(status); graph_edit->connect("_begin_node_move", this, "_begin_node_move"); graph_edit->connect("_end_node_move", this, "_end_node_move"); - status->set_pos(Vector2(5,5)); + status->set_position(Vector2(5,5)); status->add_color_override("font_color_shadow",Color(0,0,0)); status->add_color_override("font_color",Color(1,0.4,0.3)); status->add_constant_override("shadow_as_outline",1); @@ -2779,7 +2779,7 @@ void ShaderGraphEditor::_popup_requested(const Vector2 &p_position) { Vector2 scroll_ofs=graph_edits[tabs->get_current_tab()]->get_graph_edit()->get_scroll_ofs(); next_location = get_local_mouse_pos() + scroll_ofs; - popup->set_global_pos(p_position); + popup->set_global_position(p_position); popup->set_size( Size2( 200, 0) ); popup->popup(); popup->call_deferred("grab_click_focus"); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 4961de56d3..d73349f773 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -673,7 +673,7 @@ void SpatialEditorViewport::_list_select(InputEventMouseButton b) { "\nType: " + spat->get_class() + "\nPath: " + node_path); } - selection_menu->set_global_pos(Vector2(b.global_x, b.global_y)); + selection_menu->set_global_position(Vector2(b.global_x, b.global_y)); selection_menu->popup(); selection_menu->call_deferred("grab_click_focus"); selection_menu->set_invalidate_click_until_motion(); @@ -2166,7 +2166,7 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed view_menu = memnew(MenuButton); surface->add_child(view_menu); - view_menu->set_pos(Point2(4, 4)); + view_menu->set_position(Point2(4, 4)); view_menu->set_self_modulate(Color(1, 1, 1, 0.5)); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/top_view"), VIEW_TOP); view_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("spatial_editor/bottom_view"), VIEW_BOTTOM); @@ -3572,7 +3572,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { view_menu = memnew(MenuButton); view_menu->set_text(TTR("View")); - view_menu->set_pos(Point2(212, 0)); + view_menu->set_position(Point2(212, 0)); hbc_menu->add_child(view_menu); p = view_menu->get_popup(); @@ -3717,44 +3717,44 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { add_child(xform_dialog); Label *l = memnew(Label); l->set_text(TTR("Translate:")); - l->set_pos(Point2(5, 5)); + l->set_position(Point2(5, 5)); xform_dialog->add_child(l); for (int i = 0; i < 3; i++) { xform_translate[i] = memnew(LineEdit); - xform_translate[i]->set_pos(Point2(15 + i * 60, 22)); + xform_translate[i]->set_position(Point2(15 + i * 60, 22)); xform_translate[i]->set_size(Size2(50, 12)); xform_dialog->add_child(xform_translate[i]); } l = memnew(Label); l->set_text(TTR("Rotate (deg.):")); - l->set_pos(Point2(5, 45)); + l->set_position(Point2(5, 45)); xform_dialog->add_child(l); for (int i = 0; i < 3; i++) { xform_rotate[i] = memnew(LineEdit); - xform_rotate[i]->set_pos(Point2(15 + i * 60, 62)); + xform_rotate[i]->set_position(Point2(15 + i * 60, 62)); xform_rotate[i]->set_size(Size2(50, 22)); xform_dialog->add_child(xform_rotate[i]); } l = memnew(Label); l->set_text(TTR("Scale (ratio):")); - l->set_pos(Point2(5, 85)); + l->set_position(Point2(5, 85)); xform_dialog->add_child(l); for (int i = 0; i < 3; i++) { xform_scale[i] = memnew(LineEdit); - xform_scale[i]->set_pos(Point2(15 + i * 60, 102)); + xform_scale[i]->set_position(Point2(15 + i * 60, 102)); xform_scale[i]->set_size(Size2(50, 22)); xform_dialog->add_child(xform_scale[i]); } l = memnew(Label); l->set_text(TTR("Transform Type")); - l->set_pos(Point2(5, 125)); + l->set_position(Point2(5, 125)); xform_dialog->add_child(l); xform_type = memnew(OptionButton); diff --git a/editor/plugins/stream_editor_plugin.cpp b/editor/plugins/stream_editor_plugin.cpp index 43f770ab10..dd97ce936d 100644 --- a/editor/plugins/stream_editor_plugin.cpp +++ b/editor/plugins/stream_editor_plugin.cpp @@ -84,7 +84,7 @@ StreamEditor::StreamEditor() { stop = memnew( Button ); - stop->set_pos(Point2( 35, 5 )); + stop->set_position(Point2( 35, 5 )); stop->set_anchor_and_margin(MARGIN_LEFT,Control::ANCHOR_END,30); stop->set_anchor_and_margin(MARGIN_RIGHT,Control::ANCHOR_END,10); stop->set_anchor_and_margin(MARGIN_TOP,Control::ANCHOR_BEGIN,0); diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 1d067ff975..d421b203e9 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -61,12 +61,12 @@ StyleBoxEditor::StyleBoxEditor() { Label *l = memnew(Label); l->set_text(TTR("StyleBox Preview:")); - l->set_pos(Point2(5, 5)); + l->set_position(Point2(5, 5)); panel->add_child(l); preview = memnew(Panel); panel->add_child(preview); - preview->set_pos(Point2(50, 50)); + preview->set_position(Point2(50, 50)); preview->set_size(Size2(200, 100)); } diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 4ff5951049..a83ea70508 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -640,7 +640,7 @@ ThemeEditor::ThemeEditor() { theme_menu->get_popup()->add_item(TTR("Create Empty Editor Template"), POPUP_CREATE_EDITOR_EMPTY); add_child(theme_menu); - theme_menu->set_pos(Vector2(3, 3) * EDSCALE); + theme_menu->set_position(Vector2(3, 3) * EDSCALE); theme_menu->get_popup()->connect("id_pressed", this, "_theme_menu_cbk"); HBoxContainer *main_hb = memnew(HBoxContainer); @@ -778,23 +778,23 @@ ThemeEditor::ThemeEditor() { /* test_h_scroll = memnew( HScrollBar ); - test_h_scroll->set_pos( Point2( 25, 225 ) ); + test_h_scroll->set_position( Point2( 25, 225 ) ); test_h_scroll->set_size( Point2( 150, 5 ) ); panel->add_child(test_h_scroll); line_edit = memnew( LineEdit ); - line_edit->set_pos( Point2( 25, 275 ) ); + line_edit->set_position( Point2( 25, 275 ) ); line_edit->set_size( Point2( 150, 5 ) ); line_edit->set_text("Line Edit"); panel->add_child(line_edit); test_v_scroll = memnew( VScrollBar ); - test_v_scroll->set_pos( Point2( 200, 25 ) ); + test_v_scroll->set_position( Point2( 200, 25 ) ); test_v_scroll->set_size( Point2( 5, 150 ) ); panel->add_child(test_v_scroll); test_tree = memnew(Tree); - test_tree->set_pos( Point2( 300, 25 ) ); + test_tree->set_position( Point2( 300, 25 ) ); test_tree->set_size( Point2( 200, 200 ) ); panel->add_child(test_tree); @@ -818,7 +818,7 @@ ThemeEditor::ThemeEditor() { item->set_range(0,2); Button *fd_button= memnew( Button ); - fd_button->set_pos(Point2(300,275)); + fd_button->set_position(Point2(300,275)); fd_button->set_text("Open File Dialog"); panel->add_child(fd_button); @@ -833,17 +833,17 @@ ThemeEditor::ThemeEditor() { add_child(add_del_dialog); Label *l = memnew(Label); - l->set_pos(Point2(5, 5) * EDSCALE); + l->set_position(Point2(5, 5) * EDSCALE); l->set_text(TTR("Type:")); add_del_dialog->add_child(l); dtype_select_label = l; type_edit = memnew(LineEdit); - type_edit->set_pos(Point2(5, 25) * EDSCALE); + type_edit->set_position(Point2(5, 25) * EDSCALE); type_edit->set_size(Point2(150, 5) * EDSCALE); add_del_dialog->add_child(type_edit); type_menu = memnew(MenuButton); - type_menu->set_pos(Point2(160, 25) * EDSCALE); + type_menu->set_position(Point2(160, 25) * EDSCALE); type_menu->set_size(Point2(30, 5) * EDSCALE); type_menu->set_text(".."); add_del_dialog->add_child(type_menu); @@ -851,17 +851,17 @@ ThemeEditor::ThemeEditor() { type_menu->get_popup()->connect("id_pressed", this, "_type_menu_cbk"); l = memnew(Label); - l->set_pos(Point2(200, 5) * EDSCALE); + l->set_position(Point2(200, 5) * EDSCALE); l->set_text(TTR("Name:")); add_del_dialog->add_child(l); name_select_label = l; name_edit = memnew(LineEdit); - name_edit->set_pos(Point2(200, 25) * EDSCALE); + name_edit->set_position(Point2(200, 25) * EDSCALE); name_edit->set_size(Point2(150, 5) * EDSCALE); add_del_dialog->add_child(name_edit); name_menu = memnew(MenuButton); - name_menu->set_pos(Point2(360, 25) * EDSCALE); + name_menu->set_position(Point2(360, 25) * EDSCALE); name_menu->set_size(Point2(30, 5) * EDSCALE); name_menu->set_text(".."); @@ -871,7 +871,7 @@ ThemeEditor::ThemeEditor() { name_menu->get_popup()->connect("id_pressed", this, "_name_menu_cbk"); type_select_label = memnew(Label); - type_select_label->set_pos(Point2(400, 5) * EDSCALE); + type_select_label->set_position(Point2(400, 5) * EDSCALE); type_select_label->set_text(TTR("Data Type:")); add_del_dialog->add_child(type_select_label); @@ -881,7 +881,7 @@ ThemeEditor::ThemeEditor() { type_select->add_item(TTR("Font")); type_select->add_item(TTR("Color")); type_select->add_item(TTR("Constant")); - type_select->set_pos(Point2(400, 25) * EDSCALE); + type_select->set_position(Point2(400, 25) * EDSCALE); type_select->set_size(Point2(80, 5) * EDSCALE); add_del_dialog->add_child(type_select); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index cbd300a53c..e79cbd0d35 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -225,7 +225,7 @@ TileSetEditor::TileSetEditor(EditorNode *p_editor) { add_child(panel); MenuButton *options = memnew(MenuButton); panel->add_child(options); - options->set_pos(Point2(1, 1)); + options->set_position(Point2(1, 1)); options->set_text("Theme"); options->get_popup()->add_item(TTR("Add Item"), MENU_OPTION_ADD_ITEM); options->get_popup()->add_item(TTR("Remove Item"), MENU_OPTION_REMOVE_ITEM); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index cb67d706c3..35b8973818 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -50,6 +50,19 @@ #include "scene/gui/tool_button.h" #include "version.h" +static String _find_project_file(DirAccess *p_da) { + p_da->list_dir_begin(); + while (true) { + String f = p_da->get_next(); + if (f == "") + break; + if (f.get_extension() == "godot") + return p_da->get_current_dir() + "/" + f; + } + p_da->list_dir_end(); + return ""; +} + class NewProjectDialog : public ConfirmationDialog { GDCLASS(NewProjectDialog, ConfirmationDialog); @@ -92,18 +105,18 @@ private: if (mode != MODE_IMPORT) { - if (d->file_exists("godot.cfg")) { + if (_find_project_file(d) != "") { - error->set_text(TTR("Invalid project path, godot.cfg must not exist.")); + error->set_text(TTR("Invalid project path, *.godot must not exist.")); memdelete(d); return ""; } } else { - if (valid_path != "" && !d->file_exists("godot.cfg")) { + if (valid_path != "" && _find_project_file(d) == "") { - error->set_text(TTR("Invalid project path, godot.cfg must exist.")); + error->set_text(TTR("Invalid project path, *.godot must exist.")); memdelete(d); return ""; } @@ -136,7 +149,7 @@ private: String p = p_path; if (mode == MODE_IMPORT) { - if (p.ends_with("godot.cfg")) { + if (p.get_extension() == "godot") { p = p.get_base_dir(); } @@ -162,7 +175,7 @@ private: fdialog->set_mode(FileDialog::MODE_OPEN_FILE); fdialog->clear_filters(); - fdialog->add_filter("godot.cfg ; " _MKSTR(VERSION_NAME) " Project"); + fdialog->add_filter("*.godot ; " _MKSTR(VERSION_NAME) " Project"); } else { fdialog->set_mode(FileDialog::MODE_OPEN_DIR); } @@ -186,9 +199,9 @@ private: } else { if (mode == MODE_NEW) { - FileAccess *f = FileAccess::open(dir.plus_file("/godot.cfg"), FileAccess::WRITE); + FileAccess *f = FileAccess::open(dir.plus_file("/" + project_name->get_text().replace(" ", "_") + ".godot"), FileAccess::WRITE); if (!f) { - error->set_text(TTR("Couldn't create godot.cfg in project path.")); + error->set_text(TTR("Couldn't create *.godot project file in project path.")); } else { f->store_line("; Engine configuration file."); @@ -405,7 +418,7 @@ public: l = memnew(Label); l->set_text(TTR("Project Name:")); - l->set_pos(Point2(5, 50)); + l->set_position(Point2(5, 50)); vb->add_child(l); pn = l; @@ -624,7 +637,7 @@ void ProjectManager::_unhandled_input(const InputEvent &p_ev) { selected_list.clear(); selected_list.insert(current, hb->get_meta("main_scene")); - int offset_diff = scroll->get_v_scroll() - hb->get_pos().y; + int offset_diff = scroll->get_v_scroll() - hb->get_position().y; if (offset_diff > 0) scroll->set_v_scroll(scroll->get_v_scroll() - offset_diff); @@ -662,7 +675,7 @@ void ProjectManager::_unhandled_input(const InputEvent &p_ev) { selected_list.insert(current, hb->get_meta("main_scene")); int last_y_visible = scroll->get_v_scroll() + scroll->get_size().y; - int offset_diff = (hb->get_pos().y + hb->get_size().y) - last_y_visible; + int offset_diff = (hb->get_position().y + hb->get_size().y) - last_y_visible; if (offset_diff > 0) scroll->set_v_scroll(scroll->get_v_scroll() + offset_diff); @@ -741,10 +754,17 @@ void ProjectManager::_load_recent_projects() { continue; String project = _name.get_slice("/", 1); - String conf = path.plus_file("godot.cfg"); + DirAccess *dir_access = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + if (dir_access->change_dir(path) != OK) { + EditorSettings::get_singleton()->erase(_name); + continue; + } + String conf = _find_project_file(dir_access); + memdelete(dir_access); bool favorite = (_name.begins_with("favorite_projects/")) ? true : false; uint64_t last_modified = 0; + if (FileAccess::exists(conf)) { last_modified = FileAccess::get_modified_time(conf); @@ -912,7 +932,7 @@ void ProjectManager::_update_scroll_pos(const String &dir) { selected_list.insert(hb->get_meta("name"), hb->get_meta("main_scene")); _update_project_buttons(); int last_y_visible = scroll->get_v_scroll() + scroll->get_size().y; - int offset_diff = (hb->get_pos().y + hb->get_size().y) - last_y_visible; + int offset_diff = (hb->get_position().y + hb->get_size().y) - last_y_visible; if (offset_diff > 0) scroll->set_v_scroll(scroll->get_v_scroll() + offset_diff); @@ -1006,7 +1026,7 @@ void ProjectManager::_scan_dir(DirAccess *da, float pos, float total, List<Strin while (n != String()) { if (da->current_is_dir() && !n.begins_with(".")) { subdirs.push_front(n); - } else if (n == "godot.cfg") { + } else if (n.get_extension() == "godot") { r_projects->push_back(da->get_current_dir()); } n = da->get_next(); @@ -1117,7 +1137,7 @@ void ProjectManager::_files_dropped(PoolStringArray p_files, int p_screen) { dir->list_dir_begin(); String file = dir->get_next(); while (confirm && file != String()) { - if (!dir->current_is_dir() && file.ends_with("godot.cfg")) { + if (!dir->current_is_dir() && file.get_extension() == "godot") { confirm = false; } file = dir->get_next(); diff --git a/editor/project_settings.cpp b/editor/project_settings.cpp index 77af64d9e3..bc1bdcf8af 100644 --- a/editor/project_settings.cpp +++ b/editor/project_settings.cpp @@ -397,12 +397,12 @@ void ProjectSettings::_action_button_pressed(Object *p_obj, int p_column, int p_ ERR_FAIL_COND(!ti); if (p_id == 1) { - Point2 ofs = input_editor->get_global_pos(); + Point2 ofs = input_editor->get_global_position(); Rect2 ir = input_editor->get_item_rect(ti); ir.pos.y -= input_editor->get_scroll().y; ofs += ir.pos + ir.size; ofs.x -= 100; - popup_add->set_pos(ofs); + popup_add->set_position(ofs); popup_add->popup(); add_at = "input/" + ti->get_text(0); @@ -1168,7 +1168,8 @@ void ProjectSettings::_bind_methods() { ProjectSettings::ProjectSettings(EditorData *p_data) { singleton = this; - set_title(TTR("Project Settings (godot.cfg)")); + String project_file = "(" + GlobalConfig::get_singleton()->get_project_file_name() + ")"; + set_title(TTR("Project Settings " + project_file)); set_resizable(true); undo_redo = &p_data->get_undo_redo(); data = p_data; @@ -1326,7 +1327,7 @@ ProjectSettings::ProjectSettings(EditorData *p_data) { l = memnew(Label); vbc->add_child(l); - l->set_pos(Point2(6, 5)); + l->set_position(Point2(6, 5)); l->set_text(TTR("Action:")); hbc = memnew(HBoxContainer); diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 406dbac5d9..666bfa20b5 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -319,12 +319,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: CheckBox *c = checks20[0]; c->set_text("True"); - checks20gc->set_pos(Vector2(4, 4)); + checks20gc->set_position(Vector2(4, 4)); c->set_pressed(v); c->show(); checks20gc->set_size(checks20gc->get_minimum_size()); - set_size(checks20gc->get_pos() + checks20gc->get_size() + Vector2(4, 4) * EDSCALE); + set_size(checks20gc->get_position() + checks20gc->get_size() + Vector2(4, 4) * EDSCALE); } break; case Variant::INT: @@ -374,7 +374,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: for (int i = 0; i < options.size(); i++) { menu->add_item(options[i], i); } - menu->set_pos(get_pos()); + menu->set_position(get_position()); menu->popup(); hide(); updating = false; @@ -423,12 +423,12 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: value_label[0]->set_text(title); value_label[0]->show(); - value_label[0]->set_pos(Vector2(4, 4) * EDSCALE); + value_label[0]->set_position(Vector2(4, 4) * EDSCALE); - checks20gc->set_pos(Vector2(4, 4) * EDSCALE + Vector2(0, value_label[0]->get_size().height + 4 * EDSCALE)); + checks20gc->set_position(Vector2(4, 4) * EDSCALE + Vector2(0, value_label[0]->get_size().height + 4 * EDSCALE)); checks20gc->set_size(checks20gc->get_minimum_size()); - set_size(Vector2(4, 4) * EDSCALE + checks20gc->get_pos() + checks20gc->get_size()); + set_size(Vector2(4, 4) * EDSCALE + checks20gc->get_position() + checks20gc->get_size()); } else if (hint == PROPERTY_HINT_EXP_EASING) { @@ -466,7 +466,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: if (f & (1 << i)) menu->set_item_checked(menu->get_item_index(i), true); } - menu->set_pos(get_pos()); + menu->set_position(get_position()); menu->popup(); hide(); updating = false; @@ -502,7 +502,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: for (int i = 0; i < options.size(); i++) { menu->add_item(options[i], i); } - menu->set_pos(get_pos()); + menu->set_position(get_position()); menu->popup(); hide(); updating = false; @@ -838,15 +838,15 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: value_editor[i]->show(); value_label[i]->show(); - value_label[i]->set_pos(Point2(ofs,y)); + value_label[i]->set_position(Point2(ofs,y)); scroll[i]->set_min(0); scroll[i]->set_max(1.0); scroll[i]->set_page(0); - scroll[i]->set_pos(Point2(ofs+15,y+Math::floor((h-scroll[i]->get_minimum_size().height)/2.0))); + scroll[i]->set_position(Point2(ofs+15,y+Math::floor((h-scroll[i]->get_minimum_size().height)/2.0))); scroll[i]->set_val(values[i]); scroll[i]->set_size(Size2(120,1)); scroll[i]->show(); - value_editor[i]->set_pos(Point2(ofs+140,y)); + value_editor[i]->set_position(Point2(ofs+140,y)); value_editor[i]->set_size(Size2(40,h)); value_editor[i]->set_text( String::num(values[i],2 )); @@ -857,7 +857,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: value_label[2]->set_text("B"); value_label[3]->set_text("A"); - Size2 new_size = value_editor[3]->get_pos() + value_editor[3]->get_size() + Point2(10,10); + Size2 new_size = value_editor[3]->get_position() + value_editor[3]->get_size() + Point2(10,10); set_size( new_size ); */ @@ -981,7 +981,7 @@ bool CustomPropertyEditor::edit(Object *p_owner, const String &p_name, Variant:: } } - menu->set_pos(get_pos()); + menu->set_position(get_position()); menu->popup(); hide(); updating = false; @@ -1868,7 +1868,7 @@ void CustomPropertyEditor::config_action_buttons(const List<String> &p_strings) if (i < p_strings.size()) { action_buttons[i]->show(); action_buttons[i]->set_text(p_strings[i]); - action_buttons[i]->set_pos(Point2(m, m + i * (h + m))); + action_buttons[i]->set_position(Point2(m, m + i * (h + m))); action_buttons[i]->set_size(Size2(w - m * 2, h)); action_buttons[i]->set_flat(true); } else { @@ -1896,9 +1896,9 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns, int value_editor[i]->show(); value_label[i]->show(); value_label[i]->set_text(i < p_strings.size() ? p_strings[i] : String("")); - value_editor[i]->set_pos(Point2(m + p_label_w + c * (w + m + p_label_w), m + r * (h + m))); + value_editor[i]->set_position(Point2(m + p_label_w + c * (w + m + p_label_w), m + r * (h + m))); value_editor[i]->set_size(Size2(w, h)); - value_label[i]->set_pos(Point2(m + c * (w + m + p_label_w), m + r * (h + m))); + value_label[i]->set_position(Point2(m + c * (w + m + p_label_w), m + r * (h + m))); value_editor[i]->set_editable(!read_only); } else { value_editor[i]->hide(); @@ -2388,6 +2388,10 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p RES res = obj->get(p_name).operator RefPtr(); if (res->is_class("Texture")) { int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); + Vector2 size(res->call("get_width"), res->call("get_height")); + if (size.width < size.height) { + tw = MAX((size.width / size.height) * tw, 1); + } p_item->set_icon_max_width(1, tw); p_item->set_icon(1, res); p_item->set_text(1, ""); @@ -2427,7 +2431,9 @@ void PropertyEditor::set_item_text(TreeItem *p_item, int p_type, const String &p } } - if (!res->is_class("Texture")) { + if (res->is_class("Script")) { + p_item->set_text(1, res->get_path().get_file()); + } else if (!res->is_class("Texture")) { //texture already previews via itself EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", p_item->get_instance_ID()); } @@ -3618,6 +3624,10 @@ void PropertyEditor::update_tree() { if (res->is_class("Texture")) { int tw = EditorSettings::get_singleton()->get("docks/property_editor/texture_preview_width"); + Vector2 size(res->call("get_width"), res->call("get_height")); + if (size.width < size.height) { + tw = MAX((size.width / size.height) * tw, 1); + } item->set_icon_max_width(1, tw); item->set_icon(1, res); item->set_text(1, ""); @@ -3641,7 +3651,9 @@ void PropertyEditor::update_tree() { } else if (res.is_valid()) { item->set_tooltip(1, res->get_name() + " (" + res->get_class() + ")"); } - if (!res->is_class("Texture")) { + if (res->is_class("Script")) { + item->set_text(1, res->get_path().get_file()); + } else if (!res->is_class("Texture")) { //texture already previews via itself EditorResourcePreview::get_singleton()->queue_edited_resource_preview(res, this, "_resource_preview_done", item->get_instance_ID()); } @@ -3989,7 +4001,7 @@ void PropertyEditor::_custom_editor_request(bool p_arrow) { int hint = d.has("hint") ? d["hint"].operator int() : -1; String hint_text = d.has("hint_text") ? d["hint_text"] : ""; Rect2 where = tree->get_custom_popup_rect(); - custom_editor->set_pos(where.pos); + custom_editor->set_position(where.pos); if (custom_editor->edit(obj, name, type, v, hint, hint_text)) { custom_editor->popup(); @@ -4097,8 +4109,8 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht); Rect2 where = tree->get_item_rect(ti, 1); where.pos -= tree->get_scroll(); - where.pos += tree->get_global_pos(); - custom_editor->set_pos(where.pos); + where.pos += tree->get_global_position(); + custom_editor->set_position(where.pos); custom_editor->popup(); } else if (t == Variant::STRING) { @@ -4110,8 +4122,8 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { Rect2 where = tree->get_item_rect(ti, 1); where.pos -= tree->get_scroll(); - where.pos += tree->get_global_pos(); - custom_editor->set_pos(where.pos); + where.pos += tree->get_global_position(); + custom_editor->set_position(where.pos); custom_editor->popup(); } else { custom_editor->popup_centered_ratio(); @@ -4389,6 +4401,7 @@ PropertyEditor::PropertyEditor() { capitalize_paths = true; autoclear = false; tree->set_column_titles_visible(false); + tree->add_constant_override("button_margin", 0); keying = false; read_only = false; diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp index ffd4d704d5..acc511e004 100644 --- a/editor/reparent_dialog.cpp +++ b/editor/reparent_dialog.cpp @@ -95,7 +95,7 @@ ReparentDialog::ReparentDialog() { tree->get_scene_tree()->connect("item_activated", this, "_reparent"); //Label *label = memnew( Label ); - //label->set_pos( Point2( 15,8) ); + //label->set_position( Point2( 15,8) ); //label->set_text("Reparent Location (Select new Parent):"); keep_transform = memnew(CheckBox); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 1a0e67e71a..69b8723431 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1112,7 +1112,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V if (node->cast_to<Spatial>()) editor_data->get_undo_redo().add_do_method(node, "set_global_transform", node->cast_to<Spatial>()->get_global_transform()); if (node->cast_to<Control>()) - editor_data->get_undo_redo().add_do_method(node, "set_global_pos", node->cast_to<Control>()->get_global_pos()); + editor_data->get_undo_redo().add_do_method(node, "set_global_position", node->cast_to<Control>()->get_global_position()); } editor_data->get_undo_redo().add_do_method(this, "_set_owners", edited_scene, owners); @@ -1154,7 +1154,7 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V if (node->cast_to<Spatial>()) editor_data->get_undo_redo().add_undo_method(node, "set_transform", node->cast_to<Spatial>()->get_transform()); if (node->cast_to<Control>()) - editor_data->get_undo_redo().add_undo_method(node, "set_pos", node->cast_to<Control>()->get_pos()); + editor_data->get_undo_redo().add_undo_method(node, "set_position", node->cast_to<Control>()->get_position()); } } @@ -1669,7 +1669,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { menu->add_icon_shortcut(get_icon("Instance", "EditorIcons"), ED_GET_SHORTCUT("scene_tree/instance_scene"), TOOL_INSTANCE); menu->set_size(Size2(1, 1)); - menu->set_pos(p_menu_pos); + menu->set_position(p_menu_pos); menu->popup(); return; } @@ -1710,7 +1710,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { menu->add_separator(); menu->add_icon_shortcut(get_icon("Remove", "EditorIcons"), ED_SHORTCUT("scene_tree/delete", TTR("Delete Node(s)"), KEY_DELETE), TOOL_ERASE); menu->set_size(Size2(1, 1)); - menu->set_pos(p_menu_pos); + menu->set_position(p_menu_pos); menu->popup(); } diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index b8bbe2c832..8fd0d13b32 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -162,16 +162,16 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i //open scene request Rect2 item_rect = tree->get_item_rect(item, 0); item_rect.pos.y -= tree->get_scroll().y; - item_rect.pos += tree->get_global_pos(); + item_rect.pos += tree->get_global_position(); if (n == get_scene_node()) { - inheritance_menu->set_pos(item_rect.pos + Vector2(0, item_rect.size.y)); + inheritance_menu->set_position(item_rect.pos + Vector2(0, item_rect.size.y)); inheritance_menu->set_size(Vector2(item_rect.size.x, 0)); inheritance_menu->popup(); instance_node = n->get_instance_ID(); } else { - instance_menu->set_pos(item_rect.pos + Vector2(0, item_rect.size.y)); + instance_menu->set_position(item_rect.pos + Vector2(0, item_rect.size.y)); instance_menu->set_size(Vector2(item_rect.size.x, 0)); if (EditorNode::get_singleton()->get_edited_scene()->is_editable_instance(n)) instance_menu->set_item_checked(0, true); @@ -1103,7 +1103,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope if (p_label) { Label *label = memnew(Label); - label->set_pos(Point2(10, 0)); + label->set_position(Point2(10, 0)); label->set_text(TTR("Scene Tree (Nodes):")); add_child(label); diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index 136490eb10..4781bb6a3b 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -2021,6 +2021,131 @@ VisibilityNotifierGizmo::VisibilityNotifierGizmo(VisibilityNotifier *p_notifier) /// +String ParticlesGizmo::get_handle_name(int p_idx) const { + + switch (p_idx) { + case 0: return "Size X"; + case 1: return "Size Y"; + case 2: return "Size Z"; + case 3: return "Pos X"; + case 4: return "Pos Y"; + case 5: return "Pos Z"; + } + + return ""; +} +Variant ParticlesGizmo::get_handle_value(int p_idx) const { + + return particles->get_visibility_aabb(); +} +void ParticlesGizmo::set_handle(int p_idx, Camera *p_camera, const Point2 &p_point) { + + Transform gt = particles->get_global_transform(); + //gt.orthonormalize(); + Transform gi = gt.affine_inverse(); + + bool move = p_idx >= 3; + p_idx = p_idx % 3; + + Rect3 aabb = particles->get_visibility_aabb(); + Vector3 ray_from = p_camera->project_ray_origin(p_point); + Vector3 ray_dir = p_camera->project_ray_normal(p_point); + + Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 4096) }; + + Vector3 ofs = aabb.pos + aabb.size * 0.5; + + Vector3 axis; + axis[p_idx] = 1.0; + + if (move) { + + Vector3 ra, rb; + Geometry::get_closest_points_between_segments(ofs - axis * 4096, ofs + axis * 4096, sg[0], sg[1], ra, rb); + + float d = ra[p_idx]; + + aabb.pos[p_idx] = d - 1.0 - aabb.size[p_idx] * 0.5; + particles->set_visibility_aabb(aabb); + + } else { + Vector3 ra, rb; + Geometry::get_closest_points_between_segments(ofs, ofs + axis * 4096, sg[0], sg[1], ra, rb); + + float d = ra[p_idx] - ofs[p_idx]; + if (d < 0.001) + d = 0.001; + //resize + aabb.pos[p_idx] = (aabb.pos[p_idx] + aabb.size[p_idx] * 0.5) - d; + aabb.size[p_idx] = d * 2; + particles->set_visibility_aabb(aabb); + } +} + +void ParticlesGizmo::commit_handle(int p_idx, const Variant &p_restore, bool p_cancel) { + + if (p_cancel) { + particles->set_visibility_aabb(p_restore); + return; + } + + UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo(); + ur->create_action(TTR("Change Particles AABB")); + ur->add_do_method(particles, "set_custom_aabb", particles->get_visibility_aabb()); + ur->add_undo_method(particles, "set_custom_aabb", p_restore); + ur->commit_action(); +} + +void ParticlesGizmo::redraw() { + + clear(); + + Vector<Vector3> lines; + Rect3 aabb = particles->get_visibility_aabb(); + + for (int i = 0; i < 12; i++) { + Vector3 a, b; + aabb.get_edge(i, a, b); + lines.push_back(a); + lines.push_back(b); + } + + Vector<Vector3> handles; + + for (int i = 0; i < 3; i++) { + + Vector3 ax; + ax[i] = aabb.pos[i] + aabb.size[i]; + ax[(i + 1) % 3] = aabb.pos[(i + 1) % 3] + aabb.size[(i + 1) % 3] * 0.5; + ax[(i + 2) % 3] = aabb.pos[(i + 2) % 3] + aabb.size[(i + 2) % 3] * 0.5; + handles.push_back(ax); + } + + Vector3 center = aabb.pos + aabb.size * 0.5; + for (int i = 0; i < 3; i++) { + + Vector3 ax; + ax[i] = 1.0; + handles.push_back(center + ax); + lines.push_back(center); + lines.push_back(center + ax); + } + + add_lines(lines, SpatialEditorGizmos::singleton->particles_material); + add_collision_segments(lines); + //add_unscaled_billboard(SpatialEditorGizmos::singleton->visi,0.05); + add_handles(handles); +} +ParticlesGizmo::ParticlesGizmo(Particles *p_particles) { + + particles = p_particles; + set_spatial_node(p_particles); +} + +//////// + +/// + String ReflectionProbeGizmo::get_handle_name(int p_idx) const { switch (p_idx) { @@ -2938,6 +3063,12 @@ Ref<SpatialEditorGizmo> SpatialEditorGizmos::get_gizmo(Spatial *p_spatial) { return misg; } + if (p_spatial->cast_to<Particles>()) { + + Ref<ParticlesGizmo> misg = memnew(ParticlesGizmo(p_spatial->cast_to<Particles>())); + return misg; + } + if (p_spatial->cast_to<ReflectionProbe>()) { Ref<ReflectionProbeGizmo> misg = memnew(ReflectionProbeGizmo(p_spatial->cast_to<ReflectionProbe>())); @@ -3152,6 +3283,7 @@ SpatialEditorGizmos::SpatialEditorGizmos() { raycast_material = create_line_material(Color(1.0, 0.8, 0.6)); car_wheel_material = create_line_material(Color(0.6, 0.8, 1.0)); visibility_notifier_material = create_line_material(Color(1.0, 0.5, 1.0)); + particles_material = create_line_material(Color(1.0, 1.0, 0.5)); reflection_probe_material = create_line_material(Color(0.5, 1.0, 0.7)); reflection_probe_material_internal = create_line_material(Color(0.3, 0.8, 0.5, 0.15)); gi_probe_material = create_line_material(Color(0.7, 1.0, 0.5)); diff --git a/editor/spatial_editor_gizmos.h b/editor/spatial_editor_gizmos.h index 3aecc8fc02..095586ab91 100644 --- a/editor/spatial_editor_gizmos.h +++ b/editor/spatial_editor_gizmos.h @@ -33,22 +33,22 @@ #include "editor/plugins/spatial_editor_plugin.h" #include "scene/3d/body_shape.h" #include "scene/3d/camera.h" +#include "scene/3d/collision_polygon.h" #include "scene/3d/gi_probe.h" #include "scene/3d/light.h" #include "scene/3d/listener.h" #include "scene/3d/mesh_instance.h" #include "scene/3d/navigation_mesh.h" +#include "scene/3d/particles.h" +#include "scene/3d/physics_joint.h" #include "scene/3d/portal.h" #include "scene/3d/position_3d.h" #include "scene/3d/ray_cast.h" #include "scene/3d/reflection_probe.h" #include "scene/3d/room_instance.h" #include "scene/3d/test_cube.h" -#include "scene/3d/visibility_notifier.h" - -#include "scene/3d/collision_polygon.h" -#include "scene/3d/physics_joint.h" #include "scene/3d/vehicle_body.h" +#include "scene/3d/visibility_notifier.h" class Camera; @@ -244,6 +244,22 @@ public: VisibilityNotifierGizmo(VisibilityNotifier *p_notifier = NULL); }; +class ParticlesGizmo : public EditorSpatialGizmo { + + GDCLASS(ParticlesGizmo, EditorSpatialGizmo); + + Particles *particles; + +public: + virtual String get_handle_name(int p_idx) const; + virtual Variant get_handle_value(int p_idx) const; + virtual void set_handle(int p_idx, Camera *p_camera, const Point2 &p_point); + virtual void commit_handle(int p_idx, const Variant &p_restore, bool p_cancel = false); + + void redraw(); + ParticlesGizmo(Particles *p_particles = NULL); +}; + class ReflectionProbeGizmo : public EditorSpatialGizmo { GDCLASS(ReflectionProbeGizmo, EditorSpatialGizmo); @@ -420,6 +436,7 @@ public: Ref<SpatialMaterial> portal_material; Ref<SpatialMaterial> raycast_material; Ref<SpatialMaterial> visibility_notifier_material; + Ref<SpatialMaterial> particles_material; Ref<SpatialMaterial> car_wheel_material; Ref<SpatialMaterial> joint_material; diff --git a/main/SCsub b/main/SCsub index a09b7c4396..56dfbaa0f1 100644 --- a/main/SCsub +++ b/main/SCsub @@ -2,11 +2,57 @@ Import('env') + +def make_splash(target, source, env): + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src, "rb") + g = open(dst, "wb") + + buf = f.read() + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef BOOT_SPLASH_H\n") + g.write("#define BOOT_SPLASH_H\n") + g.write("static const Color boot_splash_bg_color = Color(1,1,1,1);\n"); + g.write("static const unsigned char boot_splash_png[] = {\n") + for i in range(len(buf)): + g.write(str(ord(buf[i])) + ",\n") + g.write("};\n") + g.write("#endif") + + +def make_app_icon(target, source, env): + + src = source[0].srcnode().abspath + dst = target[0].srcnode().abspath + f = open(src, "rb") + g = open(dst, "wb") + + buf = f.read() + + g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") + g.write("#ifndef APP_ICON_H\n") + g.write("#define APP_ICON_H\n") + g.write("static const unsigned char app_icon_png[] = {\n") + for i in range(len(buf)): + g.write(str(ord(buf[i])) + ",\n") + g.write("};\n") + g.write("#endif") + + env.main_sources = [] env.add_source_files(env.main_sources, "*.cpp") Export('env') +env.Depends("#main/splash.h", "#main/splash.png") +env.Command("#main/splash.h", "#main/splash.png", make_splash) + +env.Depends("#main/app_icon.h", "#main/app_icon.png") +env.Command("#main/app_icon.h", "#main/app_icon.png", make_app_icon) + SConscript('tests/SCsub') lib = env.Library("main", env.main_sources) diff --git a/main/app_icon.png b/main/app_icon.png Binary files differnew file mode 100644 index 0000000000..eafae08d59 --- /dev/null +++ b/main/app_icon.png diff --git a/main/input_default.cpp b/main/input_default.cpp index 918f3c150c..8f0b8464eb 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -340,7 +340,7 @@ void InputDefault::parse_input_event(const InputEvent &p_event) { Point2 pos = Point2(p_event.mouse_button.global_x, p_event.mouse_button.global_y); if (mouse_pos != pos) { - set_mouse_pos(pos); + set_mouse_position(pos); } } break; case InputEvent::MOUSE_MOTION: { @@ -456,16 +456,16 @@ void InputDefault::set_main_loop(MainLoop *p_main_loop) { main_loop = p_main_loop; } -void InputDefault::set_mouse_pos(const Point2 &p_posf) { +void InputDefault::set_mouse_position(const Point2 &p_posf) { mouse_speed_track.update(p_posf - mouse_pos); mouse_pos = p_posf; if (custom_cursor.is_valid()) { - VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos()); + VisualServer::get_singleton()->cursor_set_pos(get_mouse_position()); } } -Point2 InputDefault::get_mouse_pos() const { +Point2 InputDefault::get_mouse_position() const { return mouse_pos; } @@ -560,7 +560,7 @@ void InputDefault::set_custom_mouse_cursor(const RES &p_cursor, const Vector2 &p set_mouse_mode(MOUSE_MODE_HIDDEN); VisualServer::get_singleton()->cursor_set_visible(true); VisualServer::get_singleton()->cursor_set_texture(custom_cursor->get_rid(), p_hotspot, 0, region); - VisualServer::get_singleton()->cursor_set_pos(get_mouse_pos()); + VisualServer::get_singleton()->cursor_set_pos(get_mouse_position()); } } @@ -687,6 +687,7 @@ static const char *s_ControllerMappings[] = { "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "030000004c050000a00b000011010000,Sony DualShock 4 Wireless Adaptor,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,", "030000004c050000c405000011010000,Sony DualShock 4,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,", + "030000004c050000c405000011810000,Sony Computer Entertainment Wireless Controller,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:h0.1,rightshoulder:b5,rightx:a3,start:b9,righty:a4,dpleft:h0.8,lefttrigger:a2,x:b3,dpup:h0.1,back:b8,leftstick:b11,leftshoulder:b4,y:b2,a:b0,dpright:h0.2,righttrigger:a5,b:b1,", "030000004c050000cc09000011010000,Sony DualShock 4 V2,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b13,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:a3,righttrigger:a4,", "030000004f04000000b3000010010000,Thrustmaster Firestorm Dual Power,a:b0,b:b2,y:b3,x:b1,start:b10,guide:b8,back:b9,leftstick:b11,rightstick:b12,leftshoulder:b4,rightshoulder:b6,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b5,righttrigger:b7,", "030000004f04000008d0000000010000,Thrustmaster Run N Drive Wireless,a:b1,b:b2,x:b0,y:b3,start:b9,back:b8,leftstick:b10,rightstick:b11,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftx:a0,lefty:a1,rightx:a2,righty:a5,lefttrigger:b6,righttrigger:b7,", @@ -756,6 +757,7 @@ static const char *s_ControllerMappings[] = { "05000000102800000900000000010000,8Bitdo SFC30 GamePad,x:b4,a:b1,b:b0,y:b3,back:b10,start:b11,leftshoulder:b6,rightshoulder:b7,leftx:a0,lefty:a1,", "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", "05000000362800000100000003010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "05000000362800000100000004010000,OUYA Game Controller,leftx:a0,lefty:a1,dpdown:b9,rightstick:b7,rightshoulder:b5,rightx:a3,start:b16,righty:a4,dpleft:b10,lefttrigger:b12,x:b1,dpup:b8,back:b14,leftstick:b6,leftshoulder:b4,y:b2,a:b0,dpright:b11,righttrigger:b13,b:b3,", "05000000380700006652000025010000,Mad Catz C.T.R.L.R ,x:b0,a:b1,b:b2,y:b3,back:b8,guide:b12,start:b9,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "050000004c0500006802000000010000,PS3 Controller (Bluetooth),a:b14,b:b13,y:b12,x:b15,start:b3,guide:b16,back:b0,leftstick:b1,rightstick:b2,leftshoulder:b10,rightshoulder:b11,dpup:b4,dpleft:b7,dpdown:b6,dpright:b5,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b8,righttrigger:b9,", @@ -910,6 +912,7 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) { if (joy.mapping == -1) { _axis_event(p_device, p_axis, val); + return; }; Map<int, JoyEvent>::Element *el = map_db[joy.mapping].axis.find(p_axis); diff --git a/main/input_default.h b/main/input_default.h index a611047cb3..55b7555ef9 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -196,7 +196,7 @@ public: virtual Vector3 get_magnetometer() const; virtual Vector3 get_gyroscope() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual Point2 get_last_mouse_speed() const; virtual int get_mouse_button_mask() const; @@ -215,7 +215,7 @@ public: virtual void stop_joy_vibration(int p_device); void set_main_loop(MainLoop *main_loop); - void set_mouse_pos(const Point2 &p_posf); + void set_mouse_position(const Point2 &p_posf); void action_press(const StringName &p_action); void action_release(const StringName &p_action); diff --git a/main/main.cpp b/main/main.cpp index e4e2616698..c294926045 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "main.h" +#include "app_icon.h" #include "core/register_core_types.h" #include "drivers/register_driver_types.h" #include "global_config.h" @@ -128,7 +129,7 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n"); OS::get_singleton()->print("Usage: %s [options] [scene]\n", p_binary); OS::get_singleton()->print("Options:\n"); - OS::get_singleton()->print("\t-path [dir] : Path to a game, containing godot.cfg\n"); + OS::get_singleton()->print("\t-path [dir] : Path to a game, containing *.godot\n"); #ifdef TOOLS_ENABLED OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n"); #endif @@ -446,6 +447,23 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else { goto error; } + } else if (I->get().ends_with(".godot")) { + String path; + String file = I->get(); + int sep = MAX(file.find_last("/"), file.find_last("\\")); + if (sep == -1) + path = "."; + else { + path = file.substr(0, sep); + } + if (OS::get_singleton()->set_cwd(path) == OK) { + + } else { + game_path = path; + } +#ifdef TOOLS_ENABLED + editor = true; +#endif } else if (I->get() == "-bp") { // /breakpoints if (I->next()) { @@ -672,7 +690,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph else input_map->load_from_globals(); //keys for game - if (video_driver == "") // specified in godot.cfg + if (video_driver == "") // specified in *.godot video_driver = GLOBAL_DEF("display/driver/name", Variant((const char *)OS::get_singleton()->get_video_driver_name(0))); if (!force_res && use_custom_res && globals->has("display/window/width")) @@ -724,7 +742,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph /* Determine Video Driver */ - if (audio_driver == "") { // specified in godot.cfg + if (audio_driver == "") { // specified in *.godot audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0)); } @@ -885,6 +903,9 @@ Error Main::setup2() { } else if (init_fullscreen) { OS::get_singleton()->set_window_fullscreen(true); } + + register_server_types(); + MAIN_PRINT("Main: Load Remaps"); Color clear = GLOBAL_DEF("rendering/viewport/default_clear_color", Color(0.3, 0.3, 0.3)); @@ -953,7 +974,6 @@ Error Main::setup2() { MAIN_PRINT("Main: Load Scene Types"); register_scene_types(); - register_server_types(); GLOBAL_DEF("display/mouse_cursor/custom_image", String()); GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2()); @@ -1232,7 +1252,7 @@ bool Main::start() { String stretch_mode = GLOBAL_DEF("display/stretch/mode", "disabled"); String stretch_aspect = GLOBAL_DEF("display/stretch/aspect", "ignore"); - Size2i stretch_size = Size2(GLOBAL_DEF("display/screen/width", 0), GLOBAL_DEF("display/screen/height", 0)); + Size2i stretch_size = Size2(GLOBAL_DEF("display/window/width", 0), GLOBAL_DEF("display/window/height", 0)); SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED; if (stretch_mode == "2d") diff --git a/main/splash.h b/main/splash.h deleted file mode 100644 index 0872be3487..0000000000 --- a/main/splash.h +++ /dev/null @@ -1,1424 +0,0 @@ -/*************************************************************************/ -/* splash.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef BOOT_SPLASH_H -#define BOOT_SPLASH_H - -static const unsigned char boot_splash_png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, - 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x01, 0x03, - 0x08, 0x06, 0x00, 0x00, 0x00, 0xdd, 0x81, 0x53, 0xf4, 0x00, 0x00, 0x00, - 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x32, 0xdf, 0x00, 0x00, 0x32, - 0xdf, 0x01, 0x17, 0xbe, 0xe4, 0x0b, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, - 0x4d, 0x45, 0x07, 0xde, 0x01, 0x19, 0x13, 0x08, 0x19, 0x46, 0x43, 0xd9, - 0xbb, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f, 0x6d, - 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, - 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x57, 0x81, - 0x0e, 0x17, 0x00, 0x00, 0x20, 0x00, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, - 0xed, 0x9d, 0x79, 0x78, 0x54, 0xd5, 0xf9, 0xc7, 0x3f, 0xef, 0x9d, 0x49, - 0xc2, 0x0e, 0xb2, 0xb9, 0xaf, 0xb8, 0x2f, 0x3f, 0xb5, 0xa8, 0xb4, 0xa2, - 0x66, 0x66, 0x02, 0x04, 0xea, 0x5a, 0xad, 0x5a, 0x6d, 0xb5, 0x2e, 0xad, - 0x56, 0x24, 0x1b, 0x04, 0xb5, 0x5a, 0x2b, 0xb6, 0x6a, 0x55, 0x02, 0x09, - 0x09, 0xae, 0x5d, 0xd4, 0x5a, 0x6b, 0x15, 0xad, 0x15, 0x15, 0x48, 0x48, - 0x66, 0x26, 0x50, 0x10, 0x17, 0x0a, 0x2a, 0x56, 0x51, 0x11, 0xd7, 0x8a, - 0xec, 0x90, 0x00, 0x59, 0x66, 0xee, 0xfb, 0xfb, 0x63, 0x82, 0x04, 0x32, - 0x09, 0x99, 0x9b, 0x99, 0x64, 0x92, 0x9c, 0xcf, 0xf3, 0xcc, 0x43, 0xb8, - 0x33, 0xf7, 0xdc, 0x73, 0xde, 0x73, 0xbe, 0xe7, 0xbc, 0xe7, 0xdc, 0xb3, - 0x80, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, - 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, - 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, - 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, - 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, - 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, - 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, - 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, - 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, - 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x86, 0x16, - 0x19, 0x53, 0xe0, 0xdf, 0xaf, 0xbd, 0x9e, 0x95, 0x71, 0x5f, 0x79, 0x2f, - 0x63, 0xf1, 0xce, 0x87, 0x18, 0x13, 0x24, 0x81, 0x50, 0xa7, 0x96, 0x0a, - 0x92, 0x76, 0xb4, 0xc0, 0x39, 0xa0, 0xe7, 0x00, 0xe7, 0x00, 0x43, 0x4a, - 0xf3, 0xbd, 0x09, 0x17, 0x55, 0x66, 0x81, 0xdf, 0x07, 0x52, 0x0e, 0x2c, - 0x05, 0x16, 0x00, 0x0b, 0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0x4c, 0x4b, 0x54, 0x9e, 0x4b, - 0x64, 0xe0, 0xca, 0xd0, 0x8e, 0xb8, 0x8d, 0x09, 0x12, 0x52, 0x92, 0x13, - 0x25, 0x5e, 0xcb, 0x15, 0x76, 0xbd, 0x04, 0x78, 0x77, 0x5e, 0x18, 0x53, - 0x10, 0x18, 0xec, 0xb2, 0xb4, 0x4f, 0xd8, 0x96, 0x5e, 0x88, 0xf4, 0x06, - 0x3b, 0x84, 0x6d, 0x6d, 0x03, 0x7b, 0x5b, 0x38, 0xc5, 0xde, 0x52, 0x91, - 0x3b, 0xaa, 0xf1, 0x08, 0x70, 0x6e, 0xe2, 0xea, 0x2b, 0x35, 0x2d, 0xaf, - 0x11, 0x6f, 0x57, 0x68, 0x78, 0x59, 0x9b, 0xc0, 0x77, 0x70, 0xe7, 0x64, - 0x16, 0x04, 0xca, 0x80, 0x43, 0x81, 0x43, 0x80, 0x1e, 0xb6, 0x2d, 0x91, - 0x77, 0x7e, 0xaa, 0x91, 0x36, 0x50, 0x22, 0xff, 0xba, 0x43, 0x2e, 0x32, - 0x0b, 0x02, 0x1b, 0x80, 0xcf, 0x81, 0x4d, 0x09, 0xf6, 0xb4, 0x8c, 0x78, - 0x8d, 0x78, 0xbb, 0x42, 0xc3, 0x4b, 0x55, 0x82, 0xbb, 0x3a, 0xa3, 0x63, - 0xf8, 0xfd, 0xa0, 0x86, 0x4f, 0xa2, 0xab, 0xac, 0x7a, 0x93, 0xf3, 0xa6, - 0xcf, 0xdb, 0xf9, 0xc5, 0x2b, 0x52, 0xd3, 0xcd, 0x92, 0x1c, 0xaa, 0x75, - 0x89, 0x11, 0xaf, 0x11, 0x6f, 0x17, 0x70, 0x9b, 0x95, 0xee, 0x36, 0xe7, - 0xf7, 0x83, 0x60, 0x9e, 0x57, 0x4d, 0xce, 0x1b, 0xf1, 0x76, 0x05, 0xf5, - 0x76, 0x37, 0xf1, 0xbe, 0x63, 0x32, 0xdd, 0x88, 0xb7, 0x4b, 0x60, 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fa, - 0x94, 0x06, 0x41, 0x9f, 0x04, 0xa4, 0x76, 0x83, 0x72, 0x54, 0x07, 0xbc, - 0x1b, 0x11, 0x29, 0xcb, 0x14, 0x59, 0x9e, 0x12, 0xb6, 0x96, 0xbf, 0x76, - 0xeb, 0x39, 0x2d, 0xbe, 0xf0, 0x9e, 0x97, 0xef, 0x59, 0x9b, 0x59, 0x10, - 0xd8, 0x18, 0xa3, 0x27, 0x33, 0xa0, 0x99, 0xeb, 0x46, 0xbc, 0x5d, 0x80, - 0x78, 0x8b, 0xa5, 0x55, 0x53, 0x85, 0x1a, 0x0a, 0xea, 0xe2, 0x86, 0x0f, - 0x00, 0x23, 0xff, 0xf8, 0xa6, 0xab, 0xef, 0xd6, 0xed, 0x27, 0xa8, 0xad, - 0xa7, 0x21, 0xdc, 0x0e, 0x0c, 0xeb, 0x42, 0x76, 0xfe, 0x04, 0xe5, 0x5e, - 0xb1, 0x64, 0xe9, 0xe6, 0x81, 0x7d, 0xde, 0x5f, 0x72, 0xed, 0x69, 0x76, - 0x22, 0xed, 0xdb, 0x0a, 0x0e, 0x3a, 0x7f, 0xca, 0x6c, 0x79, 0x65, 0xca, - 0x05, 0x6a, 0xc4, 0xdb, 0x79, 0xdb, 0xde, 0xed, 0x89, 0xec, 0xca, 0x67, - 0x16, 0x04, 0xc6, 0x03, 0x35, 0x08, 0xcb, 0xd4, 0xae, 0x5b, 0x51, 0x36, - 0x39, 0xb3, 0xd9, 0xcd, 0xa7, 0x16, 0xfd, 0xf2, 0x8c, 0x70, 0x43, 0x8b, - 0xf4, 0x6e, 0x66, 0x41, 0xe0, 0x65, 0x9a, 0xf6, 0xc5, 0x5b, 0x5b, 0xb8, - 0x3f, 0x04, 0xb6, 0x37, 0x8c, 0x51, 0x48, 0xa3, 0xf1, 0x8a, 0x3d, 0xff, - 0x96, 0x3d, 0x04, 0xa1, 0x7b, 0xf9, 0xbb, 0x57, 0x1b, 0x5a, 0xac, 0xd3, - 0x4a, 0x27, 0x7b, 0xb7, 0xb4, 0xe6, 0x87, 0x63, 0xa6, 0x96, 0xa6, 0x88, - 0x95, 0x7a, 0x12, 0xca, 0x29, 0x40, 0x5a, 0x69, 0xbe, 0xf7, 0x91, 0x04, - 0x64, 0xcd, 0x86, 0xee, 0x24, 0xdc, 0x2e, 0xda, 0xe7, 0x95, 0xaa, 0x84, - 0x0e, 0xc3, 0x09, 0x3f, 0x46, 0xf1, 0xa2, 0x20, 0x92, 0x1a, 0xca, 0x2c, - 0x08, 0xac, 0x68, 0xdc, 0xaf, 0x73, 0x11, 0x5e, 0x3e, 0x27, 0x3f, 0xa3, - 0xc9, 0xe9, 0x5a, 0x6a, 0x6b, 0x95, 0xc4, 0x7e, 0x9c, 0x89, 0xa2, 0x7a, - 0x59, 0xe9, 0x64, 0xdf, 0x0b, 0x89, 0xab, 0x8c, 0x82, 0x57, 0x80, 0x3e, - 0x43, 0x8c, 0x35, 0x9e, 0xda, 0x1a, 0xd5, 0x25, 0xfe, 0x61, 0x41, 0x45, - 0xbf, 0x30, 0xae, 0x93, 0x1b, 0xc6, 0x03, 0x76, 0x7e, 0x4e, 0x40, 0x1b, - 0xca, 0x9a, 0x50, 0x01, 0x24, 0x42, 0xbc, 0x9f, 0x19, 0xb7, 0xb9, 0xb3, - 0x23, 0x5a, 0xdd, 0x8e, 0x83, 0xe8, 0xee, 0x86, 0xfe, 0xed, 0x29, 0x3b, - 0xb5, 0x16, 0xc6, 0xd2, 0xcc, 0x82, 0xc0, 0xaa, 0x06, 0x41, 0xcf, 0x29, - 0xcd, 0xf7, 0x3e, 0x19, 0xf9, 0x46, 0x9c, 0xc4, 0xaa, 0x36, 0x91, 0xc2, - 0x05, 0x28, 0xcd, 0xf7, 0x3c, 0x9b, 0x59, 0x10, 0x78, 0x0a, 0x48, 0x89, - 0xad, 0x56, 0x91, 0xc6, 0xde, 0xc8, 0x75, 0xc0, 0x38, 0xe0, 0xd4, 0x30, - 0x1c, 0x01, 0xda, 0x11, 0x6f, 0x31, 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0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, - 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, - 0x30, 0x18, 0x0c, 0x06, 0x83, 0xc1, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x43, - 0xdb, 0xe9, 0x90, 0x9d, 0x34, 0x32, 0x32, 0x32, 0xd2, 0x34, 0xac, 0x67, - 0xa8, 0x70, 0x00, 0x36, 0x43, 0x91, 0xef, 0x76, 0x89, 0xe8, 0x0d, 0x54, - 0x03, 0x55, 0x91, 0x8f, 0x6c, 0x11, 0xf4, 0x23, 0x1b, 0x79, 0x3f, 0x18, - 0xac, 0xf8, 0xb2, 0x3d, 0xe3, 0xe8, 0xf5, 0x78, 0x0f, 0x04, 0x4e, 0x07, - 0x6b, 0x28, 0xe8, 0xce, 0xf8, 0x0d, 0x24, 0xb2, 0xf9, 0xda, 0x5a, 0x60, - 0x1d, 0xe8, 0x5a, 0x84, 0x77, 0x03, 0x81, 0xc0, 0x27, 0x89, 0x8a, 0x87, - 0xc7, 0xe3, 0x11, 0xa0, 0x7f, 0x0c, 0xb7, 0xd4, 0x04, 0x83, 0xc1, 0xa4, - 0xde, 0xb6, 0xc6, 0xe3, 0xf1, 0xec, 0x23, 0xc8, 0x0f, 0xc0, 0xda, 0x0f, - 0xbe, 0xdb, 0x25, 0x64, 0x08, 0x91, 0xdd, 0x3e, 0x1a, 0xdb, 0x76, 0xa5, - 0xcb, 0xe5, 0x7a, 0xaf, 0xbc, 0xbc, 0x3c, 0x2e, 0xfb, 0x65, 0xa5, 0xa7, - 0xa7, 0xf7, 0x17, 0x91, 0x76, 0x2b, 0xf3, 0x22, 0x12, 0x0a, 0x04, 0x02, - 0xd5, 0x9d, 0x5e, 0xbc, 0xe9, 0xe9, 0x19, 0x47, 0x59, 0x62, 0x8f, 0x05, - 0xc9, 0x04, 0xbc, 0xc4, 0xbe, 0x51, 0xf9, 0x56, 0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xf6, - 0x08, 0xb5, 0x21, 0xfa, 0xf5, 0xb1, 0x8a, 0x57, 0x55, 0x87, 0x1a, 0xf1, - 0xee, 0x81, 0x0d, 0x5b, 0xc5, 0x51, 0x01, 0xdf, 0xdb, 0x20, 0x92, 0x1e, - 0x00, 0x12, 0xcb, 0xf0, 0x7e, 0x2a, 0x70, 0x09, 0x2a, 0x5b, 0x80, 0xeb, - 0xe3, 0x25, 0x44, 0x67, 0xfd, 0x42, 0x11, 0x27, 0xe3, 0x41, 0xed, 0xb8, - 0x8d, 0x30, 0x88, 0xf4, 0x73, 0x38, 0x66, 0x55, 0x17, 0x1f, 0xdb, 0xda, - 0xd2, 0x26, 0x13, 0x1b, 0xda, 0xde, 0xe7, 0x15, 0xc4, 0xd1, 0xfa, 0x44, - 0x51, 0x06, 0x25, 0xa8, 0x2f, 0x27, 0x51, 0xae, 0xad, 0x71, 0x10, 0x92, - 0xf3, 0xf7, 0x82, 0xaa, 0x4e, 0x2a, 0x42, 0xdd, 0xbc, 0x79, 0x73, 0x3b, - 0xae, 0x35, 0xb5, 0x9d, 0xda, 0xdf, 0xde, 0xa3, 0xc2, 0x71, 0xb6, 0x67, - 0xb6, 0x4a, 0x5b, 0xfa, 0xf8, 0x31, 0xe7, 0x8d, 0x88, 0xac, 0x35, 0xe2, - 0x6d, 0x22, 0x42, 0xdd, 0xe2, 0xb0, 0xee, 0x3c, 0x24, 0x41, 0xcd, 0x5e, - 0xb4, 0x97, 0xf8, 0x4e, 0x76, 0x2f, 0xe8, 0x71, 0xe9, 0xa5, 0x97, 0x3a, - 0x1b, 0x81, 0x17, 0x75, 0xd2, 0xc7, 0x0e, 0xc7, 0x63, 0x83, 0xf6, 0x18, - 0x22, 0x79, 0xb0, 0x33, 0xf3, 0xee, 0x2e, 0xde, 0x8a, 0x8a, 0x8a, 0x1d, - 0x38, 0x18, 0x40, 0x12, 0x4b, 0x1c, 0x0d, 0x20, 0x79, 0x3c, 0x9e, 0xbe, - 0xec, 0xbe, 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- 0x1a, 0xb0, 0x2d, 0xfe, 0xf0, 0x50, 0x51, 0x51, 0xd4, 0x35, 0xd3, 0x13, - 0xb2, 0x27, 0xa6, 0x0b, 0x3a, 0x19, 0x38, 0x0e, 0xd8, 0xa4, 0xf0, 0x12, - 0x22, 0x0f, 0x12, 0x96, 0x11, 0x62, 0xd9, 0xbf, 0x50, 0xdb, 0xfa, 0xd5, - 0xcc, 0x99, 0xd3, 0x6a, 0x1a, 0x3d, 0xeb, 0x2f, 0x28, 0xcf, 0x95, 0x94, - 0x14, 0x96, 0xee, 0x8a, 0x67, 0xde, 0x9d, 0x28, 0x47, 0x94, 0x14, 0x17, - 0x5e, 0x9b, 0x95, 0x93, 0x77, 0x22, 0xca, 0x6f, 0x80, 0x53, 0x88, 0x9c, - 0xe3, 0xe4, 0x77, 0x59, 0x7a, 0x7f, 0x51, 0x51, 0x51, 0xd4, 0x2d, 0x8e, - 0x72, 0x73, 0x73, 0x07, 0x84, 0x6d, 0xb9, 0x85, 0x48, 0x05, 0xde, 0x1b, - 0xf8, 0x8f, 0x0a, 0x33, 0x67, 0xce, 0x28, 0x7c, 0xa7, 0xbb, 0x88, 0xb7, - 0xb3, 0x0f, 0x58, 0x9d, 0x46, 0x2b, 0xf6, 0x8b, 0x2e, 0x29, 0x9e, 0xfe, - 0x75, 0x49, 0x71, 0xe1, 0x35, 0xc5, 0xc5, 0x85, 0xaf, 0x37, 0x15, 0x63, - 0xee, 0x15, 0xa0, 0xff, 0x25, 0xb2, 0x48, 0x7c, 0x45, 0x83, 0x68, 0x46, - 0x21, 0x2c, 0x9a, 0x90, 0x9d, 0x97, 0x1d, 0x25, 0xb8, 0xf3, 0x80, 0xcb, - 0xb2, 0xb2, 0xf3, 0x2e, 0x06, 0x9d, 0x43, 0x64, 0x77, 0x8a, 0xa5, 0xc0, - 0x49, 0x28, 0x4f, 0x67, 0x65, 0xe7, 0xdd, 0x9c, 0x9d, 0x3d, 0xd1, 0x2d, - 0x96, 0xcc, 0x02, 0x26, 0x03, 0xab, 0x80, 0xaf, 0x80, 0x1b, 0xc3, 0xb6, - 0x7c, 0x38, 0x61, 0x42, 0x7e, 0xff, 0xa6, 0xae, 0xfd, 0x44, 0xb7, 0x2b, - 0xa4, 0x4f, 0x0a, 0x3c, 0x42, 0x64, 0x93, 0x82, 0x52, 0x22, 0x87, 0xa3, - 0x15, 0x66, 0x65, 0xe7, 0xc5, 0xb4, 0x9b, 0x63, 0x56, 0x76, 0xde, 0x3d, - 0xa8, 0xbe, 0x00, 0x9c, 0xd4, 0x10, 0x4e, 0x0f, 0xe0, 0x4e, 0x51, 0x96, - 0x5e, 0x77, 0xfd, 0x2f, 0xf6, 0x7c, 0xaf, 0x7f, 0x31, 0xf0, 0xf3, 0x09, - 0xd9, 0x79, 0x23, 0x10, 0x59, 0x4a, 0x64, 0x17, 0x89, 0xca, 0x48, 0x1c, - 0xe4, 0x1e, 0xcb, 0x96, 0xe7, 0x73, 0x73, 0x73, 0x25, 0xca, 0x33, 0x2e, - 0x15, 0xb4, 0x02, 0xc8, 0x20, 0x32, 0xa2, 0xff, 0x5f, 0x81, 0x5c, 0x51, - 0x0d, 0x88, 0xa5, 0x63, 0x81, 0x9f, 0x8b, 0xe8, 0x9e, 0x0d, 0xc3, 0xcf, - 0x45, 0x38, 0x7e, 0x8f, 0x6b, 0xe7, 0x02, 0xd7, 0x64, 0x65, 0xe5, 0x7d, - 0x1f, 0xe5, 0x0d, 0x60, 0x30, 0x91, 0x81, 0xc6, 0xfd, 0x80, 0xdf, 0x87, - 0x6d, 0x79, 0x71, 0xfc, 0xc4, 0x89, 0x4d, 0xe6, 0x22, 0x64, 0x67, 0xe7, - 0x9e, 0x14, 0xb6, 0xe5, 0xfd, 0x86, 0xb1, 0x8e, 0x0d, 0xc0, 0x07, 0xc0, - 0x05, 0xa2, 0x2c, 0x9d, 0x90, 0x9d, 0x77, 0x85, 0x69, 0x79, 0x3b, 0x07, - 0x87, 0x03, 0x6b, 0x9d, 0xde, 0x3c,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, 0xcb, 0xff, 0x89, 0xc8, 0x11, 0xa2, 0xf6, - 0x37, 0x21, 0x97, 0xbc, 0xf5, 0x70, 0x61, 0x61, 0x7d, 0x77, 0xe9, 0xf3, - 0x0a, 0x06, 0x43, 0x1c, 0xc9, 0xca, 0xce, 0xfb, 0x1f, 0x30, 0x30, 0x54, - 0x9f, 0xd6, 0xf3, 0x91, 0x47, 0xee, 0x37, 0xc7, 0x61, 0x1a, 0xb7, 0xd9, - 0xd0, 0x19, 0xb8, 0xe9, 0xa6, 0xdb, 0x7a, 0x10, 0x99, 0xfd, 0xe4, 0x37, - 0xc2, 0x35, 0xe2, 0x35, 0x24, 0x21, 0x37, 0xe7, 0xe5, 0x0d, 0xce, 0xc9, - 0xc9, 0xdd, 0x6d, 0x20, 0x6f, 0xca, 0x94, 0x29, 0xe2, 0x4e, 0xa9, 0x7d, - 0x0e, 0xe8, 0x21, 0xc2, 0x4d, 0xc6, 0x4a, 0xa6, 0xcf, 0x6b, 0x48, 0xc6, - 0x1a, 0xdf, 0xe6, 0x5e, 0x5b, 0xe5, 0xfa, 0xac, 0xec, 0xbc, 0xb9, 0x44, - 0x16, 0x58, 0xf4, 0xdd, 0xb0, 0x71, 0x4b, 0x3a, 0x70, 0x14, 0x22, 0xc5, - 0xa1, 0xfa, 0x9a, 0x2f, 0x8c, 0x95, 0x8c, 0x78, 0x0d, 0x49, 0x88, 0x86, - 0xf5, 0x5e, 0xb1, 0x64, 0x0d, 0x30, 0x8e, 0xc8, 0x7a, 0xdf, 0xed, 0xc0, - 0xbb, 0x82, 0xe4, 0x17, 0xcf, 0x98, 0x3e, 0xdb, 0x58, 0xa8, 0x7d, 0xf8, - 0x7f, 0x49, 0xf1, 0x1a, 0x6f, 0x4b, 0xd5, 0x18, 0xc6, 0x00, 0x00, 0x00, - 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82 -}; - -static const unsigned char app_icon_png[] = { - 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, - 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, - 0x08, 0x06, 0x00, 0x00, 0x00, 0xaa, 0x69, 0x71, 0xde, 0x00, 0x00, 0x00, - 0x04, 0x73, 0x42, 0x49, 0x54, 0x08, 0x08, 0x08, 0x08, 0x7c, 0x08, 0x64, - 0x88, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x00, - 0xdd, 0x00, 0x00, 0x00, 0xdd, 0x01, 0x70, 0x53, 0xa2, 0x07, 0x00, 0x00, - 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, - 0x72, 0x65, 0x00, 0x77, 0x77, 0x77, 0x2e, 0x69, 0x6e, 0x6b, 0x73, 0x63, - 0x61, 0x70, 0x65, 0x2e, 0x6f, 0x72, 0x67, 0x9b, 0xee, 0x3c, 0x1a, 0x00, - 0x00, 0x0b, 0xe0, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0xed, 0x9b, 0x7b, - 0x74, 0xd4, 0xd7, 0x71, 0xc7, 0x3f, 0x77, 0x57, 0x2b, 0xed, 0x4a, 0xbb, - 0x7a, 0x20, 0xb4, 0x12, 0x12, 0x7e, 0x80, 0x1e, 0x08, 0xb0, 0x31, 0x36, - 0x9c, 0x02, 0xb5, 0x63, 0xd0, 0x0a, 0x24, 0x70, 0x93, 0xda, 0x24, 0x81, - 0xf8, 0x1c, 0xc7, 0x39, 0xf5, 0x49, 0x6d, 0x62, 0x37, 0x07, 0x6c, 0x04, - 0xd8, 0x75, 0x82, 0xab, 0xc4, 0x75, 0x4a, 0x8c, 0x54, 0x3b, 0xad, 0xc3, - 0x69, 0x4c, 0xeb, 0xe4, 0x70, 0xda, 0xb4, 0x91, 0x0d, 0x7e, 0x61, 0x1e, - 0x32, 0x48, 0x22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 0xc9, 0x0a, 0x9b, 0x03, 0x3c, - 0x9a, 0x4a, 0x08, 0x97, 0xac, 0xd1, 0x61, 0x98, 0x14, 0x36, 0x49, 0x01, - 0xa9, 0x22, 0x2a, 0xaf, 0xa8, 0x3c, 0x3b, 0x10, 0xcb, 0x92, 0xc2, 0x72, - 0x73, 0x5e, 0x71, 0xc5, 0x2f, 0x14, 0xb2, 0x33, 0x5c, 0x4a, 0x8d, 0x06, - 0x85, 0xec, 0xcc, 0x2f, 0x2a, 0x7f, 0x79, 0x49, 0x61, 0xb9, 0x39, 0x10, - 0x5f, 0x5e, 0x51, 0x79, 0x36, 0x12, 0x38, 0x34, 0x07, 0x24, 0xe6, 0x15, - 0x97, 0xff, 0x8d, 0x12, 0x79, 0x0e, 0xd4, 0x6b, 0xee, 0x08, 0xcf, 0x8f, - 0x0f, 0x3e, 0xb9, 0xb4, 0x71, 0x24, 0x7d, 0xd9, 0x8b, 0x87, 0x32, 0x0d, - 0x06, 0x79, 0x03, 0x64, 0x4e, 0xf0, 0xea, 0x87, 0x13, 0xea, 0xa4, 0xa6, - 0xa9, 0x6f, 0xbf, 0xbf, 0x69, 0x71, 0xe5, 0xc8, 0xd1, 0xdc, 0x97, 0x0f, - 0x24, 0x1b, 0x3d, 0xc6, 0x17, 0x94, 0xc8, 0x23, 0xa2, 0xd4, 0x4f, 0x4b, - 0x0b, 0x72, 0x7e, 0xe2, 0x57, 0x82, 0x3f, 0x42, 0xfe, 0xd6, 0xb2, 0xfb, - 0x51, 0xec, 0x02, 0x75, 0x79, 0x95, 0x74, 0x0a, 0xb2, 0xa9, 0xb4, 0x20, - 0x67, 0x3b, 0x4a, 0x49, 0xfe, 0xd6, 0xf2, 0xa5, 0x28, 0x4a, 0x80, 0x09, - 0x5c, 0xfa, 0xba, 0x68, 0x57, 0x4a, 0x56, 0xed, 0x2b, 0x70, 0x1c, 0x44, - 0x44, 0x2d, 0xff, 0xfb, 0x8a, 0xc7, 0x44, 0xd4, 0x8b, 0x20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03, 0x36, 0x7c, 0x4d, 0x18, 0x0c, 0x4a, 0x31, - 0x75, 0x52, 0x34, 0x97, 0xfa, 0xdc, 0xb4, 0x76, 0x5f, 0x89, 0x3b, 0x77, - 0x67, 0x26, 0xb1, 0xf9, 0xcf, 0x67, 0xd3, 0xd5, 0x3b, 0xe0, 0x79, 0xa6, - 0xe4, 0x93, 0x17, 0xce, 0xb7, 0x5e, 0xca, 0x55, 0xa6, 0xde, 0xdc, 0xbd, - 0x6b, 0xef, 0x1b, 0x66, 0xf2, 0xda, 0x02, 0x11, 0x66, 0x77, 0x2a, 0x44, - 0xc4, 0xd7, 0xb5, 0xf7, 0x38, 0x7e, 0xb4, 0xf3, 0x24, 0xeb, 0x96, 0xcd, - 0x60, 0xc9, 0x4c, 0xef, 0x23, 0xee, 0xe6, 0x49, 0xd1, 0xbc, 0xf2, 0xdd, - 0x79, 0xc0, 0x60, 0x0c, 0xa8, 0x6c, 0x74, 0x52, 0xd9, 0xd8, 0x4d, 0x65, - 0xa3, 0x93, 0xb3, 0x17, 0x9d, 0x38, 0x5d, 0xd7, 0xd6, 0x29, 0x4a, 0x41, - 0x5a, 0x42, 0x34, 0x59, 0xc9, 0x36, 0x32, 0x92, 0x6d, 0x64, 0x25, 0xdb, - 0x48, 0x4f, 0xb6, 0x62, 0x31, 0x19, 0xf9, 0xb4, 0xb6, 0x83, 0x8d, 0xbf, - 0xfb, 0x64, 0x98, 0x37, 0x72, 0xe8, 0xb6, 0xf9, 0xa3, 0x9d, 0x27, 0x8d, - 0xe7, 0x5a, 0x2e, 0x3d, 0x07, 0x80, 0xc7, 0x32, 0x05, 0xb8, 0x30, 0x6c, - 0xb3, 0x97, 0xf4, 0xa8, 0xc8, 0x18, 0x46, 0x14, 0x17, 0x44, 0x27, 0x47, - 0x33, 0x0f, 0x5d, 0x6d, 0x3f, 0xad, 0xed, 0x20, 0xca, 0x64, 0x64, 0xc1, - 0xf4, 0x44, 0xee, 0xce, 0x4c, 0x1a, 0xa6, 0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0x48, 0xb7, 0x5b, 0x99, 0x7b, - 0xb3, 0x77, 0x07, 0xcd, 0x68, 0x19, 0x9b, 0x47, 0x13, 0x62, 0x2d, 0x26, - 0x36, 0xdd, 0x37, 0x13, 0x00, 0x4d, 0x84, 0xa6, 0xae, 0x3e, 0xce, 0x34, - 0x74, 0x51, 0xdf, 0xd1, 0xcb, 0x17, 0x8d, 0xdd, 0x54, 0xe9, 0x6c, 0xc3, - 0x86, 0xce, 0x5e, 0x1a, 0x3a, 0xfd, 0xc6, 0x96, 0x3e, 0xb7, 0x51, 0xfd, - 0x50, 0x8f, 0x10, 0xa0, 0x47, 0xa8, 0xe2, 0x51, 0x94, 0xbc, 0x1a, 0x50, - 0xdb, 0x20, 0x10, 0x6b, 0x31, 0x91, 0x1a, 0x6f, 0x21, 0x2d, 0xc1, 0x82, - 0xd5, 0x6c, 0x62, 0xf7, 0x27, 0x75, 0x23, 0x83, 0x92, 0x0f, 0x6e, 0x4e, - 0x8c, 0x61, 0xfe, 0xad, 0x09, 0x34, 0x74, 0xba, 0xa8, 0x6d, 0xeb, 0x91, - 0xfa, 0x4e, 0x17, 0x1e, 0x8f, 0x36, 0xae, 0xae, 0x76, 0x51, 0xf2, 0xfd, - 0xd2, 0x02, 0xc7, 0x6b, 0x7a, 0xb4, 0x80, 0x82, 0xf3, 0x8b, 0xcb, 0xb7, - 0x20, 0x3c, 0x3d, 0x9e, 0xc9, 0xaf, 0x37, 0x04, 0xfe, 0xb6, 0x74, 0x43, - 0xce, 0x66, 0x7f, 0xf4, 0x80, 0x05, 0x91, 0xfd, 0x05, 0x39, 0xcf, 0x28, - 0xe1, 0x27, 0x83, 0x72, 0xbe, 0x72, 0x10, 0x94, 0x7a, 0x2e, 0x90, 0xf1, - 0x10, 0xe4, 0x07, 0x13, 0xf9, 0x5b, 0xcb, 0x56, 0xa3, 0xd4, 0xbf, 0x00, - 0x63, 0x2f, 0xbb, 0x5e, 0x1f, 0x38, 0x51, 0xf2, 0xc8, 0xfe,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 0x92, 0x48, - 0xa7, 0xd5, 0x7e, 0x87, 0x86, 0xcc, 0x42, 0xc9, 0x0c, 0x25, 0x6a, 0x3a, - 0x8a, 0x54, 0x84, 0x24, 0x50, 0x76, 0x10, 0xc5, 0x95, 0x46, 0xeb, 0x76, - 0x50, 0x02, 0xd2, 0x04, 0xaa, 0x09, 0xa4, 0x01, 0xd4, 0x97, 0x28, 0xed, - 0x8c, 0xa6, 0xd4, 0x67, 0x6d, 0x31, 0xb6, 0x13, 0xa1, 0x2c, 0xef, 0x1b, - 0xb8, 0x81, 0x1b, 0x18, 0x15, 0xff, 0x0b, 0x12, 0x38, 0x4d, 0x79, 0xd2, - 0x8f, 0xa8, 0xd2, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, - 0x42, 0x60, 0x82 -}; - -static const Color boot_splash_bg_color = Color(224 / 255.0, 224 / 255.0, 224 / 255.0); -#endif // SPLASH_H diff --git a/main/splash.png b/main/splash.png Binary files differnew file mode 100644 index 0000000000..01ca2152ce --- /dev/null +++ b/main/splash.png diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp index cf32bf7073..3d0b96ae5b 100644 --- a/main/tests/test_gui.cpp +++ b/main/tests/test_gui.cpp @@ -94,7 +94,7 @@ public: Sprite *sp = memnew( Sprite ); sp->set_texture( vp->get_render_target_texture() ); //sp->set_texture( ResourceLoader::load("res://ball.png") ); - sp->set_pos(Point2(300,300)); + sp->set_position(Point2(300,300)); get_root()->add_child(sp); @@ -113,7 +113,7 @@ public: Label *label = memnew(Label); - label->set_pos(Point2(80, 90)); + label->set_position(Point2(80, 90)); label->set_size(Point2(170, 80)); label->set_align(Label::ALIGN_FILL); //label->set_text("There"); @@ -123,7 +123,7 @@ public: Button *button = memnew(Button); - button->set_pos(Point2(20, 20)); + button->set_position(Point2(20, 20)); button->set_size(Point2(1, 1)); button->set_text("This is a biggie button"); @@ -141,7 +141,7 @@ public: Ref<ImageTexture> tt = memnew( ImageTexture ); tt->create_from_image(img); tf->set_texture(tt); - tf->set_pos(Point2(50,50)); + tf->set_position(Point2(50,50)); //tf->set_scale(Point2(0.3,0.3)); @@ -151,7 +151,7 @@ public: Tree *tree = memnew(Tree); tree->set_columns(2); - tree->set_pos(Point2(230, 210)); + tree->set_position(Point2(230, 210)); tree->set_size(Point2(150, 250)); TreeItem *item = tree->create_item(); @@ -192,14 +192,14 @@ public: LineEdit *line_edit = memnew(LineEdit); - line_edit->set_pos(Point2(30, 190)); + line_edit->set_position(Point2(30, 190)); line_edit->set_size(Point2(180, 1)); frame->add_child(line_edit); HScrollBar *hscroll = memnew(HScrollBar); - hscroll->set_pos(Point2(30, 290)); + hscroll->set_position(Point2(30, 290)); hscroll->set_size(Point2(180, 1)); hscroll->set_max(10); hscroll->set_page(4); @@ -208,7 +208,7 @@ public: SpinBox *spin = memnew(SpinBox); - spin->set_pos(Point2(30, 260)); + spin->set_position(Point2(30, 260)); spin->set_size(Point2(120, 1)); frame->add_child(spin); @@ -216,7 +216,7 @@ public: ProgressBar *progress = memnew(ProgressBar); - progress->set_pos(Point2(30, 330)); + progress->set_position(Point2(30, 330)); progress->set_size(Point2(120, 1)); frame->add_child(progress); @@ -225,7 +225,7 @@ public: MenuButton *menu_button = memnew(MenuButton); menu_button->set_text("I'm a menu!"); - menu_button->set_pos(Point2(30, 380)); + menu_button->set_position(Point2(30, 380)); menu_button->set_size(Point2(1, 1)); frame->add_child(menu_button); @@ -244,7 +244,7 @@ public: options->add_item("Hello, testing"); options->add_item("My Dearest"); - options->set_pos(Point2(230, 180)); + options->set_position(Point2(230, 180)); options->set_size(Point2(1, 1)); frame->add_child(options); @@ -253,7 +253,7 @@ public: Tree * tree = memnew( Tree ); tree->set_columns(2); - tree->set_pos( Point2( 230,210 ) ); + tree->set_position( Point2( 230,210 ) ); tree->set_size( Point2( 150,250 ) ); @@ -281,7 +281,7 @@ public: RichTextLabel *richtext = memnew(RichTextLabel); - richtext->set_pos(Point2(600, 210)); + richtext->set_position(Point2(600, 210)); richtext->set_size(Point2(180, 250)); richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 20); @@ -337,21 +337,21 @@ public: tabc->add_child(ctl); label = memnew(Label); label->set_text("Some Label"); - label->set_pos(Point2(20, 20)); + label->set_position(Point2(20, 20)); ctl->add_child(label); ctl = memnew(Control); ctl->set_name("tab 3"); button = memnew(Button); button->set_text("Some Button"); - button->set_pos(Point2(30, 50)); + button->set_position(Point2(30, 50)); ctl->add_child(button); tabc->add_child(ctl); frame->add_child(tabc); - tabc->set_pos(Point2(400, 210)); + tabc->set_position(Point2(400, 210)); tabc->set_size(Point2(180, 250)); /*Ref<ImageTexture> text = memnew( ImageTexture ); @@ -359,14 +359,14 @@ public: Sprite* sprite = memnew(Sprite); sprite->set_texture(text); - sprite->set_pos(Point2(300, 300)); + sprite->set_position(Point2(300, 300)); frame->add_child(sprite); sprite->show(); Sprite* sprite2 = memnew(Sprite); sprite->set_texture(text); sprite->add_child(sprite2); - sprite2->set_pos(Point2(50, 50)); + sprite2->set_position(Point2(50, 50)); sprite2->show();*/ } }; diff --git a/methods.py b/methods.py index 03216fb58b..d8f0bf6659 100644 --- a/methods.py +++ b/methods.py @@ -1353,66 +1353,64 @@ def win32_spawn(sh, escape, cmd, args, spawnenv): return exit_code """ - def android_add_maven_repository(self, url): - self.android_maven_repos.append(url) - + if (url not in self.android_maven_repos): + self.android_maven_repos.append(url) def android_add_dependency(self, depline): - self.android_dependencies.append(depline) - + if (depline not in self.android_dependencies): + self.android_dependencies.append(depline) def android_add_java_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath - self.android_java_dirs.append(base_path) - + if (base_path not in self.android_java_dirs): + self.android_java_dirs.append(base_path) def android_add_res_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath - self.android_res_dirs.append(base_path) - + if (base_path not in self.android_res_dirs): + self.android_res_dirs.append(base_path) def android_add_aidl_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath - self.android_aidl_dirs.append(base_path) - + if (base_path not in self.android_aidl_dirs): + self.android_aidl_dirs.append(base_path) def android_add_jni_dir(self, subpath): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + subpath - self.android_jni_dirs.append(base_path) + if (base_path not in self.android_jni_dirs): + self.android_jni_dirs.append(base_path) def android_add_gradle_plugin(self, plugin): - self.android_gradle_plugins.append(plugin) + if (plugin not in self.android_gradle_plugins): + self.android_gradle_plugins.append(plugin) def android_add_gradle_classpath(self, classpath): - self.android_gradle_classpath.append(classpath) + if (classpath not in self.android_gradle_classpath): + self.android_gradle_classpath.append(classpath) def android_add_default_config(self, config): - self.android_default_config.append(config) - + if (config not in self.android_default_config): + self.android_default_config.append(config) def android_add_to_manifest(self, file): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file f = open(base_path, "rb") self.android_manifest_chunk += f.read() - def android_add_to_permissions(self, file): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file f = open(base_path, "rb") self.android_permission_chunk += f.read() - def android_add_to_attributes(self, file): base_path = self.Dir(".").abspath + "/modules/" + self.current_module + "/" + file f = open(base_path, "rb") self.android_appattributes_chunk += f.read() - def disable_module(self): self.disabled_modules.append(self.current_module) - def use_windows_spawn_fix(self, platform=None): if (os.name != "nt"): diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format index f7620fe2c5..0971ebe23a 100755 --- a/misc/hooks/pre-commit-clang-format +++ b/misc/hooks/pre-commit-clang-format @@ -31,7 +31,7 @@ PARSE_EXTS=true # File types to parse. Only effective when PARSE_EXTS is true. # FILE_EXTS=".c .h .cpp .hpp" -FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m" +FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc" # Use pygmentize instead of cat to parse diff with highlighting. # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac) @@ -82,6 +82,11 @@ $DELETE_OLD_PATCHES && rm -f /tmp/$prefix*.patch # create one patch containing all changes to the files git diff-index --cached --diff-filter=ACMR --name-only $against -- | while read file; do + # ignore thirdparty files + if grep -q "thirdparty" <<< $file; then + continue; + fi + # ignore file if we do check for file extensions and the file # does not match any of the extensions specified in $FILE_EXTS if $PARSE_EXTS && ! matches_extension "$file"; then diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh index 5ecc1b37d8..741d3bff1b 100755 --- a/misc/travis/clang-format.sh +++ b/misc/travis/clang-format.sh @@ -11,7 +11,7 @@ else RANGE=HEAD fi -FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -e "\.cpp$" -e "\.h$" -e "\.inc$") +FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc)$") echo "Checking files:\n$FILES" # create a random filename to store our generated patch diff --git a/modules/dlscript/api_generator.h b/modules/dlscript/api_generator.h deleted file mode 100644 index 4a8354e9d6..0000000000 --- a/modules/dlscript/api_generator.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef API_GENERATOR_H -#define API_GENERATOR_H - -#include "core/ustring.h" -#include "typedefs.h" - -Error generate_c_api(const String &p_path); - -#endif // API_GENERATOR_H diff --git a/modules/dlscript/godot/godot_basis.cpp b/modules/dlscript/godot/godot_basis.cpp deleted file mode 100644 index 813a531de5..0000000000 --- a/modules/dlscript/godot/godot_basis.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include "godot_basis.h" - -#include "math/matrix3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _basis_api_anchor() { -} - -void GDAPI godot_basis_new(godot_basis *p_basis) { - Basis *basis = (Basis *)p_basis; - *basis = Basis(); -} - -void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) { - Basis *basis = (Basis *)p_basis; - Quat *euler = (Quat *)p_euler; - *basis = Basis(*euler); -} - -void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) { - Basis *basis = (Basis *)p_basis; - Vector3 *euler = (Vector3 *)p_euler; - *basis = Basis(*euler); -} - -godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) { - const Basis *basis = (const Basis *)p_basis; - godot_quat quat; - Quat *p_quat = (Quat *)&quat; - *p_quat = basis->operator Quat(); - return quat; -} - -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) { - const Basis *basis = (const Basis *)p_basis; - godot_vector3 euler; - Vector3 *p_euler = (Vector3 *)&euler; - *p_euler = basis->get_euler(); - return euler; -} - -/* - * p_elements is a pointer to an array of 3 (!!) vector3 - */ -void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) { - Basis *basis = (Basis *)p_basis; - Vector3 *elements = (Vector3 *)p_elements; - elements[0] = basis->elements[0]; - elements[1] = basis->elements[1]; - elements[2] = basis->elements[2]; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_basis.h b/modules/dlscript/godot/godot_basis.h deleted file mode 100644 index 43efd65ea2..0000000000 --- a/modules/dlscript/godot/godot_basis.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef GODOT_DLSCRIPT_BASIS_H -#define GODOT_DLSCRIPT_BASIS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED -typedef struct godot_basis { - uint8_t _dont_touch_that[36]; -} godot_basis; -#endif - -#include "../godot.h" - -void GDAPI godot_basis_new(godot_basis *p_basis); -void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler); -void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler); - -godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis); -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis); - -/* - * p_elements is a pointer to an array of 3 (!!) vector3 - */ -void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_BASIS_H diff --git a/modules/dlscript/godot/godot_color.cpp b/modules/dlscript/godot/godot_color.cpp deleted file mode 100644 index 7e49565d40..0000000000 --- a/modules/dlscript/godot/godot_color.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "godot_color.h" - -#include "color.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _color_api_anchor() { -} - -void GDAPI godot_color_new(godot_color *p_color) { - Color *color = (Color *)p_color; - *color = Color(); -} - -void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) { - Color *color = (Color *)p_color; - *color = Color(r, g, b, a); -} - -uint32_t GDAPI godot_color_get_32(const godot_color *p_color) { - const Color *color = (const Color *)p_color; - return color->to_32(); -} - -float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) { - Color *color = (Color *)p_color; - return &color->operator[](idx); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_color.h b/modules/dlscript/godot/godot_color.h deleted file mode 100644 index 72e16a2c5a..0000000000 --- a/modules/dlscript/godot/godot_color.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GODOT_DLSCRIPT_COLOR_H -#define GODOT_DLSCRIPT_COLOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED -typedef struct godot_color { - uint8_t _dont_touch_that[16]; -} godot_color; -#endif - -#include "../godot.h" - -void GDAPI godot_color_new(godot_color *p_color); -void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a); - -uint32_t GDAPI godot_color_get_32(const godot_color *p_color); - -float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_COLOR_H diff --git a/modules/dlscript/godot/godot_dictionary.h b/modules/dlscript/godot/godot_dictionary.h deleted file mode 100644 index 5f86cbca5a..0000000000 --- a/modules/dlscript/godot/godot_dictionary.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef GODOT_DLSCRIPT_DICTIONARY_H -#define GODOT_DLSCRIPT_DICTIONARY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED -typedef struct godot_dictionary { - uint8_t _dont_touch_that[8]; -} godot_dictionary; -#endif - -#include "godot_array.h" -#include "godot_variant.h" - -void GDAPI godot_dictionary_new(godot_dictionary *p_dict); - -void GDAPI godot_dictionary_clear(godot_dictionary *p_dict); - -godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict); - -void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys); - -uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict); - -godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict); - -godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json); - -godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); - -godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict); - -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict); - -godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict); - -void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_DICTIONARY_H diff --git a/modules/dlscript/godot/godot_node_path.h b/modules/dlscript/godot/godot_node_path.h deleted file mode 100644 index 04f1e70c1d..0000000000 --- a/modules/dlscript/godot/godot_node_path.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef GODOT_DLSCRIPT_NODE_PATH_H -#define GODOT_DLSCRIPT_NODE_PATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED -typedef struct godot_node_path { - uint8_t _dont_touch_that[8]; -} godot_node_path; -#endif - -#include "../godot.h" - -void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from); -void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from); - -godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx); -godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np); - -godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np); -godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx); -godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np); - -godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np); -godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np); - -godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np); - -void GDAPI godot_node_path_destroy(godot_node_path *p_np); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_NODE_PATH_H diff --git a/modules/dlscript/godot/godot_plane.cpp b/modules/dlscript/godot/godot_plane.cpp deleted file mode 100644 index 883aeb6282..0000000000 --- a/modules/dlscript/godot/godot_plane.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "godot_plane.h" - -#include "math/plane.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _plane_api_anchor() { -} - -void GDAPI godot_plane_new(godot_plane *p_pl) { - Plane *pl = (Plane *)p_pl; - *pl = Plane(); -} - -void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) { - Plane *pl = (Plane *)p_pl; - const Vector3 *normal = (const Vector3 *)p_normal; - *pl = Plane(*normal, p_d); -} - -void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) { - Plane *pl = (Plane *)p_pl; - const Vector3 *normal = (const Vector3 *)p_normal; - pl->set_normal(*normal); -} - -godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) { - const Plane *pl = (const Plane *)p_pl; - const Vector3 normal = pl->get_normal(); - godot_vector3 *v3 = (godot_vector3 *)&normal; - return *v3; -} - -void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) { - Plane *pl = (Plane *)p_pl; - pl->d = p_d; -} - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) { - const Plane *pl = (const Plane *)p_pl; - return pl->d; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_plane.h b/modules/dlscript/godot/godot_plane.h deleted file mode 100644 index 1323ef4075..0000000000 --- a/modules/dlscript/godot/godot_plane.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef GODOT_DLSCRIPT_PLANE_H -#define GODOT_DLSCRIPT_PLANE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED -typedef struct godot_plane { - uint8_t _dont_touch_that[16]; -} godot_plane; -#endif - -#include "godot_vector3.h" - -void GDAPI godot_plane_new(godot_plane *p_pl); -void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d); - -// @Incomplete -// These are additional valid constructors -// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); -// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal); -// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE); - -void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal); -godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl); - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl); -void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_PLANE_H diff --git a/modules/dlscript/godot/godot_quat.cpp b/modules/dlscript/godot/godot_quat.cpp deleted file mode 100644 index 9bd2eb0639..0000000000 --- a/modules/dlscript/godot/godot_quat.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#include "godot_quat.h" - -#include "math/quat.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _quat_api_anchor() { -} - -void GDAPI godot_quat_new(godot_quat *p_quat) { - Quat *quat = (Quat *)p_quat; - *quat = Quat(); -} - -void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) { - Quat *quat = (Quat *)p_quat; - *quat = Quat(x, y, z, w); -} - -void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) { - Quat *quat = (Quat *)p_quat; - const Vector3 *axis = (const Vector3 *)p_axis; - *quat = Quat(*axis, p_angle); -} - -void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) { - Quat *quat = (Quat *)p_quat; - const Vector3 *v0 = (const Vector3 *)p_v0; - const Vector3 *v1 = (const Vector3 *)p_v1; - *quat = Quat(*v0, *v1); -} - -godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) { - Quat *quat = (Quat *)p_quat; - Vector3 euler = quat->get_euler(); - return *(godot_vector3 *)&euler; -} - -void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) { - Quat *quat = (Quat *)p_quat; - const Vector3 *euler = (const Vector3 *)p_euler; - quat->set_euler(*euler); -} - -godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) { - Quat *quat = (Quat *)p_quat; - switch (p_idx) { - case 0: - return &quat->x; - case 1: - return &quat->y; - case 2: - return &quat->z; - default: - return &quat->y; - } -} - -godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) { - const Quat *quat = (const Quat *)p_quat; - switch (p_idx) { - case 0: - return quat->x; - case 1: - return quat->y; - case 2: - return quat->z; - default: - return quat->y; - } -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_quat.h b/modules/dlscript/godot/godot_quat.h deleted file mode 100644 index 4e3253c4e5..0000000000 --- a/modules/dlscript/godot/godot_quat.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef GODOT_DLSCRIPT_QUAT_H -#define GODOT_DLSCRIPT_QUAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED -typedef struct godot_quat { - uint8_t _dont_touch_that[16]; -} godot_quat; -#endif - -#include "../godot.h" - -void GDAPI godot_quat_new(godot_quat *p_quat); -void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w); -void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle); -void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1); - -godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat); -void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler); - -godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx); -godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_QUAT_H diff --git a/modules/dlscript/godot/godot_rect2.cpp b/modules/dlscript/godot/godot_rect2.cpp deleted file mode 100644 index 8e60811114..0000000000 --- a/modules/dlscript/godot/godot_rect2.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "godot_rect2.h" - -#include "math/math_2d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rect2_api_anchor() { -} - -void GDAPI godot_rect2_new(godot_rect2 *p_rect) { - Rect2 *rect = (Rect2 *)p_rect; - *rect = Rect2(); -} - -void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) { - Rect2 *rect = (Rect2 *)p_rect; - const Vector2 *pos = (const Vector2 *)p_pos; - const Vector2 *size = (const Vector2 *)p_size; - *rect = Rect2(*pos, *size); -} - -godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) { - Rect2 *rect = (Rect2 *)p_rect; - return (godot_vector2 *)&rect->pos; -} - -void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) { - Rect2 *rect = (Rect2 *)p_rect; - const Vector2 *pos = (const Vector2 *)p_pos; - rect->pos = *pos; -} - -godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) { - Rect2 *rect = (Rect2 *)p_rect; - return (godot_vector2 *)&rect->size; -} - -void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) { - Rect2 *rect = (Rect2 *)p_rect; - const Vector2 *size = (const Vector2 *)p_size; - rect->size = *size; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_rect2.h b/modules/dlscript/godot/godot_rect2.h deleted file mode 100644 index a3b19bdb7e..0000000000 --- a/modules/dlscript/godot/godot_rect2.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef GODOT_DLSCRIPT_RECT2_H -#define GODOT_DLSCRIPT_RECT2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED -typedef struct godot_rect2 { - uint8_t _dont_touch_that[16]; -} godot_rect2; -#endif - -#include "../godot.h" - -void GDAPI godot_rect2_new(godot_rect2 *p_rect); -void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size); - -godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect); -void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos); - -godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect); -void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_RECT3_H diff --git a/modules/dlscript/godot/godot_rect3.cpp b/modules/dlscript/godot/godot_rect3.cpp deleted file mode 100644 index 3c442a278b..0000000000 --- a/modules/dlscript/godot/godot_rect3.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include "godot_rect3.h" - -#include "math/rect3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rect3_api_anchor() { -} - -void GDAPI godot_rect3_new(godot_rect3 *p_rect) { - Rect3 *rect = (Rect3 *)p_rect; - *rect = Rect3(); -} - -void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) { - Rect3 *rect = (Rect3 *)p_rect; - const Vector3 *pos = (const Vector3 *)p_pos; - const Vector3 *size = (const Vector3 *)p_size; - *rect = Rect3(*pos, *size); -} - -godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) { - Rect3 *rect = (Rect3 *)p_rect; - return (godot_vector3 *)&rect->pos; -} - -void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) { - Rect3 *rect = (Rect3 *)p_rect; - const Vector3 *pos = (const Vector3 *)p_pos; - rect->pos = *pos; -} - -godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) { - Rect3 *rect = (Rect3 *)p_rect; - return (godot_vector3 *)&rect->size; -} - -void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) { - Rect3 *rect = (Rect3 *)p_rect; - const Vector3 *size = (const Vector3 *)p_size; - rect->size = *size; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_rect3.h b/modules/dlscript/godot/godot_rect3.h deleted file mode 100644 index b9279616d1..0000000000 --- a/modules/dlscript/godot/godot_rect3.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef GODOT_DLSCRIPT_RECT3_H -#define GODOT_DLSCRIPT_RECT3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED -typedef struct godot_rect3 { - uint8_t _dont_touch_that[24]; -} godot_rect3; -#endif - -#include "../godot.h" - -void GDAPI godot_rect3_new(godot_rect3 *p_rect); -void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size); - -godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect); -void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos); - -godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect); -void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_RECT3_H diff --git a/modules/dlscript/godot/godot_rid.cpp b/modules/dlscript/godot/godot_rid.cpp deleted file mode 100644 index a36a2e64a3..0000000000 --- a/modules/dlscript/godot/godot_rid.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "godot_rid.h" - -#include "object.h" -#include "resource.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _rid_api_anchor() { -} - -void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) { - - Resource *res_from = ((Object *)p_from)->cast_to<Resource>(); - - RID *rid = (RID *)p_rid; - memnew_placement(rid, RID); - - if (res_from) { - *rid = RID(res_from->get_rid()); - } -} - -uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) { - RID *rid = (RID *)p_rid; - return rid->get_id(); -} - -void GDAPI godot_rid_destroy(godot_rid *p_rid) { - ((RID *)p_rid)->~RID(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_rid.h b/modules/dlscript/godot/godot_rid.h deleted file mode 100644 index f20c0d4dae..0000000000 --- a/modules/dlscript/godot/godot_rid.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GODOT_DLSCRIPT_RID_H -#define GODOT_DLSCRIPT_RID_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED -typedef struct godot_rid { - uint8_t _dont_touch_that[8]; -} godot_rid; -#endif - -#include "../godot.h" - -void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from); - -uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid); - -void GDAPI godot_rid_destroy(godot_rid *p_rid); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_RID_H diff --git a/modules/dlscript/godot/godot_string.cpp b/modules/dlscript/godot/godot_string.cpp deleted file mode 100644 index 97d0985a50..0000000000 --- a/modules/dlscript/godot/godot_string.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "godot_string.h" - -#include "string_db.h" -#include "ustring.h" - -#include <string.h> - -#ifdef __cplusplus -extern "C" { -#endif - -void _string_api_anchor() { -} - -void GDAPI godot_string_new(godot_string *p_str) { - String *p = (String *)p_str; - memnew_placement(p, String); - // *p = String(); // useless here -} - -void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) { - String *p = (String *)p_str; - memnew_placement(p, String); - *p = String::utf8(p_contents, p_size); -} - -void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) { - String *p = (String *)p_str; - if (p_size != NULL) { - *p_size = p->length(); - } - if (p_dest != NULL) { - memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType)); - } -} - -void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) { - String *dest = (String *)p_dest; - String *src = (String *)p_src; - - *dest = *src; -} - -wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) { - String *s = (String *)p_str; - return &(s->operator[](p_idx)); -} - -const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) { - const String *s = (const String *)p_str; - return s->c_str(); -} - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) { - String *a = (String *)p_a; - String *b = (String *)p_b; - return *a == *b; -} - -godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) { - String *a = (String *)p_a; - String *b = (String *)p_b; - return *a < *b; -} - -void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) { - String *dest = (String *)p_dest; - const String *a = (String *)p_a; - const String *b = (String *)p_b; - - String tmp = *a + *b; - godot_string_new(p_dest); - *dest = tmp; -} - -void GDAPI godot_string_destroy(godot_string *p_str) { - String *p = (String *)p_str; - p->~String(); -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_string.h b/modules/dlscript/godot/godot_string.h deleted file mode 100644 index 73b366d9cd..0000000000 --- a/modules/dlscript/godot/godot_string.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef GODOT_DLSCRIPT_STRING_H -#define GODOT_DLSCRIPT_STRING_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED -typedef struct godot_string { - uint8_t _dont_touch_that[8]; -} godot_string; -#endif - -#include "../godot.h" - -void GDAPI godot_string_new(godot_string *p_str); -void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size); - -void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size); - -void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src); - -wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx); -const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str); - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b); -godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b); -void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b); - -// @Incomplete -// hmm, I guess exposing the whole API doesn't make much sense -// since the language used in the library has its own string funcs - -void GDAPI godot_string_destroy(godot_string *p_str); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_STRING_H diff --git a/modules/dlscript/godot/godot_transform.cpp b/modules/dlscript/godot/godot_transform.cpp deleted file mode 100644 index c8da519f6b..0000000000 --- a/modules/dlscript/godot/godot_transform.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#include "godot_transform.h" - -#include "math/transform.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _transform_api_anchor() { -} - -void GDAPI godot_transform_new(godot_transform *p_trans) { - Transform *trans = (Transform *)p_trans; - *trans = Transform(); -} - -void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) { - Transform *trans = (Transform *)p_trans; - const Basis *basis = (const Basis *)p_basis; - *trans = Transform(*basis); -} - -void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) { - Transform *trans = (Transform *)p_trans; - const Basis *basis = (const Basis *)p_basis; - const Vector3 *origin = (const Vector3 *)p_origin; - *trans = Transform(*basis, *origin); -} - -godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) { - Transform *trans = (Transform *)p_trans; - return (godot_basis *)&trans->basis; -} - -godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) { - Transform *trans = (Transform *)p_trans; - return (godot_vector3 *)&trans->origin; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_transform.h b/modules/dlscript/godot/godot_transform.h deleted file mode 100644 index 54af78d5b9..0000000000 --- a/modules/dlscript/godot/godot_transform.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GODOT_DLSCRIPT_TRANSFORM_H -#define GODOT_DLSCRIPT_TRANSFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -typedef struct godot_transform { - uint8_t _dont_touch_that[48]; -} godot_transform; -#endif - -#include "../godot.h" - -void GDAPI godot_transform_new(godot_transform *p_trans); -void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis); -void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin); - -godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans); -godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DLSCRIPT_TRANSFORM_H diff --git a/modules/dlscript/godot/godot_transform2d.cpp b/modules/dlscript/godot/godot_transform2d.cpp deleted file mode 100644 index 39fa0e7363..0000000000 --- a/modules/dlscript/godot/godot_transform2d.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "godot_transform2d.h" - -#include "../godot.h" - -#include "math/math_2d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _transform2d_api_anchor() { -} - -void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) { - Transform2D *t = (Transform2D *)p_t; - *t = Transform2D(); -} - -void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) { - Transform2D *t = (Transform2D *)p_t; - Vector2 *a = (Vector2 *)p_a; - Vector2 *b = (Vector2 *)p_b; - Vector2 *c = (Vector2 *)p_c; - *t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y); -} - -void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) { - Transform2D *t = (Transform2D *)p_t; - Vector2 *pos = (Vector2 *)p_pos; - *t = Transform2D(p_rot, *pos); -} - -godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) { - const Transform2D *t = (const Transform2D *)p_t; - const Vector2 *e = &t->operator[](p_idx); - return (godot_vector2 const *)e; -} - -godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) { - Transform2D *t = (Transform2D *)p_t; - Vector2 *e = &t->operator[](p_idx); - return (godot_vector2 *)e; -} - -godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) { - return *godot_transform2d_const_index(p_t, p_axis); -} - -void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) { - godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis); - *origin_v = *p_vec; -} - -// @Incomplete -// See header file - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_transform2d.h b/modules/dlscript/godot/godot_transform2d.h deleted file mode 100644 index 7403954527..0000000000 --- a/modules/dlscript/godot/godot_transform2d.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef GODOT_TRANSFORM2D_H -#define GODOT_TRANSFORM2D_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED -typedef struct godot_transform2d { - uint8_t _dont_touch_that[24]; -} godot_transform2d; -#endif - -#include "../godot.h" - -#include "godot_vector2.h" - -void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t); -void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c); -void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos); - -/* -godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v); -godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v); -*/ - -godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx); -godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx); - -godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis); -void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec); - -/* -void GDAPI godot_transform2d_invert(godot_transform2d *p_t); -godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t); -*/ - -// @Incomplete -// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings. - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_TRANSFORM2D_H diff --git a/modules/dlscript/godot/godot_vector2.cpp b/modules/dlscript/godot/godot_vector2.cpp deleted file mode 100644 index 0664da186e..0000000000 --- a/modules/dlscript/godot/godot_vector2.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "godot_vector2.h" - -#include "math/math_2d.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _vector2_api_anchor() { -} - -void GDAPI godot_vector2_new(godot_vector2 *p_v, godot_real p_x, godot_real p_y) { - Vector2 *v = (Vector2 *)p_v; - v->x = p_x; - v->y = p_y; -} - -void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x) { - Vector2 *v = (Vector2 *)p_v; - v->x = p_x; -} - -void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y) { - Vector2 *v = (Vector2 *)p_v; - v->y = p_y; -} - -godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v) { - Vector2 *v = (Vector2 *)p_v; - return v->x; -} -godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v) { - Vector2 *v = (Vector2 *)p_v; - return v->y; -} - -void GDAPI godot_vector2_normalize(godot_vector2 *p_v) { - Vector2 *v = (Vector2 *)p_v; - v->normalize(); -} -void GDAPI godot_vector2_normalized(godot_vector2 *p_dest, const godot_vector2 *p_src) { - Vector2 *v = (Vector2 *)p_src; - Vector2 *d = (Vector2 *)p_dest; - - *d = v->normalized(); -} - -godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v) { - Vector2 *v = (Vector2 *)p_v; - return v->length(); -} - -godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v) { - Vector2 *v = (Vector2 *)p_v; - return v->length_squared(); -} - -godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b) { - Vector2 *a = (Vector2 *)p_a; - Vector2 *b = (Vector2 *)p_b; - return a->distance_to(*b); -} - -godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b) { - Vector2 *a = (Vector2 *)p_a; - Vector2 *b = (Vector2 *)p_b; - return a->distance_squared_to(*b); -} - -void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) { - Vector2 *dest = (Vector2 *)p_dest; - const Vector2 *a = (Vector2 *)p_a; - const Vector2 *b = (Vector2 *)p_b; - *dest = *a + *b; -} - -void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) { - Vector2 *dest = (Vector2 *)p_dest; - const Vector2 *a = (Vector2 *)p_a; - const Vector2 *b = (Vector2 *)p_b; - *dest = *a - *b; -} - -void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) { - Vector2 *dest = (Vector2 *)p_dest; - const Vector2 *a = (Vector2 *)p_a; - const Vector2 *b = (Vector2 *)p_b; - *dest = *a * *b; -} - -void GDAPI godot_vector2_operator_multiply_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b) { - Vector2 *dest = (Vector2 *)p_dest; - const Vector2 *a = (Vector2 *)p_a; - *dest = *a * p_b; -} - -void GDAPI godot_vector2_operator_divide_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b) { - Vector2 *dest = (Vector2 *)p_dest; - const Vector2 *a = (Vector2 *)p_a; - const Vector2 *b = (Vector2 *)p_b; - *dest = *a / *b; -} - -void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b) { - Vector2 *dest = (Vector2 *)p_dest; - const Vector2 *a = (Vector2 *)p_a; - *dest = *a / p_b; -} - -godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b) { - const Vector2 *a = (Vector2 *)p_a; - const Vector2 *b = (Vector2 *)p_b; - return *a == *b; -} - -godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b) { - const Vector2 *a = (Vector2 *)p_a; - const Vector2 *b = (Vector2 *)p_b; - return *a < *b; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_vector2.h b/modules/dlscript/godot/godot_vector2.h deleted file mode 100644 index 63da367e4f..0000000000 --- a/modules/dlscript/godot/godot_vector2.h +++ /dev/null @@ -1,78 +0,0 @@ -#ifndef GODOT_VECTOR2_H -#define GODOT_VECTOR2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED -typedef struct godot_vector2 { - uint8_t _dont_touch_that[8]; -} godot_vector2; -#endif - -#include "../godot.h" - -void GDAPI godot_vector2_new(godot_vector2 *p_v, const godot_real p_x, const godot_real p_y); - -void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x); -void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y); -godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v); -godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v); - -void GDAPI godot_vector2_normalize(godot_vector2 *p_v); -void GDAPI godot_vector2_normalized(godot_vector2 *p_dest, const godot_vector2 *p_src); - -godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v); -godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v); - -godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b); -godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b); - -// @Incomplete -/* - * missing: - * - * angle_to - * angle_to_point - * dot - * cross_vector - * cross_scalar - * project - * plane_project - * clamped - * linear_interpolate - * cubic_interpolate - * cubic_interpolate_soft - * slide - * reflect - * angle - * abs - * rotated - * tangent - * floor - * snapped - * aspect - * - * - * to_string - */ - -void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b); -void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b); -void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b); -void GDAPI godot_vector2_operator_multiply_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b); -void GDAPI godot_vector2_operator_divide_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b); -void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_real p_b); - -godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b); -godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_VECTOR2_H diff --git a/modules/dlscript/godot/godot_vector3.cpp b/modules/dlscript/godot/godot_vector3.cpp deleted file mode 100644 index 34005cbcb8..0000000000 --- a/modules/dlscript/godot/godot_vector3.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include "godot_vector3.h" - -#include "math/vector3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void _vector3_api_anchor() { -} - -void GDAPI godot_vector3_new(godot_vector3 *p_v, const godot_real p_x, const godot_real p_y, const godot_real p_z) { - Vector3 *v = (Vector3 *)p_v; - *v = Vector3(p_x, p_y, p_z); -} - -void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val) { - Vector3 *v = (Vector3 *)p_v; - v->set_axis(p_axis, p_val); -} - -godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis) { - Vector3 *v = (Vector3 *)p_v; - return v->get_axis(p_axis); -} - -godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v) { - Vector3 *v = (Vector3 *)p_v; - return v->min_axis(); -} - -godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v) { - Vector3 *v = (Vector3 *)p_v; - return v->max_axis(); -} - -godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v) { - Vector3 *v = (Vector3 *)p_v; - return v->length(); -} - -godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v) { - Vector3 *v = (Vector3 *)p_v; - return v->length_squared(); -} - -void GDAPI godot_vector3_normalize(godot_vector3 *p_v) { - Vector3 *v = (Vector3 *)p_v; - v->normalize(); -} - -void GDAPI godot_vector3_normalized(godot_vector3 *p_dest, const godot_vector3 *p_src) { - Vector3 *src = (Vector3 *)p_src; - Vector3 *dest = (Vector3 *)p_dest; - *dest = src->normalized(); -} - -/* - * inverse - * zero - * snap - * snapped - * rotate - * rotated - * - * - * linear_interpolate - * cubic_interpolate - * cubic_interpolaten - * cross - * dot - * outer - * to_diagonal_matrix - * abs - * floor - * ceil - */ - -godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - return a->distance_to(*b); -} - -godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - return a->distance_squared_to(*b); -} - -/* - * slide - * reflect - */ - -void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *dest = (Vector3 *)p_dest; - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - *dest = *a + *b; -} - -void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *dest = (Vector3 *)p_dest; - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - *dest = *a - *b; -} - -void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *dest = (Vector3 *)p_dest; - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - *dest = *a * *b; -} - -void GDAPI godot_vector3_operator_multiply_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b) { - Vector3 *dest = (Vector3 *)p_dest; - Vector3 *a = (Vector3 *)p_a; - *dest = *a * p_b; -} - -void GDAPI godot_vector3_operator_divide_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *dest = (Vector3 *)p_dest; - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - *dest = *a / *b; -} - -void GDAPI godot_vector3_operator_divide_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b) { - Vector3 *dest = (Vector3 *)p_dest; - Vector3 *a = (Vector3 *)p_a; - *dest = *a / p_b; -} - -godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - return *a == *b; -} - -godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_a, const godot_vector3 *p_b) { - Vector3 *a = (Vector3 *)p_a; - Vector3 *b = (Vector3 *)p_b; - return *a < *b; -} - -#ifdef __cplusplus -} -#endif diff --git a/modules/dlscript/godot/godot_vector3.h b/modules/dlscript/godot/godot_vector3.h deleted file mode 100644 index 7fe93e3fd5..0000000000 --- a/modules/dlscript/godot/godot_vector3.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef GODOT_VECTOR3_H -#define GODOT_VECTOR3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <stdint.h> - -#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED -typedef struct godot_vector3 { - uint8_t _dont_touch_that[12]; -} godot_vector3; -#endif - -#include "../godot.h" - -void GDAPI godot_vector3_new(godot_vector3 *p_v, const godot_real p_x, const godot_real p_y, const godot_real p_z); - -void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val); -godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis); - -godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v); -godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v); - -godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v); -godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v); - -void GDAPI godot_vector3_normalize(godot_vector3 *p_v); -void GDAPI godot_vector3_normalized(godot_vector3 *p_dest, const godot_vector3 *p_src); - -// @Incomplete - -/* - * inverse - * zero - * snap - * snapped - * rotate - * rotated - * - * - * linear_interpolate - * cubic_interpolate - * cubic_interpolaten - * cross - * dot - * outer - * to_diagonal_matrix - * abs - * floor - * ceil - */ - -godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_a, const godot_vector3 *p_b); -godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, const godot_vector3 *p_b); - -// @Incomplete -/* - * slide - * reflect - */ - -void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b); -void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b); -void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b); -void GDAPI godot_vector3_operator_multiply_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b); -void GDAPI godot_vector3_operator_divide_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b); -void GDAPI godot_vector3_operator_divide_scalar(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_real p_b); - -godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_a, const godot_vector3 *p_b); -godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_a, const godot_vector3 *p_b); - -/* - * to_string - */ - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_VECTOR3_H diff --git a/modules/dlscript/SCsub b/modules/gdnative/SCsub index ac13319a1d..ac13319a1d 100644 --- a/modules/dlscript/SCsub +++ b/modules/gdnative/SCsub diff --git a/modules/dlscript/api_generator.cpp b/modules/gdnative/api_generator.cpp index 56e0e45608..d5f22ee7a3 100644 --- a/modules/dlscript/api_generator.cpp +++ b/modules/gdnative/api_generator.cpp @@ -1,9 +1,39 @@ +/*************************************************************************/ +/* api_generator.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "api_generator.h" #ifdef TOOLS_ENABLED #include "class_db.h" #include "core/global_config.h" +#include "core/global_constants.h" #include "os/file_access.h" // helper stuff @@ -73,8 +103,7 @@ struct ClassAPI { bool is_instanciable; // @Unclear bool is_creatable; - // @Unclear - bool memory_own; + bool is_reference; List<MethodAPI> methods; List<PropertyAPI> properties; @@ -92,6 +121,23 @@ List<ClassAPI> generate_c_api_classes() { List<StringName> classes; ClassDB::get_class_list(&classes); + // Register global constants as a fake GlobalConstants singleton class + { + ClassAPI global_constants_api; + global_constants_api.class_name = L"GlobalConstants"; + global_constants_api.api_type = ClassDB::API_CORE; + global_constants_api.is_singleton = true; + global_constants_api.is_instanciable = false; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + ConstantAPI constant_api; + constant_api.constant_name = GlobalConstants::get_global_constant_name(i); + constant_api.constant_value = GlobalConstants::get_global_constant_value(i); + global_constants_api.constants.push_back(constant_api); + } + api.push_back(global_constants_api); + } + for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) { StringName class_name = e->get(); @@ -114,7 +160,7 @@ List<ClassAPI> generate_c_api_classes() { ClassDB::get_inheriters_from_class("Reference", &inheriters); is_reference = !!inheriters.find(class_name); // @Unclear - class_api.memory_own = !class_api.is_singleton && is_reference; + class_api.is_reference = !class_api.is_singleton && is_reference; } // constants @@ -301,6 +347,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back(String("\t\t\"api_type\": \"") + (api.api_type == ClassDB::API_CORE ? "core" : (api.api_type == ClassDB::API_EDITOR ? "tools" : "none")) + "\",\n"); source.push_back(String("\t\t\"singleton\": ") + (api.is_singleton ? "true" : "false") + ",\n"); source.push_back(String("\t\t\"instanciable\": ") + (api.is_instanciable ? "true" : "false") + ",\n"); + source.push_back(String("\t\t\"is_reference\": ") + (api.is_reference ? "true" : "false") + ",\n"); // @Unclear // source.push_back(String("\t\t\"createable\": ") + (api.is_creatable ? "true" : "false") + ",\n"); @@ -355,6 +402,7 @@ static List<String> generate_c_api_json(const List<ClassAPI> &p_api) { source.push_back("\t\t\t\t\t{\n"); source.push_back("\t\t\t\t\t\t\"name\": \"" + e->get().argument_names[i] + "\",\n"); source.push_back("\t\t\t\t\t\t\"type\": \"" + e->get().argument_types[i] + "\",\n"); + source.push_back(String("\t\t\t\t\t\t\"has_default_value\": ") + (e->get().default_arguments.has(i) ? "true" : "false") + ",\n"); source.push_back("\t\t\t\t\t\t\"default_value\": \"" + (e->get().default_arguments.has(i) ? (String)e->get().default_arguments[i] : "") + "\"\n"); source.push_back(String("\t\t\t\t\t}") + ((i < e->get().argument_names.size() - 1) ? "," : "") + "\n"); } diff --git a/modules/gdnative/api_generator.h b/modules/gdnative/api_generator.h new file mode 100644 index 0000000000..a108d7a7b6 --- /dev/null +++ b/modules/gdnative/api_generator.h @@ -0,0 +1,38 @@ +/*************************************************************************/ +/* api_generator.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef API_GENERATOR_H +#define API_GENERATOR_H + +#include "core/ustring.h" +#include "typedefs.h" + +Error generate_c_api(const String &p_path); + +#endif // API_GENERATOR_H diff --git a/modules/dlscript/config.py b/modules/gdnative/config.py index 9f57b9bb74..9f57b9bb74 100644 --- a/modules/dlscript/config.py +++ b/modules/gdnative/config.py diff --git a/modules/dlscript/dl_script.cpp b/modules/gdnative/gdnative.cpp index fa082d7b94..09859d95bd 100644 --- a/modules/dlscript/dl_script.cpp +++ b/modules/gdnative/gdnative.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* dl_script.cpp */ +/* gdnative.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,7 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "dl_script.h" +#include "gdnative.h" #include "global_config.h" #include "global_constants.h" @@ -48,8 +48,8 @@ Error NativeLibrary::initialize(NativeLibrary *&p_native_lib, const StringName p_path) { - if (DLScriptLanguage::get_singleton()->initialized_libraries.has(p_path)) { - p_native_lib = DLScriptLanguage::get_singleton()->initialized_libraries[p_path]; + if (GDNativeScriptLanguage::get_singleton()->initialized_libraries.has(p_path)) { + p_native_lib = GDNativeScriptLanguage::get_singleton()->initialized_libraries[p_path]; return OK; } @@ -68,31 +68,29 @@ Error NativeLibrary::initialize(NativeLibrary *&p_native_lib, const StringName p // Get the method void *library_init; - error = OS::get_singleton()->get_dynamic_library_symbol_handle(lib->handle, DLScriptLanguage::get_init_symbol_name(), library_init); + error = OS::get_singleton()->get_dynamic_library_symbol_handle(lib->handle, GDNativeScriptLanguage::get_init_symbol_name(), library_init); if (error) return error; ERR_FAIL_COND_V(!library_init, ERR_BUG); - void (*library_init_fpointer)(godot_dlscript_init_options *) = (void (*)(godot_dlscript_init_options *))library_init; + void (*library_init_fpointer)(godot_native_init_options *) = (void (*)(godot_native_init_options *))library_init; - godot_dlscript_init_options options; + godot_native_init_options options; options.in_editor = SceneTree::get_singleton()->is_editor_hint(); - /* options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE); options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR); options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE); - */ library_init_fpointer(&options); // Catch errors? - DLScriptLanguage::get_singleton()->initialized_libraries[p_path] = lib; + GDNativeScriptLanguage::get_singleton()->initialized_libraries[p_path] = lib; return OK; } Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) { - if (!DLScriptLanguage::get_singleton()->initialized_libraries.has(p_native_lib->path)) { + if (!GDNativeScriptLanguage::get_singleton()->initialized_libraries.has(p_native_lib->path)) { OS::get_singleton()->close_dynamic_library(p_native_lib->handle); p_native_lib->handle = 0; return OK; @@ -100,18 +98,18 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) { Error error = OK; void *library_terminate; - error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, DLScriptLanguage::get_terminate_symbol_name(), library_terminate); + error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, GDNativeScriptLanguage::get_terminate_symbol_name(), library_terminate); if (error) return OK; // no terminate? okay, not that important lol - void (*library_terminate_pointer)(godot_dlscript_terminate_options *) = (void (*)(godot_dlscript_terminate_options *))library_terminate; + void (*library_terminate_pointer)(godot_native_terminate_options *) = (void (*)(godot_native_terminate_options *))library_terminate; - godot_dlscript_terminate_options options; + godot_native_terminate_options options; options.in_editor = SceneTree::get_singleton()->is_editor_hint(); library_terminate_pointer(&options); - DLScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); + GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path); OS::get_singleton()->close_dynamic_library(p_native_lib->handle); p_native_lib->handle = 0; @@ -122,12 +120,13 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) { // Script #ifdef TOOLS_ENABLED -void DLScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { +void GDNativeScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { + ERR_FAIL_COND(!script_data); List<PropertyInfo> pinfo; Map<StringName, Variant> values; - for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) { + for (Map<StringName, GDNativeScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) { PropertyInfo p = E->get().info; p.name = String(E->key()); pinfo.push_back(p); @@ -137,24 +136,24 @@ void DLScript::_update_placeholder(PlaceHolderScriptInstance *p_placeholder) { p_placeholder->update(pinfo, values); } -void DLScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { +void GDNativeScript::_placeholder_erased(PlaceHolderScriptInstance *p_placeholder) { placeholders.erase(p_placeholder); } #endif -bool DLScript::can_instance() const { -#ifdef DLSCRIPT_EDITOR_FEATURES +bool GDNativeScript::can_instance() const { +#ifdef TOOLS_ENABLED return script_data || (!is_tool() && !ScriptServer::is_scripting_enabled()); #else // allow defaultlibrary without editor features if (!library.is_valid()) { - String path = GLOBAL_GET("dlscript/default_dllibrary"); + String path = GLOBAL_GET("gdnative/default_gdnativelibrary"); RES lib = ResourceLoader::load(path); - if (lib.is_valid() && lib->cast_to<DLLibrary>()) { + if (lib.is_valid() && lib->cast_to<GDNativeLibrary>()) { return true; } } @@ -165,28 +164,27 @@ bool DLScript::can_instance() const { // change to true enable in editor stuff. } -Ref<Script> DLScript::get_base_script() const { - Ref<DLScript> base_script; +Ref<Script> GDNativeScript::get_base_script() const { + Ref<GDNativeScript> base_script; base_script->library = library; base_script->script_data = script_data; base_script->script_name = script_data->base; return base_script; } -StringName DLScript::get_instance_base_type() const { +StringName GDNativeScript::get_instance_base_type() const { return script_data->base_native_type; } -ScriptInstance *DLScript::instance_create(Object *p_this) { +ScriptInstance *GDNativeScript::instance_create(Object *p_this) { #ifdef TOOLS_ENABLED -// find a good way to initialize stuff in the editor -#ifdef DLSCRIPT_EDITOR_FEATURES + // find a good way to initialize stuff in the editor if (!ScriptServer::is_scripting_enabled() && !is_tool()) { // placeholder, for nodes. But for tools we want the real thing - PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(DLScriptLanguage::singleton, Ref<Script>((Script *)this), p_this)); + PlaceHolderScriptInstance *sins = memnew(PlaceHolderScriptInstance(GDNativeScriptLanguage::singleton, Ref<Script>((Script *)this), p_this)); placeholders.insert(sins); if (!library.is_valid()) @@ -210,26 +208,25 @@ ScriptInstance *DLScript::instance_create(Object *p_this) { return sins; } -#endif #endif if (!library.is_valid()) { - String path = GLOBAL_GET("dlscript/default_dllibrary"); + String path = GLOBAL_GET("gdnative/default_gdnativelibrary"); RES lib = ResourceLoader::load(path); - if (lib.is_valid() && lib->cast_to<DLLibrary>()) { + if (lib.is_valid() && lib->cast_to<GDNativeLibrary>()) { set_library(lib); } } - DLInstance *new_instance = memnew(DLInstance); + GDNativeInstance *new_instance = memnew(GDNativeInstance); new_instance->owner = p_this; - new_instance->script = Ref<DLScript>(this); + new_instance->script = Ref<GDNativeScript>(this); -#ifndef DLSCRIPT_EDITOR_FEATURES +#ifndef TOOLS_ENABLED if (!ScriptServer::is_scripting_enabled()) { new_instance->userdata = 0; } else { @@ -243,26 +240,26 @@ ScriptInstance *DLScript::instance_create(Object *p_this) { return new_instance; } -bool DLScript::instance_has(const Object *p_this) const { +bool GDNativeScript::instance_has(const Object *p_this) const { return instances.has((Object *)p_this); // TODO } -bool DLScript::has_source_code() const { +bool GDNativeScript::has_source_code() const { return false; } -String DLScript::get_source_code() const { +String GDNativeScript::get_source_code() const { return ""; } -Error DLScript::reload(bool p_keep_state) { +Error GDNativeScript::reload(bool p_keep_state) { return FAILED; } -bool DLScript::has_method(const StringName &p_method) const { +bool GDNativeScript::has_method(const StringName &p_method) const { if (!script_data) return false; - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { if (data->methods.has(p_method)) @@ -274,10 +271,10 @@ bool DLScript::has_method(const StringName &p_method) const { return false; } -MethodInfo DLScript::get_method_info(const StringName &p_method) const { +MethodInfo GDNativeScript::get_method_info(const StringName &p_method) const { if (!script_data) return MethodInfo(); - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { if (data->methods.has(p_method)) @@ -290,14 +287,14 @@ MethodInfo DLScript::get_method_info(const StringName &p_method) const { return MethodInfo(); } -void DLScript::get_script_method_list(List<MethodInfo> *p_list) const { +void GDNativeScript::get_script_method_list(List<MethodInfo> *p_list) const { if (!script_data) return; Set<MethodInfo> methods; - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { - for (Map<StringName, DLScriptData::Method>::Element *E = data->methods.front(); E; E = E->next()) { + for (Map<StringName, GDNativeScriptData::Method>::Element *E = data->methods.front(); E; E = E->next()) { methods.insert(E->get().info); } data = data->base_data; @@ -308,14 +305,14 @@ void DLScript::get_script_method_list(List<MethodInfo> *p_list) const { } } -void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const { +void GDNativeScript::get_script_property_list(List<PropertyInfo> *p_list) const { if (!script_data) return; Set<PropertyInfo> properties; - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { - for (Map<StringName, DLScriptData::Property>::Element *E = data->properties.front(); E; E = E->next()) { + for (Map<StringName, GDNativeScriptData::Property>::Element *E = data->properties.front(); E; E = E->next()) { properties.insert(E->get().info); } data = data->base_data; @@ -326,10 +323,10 @@ void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const { } } -bool DLScript::get_property_default_value(const StringName &p_property, Variant &r_value) const { +bool GDNativeScript::get_property_default_value(const StringName &p_property, Variant &r_value) const { if (!script_data) return false; - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { if (data->properties.has(p_property)) { @@ -343,24 +340,24 @@ bool DLScript::get_property_default_value(const StringName &p_property, Variant return false; } -bool DLScript::is_tool() const { +bool GDNativeScript::is_tool() const { ERR_FAIL_COND_V(!script_data, false); return script_data->is_tool; } -String DLScript::get_node_type() const { +String GDNativeScript::get_node_type() const { return ""; // ? } -ScriptLanguage *DLScript::get_language() const { - return DLScriptLanguage::singleton; +ScriptLanguage *GDNativeScript::get_language() const { + return GDNativeScriptLanguage::singleton; } -bool DLScript::has_script_signal(const StringName &p_signal) const { +bool GDNativeScript::has_script_signal(const StringName &p_signal) const { if (!script_data) return false; - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { if (data->signals_.has(p_signal)) { @@ -373,16 +370,16 @@ bool DLScript::has_script_signal(const StringName &p_signal) const { return false; } -void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const { +void GDNativeScript::get_script_signal_list(List<MethodInfo> *r_signals) const { if (!script_data) return; Set<MethodInfo> signals_; - DLScriptData *data = script_data; + GDNativeScriptData *data = script_data; while (data) { - for (Map<StringName, DLScriptData::Signal>::Element *S = data->signals_.front(); S; S = S->next()) { + for (Map<StringName, GDNativeScriptData::Signal>::Element *S = data->signals_.front(); S; S = S->next()) { signals_.insert(S->get().signal); } @@ -394,11 +391,59 @@ void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const { } } -Ref<DLLibrary> DLScript::get_library() const { +Variant GDNativeScript::_new(const Variant **p_args, int p_argcount, Variant::CallError &r_error) { + + /* STEP 1, CREATE */ + + if (!library.is_valid() || ((String)script_name).empty() || !script_data) { + r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD; + return Variant(); + } + + r_error.error = Variant::CallError::CALL_OK; + REF ref; + Object *owner = NULL; + + GDNativeScriptData *_baseptr = script_data; + while (_baseptr->base_data) { + _baseptr = _baseptr->base_data; + } + + if (!(_baseptr->base_native_type == "")) { + owner = ClassDB::instance(_baseptr->base_native_type); + } else { + owner = memnew(Reference); //by default, no base means use reference + } + + Reference *r = owner->cast_to<Reference>(); + if (r) { + ref = REF(r); + } + + // GDScript does it like this: _create_instance(p_args, p_argcount, owner, r != NULL, r_error); + // @Todo support varargs for constructors. + GDNativeInstance *instance = (GDNativeInstance *)instance_create(owner); + + owner->set_script_instance(instance); + if (!instance) { + if (ref.is_null()) { + memdelete(owner); //no owner, sorry + } + return Variant(); + } + + if (ref.is_valid()) { + return ref; + } else { + return owner; + } +} + +Ref<GDNativeLibrary> GDNativeScript::get_library() const { return library; } -void DLScript::set_library(Ref<DLLibrary> p_library) { +void GDNativeScript::set_library(Ref<GDNativeLibrary> p_library) { library = p_library; #ifdef TOOLS_ENABLED @@ -415,15 +460,15 @@ void DLScript::set_library(Ref<DLLibrary> p_library) { } } -StringName DLScript::get_script_name() const { +StringName GDNativeScript::get_script_name() const { return script_name; } -void DLScript::set_script_name(StringName p_script_name) { +void GDNativeScript::set_script_name(StringName p_script_name) { script_name = p_script_name; if (library.is_valid()) { -#ifdef DLSCRIPT_EDITOR_FEATURES +#ifdef TOOLS_ENABLED if (!library->native_library) { library->_initialize(); } @@ -435,31 +480,33 @@ void DLScript::set_script_name(StringName p_script_name) { } } -void DLScript::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_library"), &DLScript::get_library); - ClassDB::bind_method(D_METHOD("set_library", "library"), &DLScript::set_library); - ClassDB::bind_method(D_METHOD("get_script_name"), &DLScript::get_script_name); - ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &DLScript::set_script_name); +void GDNativeScript::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_library"), &GDNativeScript::get_library); + ClassDB::bind_method(D_METHOD("set_library", "library"), &GDNativeScript::set_library); + ClassDB::bind_method(D_METHOD("get_script_name"), &GDNativeScript::get_script_name); + ClassDB::bind_method(D_METHOD("set_script_name", "script_name"), &GDNativeScript::set_script_name); - ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "DLLibrary"), "set_library", "get_library"); + ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDNativeScript::_new, MethodInfo(Variant::OBJECT, "new")); + + ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "GDNativeLibrary"), "set_library", "get_library"); ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "script_name"), "set_script_name", "get_script_name"); } -DLScript::DLScript() { +GDNativeScript::GDNativeScript() { script_data = NULL; - DLScriptLanguage::get_singleton()->script_list.insert(this); + GDNativeScriptLanguage::get_singleton()->script_list.insert(this); } -DLScript::~DLScript() { +GDNativeScript::~GDNativeScript() { //hmm - DLScriptLanguage::get_singleton()->script_list.erase(this); + GDNativeScriptLanguage::get_singleton()->script_list.erase(this); } // Library -DLLibrary *DLLibrary::currently_initialized_library = NULL; +GDNativeLibrary *GDNativeLibrary::currently_initialized_library = NULL; -DLLibrary *DLLibrary::get_currently_initialized_library() { +GDNativeLibrary *GDNativeLibrary::get_currently_initialized_library() { return currently_initialized_library; } @@ -479,7 +526,7 @@ static const char *_dl_platforms_info[] = { NULL // Finishing condition }; -void DLLibrary::set_platform_file(StringName p_platform, String p_file) { +void GDNativeLibrary::set_platform_file(StringName p_platform, String p_file) { if (p_file.empty()) { platform_files.erase(p_platform); } else { @@ -487,7 +534,7 @@ void DLLibrary::set_platform_file(StringName p_platform, String p_file) { } } -String DLLibrary::get_platform_file(StringName p_platform) const { +String GDNativeLibrary::get_platform_file(StringName p_platform) const { if (platform_files.has(p_platform)) { return platform_files[p_platform]; } else { @@ -495,7 +542,7 @@ String DLLibrary::get_platform_file(StringName p_platform) const { } } -Error DLLibrary::_initialize() { +Error GDNativeLibrary::_initialize() { _THREAD_SAFE_METHOD_ // Get the file @@ -529,24 +576,24 @@ Error DLLibrary::_initialize() { StringName path = GlobalConfig::get_singleton()->globalize_path(platform_file); - DLLibrary::currently_initialized_library = this; + GDNativeLibrary::currently_initialized_library = this; Error ret = NativeLibrary::initialize(native_library, path); native_library->dllib = this; - DLLibrary::currently_initialized_library = NULL; + GDNativeLibrary::currently_initialized_library = NULL; return ret; } -Error DLLibrary::_terminate() { +Error GDNativeLibrary::_terminate() { ERR_FAIL_COND_V(!native_library, ERR_BUG); ERR_FAIL_COND_V(!native_library->handle, ERR_BUG); // de-init stuff - for (Map<StringName, DLScriptData *>::Element *E = native_library->scripts.front(); E; E = E->next()) { - for (Map<StringName, DLScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) { + for (Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.front(); E; E = E->next()) { + for (Map<StringName, GDNativeScriptData::Method>::Element *M = E->get()->methods.front(); M; M = M->next()) { if (M->get().method.free_func) { M->get().method.free_func(M->get().method.method_data); } @@ -558,7 +605,7 @@ Error DLLibrary::_terminate() { E->get()->destroy_func.free_func(E->get()->destroy_func.method_data); } - for (Set<DLScript *>::Element *S = DLScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) { + for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) { if (S->get()->script_data == E->get()) { S->get()->script_data = NULL; } @@ -574,15 +621,15 @@ Error DLLibrary::_terminate() { return ret; } -void DLLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { +void GDNativeLibrary::_register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { ERR_FAIL_COND(!native_library); ERR_FAIL_COND(native_library->scripts.has(p_name)); - DLScriptData *s = memnew(DLScriptData); + GDNativeScriptData *s = memnew(GDNativeScriptData); s->base = p_base; s->create_func = p_instance_func; s->destroy_func = p_destroy_func; - Map<StringName, DLScriptData *>::Element *E = native_library->scripts.find(p_base); + Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.find(p_base); if (E) { s->base_data = E->get(); s->base_native_type = s->base_data->base_native_type; @@ -598,16 +645,16 @@ void DLLibrary::_register_script(const StringName p_name, const StringName p_bas native_library->scripts.insert(p_name, s); } -void DLLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { +void GDNativeLibrary::_register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func) { ERR_FAIL_COND(!native_library); ERR_FAIL_COND(native_library->scripts.has(p_name)); - DLScriptData *s = memnew(DLScriptData); + GDNativeScriptData *s = memnew(GDNativeScriptData); s->base = p_base; s->create_func = p_instance_func; s->destroy_func = p_destroy_func; s->is_tool = true; - Map<StringName, DLScriptData *>::Element *E = native_library->scripts.find(p_base); + Map<StringName, GDNativeScriptData *>::Element *E = native_library->scripts.find(p_base); if (E) { s->base_data = E->get(); s->base_native_type = s->base_data->base_native_type; @@ -623,23 +670,23 @@ void DLLibrary::_register_tool_script(const StringName p_name, const StringName native_library->scripts.insert(p_name, s); } -void DLLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) { +void GDNativeLibrary::_register_script_method(const StringName p_name, const StringName p_method, godot_method_attributes p_attr, godot_instance_method p_func, MethodInfo p_info) { ERR_FAIL_COND(!native_library); ERR_FAIL_COND(!native_library->scripts.has(p_name)); p_info.name = p_method; - DLScriptData::Method method; + GDNativeScriptData::Method method; - method = DLScriptData::Method(p_func, p_info, p_attr.rpc_type); + method = GDNativeScriptData::Method(p_func, p_info, p_attr.rpc_type); native_library->scripts[p_name]->methods.insert(p_method, method); } -void DLLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) { +void GDNativeLibrary::_register_script_property(const StringName p_name, const String p_path, godot_property_attributes *p_attr, godot_property_set_func p_setter, godot_property_get_func p_getter) { ERR_FAIL_COND(!native_library); ERR_FAIL_COND(!native_library->scripts.has(p_name)); - DLScriptData::Property p; + GDNativeScriptData::Property p; PropertyInfo pi; pi.name = p_path; @@ -647,18 +694,18 @@ void DLLibrary::_register_script_property(const StringName p_name, const String if (p_attr != NULL) { pi = PropertyInfo((Variant::Type)p_attr->type, p_path, (PropertyHint)p_attr->hint, *(String *)&p_attr->hint_string, p_attr->usage); - p = DLScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type); + p = GDNativeScriptData::Property(p_setter, p_getter, pi, *(Variant *)&p_attr->default_value, p_attr->rset_type); } native_library->scripts[p_name]->properties.insert(p_path, p); } -void DLLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) { +void GDNativeLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) { ERR_FAIL_COND(!native_library); ERR_FAIL_COND(!native_library->scripts.has(p_name)); ERR_FAIL_COND(!p_signal); - DLScriptData::Signal signal; + GDNativeScriptData::Signal signal; signal.signal.name = *(String *)&p_signal->name; @@ -698,7 +745,7 @@ void DLLibrary::_register_script_signal(const StringName p_name, const godot_sig native_library->scripts[p_name]->signals_.insert(*(String *)&p_signal->name, signal); } -DLScriptData *DLLibrary::get_script_data(const StringName p_name) { +GDNativeScriptData *GDNativeLibrary::get_script_data(const StringName p_name) { ERR_FAIL_COND_V(!native_library, NULL); ERR_FAIL_COND_V(!native_library->scripts.has(p_name), NULL); @@ -706,7 +753,7 @@ DLScriptData *DLLibrary::get_script_data(const StringName p_name) { return native_library->scripts[p_name]; } -bool DLLibrary::_set(const StringName &p_name, const Variant &p_value) { +bool GDNativeLibrary::_set(const StringName &p_name, const Variant &p_value) { String name = p_name; if (name.begins_with("platform/")) { set_platform_file(name.get_slice("/", 1), p_value); @@ -715,7 +762,7 @@ bool DLLibrary::_set(const StringName &p_name, const Variant &p_value) { return false; } -bool DLLibrary::_get(const StringName &p_name, Variant &r_ret) const { +bool GDNativeLibrary::_get(const StringName &p_name, Variant &r_ret) const { String name = p_name; if (name.begins_with("platform/")) { r_ret = get_platform_file(name.get_slice("/", 1)); @@ -724,7 +771,7 @@ bool DLLibrary::_get(const StringName &p_name, Variant &r_ret) const { return false; } -void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const { +void GDNativeLibrary::_get_property_list(List<PropertyInfo> *p_list) const { char **platform_info = (char **)_dl_platforms_info; Set<String> registered_platform_names; @@ -769,20 +816,20 @@ void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const { } } -void DLLibrary::_notification(int what) { +void GDNativeLibrary::_notification(int what) { // TODO } -void DLLibrary::_bind_methods() { - ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &DLLibrary::set_platform_file); - ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &DLLibrary::get_platform_file); +void GDNativeLibrary::_bind_methods() { + ClassDB::bind_method(D_METHOD("set_platform_file", "platform", "file"), &GDNativeLibrary::set_platform_file); + ClassDB::bind_method(D_METHOD("get_platform_file", "platform"), &GDNativeLibrary::get_platform_file); } -DLLibrary::DLLibrary() { +GDNativeLibrary::GDNativeLibrary() { native_library = NULL; } -DLLibrary::~DLLibrary() { +GDNativeLibrary::~GDNativeLibrary() { if (!native_library) { return; @@ -795,7 +842,7 @@ DLLibrary::~DLLibrary() { // Instance -bool DLInstance::set(const StringName &p_name, const Variant &p_value) { +bool GDNativeInstance::set(const StringName &p_name, const Variant &p_value) { if (!script->script_data) return false; if (script->script_data->properties.has(p_name)) { @@ -805,7 +852,7 @@ bool DLInstance::set(const StringName &p_name, const Variant &p_value) { return false; } -bool DLInstance::get(const StringName &p_name, Variant &r_ret) const { +bool GDNativeInstance::get(const StringName &p_name, Variant &r_ret) const { if (!script->script_data) return false; if (script->script_data->properties.has(p_name)) { @@ -816,12 +863,12 @@ bool DLInstance::get(const StringName &p_name, Variant &r_ret) const { return false; } -void DLInstance::get_property_list(List<PropertyInfo> *p_properties) const { +void GDNativeInstance::get_property_list(List<PropertyInfo> *p_properties) const { script->get_script_property_list(p_properties); // TODO: dynamic properties } -Variant::Type DLInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { +Variant::Type GDNativeInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const { if (script->script_data->properties.has(p_name)) { *r_is_valid = true; return script->script_data->properties[p_name].info.type; @@ -830,20 +877,20 @@ Variant::Type DLInstance::get_property_type(const StringName &p_name, bool *r_is return Variant::NIL; } -void DLInstance::get_method_list(List<MethodInfo> *p_list) const { +void GDNativeInstance::get_method_list(List<MethodInfo> *p_list) const { script->get_script_method_list(p_list); } -bool DLInstance::has_method(const StringName &p_method) const { +bool GDNativeInstance::has_method(const StringName &p_method) const { return script->has_method(p_method); } -Variant DLInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { +Variant GDNativeInstance::call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error) { // TODO: validated methods & errors - DLScriptData *data_ptr = script->script_data; + GDNativeScriptData *data_ptr = script->script_data; while (data_ptr) { - Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method); + Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method); if (E) { godot_variant result = E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); return *(Variant *)&result; @@ -854,12 +901,12 @@ Variant DLInstance::call(const StringName &p_method, const Variant **p_args, int return Variant(); } -void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { +void GDNativeInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) { // TODO: validated methods & errors - DLScriptData *data_ptr = script->script_data; + GDNativeScriptData *data_ptr = script->script_data; while (data_ptr) { - Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method); + Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method); if (E) { E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); } @@ -867,7 +914,7 @@ void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_a } } -void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) { +void GDNativeInstance::_ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) { // TODO: validated methods & errors if (data_ptr->base_data) @@ -875,34 +922,34 @@ void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_m // Variant::CallError ce; - Map<StringName, DLScriptData::Method>::Element *E = data_ptr->methods.find(p_method); + Map<StringName, GDNativeScriptData::Method>::Element *E = data_ptr->methods.find(p_method); if (E) { E->get().method.method((godot_object *)owner, E->get().method.method_data, userdata, p_argcount, (godot_variant **)p_args); } } -void DLInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { +void GDNativeInstance::call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount) { if (script.ptr() && script->script_data) { _ml_call_reversed(script->script_data, p_method, p_args, p_argcount); } } -void DLInstance::notification(int p_notification) { +void GDNativeInstance::notification(int p_notification) { Variant value = p_notification; const Variant *args[1] = { &value }; - call_multilevel(DLScriptLanguage::singleton->strings._notification, args, 1); + call_multilevel(GDNativeScriptLanguage::singleton->strings._notification, args, 1); } -Ref<Script> DLInstance::get_script() const { +Ref<Script> GDNativeInstance::get_script() const { return script; } -ScriptLanguage *DLInstance::get_language() { - return DLScriptLanguage::singleton; +ScriptLanguage *GDNativeInstance::get_language() { + return GDNativeScriptLanguage::singleton; } -ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) const { - DLScriptData::Method m = script->script_data->methods[p_method]; +ScriptInstance::RPCMode GDNativeInstance::get_rpc_mode(const StringName &p_method) const { + GDNativeScriptData::Method m = script->script_data->methods[p_method]; switch (m.rpc_mode) { case GODOT_METHOD_RPC_MODE_DISABLED: return RPC_MODE_DISABLED; @@ -919,8 +966,8 @@ ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) con } } -ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable) const { - DLScriptData::Property p = script->script_data->properties[p_variable]; +ScriptInstance::RPCMode GDNativeInstance::get_rset_mode(const StringName &p_variable) const { + GDNativeScriptData::Property p = script->script_data->properties[p_variable]; switch (p.rset_mode) { case GODOT_METHOD_RPC_MODE_DISABLED: return RPC_MODE_DISABLED; @@ -937,12 +984,12 @@ ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable) } } -DLInstance::DLInstance() { +GDNativeInstance::GDNativeInstance() { owner = NULL; userdata = NULL; } -DLInstance::~DLInstance() { +GDNativeInstance::~GDNativeInstance() { if (script.is_valid()) { if (owner) { script->instances.erase(owner); @@ -959,31 +1006,31 @@ DLInstance::~DLInstance() { // Language -DLScriptLanguage *DLScriptLanguage::singleton = NULL; +GDNativeScriptLanguage *GDNativeScriptLanguage::singleton = NULL; -String DLScriptLanguage::get_name() const { - return "DLScript"; +String GDNativeScriptLanguage::get_name() const { + return "Native"; } void _add_reload_node() { #ifdef TOOLS_ENABLED - DLReloadNode *rn = memnew(DLReloadNode); + GDNativeReloadNode *rn = memnew(GDNativeReloadNode); EditorNode::get_singleton()->add_child(rn); #endif } -void DLScriptLanguage::init() { +void GDNativeScriptLanguage::init() { // TODO: Expose globals - GLOBAL_DEF("dlscript/default_dllibrary", ""); - PropertyInfo prop_info(Variant::STRING, "dlscript/default_dllibrary", PROPERTY_HINT_FILE, "tres,res,dllib"); - GlobalConfig::get_singleton()->set_custom_property_info("dlscript/default_dllibrary", prop_info); + GLOBAL_DEF("gdnative/default_gdnativelibrary", ""); + PropertyInfo prop_info(Variant::STRING, "gdnative/default_gdnativelibrary", PROPERTY_HINT_FILE, "tres,res,dllib"); + GlobalConfig::get_singleton()->set_custom_property_info("gdnative/default_gdnativelibrary", prop_info); // generate bindings #if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED) List<String> args = OS::get_singleton()->get_cmdline_args(); - List<String>::Element *E = args.find("--dlscript-generate-json-api"); + List<String>::Element *E = args.find("--gdnative-generate-json-api"); if (E && E->next()) { if (generate_c_api(E->next()->get()) != OK) { @@ -999,162 +1046,160 @@ void DLScriptLanguage::init() { #endif } -String DLScriptLanguage::get_type() const { - return "DLScript"; +String GDNativeScriptLanguage::get_type() const { + return "Native"; } -String DLScriptLanguage::get_extension() const { - return "dl"; +String GDNativeScriptLanguage::get_extension() const { + return "gdn"; } -Error DLScriptLanguage::execute_file(const String &p_path) { +Error GDNativeScriptLanguage::execute_file(const String &p_path) { return OK; // ?? } -void DLScriptLanguage::finish() { +void GDNativeScriptLanguage::finish() { // cleanup is for noobs } // scons doesn't want to link in the api source so we need to call a dummy function to cause it to link extern "C" void _api_anchor(); -void DLScriptLanguage::_compile_dummy_for_the_api() { +void GDNativeScriptLanguage::_compile_dummy_for_the_api() { _api_anchor(); } -Ref<Script> DLScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const { - DLScript *src = memnew(DLScript); +Ref<Script> GDNativeScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const { + GDNativeScript *src = memnew(GDNativeScript); src->set_script_name(p_class_name); - return Ref<DLScript>(src); + return Ref<GDNativeScript>(src); } -bool DLScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { +bool GDNativeScriptLanguage::validate(const String &p_script, int &r_line_error, int &r_col_error, String &r_test_error, const String &p_path, List<String> *r_functions) const { return false; // TODO } -Script *DLScriptLanguage::create_script() const { - DLScript *scr = memnew(DLScript); +Script *GDNativeScriptLanguage::create_script() const { + GDNativeScript *scr = memnew(GDNativeScript); return scr; } -bool DLScriptLanguage::has_named_classes() const { +bool GDNativeScriptLanguage::has_named_classes() const { return true; } -int DLScriptLanguage::find_function(const String &p_function, const String &p_code) const { +int GDNativeScriptLanguage::find_function(const String &p_function, const String &p_code) const { return -1; // No source code! } -String DLScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { +String GDNativeScriptLanguage::make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const { return ""; // No source code! } -void DLScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) { +void GDNativeScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) { // TODO TODO TODO } // TODO: Any debugging? (research) -String DLScriptLanguage::debug_get_error() const { +String GDNativeScriptLanguage::debug_get_error() const { return ""; } -int DLScriptLanguage::debug_get_stack_level_count() const { +int GDNativeScriptLanguage::debug_get_stack_level_count() const { return 1; // ? } -int DLScriptLanguage::debug_get_stack_level_line(int p_level) const { +int GDNativeScriptLanguage::debug_get_stack_level_line(int p_level) const { return -1; } -String DLScriptLanguage::debug_get_stack_level_function(int p_level) const { +String GDNativeScriptLanguage::debug_get_stack_level_function(int p_level) const { return "[native code]"; // ? } -String DLScriptLanguage::debug_get_stack_level_source(int p_level) const { +String GDNativeScriptLanguage::debug_get_stack_level_source(int p_level) const { return ""; } -void DLScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} +void GDNativeScriptLanguage::debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} -void DLScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} +void GDNativeScriptLanguage::debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems, int p_max_depth) {} -String DLScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { +String GDNativeScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) { return ""; // ?? } -void DLScriptLanguage::reload_all_scripts() { +void GDNativeScriptLanguage::reload_all_scripts() { // @Todo } -void DLScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) { +void GDNativeScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload) { // @Todo OS::get_singleton()->print("reload tool scripts\n"); } -void DLScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("dl"); // Container file format +void GDNativeScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const { + p_extensions->push_back("gdn"); // Container file format } -void DLScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const { +void GDNativeScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const { } -void DLScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const { +void GDNativeScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const { } // TODO: all profilling -void DLScriptLanguage::profiling_start() { +void GDNativeScriptLanguage::profiling_start() { } -void DLScriptLanguage::profiling_stop() { +void GDNativeScriptLanguage::profiling_stop() { } -int DLScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) { +int GDNativeScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) { return 0; } -int DLScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) { +int GDNativeScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) { return 0; } -void DLScriptLanguage::frame() { +void GDNativeScriptLanguage::frame() { } -String DLScriptLanguage::get_init_symbol_name() { - return "godot_dlscript_init"; // TODO: Maybe make some internal function which would do the actual stuff +String GDNativeScriptLanguage::get_init_symbol_name() { + return "godot_native_init"; // TODO: Maybe make some internal function which would do the actual stuff } -String DLScriptLanguage::get_terminate_symbol_name() { - return "godot_dlscript_terminate"; +String GDNativeScriptLanguage::get_terminate_symbol_name() { + return "godot_native_terminate"; } -DLScriptLanguage::DLScriptLanguage() { +GDNativeScriptLanguage::GDNativeScriptLanguage() { ERR_FAIL_COND(singleton); strings._notification = StringName("_notification"); singleton = this; initialized_libraries = Map<StringName, NativeLibrary *>(); } -DLScriptLanguage::~DLScriptLanguage() { +GDNativeScriptLanguage::~GDNativeScriptLanguage() { singleton = NULL; } // DLReloadNode -void DLReloadNode::_bind_methods() { - ClassDB::bind_method("_notification", &DLReloadNode::_notification); +void GDNativeReloadNode::_bind_methods() { + ClassDB::bind_method("_notification", &GDNativeReloadNode::_notification); } -void DLReloadNode::_notification(int p_what) { +void GDNativeReloadNode::_notification(int p_what) { #ifdef TOOLS_ENABLED switch (p_what) { case MainLoop::NOTIFICATION_WM_FOCUS_IN: { - // break; // For now. - Set<NativeLibrary *> libs_to_reload; - for (Map<StringName, NativeLibrary *>::Element *L = DLScriptLanguage::get_singleton()->initialized_libraries.front(); L; L = L->next()) { + for (Map<StringName, NativeLibrary *>::Element *L = GDNativeScriptLanguage::get_singleton()->initialized_libraries.front(); L; L = L->next()) { // check if file got modified at all // @Todo @@ -1163,34 +1208,32 @@ void DLReloadNode::_notification(int p_what) { for (Set<NativeLibrary *>::Element *L = libs_to_reload.front(); L; L = L->next()) { - DLLibrary *lib = L->get()->dllib; + GDNativeLibrary *lib = L->get()->dllib; lib->_terminate(); lib->_initialize(); // update placeholders (if any) - DLScript *script = NULL; + Set<GDNativeScript *> scripts; - for (Set<DLScript *>::Element *S = DLScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) { + for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) { if (lib->native_library->scripts.has(S->get()->get_script_name())) { - script = S->get(); + GDNativeScript *script = S->get(); script->script_data = lib->get_script_data(script->get_script_name()); - break; + scripts.insert(script); } } - if (script == NULL) { - // new class, cool. Nothing to do here - continue; - } - - if (script->placeholders.size() == 0) - continue; + for (Set<GDNativeScript *>::Element *S = scripts.front(); S; S = S->next()) { + GDNativeScript *script = S->get(); + if (script->placeholders.size() == 0) + continue; - for (Set<PlaceHolderScriptInstance *>::Element *P = script->placeholders.front(); P; P = P->next()) { - PlaceHolderScriptInstance *p = P->get(); - script->_update_placeholder(p); + for (Set<PlaceHolderScriptInstance *>::Element *P = script->placeholders.front(); P; P = P->next()) { + PlaceHolderScriptInstance *p = P->get(); + script->_update_placeholder(p); + } } } @@ -1203,35 +1246,35 @@ void DLReloadNode::_notification(int p_what) { // Resource loader/saver -RES ResourceFormatLoaderDLScript::load(const String &p_path, const String &p_original_path, Error *r_error) { +RES ResourceFormatLoaderGDNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error) { ResourceFormatLoaderText rsflt; return rsflt.load(p_path, p_original_path, r_error); } -void ResourceFormatLoaderDLScript::get_recognized_extensions(List<String> *p_extensions) const { - p_extensions->push_back("dl"); +void ResourceFormatLoaderGDNativeScript::get_recognized_extensions(List<String> *p_extensions) const { + p_extensions->push_back("gdn"); } -bool ResourceFormatLoaderDLScript::handles_type(const String &p_type) const { - return (p_type == "Script" || p_type == "DLScript"); +bool ResourceFormatLoaderGDNativeScript::handles_type(const String &p_type) const { + return (p_type == "Script" || p_type == "Native"); } -String ResourceFormatLoaderDLScript::get_resource_type(const String &p_path) const { +String ResourceFormatLoaderGDNativeScript::get_resource_type(const String &p_path) const { String el = p_path.get_extension().to_lower(); - if (el == "dl") - return "DLScript"; + if (el == "gdn") + return "Native"; return ""; } -Error ResourceFormatSaverDLScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { +Error ResourceFormatSaverGDNativeScript::save(const String &p_path, const RES &p_resource, uint32_t p_flags) { ResourceFormatSaverText rfst; return rfst.save(p_path, p_resource, p_flags); } -bool ResourceFormatSaverDLScript::recognize(const RES &p_resource) const { - return p_resource->cast_to<DLScript>() != NULL; +bool ResourceFormatSaverGDNativeScript::recognize(const RES &p_resource) const { + return p_resource->cast_to<GDNativeScript>() != NULL; } -void ResourceFormatSaverDLScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { - if (p_resource->cast_to<DLScript>()) { - p_extensions->push_back("dl"); +void ResourceFormatSaverGDNativeScript::get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const { + if (p_resource->cast_to<GDNativeScript>()) { + p_extensions->push_back("gdn"); } } diff --git a/modules/dlscript/dl_script.h b/modules/gdnative/gdnative.h index 630ce21883..27e0c3788b 100644 --- a/modules/dlscript/dl_script.h +++ b/modules/gdnative/gdnative.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* dl_script.h */ +/* gdnative.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -27,8 +27,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef DL_SCRIPT_H -#define DL_SCRIPT_H +#ifndef GDNATIVE_H +#define GDNATIVE_H #include "io/resource_loader.h" #include "io/resource_saver.h" @@ -40,26 +40,22 @@ #include "godot.h" -#ifdef TOOLS_ENABLED -#define DLSCRIPT_EDITOR_FEATURES -#endif - -class DLScriptData; -class DLLibrary; +class GDNativeScriptData; +class GDNativeLibrary; struct NativeLibrary { StringName path; void *handle; - DLLibrary *dllib; + GDNativeLibrary *dllib; - Map<StringName, DLScriptData *> scripts; + Map<StringName, GDNativeScriptData *> scripts; static Error initialize(NativeLibrary *&p_native_lib, const StringName p_path); static Error terminate(NativeLibrary *&p_native_lib); }; -struct DLScriptData { +struct GDNativeScriptData { /* typedef void* (InstanceFunc)(godot_object* instance); typedef void (DestroyFunc)(godot_object* instance,void* userdata); typedef godot_variant (MethodFunc)(godot_object *instance, void *userdata, void *method_data, int arg_count,godot_variant **args); @@ -111,18 +107,18 @@ struct DLScriptData { Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals StringName base; StringName base_native_type; - DLScriptData *base_data; + GDNativeScriptData *base_data; godot_instance_create_func create_func; godot_instance_destroy_func destroy_func; bool is_tool; - DLScriptData() { + GDNativeScriptData() { base = StringName(); base_data = NULL; is_tool = false; } - DLScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) { + GDNativeScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) { base = p_base; base_data = NULL; create_func = p_instance; @@ -131,16 +127,16 @@ struct DLScriptData { } }; -class DLLibrary; +class GDNativeLibrary; -class DLScript : public Script { - GDCLASS(DLScript, Script); +class GDNativeScript : public Script { + GDCLASS(GDNativeScript, Script); - Ref<DLLibrary> library; + Ref<GDNativeLibrary> library; StringName script_name; StringName base_native_type; Set<Object *> instances; - DLScriptData *script_data; + GDNativeScriptData *script_data; #ifdef TOOLS_ENABLED Set<PlaceHolderScriptInstance *> placeholders; @@ -148,10 +144,10 @@ class DLScript : public Script { virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder); #endif - friend class DLInstance; - friend class DLScriptLanguage; - friend class DLReloadNode; - friend class DLLibrary; + friend class GDNativeInstance; + friend class GDNativeScriptLanguage; + friend class GDNativeReloadNode; + friend class GDNativeLibrary; protected: static void _bind_methods(); @@ -188,32 +184,34 @@ public: virtual void get_script_method_list(List<MethodInfo> *p_list) const; virtual void get_script_property_list(List<PropertyInfo> *p_list) const; - Ref<DLLibrary> get_library() const; - void set_library(Ref<DLLibrary> p_library); + Variant _new(const Variant **p_args, int p_argcount, Variant::CallError &r_error); + + Ref<GDNativeLibrary> get_library() const; + void set_library(Ref<GDNativeLibrary> p_library); StringName get_script_name() const; void set_script_name(StringName p_script_name); - DLScript(); - ~DLScript(); + GDNativeScript(); + ~GDNativeScript(); }; -class DLLibrary : public Resource { +class GDNativeLibrary : public Resource { _THREAD_SAFE_CLASS_ - GDCLASS(DLLibrary, Resource); - OBJ_SAVE_TYPE(DLLibrary); + GDCLASS(GDNativeLibrary, Resource); + OBJ_SAVE_TYPE(GDNativeLibrary); Map<StringName, String> platform_files; NativeLibrary *native_library; - static DLLibrary *currently_initialized_library; + static GDNativeLibrary *currently_initialized_library; protected: - friend class DLScript; + friend class GDNativeScript; friend class NativeLibrary; - friend class DLReloadNode; + friend class GDNativeReloadNode; - DLScriptData *get_script_data(const StringName p_name); + GDNativeScriptData *get_script_data(const StringName p_name); bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; @@ -225,7 +223,7 @@ public: Error _initialize(); Error _terminate(); - static DLLibrary *get_currently_initialized_library(); + static GDNativeLibrary *get_currently_initialized_library(); void _register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func); void _register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func); @@ -236,18 +234,18 @@ public: void set_platform_file(StringName p_platform, String p_file); String get_platform_file(StringName p_platform) const; - DLLibrary(); - ~DLLibrary(); + GDNativeLibrary(); + ~GDNativeLibrary(); }; -class DLInstance : public ScriptInstance { - friend class DLScript; +class GDNativeInstance : public ScriptInstance { + friend class GDNativeScript; Object *owner; - Ref<DLScript> script; + Ref<GDNativeScript> script; void *userdata; - void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount); + void _ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount); public: _FORCE_INLINE_ Object *get_owner() { return owner; } @@ -280,19 +278,19 @@ public: virtual RPCMode get_rpc_mode(const StringName &p_method) const; virtual RPCMode get_rset_mode(const StringName &p_variable) const; - DLInstance(); - ~DLInstance(); + GDNativeInstance(); + ~GDNativeInstance(); }; -class DLReloadNode; +class GDNativeReloadNode; -class DLScriptLanguage : public ScriptLanguage { - friend class DLScript; - friend class DLInstance; - friend class DLReloadNode; - friend class DLLibrary; +class GDNativeScriptLanguage : public ScriptLanguage { + friend class GDNativeScript; + friend class GDNativeInstance; + friend class GDNativeReloadNode; + friend class GDNativeLibrary; - static DLScriptLanguage *singleton; + static GDNativeScriptLanguage *singleton; Variant *_global_array; // @Unused necessary? Vector<Variant> global_array; // @Unused necessary? @@ -303,7 +301,7 @@ class DLScriptLanguage : public ScriptLanguage { Mutex *lock; - Set<DLScript *> script_list; + Set<GDNativeScript *> script_list; bool profiling; uint64_t script_frame_time; @@ -317,7 +315,7 @@ class DLScriptLanguage : public ScriptLanguage { public: Map<StringName, NativeLibrary *> initialized_libraries; - _FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; } + _FORCE_INLINE_ static GDNativeScriptLanguage *get_singleton() { return singleton; } virtual String get_name() const; @@ -391,18 +389,18 @@ public: /* HACKER FUNCTIONS */ void _compile_dummy_for_the_api(); - DLScriptLanguage(); - ~DLScriptLanguage(); + GDNativeScriptLanguage(); + ~GDNativeScriptLanguage(); }; -class DLReloadNode : public Node { - GDCLASS(DLReloadNode, Node) +class GDNativeReloadNode : public Node { + GDCLASS(GDNativeReloadNode, Node) public: static void _bind_methods(); void _notification(int p_what); }; -class ResourceFormatLoaderDLScript : public ResourceFormatLoader { +class ResourceFormatLoaderGDNativeScript : public ResourceFormatLoader { public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List<String> *p_extensions) const; @@ -410,12 +408,10 @@ public: virtual String get_resource_type(const String &p_path) const; }; -class ResourceFormatSaverDLScript : public ResourceFormatSaver { +class ResourceFormatSaverGDNativeScript : public ResourceFormatSaver { virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0); virtual bool recognize(const RES &p_resource) const; virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const; }; -// ugly, but hey - -#endif // DL_SCRIPT_H +#endif // GDNATIVE_H diff --git a/modules/dlscript/godot.cpp b/modules/gdnative/godot.cpp index 478eb86c08..7477a28db6 100644 --- a/modules/dlscript/godot.cpp +++ b/modules/gdnative/godot.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godot_c.cpp */ +/* godot.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -30,8 +30,9 @@ #include "godot.h" #include "class_db.h" -#include "dl_script.h" +#include "gdnative.h" #include "global_config.h" +#include "global_constants.h" #include "variant.h" #ifdef __cplusplus @@ -125,7 +126,7 @@ void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind) // Script API void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -134,7 +135,7 @@ void GDAPI godot_script_register_class(const char *p_name, const char *p_base, g } void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -143,7 +144,7 @@ void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_ba } void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -152,7 +153,7 @@ void GDAPI godot_script_register_method(const char *p_name, const char *p_functi } void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -162,7 +163,7 @@ void GDAPI godot_script_register_property(const char *p_name, const char *p_path } void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) { - DLLibrary *library = DLLibrary::get_currently_initialized_library(); + GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library(); if (!library) { ERR_EXPLAIN("Attempt to register script after initializing library!"); ERR_FAIL(); @@ -171,16 +172,36 @@ void GDAPI godot_script_register_signal(const char *p_name, const godot_signal * library->_register_script_signal(p_name, p_signal); } -void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) { +void GDAPI *godot_native_get_userdata(godot_object *p_instance) { Object *instance = (Object *)p_instance; if (!instance) return NULL; - if (instance->get_script_instance() && instance->get_script_instance()->get_language() == DLScriptLanguage::get_singleton()) { - return ((DLInstance *)instance->get_script_instance())->get_userdata(); + if (instance->get_script_instance() && instance->get_script_instance()->get_language() == GDNativeScriptLanguage::get_singleton()) { + return ((GDNativeInstance *)instance->get_script_instance())->get_userdata(); } return NULL; } +godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) { + ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname)); + if (class_info) + return (godot_class_constructor)class_info->creation_func; + return NULL; +} + +godot_dictionary GDAPI godot_get_global_constants() { + godot_dictionary constants; + godot_dictionary_new(&constants); + Dictionary *p_constants = (Dictionary *)&constants; + const int constants_count = GlobalConstants::get_global_constant_count(); + for (int i = 0; i < constants_count; ++i) { + const char *name = GlobalConstants::get_global_constant_name(i); + int value = GlobalConstants::get_global_constant_value(i); + (*p_constants)[name] = value; + } + return constants; +} + // System functions void GDAPI *godot_alloc(int p_bytes) { return memalloc(p_bytes); diff --git a/modules/dlscript/godot.h b/modules/gdnative/godot.h index 4a977ad8cb..88d2a9bac2 100644 --- a/modules/dlscript/godot.h +++ b/modules/gdnative/godot.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* godot_c.h */ +/* godot.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -38,12 +38,26 @@ extern "C" { #define GDAPI_EXPORT #endif -#if !defined(_WIN32) && !defined(_MSC_VER) +#ifdef _WIN32 +#if defined(GDAPI_EXPORT) +#define GDCALLINGCONV __cdecl +#define GDAPI __declspec(dllexport) GDCALLINGCONV +#else +#define GDCALLINGCONV __cdecl +#define GDAPI __declspec(dllimport) GDCALLINGCONV +#endif +#elif defined(__APPLE__) +#include "TargetConditionals.h" +#if TARGET_OS_IPHONE +#define GDCALLINGCONV #define GDAPI -#elif defined(GDAPI_EXPORT) -#define GDAPI __declspec(dllexport) +#elif TARGET_OS_MAC +#define GDCALLINGCONV __attribute__((sysv_abi)) +#define GDAPI GDCALLINGCONV +#endif #else -#define GDAPI __declspec(dllimport) +#define GDCALLINGCONV __attribute__((sysv_abi)) +#define GDAPI GDCALLINGCONV #endif #include <stdbool.h> @@ -217,16 +231,16 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj ////// Script API -typedef struct godot_dlscript_init_options { +typedef struct godot_native_init_options { godot_bool in_editor; uint64_t core_api_hash; uint64_t editor_api_hash; uint64_t no_api_hash; -} godot_dlscript_init_options; +} godot_native_init_options; -typedef struct godot_dlscript_terminate_options { +typedef struct godot_native_terminate_options { godot_bool in_editor; -} godot_dlscript_terminate_options; +} godot_native_terminate_options; typedef enum godot_method_rpc_mode { GODOT_METHOD_RPC_MODE_DISABLED, @@ -314,16 +328,16 @@ typedef struct godot_property_attributes { typedef struct godot_instance_create_func { // instance pointer, method_data - return user data - void *(*create_func)(godot_object *, void *); + GDCALLINGCONV void *(*create_func)(godot_object *, void *); void *method_data; - void (*free_func)(void *); -} godot_script_instance_func; + GDCALLINGCONV void (*free_func)(void *); +} godot_instance_create_func; typedef struct godot_instance_destroy_func { // instance pointer, method data, user data - void (*destroy_func)(godot_object *, void *, void *); + GDCALLINGCONV void (*destroy_func)(godot_object *, void *, void *); void *method_data; - void (*free_func)(void *); + GDCALLINGCONV void (*free_func)(void *); } godot_instance_destroy_func; void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func); @@ -332,25 +346,25 @@ void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_ba typedef struct godot_instance_method { // instance pointer, method data, user data, num args, args - return result as varaint - godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **); + GDCALLINGCONV godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **); void *method_data; - void (*free_func)(void *); + GDCALLINGCONV void (*free_func)(void *); } godot_instance_method; void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method); typedef struct godot_property_set_func { // instance pointer, method data, user data, value - void (*set_func)(godot_object *, void *, void *, godot_variant); + GDCALLINGCONV void (*set_func)(godot_object *, void *, void *, godot_variant); void *method_data; - void (*free_func)(void *); + GDCALLINGCONV void (*free_func)(void *); } godot_property_set_func; typedef struct godot_property_get_func { // instance pointer, method data, user data, value - godot_variant (*get_func)(godot_object *, void *, void *); + GDCALLINGCONV godot_variant (*get_func)(godot_object *, void *, void *); void *method_data; - void (*free_func)(void *); + GDCALLINGCONV void (*free_func)(void *); } godot_property_get_func; void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func); @@ -374,7 +388,14 @@ typedef struct godot_signal { void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal); -void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance); +void GDAPI *godot_native_get_userdata(godot_object *p_instance); + +// Calling convention? +typedef godot_object *(*godot_class_constructor)(); + +godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname); + +godot_dictionary GDAPI godot_get_global_constants(); ////// System Functions diff --git a/modules/dlscript/godot/godot_array.cpp b/modules/gdnative/godot/godot_array.cpp index 21ad97ca78..6c55c5d048 100644 --- a/modules/dlscript/godot/godot_array.cpp +++ b/modules/gdnative/godot/godot_array.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_array.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_array.h" #include "core/array.h" diff --git a/modules/dlscript/godot/godot_array.h b/modules/gdnative/godot/godot_array.h index 544e95a2ed..b92ebb834f 100644 --- a/modules/dlscript/godot/godot_array.h +++ b/modules/gdnative/godot/godot_array.h @@ -1,5 +1,35 @@ -#ifndef GODOT_DLSCRIPT_ARRAY_H -#define GODOT_DLSCRIPT_ARRAY_H +/*************************************************************************/ +/* godot_array.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#ifndef GODOT_ARRAY_H +#define GODOT_ARRAY_H #ifdef __cplusplus extern "C" { @@ -85,4 +115,4 @@ void GDAPI godot_array_destroy(godot_array *p_arr); } #endif -#endif // GODOT_DLSCRIPT_ARRAY_H +#endif // GODOT_ARRAY_H diff --git a/modules/gdnative/godot/godot_basis.cpp b/modules/gdnative/godot/godot_basis.cpp new file mode 100644 index 0000000000..474cd3d448 --- /dev/null +++ b/modules/gdnative/godot/godot_basis.cpp @@ -0,0 +1,215 @@ +/*************************************************************************/ +/* godot_basis.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_basis.h" + +#include "math/matrix3.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _basis_api_anchor() { +} + +void GDAPI godot_basis_new(godot_basis *p_v) { + Basis *v = (Basis *)p_v; + *v = Basis(); +} + +void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_v, const godot_quat *p_euler) { + Basis *v = (Basis *)p_v; + Quat *euler = (Quat *)p_euler; + *v = Basis(*euler); +} + +void GDAPI godot_basis_new_with_euler(godot_basis *p_v, const godot_vector3 p_euler) { + Basis *v = (Basis *)p_v; + Vector3 *euler = (Vector3 *)&p_euler; + *v = Basis(*euler); +} + +void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi) { + Basis *v = (Basis *)p_v; + const Vector3 *axis = (Vector3 *)&p_axis; + *v = Basis(*axis, p_phi); +} + +void GDAPI godot_basis_new_with_rows(godot_basis *p_v, const godot_vector3 p_row0, const godot_vector3 p_row1, const godot_vector3 p_row2) { + Basis *v = (Basis *)p_v; + const Vector3 *row0 = (Vector3 *)&p_row0; + const Vector3 *row1 = (Vector3 *)&p_row1; + const Vector3 *row2 = (Vector3 *)&p_row2; + *v = Basis(*row0, *row1, *row2); +} + +godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_v) { + const Basis *v = (const Basis *)p_v; + godot_quat quat; + Quat *p_quat = (Quat *)&quat; + *p_quat = v->operator Quat(); + return quat; +} + +/* + * p_elements is a pointer to an array of 3 (!!) vector3 + */ +void GDAPI godot_basis_get_elements(godot_basis *p_v, godot_vector3 *p_elements) { + Basis *v = (Basis *)p_v; + Vector3 *elements = (Vector3 *)p_elements; + elements[0] = v->elements[0]; + elements[1] = v->elements[1]; + elements[2] = v->elements[2]; +} + +godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_v, const godot_int p_axis) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *v = (Basis *)p_v; + *d = v->get_axis(p_axis); + return dest; +} + +void GDAPI godot_basis_set_axis(godot_basis *p_v, const godot_int p_axis, const godot_vector3 p_value) { + Basis *v = (Basis *)p_v; + const Vector3 *value = (Vector3 *)&p_value; + v->set_axis(p_axis, *value); +} + +godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_v, const godot_int p_row) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *v = (Basis *)p_v; + *d = v->get_row(p_row); + return dest; +} + +void GDAPI godot_basis_set_row(godot_basis *p_v, const godot_int p_row, const godot_vector3 p_value) { + Basis *v = (Basis *)p_v; + const Vector3 *value = (Vector3 *)&p_value; + v->set_row(p_row, *value); +} + +godot_real godot_basis_determinant(const godot_basis *p_v) { + Basis *v = (Basis *)p_v; + return v->determinant(); +} + +godot_vector3 godot_basis_get_euler(const godot_basis *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *v = (Basis *)p_v; + *d = v->get_euler(); + return dest; +} + +godot_int godot_basis_get_orthogonal_index(const godot_basis *p_v) { + const Basis *v = (Basis *)p_v; + return v->get_orthogonal_index(); +} + +godot_vector3 godot_basis_get_scale(const godot_basis *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *v = (Basis *)p_v; + *d = v->get_scale(); + return dest; +} + +void godot_basis_inverse(godot_basis *p_dest, const godot_basis *p_v) { + Basis *d = (Basis *)p_dest; + const Basis *v = (Basis *)p_v; + *d = v->inverse(); +} + +void godot_basis_orthonormalized(godot_basis *p_dest, const godot_basis *p_v) { + Basis *d = (Basis *)p_dest; + const Basis *v = (Basis *)p_v; + *d = v->orthonormalized(); +} + +void godot_basis_rotated(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi) { + Basis *d = (Basis *)p_dest; + const Basis *v = (Basis *)p_v; + const Vector3 *axis = (Vector3 *)&p_axis; + *d = v->rotated(*axis, p_phi); +} + +void godot_basis_scaled(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_scale) { + Basis *d = (Basis *)p_dest; + const Basis *v = (Basis *)p_v; + const Vector3 *scale = (Vector3 *)&p_scale; + *d = v->scaled(*scale); +} + +godot_real godot_basis_tdotx(const godot_basis *p_v, const godot_vector3 p_with) { + const Basis *v = (Basis *)p_v; + const Vector3 *with = (Vector3 *)&p_with; + return v->tdotx(*with); +} + +godot_real godot_basis_tdoty(const godot_basis *p_v, const godot_vector3 p_with) { + const Basis *v = (Basis *)p_v; + const Vector3 *with = (Vector3 *)&p_with; + return v->tdoty(*with); +} + +godot_real godot_basis_tdotz(const godot_basis *p_v, const godot_vector3 p_with) { + const Basis *v = (Basis *)p_v; + const Vector3 *with = (Vector3 *)&p_with; + return v->tdotz(*with); +} + +void godot_basis_transposed(godot_basis *p_dest, const godot_basis *p_v) { + Basis *d = (Basis *)p_dest; + const Basis *v = (Basis *)p_v; + *d = v->transposed(); +} + +godot_vector3 godot_basis_xform(const godot_basis *p_v, const godot_vector3 p_vect) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *v = (Basis *)p_v; + const Vector3 *vect = (Vector3 *)&p_vect; + *d = v->xform(*vect); + return dest; +} + +godot_vector3 godot_basis_xform_inv(const godot_basis *p_v, const godot_vector3 p_vect) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Basis *v = (Basis *)p_v; + const Vector3 *vect = (Vector3 *)&p_vect; + *d = v->xform_inv(*vect); + return dest; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_basis.h b/modules/gdnative/godot/godot_basis.h new file mode 100644 index 0000000000..2803396997 --- /dev/null +++ b/modules/gdnative/godot/godot_basis.h @@ -0,0 +1,84 @@ +/*************************************************************************/ +/* godot_basis.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_BASIS_H +#define GODOT_BASIS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED +typedef struct godot_basis { + uint8_t _dont_touch_that[36]; +} godot_basis; +#endif + +#include "../godot.h" +#include "godot_quat.h" + +void GDAPI godot_basis_new(godot_basis *p_v); +void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_v, const godot_quat *p_euler); +void GDAPI godot_basis_new_with_euler(godot_basis *p_v, const godot_vector3 p_euler); +void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi); +void GDAPI godot_basis_new_with_rows(godot_basis *p_v, const godot_vector3 p_row0, const godot_vector3 p_row1, const godot_vector3 p_row2); + +godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_v); + +/* + * p_elements is a pointer to an array of 3 (!!) vector3 + */ +void GDAPI godot_basis_get_elements(godot_basis *p_v, godot_vector3 *p_elements); +godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_v, const godot_int p_axis); +void GDAPI godot_basis_set_axis(godot_basis *p_v, const godot_int p_axis, const godot_vector3 p_value); +godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_v, const godot_int p_row); +void GDAPI godot_basis_set_row(godot_basis *p_v, const godot_int p_row, const godot_vector3 p_value); + +godot_real godot_basis_determinant(const godot_basis *p_v); +godot_vector3 godot_basis_get_euler(const godot_basis *p_v); +godot_int godot_basis_get_orthogonal_index(const godot_basis *p_v); +godot_vector3 godot_basis_get_scale(const godot_basis *p_v); +void godot_basis_inverse(godot_basis *p_dest, const godot_basis *p_v); +void godot_basis_orthonormalized(godot_basis *p_dest, const godot_basis *p_v); +void godot_basis_rotated(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_axis, const godot_real p_phi); +void godot_basis_scaled(godot_basis *p_dest, const godot_basis *p_v, const godot_vector3 p_scale); +godot_real godot_basis_tdotx(const godot_basis *p_v, const godot_vector3 p_with); +godot_real godot_basis_tdoty(const godot_basis *p_v, const godot_vector3 p_with); +godot_real godot_basis_tdotz(const godot_basis *p_v, const godot_vector3 p_with); +void godot_basis_transposed(godot_basis *p_dest, const godot_basis *p_v); +godot_vector3 godot_basis_xform(const godot_basis *p_v, const godot_vector3 p_vect); +godot_vector3 godot_basis_xform_inv(const godot_basis *p_v, const godot_vector3 p_vect); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_BASIS_H diff --git a/modules/gdnative/godot/godot_color.cpp b/modules/gdnative/godot/godot_color.cpp new file mode 100644 index 0000000000..203ce672fa --- /dev/null +++ b/modules/gdnative/godot/godot_color.cpp @@ -0,0 +1,63 @@ +/*************************************************************************/ +/* godot_color.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_color.h" + +#include "color.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _color_api_anchor() { +} + +void GDAPI godot_color_new(godot_color *p_color) { + Color *color = (Color *)p_color; + *color = Color(); +} + +void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) { + Color *color = (Color *)p_color; + *color = Color(r, g, b, a); +} + +uint32_t GDAPI godot_color_get_32(const godot_color *p_color) { + const Color *color = (const Color *)p_color; + return color->to_32(); +} + +float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) { + Color *color = (Color *)p_color; + return &color->operator[](idx); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_color.h b/modules/gdnative/godot/godot_color.h new file mode 100644 index 0000000000..b99a062a66 --- /dev/null +++ b/modules/gdnative/godot/godot_color.h @@ -0,0 +1,58 @@ +/*************************************************************************/ +/* godot_color.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_COLOR_H +#define GODOT_COLOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED +typedef struct godot_color { + uint8_t _dont_touch_that[16]; +} godot_color; +#endif + +#include "../godot.h" + +void GDAPI godot_color_new(godot_color *p_color); +void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a); + +uint32_t GDAPI godot_color_get_32(const godot_color *p_color); + +float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_COLOR_H diff --git a/modules/dlscript/godot/godot_dictionary.cpp b/modules/gdnative/godot/godot_dictionary.cpp index 9147b17307..16d08e58e2 100644 --- a/modules/dlscript/godot/godot_dictionary.cpp +++ b/modules/gdnative/godot/godot_dictionary.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_dictionary.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_dictionary.h" #include "core/dictionary.h" diff --git a/modules/gdnative/godot/godot_dictionary.h b/modules/gdnative/godot/godot_dictionary.h new file mode 100644 index 0000000000..3f7c504880 --- /dev/null +++ b/modules/gdnative/godot/godot_dictionary.h @@ -0,0 +1,80 @@ +/*************************************************************************/ +/* godot_dictionary.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_DICTIONARY_H +#define GODOT_DICTIONARY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED +typedef struct godot_dictionary { + uint8_t _dont_touch_that[8]; +} godot_dictionary; +#endif + +#include "godot_array.h" +#include "godot_variant.h" + +void GDAPI godot_dictionary_new(godot_dictionary *p_dict); + +void GDAPI godot_dictionary_clear(godot_dictionary *p_dict); + +godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict); + +void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key); + +godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key); + +godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys); + +uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict); + +godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict); + +godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json); + +godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key); + +godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict); + +godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict); + +godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict); + +void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_DICTIONARY_H diff --git a/modules/dlscript/godot/godot_image.cpp b/modules/gdnative/godot/godot_image.cpp index 362d1aa3e6..ae8290afc2 100644 --- a/modules/dlscript/godot/godot_image.cpp +++ b/modules/gdnative/godot/godot_image.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_image.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_image.h" #include "image.h" diff --git a/modules/dlscript/godot/godot_image.h b/modules/gdnative/godot/godot_image.h index 78593f21a7..c43dd45148 100644 --- a/modules/dlscript/godot/godot_image.h +++ b/modules/gdnative/godot/godot_image.h @@ -1,5 +1,34 @@ -#ifndef GODOT_DLSCRIPT_IMAGE_H -#define GODOT_DLSCRIPT_IMAGE_H +/*************************************************************************/ +/* godot_image.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_IMAGE_H +#define GODOT_IMAGE_H #ifdef __cplusplus extern "C" { @@ -92,4 +121,4 @@ void GDAPI godot_image_destroy(godot_image *p_img); } #endif -#endif // GODOT_DLSCRIPT_IMAGE_H +#endif // GODOT_IMAGE_H diff --git a/modules/dlscript/godot/godot_input_event.cpp b/modules/gdnative/godot/godot_input_event.cpp index b50ed8a22d..0401c96a88 100644 --- a/modules/dlscript/godot/godot_input_event.cpp +++ b/modules/gdnative/godot/godot_input_event.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_input_event.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_input_event.h" #include "os/input_event.h" diff --git a/modules/dlscript/godot/godot_input_event.h b/modules/gdnative/godot/godot_input_event.h index bfda18bf7c..b0a133e3d9 100644 --- a/modules/dlscript/godot/godot_input_event.h +++ b/modules/gdnative/godot/godot_input_event.h @@ -1,5 +1,34 @@ -#ifndef GODOT_DLSCRIPT_INPUT_EVENT_H -#define GODOT_DLSCRIPT_INPUT_EVENT_H +/*************************************************************************/ +/* godot_input_event.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_INPUT_EVENT_H +#define GODOT_INPUT_EVENT_H #ifdef __cplusplus extern "C" { @@ -203,4 +232,4 @@ float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_even } #endif -#endif // GODOT_DLSCRIPT_INPUT_EVENT_H +#endif // GODOT_INPUT_EVENT_H diff --git a/modules/dlscript/godot/godot_node_path.cpp b/modules/gdnative/godot/godot_node_path.cpp index 8b79175e44..a2c9e11699 100644 --- a/modules/dlscript/godot/godot_node_path.cpp +++ b/modules/gdnative/godot/godot_node_path.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_node_path.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_node_path.h" #include "path_db.h" diff --git a/modules/gdnative/godot/godot_node_path.h b/modules/gdnative/godot/godot_node_path.h new file mode 100644 index 0000000000..c5f313d190 --- /dev/null +++ b/modules/gdnative/godot/godot_node_path.h @@ -0,0 +1,68 @@ +/*************************************************************************/ +/* godot_node_path.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_NODE_PATH_H +#define GODOT_NODE_PATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED +typedef struct godot_node_path { + uint8_t _dont_touch_that[8]; +} godot_node_path; +#endif + +#include "../godot.h" + +void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from); +void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from); + +godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx); +godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np); + +godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np); +godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx); +godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np); + +godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np); +godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np); + +godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np); + +void GDAPI godot_node_path_destroy(godot_node_path *p_np); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_NODE_PATH_H diff --git a/modules/gdnative/godot/godot_plane.cpp b/modules/gdnative/godot/godot_plane.cpp new file mode 100644 index 0000000000..38329ef709 --- /dev/null +++ b/modules/gdnative/godot/godot_plane.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_plane.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_plane.h" + +#include "math/plane.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _plane_api_anchor() { +} + +void GDAPI godot_plane_new(godot_plane *p_pl) { + Plane *pl = (Plane *)p_pl; + *pl = Plane(); +} + +void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) { + Plane *pl = (Plane *)p_pl; + const Vector3 *normal = (const Vector3 *)p_normal; + *pl = Plane(*normal, p_d); +} + +void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) { + Plane *pl = (Plane *)p_pl; + const Vector3 *normal = (const Vector3 *)p_normal; + pl->set_normal(*normal); +} + +godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) { + const Plane *pl = (const Plane *)p_pl; + const Vector3 normal = pl->get_normal(); + godot_vector3 *v3 = (godot_vector3 *)&normal; + return *v3; +} + +void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) { + Plane *pl = (Plane *)p_pl; + pl->d = p_d; +} + +godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) { + const Plane *pl = (const Plane *)p_pl; + return pl->d; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_plane.h b/modules/gdnative/godot/godot_plane.h new file mode 100644 index 0000000000..c98e45c9cb --- /dev/null +++ b/modules/gdnative/godot/godot_plane.h @@ -0,0 +1,66 @@ +/*************************************************************************/ +/* godot_plane.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_PLANE_H +#define GODOT_PLANE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED +typedef struct godot_plane { + uint8_t _dont_touch_that[16]; +} godot_plane; +#endif + +#include "godot_vector3.h" + +void GDAPI godot_plane_new(godot_plane *p_pl); +void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d); + +// @Incomplete +// These are additional valid constructors +// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d); +// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal); +// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE); + +void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal); +godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl); + +godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl); +void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_PLANE_H diff --git a/modules/dlscript/godot/godot_pool_arrays.cpp b/modules/gdnative/godot/godot_pool_arrays.cpp index 3fb030f835..93e9a9e9dc 100644 --- a/modules/dlscript/godot/godot_pool_arrays.cpp +++ b/modules/gdnative/godot/godot_pool_arrays.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_pool_arrays.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_pool_arrays.h" #include "array.h" diff --git a/modules/dlscript/godot/godot_pool_arrays.h b/modules/gdnative/godot/godot_pool_arrays.h index 77b6c3dde0..ec9185f6f3 100644 --- a/modules/dlscript/godot/godot_pool_arrays.h +++ b/modules/gdnative/godot/godot_pool_arrays.h @@ -1,5 +1,34 @@ -#ifndef GODOT_DLSCRIPT_POOL_ARRAYS_H -#define GODOT_DLSCRIPT_POOL_ARRAYS_H +/*************************************************************************/ +/* godot_pool_arrays.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_POOL_ARRAYS_H +#define GODOT_POOL_ARRAYS_H #ifdef __cplusplus extern "C" { @@ -253,4 +282,4 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca); } #endif -#endif // GODOT_DLSCRIPT_POOL_ARRAYS_H +#endif // GODOT_POOL_ARRAYS_H diff --git a/modules/gdnative/godot/godot_quat.cpp b/modules/gdnative/godot/godot_quat.cpp new file mode 100644 index 0000000000..7c3a71dfc0 --- /dev/null +++ b/modules/gdnative/godot/godot_quat.cpp @@ -0,0 +1,106 @@ +/*************************************************************************/ +/* godot_quat.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_quat.h" + +#include "math/quat.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _quat_api_anchor() { +} + +void GDAPI godot_quat_new(godot_quat *p_quat) { + Quat *quat = (Quat *)p_quat; + *quat = Quat(); +} + +void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) { + Quat *quat = (Quat *)p_quat; + *quat = Quat(x, y, z, w); +} + +void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) { + Quat *quat = (Quat *)p_quat; + const Vector3 *axis = (const Vector3 *)p_axis; + *quat = Quat(*axis, p_angle); +} + +void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) { + Quat *quat = (Quat *)p_quat; + const Vector3 *v0 = (const Vector3 *)p_v0; + const Vector3 *v1 = (const Vector3 *)p_v1; + *quat = Quat(*v0, *v1); +} + +godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) { + Quat *quat = (Quat *)p_quat; + Vector3 euler = quat->get_euler(); + return *(godot_vector3 *)&euler; +} + +void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) { + Quat *quat = (Quat *)p_quat; + const Vector3 *euler = (const Vector3 *)p_euler; + quat->set_euler(*euler); +} + +godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) { + Quat *quat = (Quat *)p_quat; + switch (p_idx) { + case 0: + return &quat->x; + case 1: + return &quat->y; + case 2: + return &quat->z; + default: + return &quat->y; + } +} + +godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) { + const Quat *quat = (const Quat *)p_quat; + switch (p_idx) { + case 0: + return quat->x; + case 1: + return quat->y; + case 2: + return quat->z; + default: + return quat->y; + } +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_quat.h b/modules/gdnative/godot/godot_quat.h new file mode 100644 index 0000000000..35b1acd3ed --- /dev/null +++ b/modules/gdnative/godot/godot_quat.h @@ -0,0 +1,62 @@ +/*************************************************************************/ +/* godot_quat.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_QUAT_H +#define GODOT_QUAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED +typedef struct godot_quat { + uint8_t _dont_touch_that[16]; +} godot_quat; +#endif + +#include "../godot.h" + +void GDAPI godot_quat_new(godot_quat *p_quat); +void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w); +void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle); +void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1); + +godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat); +void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler); + +godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx); +godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_QUAT_H diff --git a/modules/gdnative/godot/godot_rect2.cpp b/modules/gdnative/godot/godot_rect2.cpp new file mode 100644 index 0000000000..b19096b79e --- /dev/null +++ b/modules/gdnative/godot/godot_rect2.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_rect2.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_rect2.h" + +#include "math/math_2d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _rect2_api_anchor() { +} + +void GDAPI godot_rect2_new(godot_rect2 *p_rect) { + Rect2 *rect = (Rect2 *)p_rect; + *rect = Rect2(); +} + +void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) { + Rect2 *rect = (Rect2 *)p_rect; + const Vector2 *pos = (const Vector2 *)p_pos; + const Vector2 *size = (const Vector2 *)p_size; + *rect = Rect2(*pos, *size); +} + +godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) { + Rect2 *rect = (Rect2 *)p_rect; + return (godot_vector2 *)&rect->pos; +} + +void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) { + Rect2 *rect = (Rect2 *)p_rect; + const Vector2 *pos = (const Vector2 *)p_pos; + rect->pos = *pos; +} + +godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) { + Rect2 *rect = (Rect2 *)p_rect; + return (godot_vector2 *)&rect->size; +} + +void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) { + Rect2 *rect = (Rect2 *)p_rect; + const Vector2 *size = (const Vector2 *)p_size; + rect->size = *size; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_rect2.h b/modules/gdnative/godot/godot_rect2.h new file mode 100644 index 0000000000..e9e4a26897 --- /dev/null +++ b/modules/gdnative/godot/godot_rect2.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* godot_rect2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RECT2_H +#define GODOT_RECT2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED +typedef struct godot_rect2 { + uint8_t _dont_touch_that[16]; +} godot_rect2; +#endif + +#include "../godot.h" + +void GDAPI godot_rect2_new(godot_rect2 *p_rect); +void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size); + +godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect); +void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos); + +godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect); +void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_RECT3_H diff --git a/modules/gdnative/godot/godot_rect3.cpp b/modules/gdnative/godot/godot_rect3.cpp new file mode 100644 index 0000000000..96c5d17b1a --- /dev/null +++ b/modules/gdnative/godot/godot_rect3.cpp @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_rect3.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_rect3.h" + +#include "math/rect3.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _rect3_api_anchor() { +} + +void GDAPI godot_rect3_new(godot_rect3 *p_rect) { + Rect3 *rect = (Rect3 *)p_rect; + *rect = Rect3(); +} + +void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) { + Rect3 *rect = (Rect3 *)p_rect; + const Vector3 *pos = (const Vector3 *)p_pos; + const Vector3 *size = (const Vector3 *)p_size; + *rect = Rect3(*pos, *size); +} + +godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) { + Rect3 *rect = (Rect3 *)p_rect; + return (godot_vector3 *)&rect->pos; +} + +void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) { + Rect3 *rect = (Rect3 *)p_rect; + const Vector3 *pos = (const Vector3 *)p_pos; + rect->pos = *pos; +} + +godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) { + Rect3 *rect = (Rect3 *)p_rect; + return (godot_vector3 *)&rect->size; +} + +void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) { + Rect3 *rect = (Rect3 *)p_rect; + const Vector3 *size = (const Vector3 *)p_size; + rect->size = *size; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_rect3.h b/modules/gdnative/godot/godot_rect3.h new file mode 100644 index 0000000000..562ac8379e --- /dev/null +++ b/modules/gdnative/godot/godot_rect3.h @@ -0,0 +1,60 @@ +/*************************************************************************/ +/* godot_rect3.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RECT3_H +#define GODOT_RECT3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED +typedef struct godot_rect3 { + uint8_t _dont_touch_that[24]; +} godot_rect3; +#endif + +#include "../godot.h" + +void GDAPI godot_rect3_new(godot_rect3 *p_rect); +void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size); + +godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect); +void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos); + +godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect); +void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_RECT3_H diff --git a/modules/gdnative/godot/godot_rid.cpp b/modules/gdnative/godot/godot_rid.cpp new file mode 100644 index 0000000000..fff31e3992 --- /dev/null +++ b/modules/gdnative/godot/godot_rid.cpp @@ -0,0 +1,65 @@ +/*************************************************************************/ +/* godot_rid.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_rid.h" + +#include "object.h" +#include "resource.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _rid_api_anchor() { +} + +void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) { + + Resource *res_from = ((Object *)p_from)->cast_to<Resource>(); + + RID *rid = (RID *)p_rid; + memnew_placement(rid, RID); + + if (res_from) { + *rid = RID(res_from->get_rid()); + } +} + +uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) { + RID *rid = (RID *)p_rid; + return rid->get_id(); +} + +void GDAPI godot_rid_destroy(godot_rid *p_rid) { + ((RID *)p_rid)->~RID(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_rid.h b/modules/gdnative/godot/godot_rid.h new file mode 100644 index 0000000000..e00c8f89ad --- /dev/null +++ b/modules/gdnative/godot/godot_rid.h @@ -0,0 +1,57 @@ +/*************************************************************************/ +/* godot_rid.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RID_H +#define GODOT_RID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED +typedef struct godot_rid { + uint8_t _dont_touch_that[8]; +} godot_rid; +#endif + +#include "../godot.h" + +void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from); + +uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid); + +void GDAPI godot_rid_destroy(godot_rid *p_rid); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_RID_H diff --git a/modules/gdnative/godot/godot_string.cpp b/modules/gdnative/godot/godot_string.cpp new file mode 100644 index 0000000000..92c0b04041 --- /dev/null +++ b/modules/gdnative/godot/godot_string.cpp @@ -0,0 +1,117 @@ +/*************************************************************************/ +/* godot_string.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_string.h" + +#include "string_db.h" +#include "ustring.h" + +#include <string.h> + +#ifdef __cplusplus +extern "C" { +#endif + +void _string_api_anchor() { +} + +void GDAPI godot_string_new(godot_string *p_str) { + String *p = (String *)p_str; + memnew_placement(p, String); + // *p = String(); // useless here +} + +void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) { + String *p = (String *)p_str; + memnew_placement(p, String); + *p = String::utf8(p_contents, p_size); +} + +void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size) { + String *p = (String *)p_str; + if (p_size != NULL) { + *p_size = p->utf8().length(); + } + if (p_dest != NULL) { + memcpy(p_dest, p->utf8().get_data(), *p_size); + } +} + +void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) { + String *dest = (String *)p_dest; + String *src = (String *)p_src; + + *dest = *src; +} + +wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) { + String *s = (String *)p_str; + return &(s->operator[](p_idx)); +} + +const char GDAPI *godot_string_c_str(const godot_string *p_str) { + const String *s = (const String *)p_str; + return s->utf8().get_data(); +} + +const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_str) { + const String *s = (const String *)p_str; + return s->c_str(); +} + +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) { + String *a = (String *)p_a; + String *b = (String *)p_b; + return *a == *b; +} + +godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) { + String *a = (String *)p_a; + String *b = (String *)p_b; + return *a < *b; +} + +void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) { + String *dest = (String *)p_dest; + const String *a = (String *)p_a; + const String *b = (String *)p_b; + + String tmp = *a + *b; + godot_string_new(p_dest); + *dest = tmp; +} + +void GDAPI godot_string_destroy(godot_string *p_str) { + String *p = (String *)p_str; + p->~String(); +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_string.h b/modules/gdnative/godot/godot_string.h new file mode 100644 index 0000000000..83ed5d6ec1 --- /dev/null +++ b/modules/gdnative/godot/godot_string.h @@ -0,0 +1,73 @@ +/*************************************************************************/ +/* godot_string.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_STRING_H +#define GODOT_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> +#include <wchar.h> + +#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED +typedef struct godot_string { + uint8_t _dont_touch_that[8]; +} godot_string; +#endif + +#include "../godot.h" + +void GDAPI godot_string_new(godot_string *p_str); +void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size); + +void GDAPI godot_string_get_data(const godot_string *p_str, char *p_dest, int *p_size); + +void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src); + +wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx); +const char GDAPI *godot_string_c_str(const godot_string *p_str); +const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_str); + +godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b); +godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b); +void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b); + +// @Incomplete +// hmm, I guess exposing the whole API doesn't make much sense +// since the language used in the library has its own string funcs + +void GDAPI godot_string_destroy(godot_string *p_str); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_STRING_H diff --git a/modules/gdnative/godot/godot_transform.cpp b/modules/gdnative/godot/godot_transform.cpp new file mode 100644 index 0000000000..681c2b049a --- /dev/null +++ b/modules/gdnative/godot/godot_transform.cpp @@ -0,0 +1,71 @@ +/*************************************************************************/ +/* godot_transform.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_transform.h" + +#include "math/transform.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _transform_api_anchor() { +} + +void GDAPI godot_transform_new(godot_transform *p_trans) { + Transform *trans = (Transform *)p_trans; + *trans = Transform(); +} + +void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) { + Transform *trans = (Transform *)p_trans; + const Basis *basis = (const Basis *)p_basis; + *trans = Transform(*basis); +} + +void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) { + Transform *trans = (Transform *)p_trans; + const Basis *basis = (const Basis *)p_basis; + const Vector3 *origin = (const Vector3 *)p_origin; + *trans = Transform(*basis, *origin); +} + +godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) { + Transform *trans = (Transform *)p_trans; + return (godot_basis *)&trans->basis; +} + +godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) { + Transform *trans = (Transform *)p_trans; + return (godot_vector3 *)&trans->origin; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_transform.h b/modules/gdnative/godot/godot_transform.h new file mode 100644 index 0000000000..93817ffbf2 --- /dev/null +++ b/modules/gdnative/godot/godot_transform.h @@ -0,0 +1,58 @@ +/*************************************************************************/ +/* godot_transform.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_TRANSFORM_H +#define GODOT_TRANSFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED +typedef struct godot_transform { + uint8_t _dont_touch_that[48]; +} godot_transform; +#endif + +#include "../godot.h" + +void GDAPI godot_transform_new(godot_transform *p_trans); +void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis); +void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin); + +godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans); +godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_TRANSFORM_H diff --git a/modules/gdnative/godot/godot_transform2d.cpp b/modules/gdnative/godot/godot_transform2d.cpp new file mode 100644 index 0000000000..ffc7167559 --- /dev/null +++ b/modules/gdnative/godot/godot_transform2d.cpp @@ -0,0 +1,88 @@ +/*************************************************************************/ +/* godot_transform2d.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_transform2d.h" + +#include "../godot.h" + +#include "math/math_2d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _transform2d_api_anchor() { +} + +void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) { + Transform2D *t = (Transform2D *)p_t; + *t = Transform2D(); +} + +void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) { + Transform2D *t = (Transform2D *)p_t; + Vector2 *a = (Vector2 *)p_a; + Vector2 *b = (Vector2 *)p_b; + Vector2 *c = (Vector2 *)p_c; + *t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y); +} + +void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) { + Transform2D *t = (Transform2D *)p_t; + Vector2 *pos = (Vector2 *)p_pos; + *t = Transform2D(p_rot, *pos); +} + +godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) { + const Transform2D *t = (const Transform2D *)p_t; + const Vector2 *e = &t->operator[](p_idx); + return (godot_vector2 const *)e; +} + +godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) { + Transform2D *t = (Transform2D *)p_t; + Vector2 *e = &t->operator[](p_idx); + return (godot_vector2 *)e; +} + +godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) { + return *godot_transform2d_const_index(p_t, p_axis); +} + +void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) { + godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis); + *origin_v = *p_vec; +} + +// @Incomplete +// See header file + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_transform2d.h b/modules/gdnative/godot/godot_transform2d.h new file mode 100644 index 0000000000..ae0569dbe8 --- /dev/null +++ b/modules/gdnative/godot/godot_transform2d.h @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* godot_transform2d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_TRANSFORM2D_H +#define GODOT_TRANSFORM2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED +typedef struct godot_transform2d { + uint8_t _dont_touch_that[24]; +} godot_transform2d; +#endif + +#include "../godot.h" + +#include "godot_vector2.h" + +void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t); +void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c); +void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos); + +/* +godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v); +godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v); +*/ + +godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx); +godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx); + +godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis); +void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec); + +/* +void GDAPI godot_transform2d_invert(godot_transform2d *p_t); +godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t); +*/ + +// @Incomplete +// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings. + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_TRANSFORM2D_H diff --git a/modules/dlscript/godot/godot_variant.cpp b/modules/gdnative/godot/godot_variant.cpp index 3681f89753..2214f85056 100644 --- a/modules/dlscript/godot/godot_variant.cpp +++ b/modules/gdnative/godot/godot_variant.cpp @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_variant.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #include "godot_variant.h" #include "../godot.h" diff --git a/modules/dlscript/godot/godot_variant.h b/modules/gdnative/godot/godot_variant.h index 1ff5ba4a57..6f98b32363 100644 --- a/modules/dlscript/godot/godot_variant.h +++ b/modules/gdnative/godot/godot_variant.h @@ -1,3 +1,32 @@ +/*************************************************************************/ +/* godot_variant.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ #ifndef GODOT_VARIANT_H #define GODOT_VARIANT_H diff --git a/modules/gdnative/godot/godot_vector2.cpp b/modules/gdnative/godot/godot_vector2.cpp new file mode 100644 index 0000000000..87e60b6245 --- /dev/null +++ b/modules/gdnative/godot/godot_vector2.cpp @@ -0,0 +1,296 @@ +/*************************************************************************/ +/* godot_vector2.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_vector2.h" + +#include "math/math_2d.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _vector2_api_anchor() {} + +godot_vector2 GDAPI godot_vector2_new(const godot_real p_x, const godot_real p_y) { + godot_vector2 value; + Vector2 *v = (Vector2 *)&value; + v->x = p_x; + v->y = p_y; + return value; +} + +void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x) { + Vector2 *v = (Vector2 *)p_v; + v->x = p_x; +} + +void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y) { + Vector2 *v = (Vector2 *)p_v; + v->y = p_y; +} + +godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v) { + const Vector2 *v = (Vector2 *)p_v; + return v->x; +} +godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v) { + const Vector2 *v = (Vector2 *)p_v; + return v->y; +} + +void GDAPI godot_vector2_normalize(godot_vector2 *p_v) { + Vector2 *v = (Vector2 *)p_v; + v->normalize(); +} + +godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_v) { + godot_vector2 dest; + const Vector2 *v = (Vector2 *)p_v; + Vector2 *d = (Vector2 *)&dest; + *d = v->normalized(); + return dest; +} + +godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v) { + const Vector2 *v = (Vector2 *)p_v; + return v->length(); +} + +godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v) { + const Vector2 *v = (Vector2 *)p_v; + return v->length_squared(); +} + +godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_v, const godot_vector2 p_b) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + return v->distance_to(*b); +} + +godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_v, const godot_vector2 p_b) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + return v->distance_squared_to(*b); +} + +godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_v, const godot_vector2 p_b) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + *d = *v + *b; + return dest; +} + +godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_v, const godot_vector2 p_b) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + *d = *v - *b; + return dest; +} + +godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_v, const godot_vector2 p_b) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + *d = *v * *b; + return dest; +} + +godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_v, const godot_real p_b) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = *v * p_b; + return dest; +} + +godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_v, const godot_vector2 p_b) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + *d = *v / *b; + return dest; +} + +godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_v, const godot_real p_b) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = *v / p_b; + return dest; +} + +godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_v, const godot_vector2 p_b) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + return *v == *b; +} + +godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_v, const godot_vector2 p_b) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + return *v < *b; +} + +godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_v) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = v->abs(); + return dest; +} + +godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_v) { + const Vector2 *v = (Vector2 *)p_v; + return v->angle(); +} + +godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_v, const godot_vector2 p_to) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *to = (Vector2 *)&p_to; + return v->angle_to(*to); +} + +godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_v, const godot_vector2 p_to) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *to = (Vector2 *)&p_to; + return v->angle_to_point(*to); +} + +godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_v, const godot_real length) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = v->clamped(length); + return dest; +} + +godot_vector2 GDAPI godot_vector2_cubic_interpolate( + const godot_vector2 *p_v, const godot_vector2 p_b, const godot_vector2 p_pre_a, + const godot_vector2 p_post_b, godot_real t) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + const Vector2 *pre_a = (Vector2 *)&p_pre_a; + const Vector2 *post_b = (Vector2 *)&p_post_b; + *d = v->cubic_interpolate(*b, *pre_a, *post_b, t); + return dest; +} + +godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_v, const godot_vector2 p_with) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *with = (Vector2 *)&p_with; + return v->dot(*with); +} + +godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_v) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = v->floor(); + return dest; +} + +godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_v) { + const Vector2 *v = (Vector2 *)p_v; + return v->aspect(); +} + +godot_vector2 GDAPI godot_vector2_linear_interpolate( + const godot_vector2 *p_v, + const godot_vector2 p_b, + godot_real t) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *b = (Vector2 *)&p_b; + *d = v->linear_interpolate(*b, t); + return dest; +} + +godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_v, const godot_vector2 p_vec) { + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *vec = (Vector2 *)&p_vec; + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + *d = v->reflect(*vec); + return dest; +} + +godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_v, godot_real phi) { + const Vector2 *v = (Vector2 *)p_v; + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + *d = v->rotated(phi); + return dest; +} + +godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_v, godot_vector2 p_vec) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *vec = (Vector2 *)&p_vec; + *d = v->slide(*vec); + return dest; +} + +godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_v, godot_vector2 p_by) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + const Vector2 *by = (Vector2 *)&p_by; + *d = v->snapped(*by); + return dest; +} + +godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_v) { + godot_vector2 dest; + Vector2 *d = (Vector2 *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = v->tangent(); + return dest; +} + +godot_string GDAPI godot_vector2_to_string(const godot_vector2 *p_v) { + godot_string dest; + String *d = (String *)&dest; + const Vector2 *v = (Vector2 *)p_v; + *d = "(" + *v + ")"; + return dest; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_vector2.h b/modules/gdnative/godot/godot_vector2.h new file mode 100644 index 0000000000..36a4f01d03 --- /dev/null +++ b/modules/gdnative/godot/godot_vector2.h @@ -0,0 +1,98 @@ +/*************************************************************************/ +/* godot_vector2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_VECTOR2_H +#define GODOT_VECTOR2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED +typedef struct godot_vector2 { + uint8_t _dont_touch_that[8]; +} godot_vector2; +#endif + +#include "../godot.h" + +godot_vector2 GDAPI godot_vector2_new(const godot_real p_x, const godot_real p_y); + +void GDAPI godot_vector2_set_x(godot_vector2 *p_v, const godot_real p_x); +void GDAPI godot_vector2_set_y(godot_vector2 *p_v, const godot_real p_y); +godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_v); +godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_v); + +void GDAPI godot_vector2_normalize(godot_vector2 *p_v); +godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_v); + +godot_real GDAPI godot_vector2_length(const godot_vector2 *p_v); +godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v); + +godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_v, const godot_vector2 p_b); +godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_v, const godot_vector2 p_b); + +godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_v); +godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_v); +godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_v, const godot_vector2 p_to); +godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_v, const godot_vector2 p_to); +godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_v, godot_real length); +godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_v, + const godot_vector2 p_b, const godot_vector2 p_pre_a, + const godot_vector2 p_post_b, godot_real t); +godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_v, const godot_vector2 p_with); +godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_v); +godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_v); +godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_v, + const godot_vector2 p_b, godot_real t); +godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_v, const godot_vector2 p_vec); +godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_v, godot_real phi); +godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_v, godot_vector2 p_vec); +godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_v, godot_vector2 p_by); +godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_v); +godot_string GDAPI godot_vector2_to_string(const godot_vector2 *p_v); + +godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_v, const godot_vector2 p_b); +godot_vector2 GDAPI godot_vector2_operator_subtract(const godot_vector2 *p_v, const godot_vector2 p_b); +godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_v, const godot_vector2 p_b); +godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_v, const godot_real p_b); +godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_v, const godot_vector2 p_b); +godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_v, const godot_real p_b); + +godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_v, const godot_vector2 p_b); +godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_v, const godot_vector2 p_b); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_VECTOR2_H diff --git a/modules/gdnative/godot/godot_vector3.cpp b/modules/gdnative/godot/godot_vector3.cpp new file mode 100644 index 0000000000..5f71b9f7e4 --- /dev/null +++ b/modules/gdnative/godot/godot_vector3.cpp @@ -0,0 +1,342 @@ +/*************************************************************************/ +/* godot_vector3.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#include "godot_vector3.h" + +#include "math/vector3.h" + +#ifdef __cplusplus +extern "C" { +#endif + +void _vector3_api_anchor() { +} + +godot_vector3 GDAPI godot_vector3_new(const godot_real p_x, const godot_real p_y, const godot_real p_z) { + godot_vector3 value; + Vector3 *v = (Vector3 *)&value; + *v = Vector3(p_x, p_y, p_z); + return value; +} + +void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val) { + Vector3 *v = (Vector3 *)p_v; + v->set_axis(p_axis, p_val); +} + +godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis) { + Vector3 *v = (Vector3 *)p_v; + return v->get_axis(p_axis); +} + +godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v) { + Vector3 *v = (Vector3 *)p_v; + return v->min_axis(); +} + +godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v) { + Vector3 *v = (Vector3 *)p_v; + return v->max_axis(); +} + +godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v) { + Vector3 *v = (Vector3 *)p_v; + return v->length(); +} + +godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v) { + Vector3 *v = (Vector3 *)p_v; + return v->length_squared(); +} + +void GDAPI godot_vector3_normalize(godot_vector3 *p_v) { + Vector3 *v = (Vector3 *)p_v; + v->normalize(); +} + +godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + *d = v->normalized(); + return dest; +} + +godot_vector3 godot_vector3_inverse(const godot_vector3 *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = v->inverse(); + return dest; +} + +void godot_vector3_zero(godot_vector3 *p_v) { + Vector3 *v = (Vector3 *)p_v; + v->zero(); +} + +void godot_vector3_snap(godot_vector3 *p_v, const godot_real val) { + Vector3 *v = (Vector3 *)p_v; + v->snap(val); +} + +godot_vector3 godot_vector3_snapped(const godot_vector3 *p_v, const godot_real val) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = v->snapped(val); + return dest; +} + +void godot_vector3_rotate(godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi) { + Vector3 *v = (Vector3 *)p_v; + const Vector3 *axis = (Vector3 *)&p_axis; + v->rotate(*axis, phi); +} + +godot_vector3 godot_vector3_rotated(const godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *axis = (Vector3 *)&p_axis; + *d = v->rotated(*axis, phi); + return dest; +} + +godot_vector3 godot_vector3_linear_interpolate(const godot_vector3 *p_v, const godot_vector3 p_b, const godot_real t) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *b = (Vector3 *)&p_b; + *d = v->linear_interpolate(*b, t); + return dest; +} + +godot_vector3 godot_vector3_cubic_interpolate(const godot_vector3 *p_v, + const godot_vector3 p_b, const godot_vector3 p_pre_a, + const godot_vector3 p_post_b, const godot_real t) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *b = (Vector3 *)&p_b; + const Vector3 *pre_a = (Vector3 *)&p_pre_a; + const Vector3 *post_b = (Vector3 *)&p_post_b; + *d = v->cubic_interpolate(*b, *pre_a, *post_b, t); + return dest; +} + +godot_vector3 godot_vector3_cubic_interpolaten(const godot_vector3 *p_v, + const godot_vector3 p_b, const godot_vector3 p_pre_a, + const godot_vector3 p_post_b, const godot_real t) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *b = (Vector3 *)&p_b; + const Vector3 *pre_a = (Vector3 *)&p_pre_a; + const Vector3 *post_b = (Vector3 *)&p_post_b; + *d = v->cubic_interpolaten(*b, *pre_a, *post_b, t); + return dest; +} + +godot_vector3 godot_vector3_cross(const godot_vector3 *p_v, const godot_vector3 p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *b = (Vector3 *)&p_b; + *d = v->cross(*b); + return dest; +} + +godot_real godot_vector3_dot(const godot_vector3 *p_v, const godot_vector3 p_b) { + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *b = (Vector3 *)&p_b; + return v->dot(*b); +} + +godot_basis godot_vector3_outer(const godot_vector3 *p_v, const godot_vector3 p_b) { + godot_basis dest; + Basis *d = (Basis *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *b = (Vector3 *)&p_b; + *d = v->outer(*b); + return dest; +} + +godot_basis godot_vector3_to_diagonal_matrix(const godot_vector3 *p_v) { + godot_basis dest; + Basis *d = (Basis *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = v->to_diagonal_matrix(); + return dest; +} + +godot_vector3 godot_vector3_abs(const godot_vector3 *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = v->abs(); + return dest; +} + +godot_vector3 godot_vector3_floor(const godot_vector3 *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = v->floor(); + return dest; +} + +godot_vector3 godot_vector3_ceil(const godot_vector3 *p_v) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = v->ceil(); + return dest; +} + +godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_v, const godot_vector3 p_b) { + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + return v->distance_to(*b); +} + +godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_v, const godot_vector3 p_b) { + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + return v->distance_squared_to(*b); +} + +godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_v, const godot_vector3 p_b) { + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + return v->angle_to(*b); +} + +godot_vector3 godot_vector3_slide(const godot_vector3 *p_v, const godot_vector3 p_vec) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *vec = (Vector3 *)&p_vec; + *d = v->slide(*vec); + return dest; +} + +godot_vector3 godot_vector3_bounce(const godot_vector3 *p_v, const godot_vector3 p_vec) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *vec = (Vector3 *)&p_vec; + *d = v->bounce(*vec); + return dest; +} + +godot_vector3 godot_vector3_reflect(const godot_vector3 *p_v, const godot_vector3 p_vec) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + const Vector3 *v = (Vector3 *)p_v; + const Vector3 *vec = (Vector3 *)&p_vec; + *d = v->reflect(*vec); + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_v, const godot_vector3 p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + *d = *v + *b; + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_v, const godot_vector3 p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + *d = *v - *b; + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_v, const godot_vector3 p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + *d = *v * *b; + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_v, const godot_real p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + *d = *v * p_b; + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_v, const godot_vector3 p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + *d = *v / *b; + return dest; +} + +godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_v, const godot_real p_b) { + godot_vector3 dest; + Vector3 *d = (Vector3 *)&dest; + Vector3 *v = (Vector3 *)p_v; + *d = *v / p_b; + return dest; +} + +godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_v, const godot_vector3 p_b) { + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + return *v == *b; +} + +godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_v, const godot_vector3 p_b) { + Vector3 *v = (Vector3 *)p_v; + Vector3 *b = (Vector3 *)&p_b; + return *v < *b; +} + +godot_string GDAPI godot_vector3_to_string(const godot_vector3 *p_v) { + godot_string dest; + String *d = (String *)&dest; + const Vector3 *v = (Vector3 *)p_v; + *d = "(" + *v + ")"; + return dest; +} + +#ifdef __cplusplus +} +#endif diff --git a/modules/gdnative/godot/godot_vector3.h b/modules/gdnative/godot/godot_vector3.h new file mode 100644 index 0000000000..654ddd7792 --- /dev/null +++ b/modules/gdnative/godot/godot_vector3.h @@ -0,0 +1,113 @@ +/*************************************************************************/ +/* godot_vector3.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* http://www.godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_VECTOR3_H +#define GODOT_VECTOR3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED +typedef struct godot_vector3 { + uint8_t _dont_touch_that[12]; +} godot_vector3; +#endif + +#define GODOT_VECTOR3_AXIX_X 0 +#define GODOT_VECTOR3_AXIX_Y 1 +#define GODOT_VECTOR3_AXIX_Z 2 + +#include "../godot.h" +#include "godot_basis.h" + +godot_vector3 GDAPI godot_vector3_new(const godot_real p_x, const godot_real p_y, const godot_real p_z); + +void GDAPI godot_vector3_set_axis(godot_vector3 *p_v, const godot_int p_axis, const godot_real p_val); +godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_v, const godot_int p_axis); + +godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_v); +godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_v); + +godot_real GDAPI godot_vector3_length(const godot_vector3 *p_v); +godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_v); + +void GDAPI godot_vector3_normalize(godot_vector3 *p_v); +godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_v); + +godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_v); +void GDAPI godot_vector3_zero(godot_vector3 *p_v); +void GDAPI godot_vector3_snap(godot_vector3 *p_v, const godot_real val); +godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_v, const godot_real val); +void GDAPI godot_vector3_rotate(godot_vector3 *p_v, const godot_vector3 p_axis, const godot_real phi); +godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_v, + const godot_vector3 p_axis, const godot_real phi); +godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_v, + const godot_vector3 p_b, const godot_real t); +godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_v, + const godot_vector3 p_b, const godot_vector3 p_pre_a, + const godot_vector3 p_post_b, const godot_real t); +godot_vector3 GDAPI godot_vector3_cubic_interpolaten(const godot_vector3 *p_v, + const godot_vector3 p_b, const godot_vector3 p_pre_a, + const godot_vector3 p_post_b, const godot_real t); +godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_v); +godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_v); +godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_v); +godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_v); + +godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_v, const godot_vector3 p_b); + +godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_v, const godot_vector3 p_vec); +godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_v, const godot_vector3 p_vec); +godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_v, const godot_vector3 p_vec); + +godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_vector3 GDAPI godot_vector3_operator_subtract(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_v, const godot_real p_b); +godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_v, const godot_real p_b); + +godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_v, const godot_vector3 p_b); +godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_v, const godot_vector3 p_b); + +godot_string GDAPI godot_vector3_to_string(const godot_vector3 *p_v); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_VECTOR3_H diff --git a/modules/dlscript/register_types.cpp b/modules/gdnative/register_types.cpp index 2ec6b89cbf..8789c9a267 100644 --- a/modules/dlscript/register_types.cpp +++ b/modules/gdnative/register_types.cpp @@ -28,43 +28,39 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "register_types.h" -#include "dl_script.h" +#include "gdnative.h" #include "io/resource_loader.h" #include "io/resource_saver.h" -DLScriptLanguage *script_language_dl = NULL; -ResourceFormatLoaderDLScript *resource_loader_dl = NULL; -ResourceFormatSaverDLScript *resource_saver_dl = NULL; +GDNativeScriptLanguage *script_language_gdn = NULL; +ResourceFormatLoaderGDNativeScript *resource_loader_gdn = NULL; +ResourceFormatSaverGDNativeScript *resource_saver_gdn = NULL; //ResourceFormatLoaderDLLibrary *resource_loader_dllib=NULL; -void register_dlscript_types() { +void register_gdnative_types() { - ClassDB::register_class<DLLibrary>(); - ClassDB::register_class<DLScript>(); + ClassDB::register_class<GDNativeLibrary>(); + ClassDB::register_class<GDNativeScript>(); - script_language_dl = memnew(DLScriptLanguage); - //script_language_gd->init(); - ScriptServer::register_language(script_language_dl); - resource_loader_dl = memnew(ResourceFormatLoaderDLScript); - ResourceLoader::add_resource_format_loader(resource_loader_dl); - resource_saver_dl = memnew(ResourceFormatSaverDLScript); - ResourceSaver::add_resource_format_saver(resource_saver_dl); - - // resource_loader_dllib=memnew( ResourceFormatLoaderDLLibrary ); - // ResourceLoader::add_resource_format_loader(resource_loader_gd); + script_language_gdn = memnew(GDNativeScriptLanguage); + ScriptServer::register_language(script_language_gdn); + resource_loader_gdn = memnew(ResourceFormatLoaderGDNativeScript); + ResourceLoader::add_resource_format_loader(resource_loader_gdn); + resource_saver_gdn = memnew(ResourceFormatSaverGDNativeScript); + ResourceSaver::add_resource_format_saver(resource_saver_gdn); } -void unregister_dlscript_types() { +void unregister_gdnative_types() { - ScriptServer::unregister_language(script_language_dl); + ScriptServer::unregister_language(script_language_gdn); - if (script_language_dl) - memdelete(script_language_dl); + if (script_language_gdn) + memdelete(script_language_gdn); - if (resource_loader_dl) - memdelete(resource_loader_dl); + if (resource_loader_gdn) + memdelete(resource_loader_gdn); - if (resource_saver_dl) - memdelete(resource_saver_dl); + if (resource_saver_gdn) + memdelete(resource_saver_gdn); } diff --git a/modules/dlscript/register_types.h b/modules/gdnative/register_types.h index 1968986718..48e778cb2c 100644 --- a/modules/dlscript/register_types.h +++ b/modules/gdnative/register_types.h @@ -27,5 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -void register_dlscript_types(); -void unregister_dlscript_types(); +void register_gdnative_types(); +void unregister_gdnative_types(); diff --git a/modules/gdscript/gd_editor.cpp b/modules/gdscript/gd_editor.cpp index ae5bb5694c..c2f14f5466 100644 --- a/modules/gdscript/gd_editor.cpp +++ b/modules/gdscript/gd_editor.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "editor/editor_settings.h" #include "gd_compiler.h" #include "gd_script.h" #include "global_config.h" @@ -2391,8 +2392,27 @@ Error GDScriptLanguage::complete_code(const String &p_code, const String &p_base #endif +String GDScriptLanguage::_get_indentation() const { +#ifdef TOOLS_ENABLED + bool use_space_indentation = EDITOR_DEF("text_editor/indent/type", "Tabs") == "Tabs" ? 0 : 1; + + if (use_space_indentation) { + int indent_size = EDITOR_DEF("text_editor/indent/size", 4); + + String space_indent = ""; + for (int i = 0; i < indent_size; i++) { + space_indent += " "; + } + return space_indent; + } +#endif + return "\t"; +} + void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_to_line) const { + String indent = _get_indentation(); + Vector<String> lines = p_code.split("\n"); List<int> indent_stack; @@ -2432,8 +2452,9 @@ void GDScriptLanguage::auto_indent_code(String &p_code, int p_from_line, int p_t if (i >= p_from_line) { l = ""; - for (int j = 0; j < indent_stack.size(); j++) - l += "\t"; + for (int j = 0; j < indent_stack.size(); j++) { + l += indent; + } l += st; } else if (i > p_to_line) { diff --git a/modules/gdscript/gd_parser.cpp b/modules/gdscript/gd_parser.cpp index 9033b51d28..cd16fef6b3 100644 --- a/modules/gdscript/gd_parser.cpp +++ b/modules/gdscript/gd_parser.cpp @@ -2265,6 +2265,7 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { if (!is_first_line && tab_level.back()->prev() && tab_level.back()->prev()->get() == indent_level) { // pythonic single-line expression, don't parse future lines tab_level.pop_back(); + p_block->end_line = tokenizer->get_token_line(); return; } is_first_line = false; @@ -2436,9 +2437,8 @@ void GDParser::_parse_block(BlockNode *p_block, bool p_static) { while (true) { - while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE) { - tokenizer->advance(); - } + while (tokenizer->get_token() == GDTokenizer::TK_NEWLINE && _parse_newline()) + ; if (tab_level.back()->get() < indent_level) { //not at current indent level p_block->end_line = tokenizer->get_token_line(); diff --git a/modules/gdscript/gd_script.h b/modules/gdscript/gd_script.h index 93f8ee8721..f92c11b9e0 100644 --- a/modules/gdscript/gd_script.h +++ b/modules/gdscript/gd_script.h @@ -390,6 +390,7 @@ public: #ifdef TOOLS_ENABLED virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result); #endif + virtual String _get_indentation() const; virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const; virtual void add_global_constant(const StringName &p_variable, const Variant &p_value); diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index 5a765f9342..f1816a762e 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -1017,7 +1017,7 @@ void VisualScriptEditor::_member_button(Object *p_item, int p_column, int p_butt } Rect2 pos = members->get_item_rect(ti); - new_function_menu->set_pos(members->get_global_pos() + pos.pos + Vector2(0, pos.size.y)); + new_function_menu->set_position(members->get_global_position() + pos.pos + Vector2(0, pos.size.y)); new_function_menu->popup(); return; } else if (p_button == 0) { @@ -2163,6 +2163,12 @@ void VisualScriptEditor::goto_line(int p_line, bool p_with_error) { void VisualScriptEditor::trim_trailing_whitespace() { } +void VisualScriptEditor::convert_indent_to_spaces() { +} + +void VisualScriptEditor::convert_indent_to_tabs() { +} + void VisualScriptEditor::ensure_focus() { graph->grab_focus(); @@ -2505,7 +2511,7 @@ void VisualScriptEditor::_graph_connect_to_empty(const String &p_from, int p_fro port_action_pos = p_release_pos; port_action_popup->set_size(Size2(1, 1)); - port_action_popup->set_pos(graph->get_global_pos() + p_release_pos); + port_action_popup->set_position(graph->get_global_position() + p_release_pos); port_action_popup->popup(); } @@ -2794,7 +2800,7 @@ void VisualScriptEditor::_default_value_edited(Node *p_button, int p_id, int p_i existing = Variant::construct(pinfo.type, &existingp, 1, ce, false); } - default_value_edit->set_pos(p_button->cast_to<Control>()->get_global_pos() + Vector2(0, p_button->cast_to<Control>()->get_size().y)); + default_value_edit->set_position(p_button->cast_to<Control>()->get_global_position() + Vector2(0, p_button->cast_to<Control>()->get_size().y)); default_value_edit->set_size(Size2(1, 1)); if (default_value_edit->edit(NULL, pinfo.name, pinfo.type, existing, pinfo.hint, pinfo.hint_string)) { if (pinfo.hint == PROPERTY_HINT_MULTILINE_TEXT) diff --git a/modules/visual_script/visual_script_editor.h b/modules/visual_script/visual_script_editor.h index 52f5d28a36..1fd97cc1bc 100644 --- a/modules/visual_script/visual_script_editor.h +++ b/modules/visual_script/visual_script_editor.h @@ -240,6 +240,8 @@ public: virtual void set_edit_state(const Variant &p_state); virtual void goto_line(int p_line, bool p_with_error = false); virtual void trim_trailing_whitespace(); + virtual void convert_indent_to_spaces(); + virtual void convert_indent_to_tabs(); virtual void ensure_focus(); virtual void tag_saved_version(); virtual void reload(bool p_soft); diff --git a/platform/android/SCsub b/platform/android/SCsub index 02a8c3bc42..7fb3c876be 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -52,13 +52,13 @@ if len(env.android_maven_repos) > 0: gradle_maven_repos_text += "" for x in env.android_maven_repos: gradle_maven_repos_text += "\tmaven {\n" - gradle_maven_repos_text += "\t\t" + x + "\n" + gradle_maven_repos_text += "\t" + x + "\n" gradle_maven_repos_text += "\t}\n" gradle_maven_dependencies_text = "" for x in env.android_dependencies: - gradle_maven_dependencies_text += x + "\n" + gradle_maven_dependencies_text += x + "\n\t" gradle_java_dirs_text = "" @@ -92,9 +92,23 @@ gradle_asset_dirs_text = "" gradle_default_config_text = "" +minSdk = 14 +targetSdk = 23 + for x in env.android_default_config: + if x.startswith("minSdkVersion") and int(x.split(" ")[-1]) < minSdk: + x = "minSdkVersion " + str(minSdk) + if x.startswith("targetSdkVersion") and int(x.split(" ")[-1]) > targetSdk: + x = "targetSdkVersion " + str(targetSdk) + gradle_default_config_text += x + "\n\t\t" +if "minSdkVersion" not in gradle_default_config_text: + gradle_default_config_text += ("minSdkVersion " + str(minSdk) + "\n\t\t") + +if "targetSdkVersion" not in gradle_default_config_text: + gradle_default_config_text += ("targetSdkVersion " + str(targetSdk) + "\n\t\t") + gradle_text = gradle_text.replace("$$GRADLE_REPOSITORY_URLS$$", gradle_maven_repos_text) gradle_text = gradle_text.replace("$$GRADLE_DEPENDENCIES$$", gradle_maven_dependencies_text) gradle_text = gradle_text.replace("$$GRADLE_JAVA_DIRS$$", gradle_java_dirs_text) diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index ec5bbb6630..8dfb006c00 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -39,8 +39,6 @@ android { exclude 'META-INF/NOTICE' } defaultConfig { - minSdkVersion 14 - targetSdkVersion 23 $$GRADLE_DEFAULT_CONFIG$$ } // Both signing and zip-aligning will be done at export time diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 78c28ede50..72d665329e 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -3532,6 +3532,13 @@ public: devices_changed = true; quit_request = false; } + + ~EditorExportAndroid() { + quit_request = true; + Thread::wait_to_finish(device_thread); + memdelete(device_lock); + memdelete(device_thread); + } }; void register_android_exporter() { diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 0cdc2bbddf..6772964c2f 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -245,7 +245,7 @@ bool OS_Android::is_mouse_grab_enabled() const { return false; } -Point2 OS_Android::get_mouse_pos() const { +Point2 OS_Android::get_mouse_position() const { return Point2(); } @@ -414,7 +414,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev.mouse_button.y = touch[0].pos.y; ev.mouse_button.global_x = touch[0].pos.x; ev.mouse_button.global_y = touch[0].pos.y; - input->set_mouse_pos(Point2(touch[0].pos.x, touch[0].pos.y)); + input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y)); last_mouse = touch[0].pos; input->parse_input_event(ev); } @@ -441,7 +441,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev.mouse_motion.button_mask = BUTTON_MASK_LEFT; ev.mouse_motion.x = p_points[0].pos.x; ev.mouse_motion.y = p_points[0].pos.y; - input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); + input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); ev.mouse_motion.speed_x = input->get_last_mouse_speed().x; ev.mouse_motion.speed_y = input->get_last_mouse_speed().y; ev.mouse_motion.relative_x = p_points[0].pos.x - last_mouse.x; @@ -493,7 +493,7 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev.mouse_button.y = touch[0].pos.y; ev.mouse_button.global_x = touch[0].pos.x; ev.mouse_button.global_y = touch[0].pos.y; - input->set_mouse_pos(Point2(touch[0].pos.x, touch[0].pos.y)); + input->set_mouse_position(Point2(touch[0].pos.x, touch[0].pos.y)); input->parse_input_event(ev); for (int i = 0; i < touch.size(); i++) { diff --git a/platform/android/os_android.h b/platform/android/os_android.h index 87ab0bb757..f1da2867f0 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -171,7 +171,7 @@ public: virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/bb10/os_bb10.cpp b/platform/bb10/os_bb10.cpp index 0bfeff80da..b571d1640c 100644 --- a/platform/bb10/os_bb10.cpp +++ b/platform/bb10/os_bb10.cpp @@ -217,7 +217,7 @@ bool OSBB10::is_mouse_grab_enabled() const { //*sigh* technology has evolved so much since i was a kid.. return false; } -Point2 OSBB10::get_mouse_pos() const { +Point2 OSBB10::get_mouse_position() const { return Point2(); } @@ -348,7 +348,7 @@ void OSBB10::handle_screen_event(bps_event_t *event) { ievent.device = 0; ievent.mouse_motion.x = ievent.mouse_motion.global_x = mpos.x; ievent.mouse_motion.y = ievent.mouse_motion.global_y = mpos.y; - input->set_mouse_pos(Point2(ievent.mouse_motion.x, ievent.mouse_motion.y)); + input->set_mouse_position(Point2(ievent.mouse_motion.x, ievent.mouse_motion.y)); ievent.mouse_motion.speed_x = input->get_last_mouse_speed().x; ievent.mouse_motion.speed_y = input->get_last_mouse_speed().y; ievent.mouse_motion.relative_x = mrel.x; diff --git a/platform/bb10/os_bb10.h b/platform/bb10/os_bb10.h index 42781c85d8..91149b6f68 100644 --- a/platform/bb10/os_bb10.h +++ b/platform/bb10/os_bb10.h @@ -113,7 +113,7 @@ public: virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp index bb2495d99c..fb6d9afd85 100644 --- a/platform/haiku/haiku_direct_window.cpp +++ b/platform/haiku/haiku_direct_window.cpp @@ -215,7 +215,7 @@ void HaikuDirectWindow::HandleMouseMoved(BMessage *message) { motion_event.mouse_motion.button_mask = GetMouseButtonState(buttons); motion_event.mouse_motion.x = pos.x; motion_event.mouse_motion.y = pos.y; - input->set_mouse_pos(pos); + input->set_mouse_position(pos); motion_event.mouse_motion.global_x = pos.x; motion_event.mouse_motion.global_y = pos.y; motion_event.mouse_motion.speed_x = input->get_last_mouse_speed().x; diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 38aa6ae74d..3131f2bf1e 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -207,7 +207,7 @@ void OS_Haiku::swap_buffers() { context_gl->swap_buffers(); } -Point2 OS_Haiku::get_mouse_pos() const { +Point2 OS_Haiku::get_mouse_position() const { return window->GetLastMousePosition(); } diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h index 1d6c31e39d..83e44734a6 100644 --- a/platform/haiku/os_haiku.h +++ b/platform/haiku/os_haiku.h @@ -89,7 +89,7 @@ public: virtual void make_rendering_thread(); virtual void swap_buffers(); - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_cursor_shape(CursorShape p_shape); diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 4c36942ff8..e075941d36 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -28,11 +28,11 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #import "app_delegate.h" -#import "gl_view.h" -#include "os_iphone.h" #include "core/global_config.h" +#import "gl_view.h" #include "main/main.h" +#include "os_iphone.h" #ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED #include "modules/FacebookScorer_ios/FacebookScorer.h" @@ -45,24 +45,24 @@ #endif #ifdef MODULE_PARSE_ENABLED -#import <Parse/Parse.h> #import "FBSDKCoreKit/FBSDKCoreKit.h" +#import <Parse/Parse.h> #endif -#define kFilteringFactor 0.1 -#define kRenderingFrequency 60 -#define kAccelerometerFrequency 100.0 // Hz +#define kFilteringFactor 0.1 +#define kRenderingFrequency 60 +#define kAccelerometerFrequency 100.0 // Hz Error _shell_open(String); void _set_keep_screen_on(bool p_enabled); Error _shell_open(String p_uri) { - NSString* url = [[NSString alloc] initWithUTF8String:p_uri.utf8().get_data()]; + NSString *url = [[NSString alloc] initWithUTF8String:p_uri.utf8().get_data()]; - if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]]) - return ERR_CANT_OPEN; + if (![[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]]) + return ERR_CANT_OPEN; - printf("opening url %ls\n", p_uri.c_str()); + printf("opening url %ls\n", p_uri.c_str()); [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]]; [url release]; return OK; @@ -77,174 +77,170 @@ void _set_keep_screen_on(bool p_enabled) { @synthesize window; extern int gargc; -extern char** gargv; -extern int iphone_main(int, int, int, char**); +extern char **gargv; +extern int iphone_main(int, int, int, char **); extern void iphone_finish(); CMMotionManager *motionManager; -bool motionInitialised; +bool motionInitialised; -static ViewController* mainViewController = nil; -+ (ViewController*) getViewController -{ +static ViewController *mainViewController = nil; ++ (ViewController *)getViewController { return mainViewController; } static int frame_count = 0; -- (void)drawView:(GLView*)view; { +- (void)drawView:(GLView *)view; +{ switch (frame_count) { - - case 0: { - int backingWidth; - int backingHeight; - glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); - glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); - - - OS::VideoMode vm; - vm.fullscreen = true; - vm.width = backingWidth; - vm.height = backingHeight; - vm.resizable = false; - OS::get_singleton()->set_video_mode(vm); - - if (!OS::get_singleton()) { - exit(0); - }; - ++frame_count; - - NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - //NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; - OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String])); - - NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2]; - OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String])); - - NSString* uuid; - if ([[UIDevice currentDevice]respondsToSelector:@selector(identifierForVendor)]) { - uuid = [UIDevice currentDevice].identifierForVendor.UUIDString; - }else{ - - // before iOS 6, so just generate an identifier and store it - uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"identiferForVendor"]; - if( !uuid ) { - CFUUIDRef cfuuid = CFUUIDCreate(NULL); - uuid = (__bridge_transfer NSString*)CFUUIDCreateString(NULL, cfuuid); - CFRelease(cfuuid); - [[NSUserDefaults standardUserDefaults] setObject:uuid forKey:@"identifierForVendor"]; + case 0: { + int backingWidth; + int backingHeight; + glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth); + glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight); + + OS::VideoMode vm; + vm.fullscreen = true; + vm.width = backingWidth; + vm.height = backingHeight; + vm.resizable = false; + OS::get_singleton()->set_video_mode(vm); + + if (!OS::get_singleton()) { + exit(0); + }; + ++frame_count; + + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + //NSString *documentsDirectory = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; + OSIPhone::get_singleton()->set_data_dir(String::utf8([documentsDirectory UTF8String])); + + NSString *locale_code = [[[NSLocale preferredLanguages] objectAtIndex:0] substringToIndex:2]; + OSIPhone::get_singleton()->set_locale(String::utf8([locale_code UTF8String])); + + NSString *uuid; + if ([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { + uuid = [UIDevice currentDevice].identifierForVendor.UUIDString; + } else { + // before iOS 6, so just generate an identifier and store it + uuid = [[NSUserDefaults standardUserDefaults] objectForKey:@"identiferForVendor"]; + if (!uuid) { + CFUUIDRef cfuuid = CFUUIDCreate(NULL); + uuid = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, cfuuid); + CFRelease(cfuuid); + [[NSUserDefaults standardUserDefaults] setObject:uuid forKey:@"identifierForVendor"]; + } } - } - OSIPhone::get_singleton()->set_unique_ID(String::utf8([uuid UTF8String])); + OSIPhone::get_singleton()->set_unique_ID(String::utf8([uuid UTF8String])); - }; break; -/* - case 1: { - ++frame_count; - } break; + }; break; + /* + case 1: { + ++frame_count; + }; break; */ - case 1: { + case 1: { - Main::setup2(); - ++frame_count; + Main::setup2(); + ++frame_count; - // this might be necessary before here - NSDictionary* dict = [[NSBundle mainBundle] infoDictionary]; - for (NSString* key in dict) { - NSObject* value = [dict objectForKey:key]; - String ukey = String::utf8([key UTF8String]); + // this might be necessary before here + NSDictionary *dict = [[NSBundle mainBundle] infoDictionary]; + for (NSString *key in dict) { + NSObject *value = [dict objectForKey:key]; + String ukey = String::utf8([key UTF8String]); - // we need a NSObject to Variant conversor + // we need a NSObject to Variant conversor - if ([value isKindOfClass:[NSString class]]) { - NSString* str = (NSString*)value; - String uval = String::utf8([str UTF8String]); + if ([value isKindOfClass:[NSString class]]) { + NSString *str = (NSString *)value; + String uval = String::utf8([str UTF8String]); - GlobalConfig::get_singleton()->set("Info.plist/"+ukey, uval); + GlobalConfig::get_singleton()->set("Info.plist/" + ukey, uval); - } else if ([value isKindOfClass:[NSNumber class]]) { + } else if ([value isKindOfClass:[NSNumber class]]) { - NSNumber* n = (NSNumber*)value; - double dval = [n doubleValue]; + NSNumber *n = (NSNumber *)value; + double dval = [n doubleValue]; - GlobalConfig::get_singleton()->set("Info.plist/"+ukey, dval); - }; - // do stuff - } - - } break; -/* - case 3: { - ++frame_count; - } break; -*/ - case 2: { - - Main::start(); - ++frame_count; - - }; break; // no fallthrough - - default: { - if (OSIPhone::get_singleton()) { -// OSIPhone::get_singleton()->update_accelerometer(accel[0], accel[1], accel[2]); - if (motionInitialised) { - // Just using polling approach for now, we can set this up so it sends data to us in intervals, might be better. - // See Apple reference pages for more details: - // https://developer.apple.com/reference/coremotion/cmmotionmanager?language=objc - - // Apple splits our accelerometer date into a gravity and user movement component. We add them back together - CMAcceleration gravity = motionManager.deviceMotion.gravity; - CMAcceleration acceleration = motionManager.deviceMotion.userAcceleration; - - ///@TODO We don't seem to be getting data here, is my device broken or is this code incorrect? - CMMagneticField magnetic = motionManager.deviceMotion.magneticField.field; - - ///@TODO we can access rotationRate as a CMRotationRate variable (processed date) or CMGyroData (raw data), have to see what works best - CMRotationRate rotation = motionManager.deviceMotion.rotationRate; - - // Adjust for screen orientation. - // [[UIDevice currentDevice] orientation] changes even if we've fixed our orientation which is not - // a good thing when you're trying to get your user to move the screen in all directions and want consistent output - - ///@TODO Using [[UIApplication sharedApplication] statusBarOrientation] is a bit of a hack. Godot obviously knows the orientation so maybe we - // can use that instead? (note that left and right seem swapped) - - switch ([[UIApplication sharedApplication] statusBarOrientation]) { - case UIDeviceOrientationLandscapeLeft: { - OSIPhone::get_singleton()->update_gravity(-gravity.y, gravity.x, gravity.z); - OSIPhone::get_singleton()->update_accelerometer(-(acceleration.y + gravity.y), (acceleration.x + gravity.x), acceleration.z + gravity.z); - OSIPhone::get_singleton()->update_magnetometer(-magnetic.y, magnetic.x, magnetic.z); - OSIPhone::get_singleton()->update_gyroscope(-rotation.y, rotation.x, rotation.z); - }; break; - case UIDeviceOrientationLandscapeRight: { - OSIPhone::get_singleton()->update_gravity(gravity.y, -gravity.x, gravity.z); - OSIPhone::get_singleton()->update_accelerometer((acceleration.y + gravity.y), -(acceleration.x + gravity.x), acceleration.z + gravity.z); - OSIPhone::get_singleton()->update_magnetometer(magnetic.y, -magnetic.x, magnetic.z); - OSIPhone::get_singleton()->update_gyroscope(rotation.y, -rotation.x, rotation.z); - }; break; - case UIDeviceOrientationPortraitUpsideDown: { - OSIPhone::get_singleton()->update_gravity(-gravity.x, gravity.y, gravity.z); - OSIPhone::get_singleton()->update_accelerometer(-(acceleration.x + gravity.x), (acceleration.y + gravity.y), acceleration.z + gravity.z); - OSIPhone::get_singleton()->update_magnetometer(-magnetic.x, magnetic.y, magnetic.z); - OSIPhone::get_singleton()->update_gyroscope(-rotation.x, rotation.y, rotation.z); - }; break; - default: { // assume portrait - OSIPhone::get_singleton()->update_gravity(gravity.x, gravity.y, gravity.z); - OSIPhone::get_singleton()->update_accelerometer(acceleration.x + gravity.x, acceleration.y + gravity.y, acceleration.z + gravity.z); - OSIPhone::get_singleton()->update_magnetometer(magnetic.x, magnetic.y, magnetic.z); - OSIPhone::get_singleton()->update_gyroscope(rotation.x, rotation.y, rotation.z); - }; break; + GlobalConfig::get_singleton()->set("Info.plist/" + ukey, dval); }; + // do stuff } - bool quit_request = OSIPhone::get_singleton()->iterate(); - }; - - }; + }; break; + /* + case 3: { + ++frame_count; + }; break; +*/ + case 2: { + + Main::start(); + ++frame_count; + + }; break; // no fallthrough + + default: { + if (OSIPhone::get_singleton()) { + //OSIPhone::get_singleton()->update_accelerometer(accel[0], accel[1], accel[2]); + if (motionInitialised) { + // Just using polling approach for now, we can set this up so it sends data to us in intervals, might be better. + // See Apple reference pages for more details: + // https://developer.apple.com/reference/coremotion/cmmotionmanager?language=objc + + // Apple splits our accelerometer date into a gravity and user movement component. We add them back together + CMAcceleration gravity = motionManager.deviceMotion.gravity; + CMAcceleration acceleration = motionManager.deviceMotion.userAcceleration; + + ///@TODO We don't seem to be getting data here, is my device broken or is this code incorrect? + CMMagneticField magnetic = motionManager.deviceMotion.magneticField.field; + + ///@TODO we can access rotationRate as a CMRotationRate variable (processed date) or CMGyroData (raw data), have to see what works best + CMRotationRate rotation = motionManager.deviceMotion.rotationRate; + + // Adjust for screen orientation. + // [[UIDevice currentDevice] orientation] changes even if we've fixed our orientation which is not + // a good thing when you're trying to get your user to move the screen in all directions and want consistent output + + ///@TODO Using [[UIApplication sharedApplication] statusBarOrientation] is a bit of a hack. Godot obviously knows the orientation so maybe we + // can use that instead? (note that left and right seem swapped) + + switch ([[UIApplication sharedApplication] statusBarOrientation]) { + case UIDeviceOrientationLandscapeLeft: { + OSIPhone::get_singleton()->update_gravity(-gravity.y, gravity.x, gravity.z); + OSIPhone::get_singleton()->update_accelerometer(-(acceleration.y + gravity.y), (acceleration.x + gravity.x), acceleration.z + gravity.z); + OSIPhone::get_singleton()->update_magnetometer(-magnetic.y, magnetic.x, magnetic.z); + OSIPhone::get_singleton()->update_gyroscope(-rotation.y, rotation.x, rotation.z); + }; break; + case UIDeviceOrientationLandscapeRight: { + OSIPhone::get_singleton()->update_gravity(gravity.y, -gravity.x, gravity.z); + OSIPhone::get_singleton()->update_accelerometer((acceleration.y + gravity.y), -(acceleration.x + gravity.x), acceleration.z + gravity.z); + OSIPhone::get_singleton()->update_magnetometer(magnetic.y, -magnetic.x, magnetic.z); + OSIPhone::get_singleton()->update_gyroscope(rotation.y, -rotation.x, rotation.z); + }; break; + case UIDeviceOrientationPortraitUpsideDown: { + OSIPhone::get_singleton()->update_gravity(-gravity.x, gravity.y, gravity.z); + OSIPhone::get_singleton()->update_accelerometer(-(acceleration.x + gravity.x), (acceleration.y + gravity.y), acceleration.z + gravity.z); + OSIPhone::get_singleton()->update_magnetometer(-magnetic.x, magnetic.y, magnetic.z); + OSIPhone::get_singleton()->update_gyroscope(-rotation.x, rotation.y, rotation.z); + }; break; + default: { // assume portrait + OSIPhone::get_singleton()->update_gravity(gravity.x, gravity.y, gravity.z); + OSIPhone::get_singleton()->update_accelerometer(acceleration.x + gravity.x, acceleration.y + gravity.y, acceleration.z + gravity.z); + OSIPhone::get_singleton()->update_magnetometer(magnetic.x, magnetic.y, magnetic.z); + OSIPhone::get_singleton()->update_gyroscope(rotation.x, rotation.y, rotation.z); + }; break; + }; + } + + bool quit_request = OSIPhone::get_singleton()->iterate(); + }; + }; break; }; }; @@ -254,7 +250,7 @@ static int frame_count = 0; OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_OS_MEMORY_WARNING); }; -- (void)applicationDidFinishLaunching:(UIApplication*)application { +- (void)applicationDidFinishLaunching:(UIApplication *)application { printf("**************** app delegate init\n"); CGRect rect = [[UIScreen mainScreen] bounds]; @@ -287,8 +283,8 @@ static int frame_count = 0; view_controller.view = glView; window.rootViewController = view_controller; - _set_keep_screen_on(bool(GLOBAL_DEF("display/keep_screen_on",true)) ? YES : NO); - glView.useCADisplayLink = bool(GLOBAL_DEF("display.iOS/use_cadisplaylink",true)) ? YES : NO; + _set_keep_screen_on(bool(GLOBAL_DEF("display/keep_screen_on", true)) ? YES : NO); + glView.useCADisplayLink = bool(GLOBAL_DEF("display.iOS/use_cadisplaylink", true)) ? YES : NO; printf("cadisaplylink: %d", glView.useCADisplayLink); glView.animationInterval = 1.0 / kRenderingFrequency; [glView startAnimation]; @@ -300,8 +296,8 @@ static int frame_count = 0; if (!motionInitialised) { motionManager = [[CMMotionManager alloc] init]; if (motionManager.deviceMotionAvailable) { - motionManager.deviceMotionUpdateInterval = 1.0/70.0; - [motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXMagneticNorthZVertical]; + motionManager.deviceMotionUpdateInterval = 1.0 / 70.0; + [motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXMagneticNorthZVertical]; motionInitialised = YES; }; }; @@ -312,36 +308,32 @@ static int frame_count = 0; mainViewController = view_controller; #ifdef MODULE_GAME_ANALYTICS_ENABLED - printf("********************* didFinishLaunchingWithOptions\n"); - if(!GlobalConfig::get_singleton()->has("mobileapptracker/advertiser_id")) - { - return; - } - if(!GlobalConfig::get_singleton()->has("mobileapptracker/conversion_key")) - { - return; - } - - String adid = GLOBAL_DEF("mobileapptracker/advertiser_id",""); - String convkey = GLOBAL_DEF("mobileapptracker/conversion_key",""); - - NSString * advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()]; - NSString * conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()]; - - // Account Configuration info - must be set - [MobileAppTracker initializeWithMATAdvertiserId:advertiser_id - MATConversionKey:conversion_key]; - - // Used to pass us the IFA, enables highly accurate 1-to-1 attribution. - // Required for many advertising networks. - [MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier] - advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]]; + printf("********************* didFinishLaunchingWithOptions\n"); + if (!GlobalConfig::get_singleton()->has("mobileapptracker/advertiser_id")) { + return; + } + if (!GlobalConfig::get_singleton()->has("mobileapptracker/conversion_key")) { + return; + } -#endif + String adid = GLOBAL_DEF("mobileapptracker/advertiser_id", ""); + String convkey = GLOBAL_DEF("mobileapptracker/conversion_key", ""); + + NSString *advertiser_id = [NSString stringWithUTF8String:adid.utf8().get_data()]; + NSString *conversion_key = [NSString stringWithUTF8String:convkey.utf8().get_data()]; + + // Account Configuration info - must be set + [MobileAppTracker initializeWithMATAdvertiserId:advertiser_id MATConversionKey:conversion_key]; + + // Used to pass us the IFA, enables highly accurate 1-to-1 attribution. + // Required for many advertising networks. + [MobileAppTracker setAppleAdvertisingIdentifier:[[ASIdentifierManager sharedManager] advertisingIdentifier] + advertisingTrackingEnabled:[[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]]; +#endif }; -- (void)applicationWillTerminate:(UIApplication*)application { +- (void)applicationWillTerminate:(UIApplication *)application { printf("********************* will terminate\n"); @@ -350,48 +342,46 @@ static int frame_count = 0; [motionManager stopDeviceMotionUpdates]; [motionManager release]; motionManager = nil; - motionInitialised = NO; + motionInitialised = NO; }; iphone_finish(); }; -- (void)applicationDidEnterBackground:(UIApplication *)application -{ +- (void)applicationDidEnterBackground:(UIApplication *)application { printf("********************* did enter background\n"); ///@TODO maybe add pause motionManager? and where would we unpause it? if (OS::get_singleton()->get_main_loop()) OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); + [view_controller.view stopAnimation]; if (OS::get_singleton()->native_video_is_playing()) { OSIPhone::get_singleton()->native_video_focus_out(); }; } -- (void)applicationWillEnterForeground:(UIApplication *)application -{ +- (void)applicationWillEnterForeground:(UIApplication *)application { printf("********************* did enter foreground\n"); //OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); [view_controller.view startAnimation]; } -- (void) applicationWillResignActive:(UIApplication *)application -{ +- (void)applicationWillResignActive:(UIApplication *)application { printf("********************* will resign active\n"); //OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); [view_controller.view stopAnimation]; // FIXME: pause seems to be recommended elsewhere } -- (void) applicationDidBecomeActive:(UIApplication *)application -{ +- (void)applicationDidBecomeActive:(UIApplication *)application { printf("********************* did become active\n"); #ifdef MODULE_GAME_ANALYTICS_ENABLED - printf("********************* mobile app tracker found\n"); + printf("********************* mobile app tracker found\n"); [MobileAppTracker measureSession]; #endif if (OS::get_singleton()->get_main_loop()) OS::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); + [view_controller.view startAnimation]; // FIXME: resume seems to be recommended elsewhere if (OSIPhone::get_singleton()->native_video_is_playing()) { OSIPhone::get_singleton()->native_video_unpause(); @@ -410,13 +400,13 @@ static int frame_count = 0; - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { #ifdef MODULE_PARSE_ENABLED NSLog(@"Handling application openURL"); - return [[FBSDKApplicationDelegate sharedInstance] application:application - openURL:url - sourceApplication:sourceApplication - annotation:annotation]; + return [[FBSDKApplicationDelegate sharedInstance] + application:application + openURL:url + sourceApplication:sourceApplication + annotation:annotation]; #endif - #ifdef MODULE_FACEBOOKSCORER_IOS_ENABLED return [[[FacebookScorer sharedInstance] facebook] handleOpenURL:url]; #else @@ -450,8 +440,7 @@ static int frame_count = 0; #endif } -- (void)dealloc -{ +- (void)dealloc { [window release]; [super dealloc]; } diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 2593134512..f9bc70b7c4 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -46,24 +46,23 @@ extern "C" { #import "app_delegate.h" }; -GameCenter* GameCenter::instance = NULL; +GameCenter *GameCenter::instance = NULL; void GameCenter::_bind_methods() { - ClassDB::bind_method(D_METHOD("connect"),&GameCenter::connect); - ClassDB::bind_method(D_METHOD("is_connected"),&GameCenter::is_connected); - - ClassDB::bind_method(D_METHOD("post_score"),&GameCenter::post_score); - ClassDB::bind_method(D_METHOD("award_achievement"),&GameCenter::award_achievement); - ClassDB::bind_method(D_METHOD("reset_achievements"),&GameCenter::reset_achievements); - ClassDB::bind_method(D_METHOD("request_achievements"),&GameCenter::request_achievements); - ClassDB::bind_method(D_METHOD("request_achievement_descriptions"),&GameCenter::request_achievement_descriptions); - ClassDB::bind_method(D_METHOD("show_game_center"),&GameCenter::show_game_center); - - ClassDB::bind_method(D_METHOD("get_pending_event_count"),&GameCenter::get_pending_event_count); - ClassDB::bind_method(D_METHOD("pop_pending_event"),&GameCenter::pop_pending_event); + ClassDB::bind_method(D_METHOD("connect"), &GameCenter::connect); + ClassDB::bind_method(D_METHOD("is_connected"), &GameCenter::is_connected); + + ClassDB::bind_method(D_METHOD("post_score"), &GameCenter::post_score); + ClassDB::bind_method(D_METHOD("award_achievement"), &GameCenter::award_achievement); + ClassDB::bind_method(D_METHOD("reset_achievements"), &GameCenter::reset_achievements); + ClassDB::bind_method(D_METHOD("request_achievements"), &GameCenter::request_achievements); + ClassDB::bind_method(D_METHOD("request_achievement_descriptions"), &GameCenter::request_achievement_descriptions); + ClassDB::bind_method(D_METHOD("show_game_center"), &GameCenter::show_game_center); + + ClassDB::bind_method(D_METHOD("get_pending_event_count"), &GameCenter::get_pending_event_count); + ClassDB::bind_method(D_METHOD("pop_pending_event"), &GameCenter::pop_pending_event); }; - Error GameCenter::connect() { //if this class isn't available, game center isn't implemented @@ -72,33 +71,34 @@ Error GameCenter::connect() { return ERR_UNAVAILABLE; } - GKLocalPlayer* player = [GKLocalPlayer localPlayer]; + GKLocalPlayer *player = [GKLocalPlayer localPlayer]; ERR_FAIL_COND_V(![player respondsToSelector:@selector(authenticateHandler)], ERR_UNAVAILABLE); - ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController; + ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController; ERR_FAIL_COND_V(!root_controller, FAILED); - //this handler is called serveral times. first when the view needs to be shown, then again after the view is cancelled or the user logs in. or if the user's already logged in, it's called just once to confirm they're authenticated. This is why no result needs to be specified in the presentViewController phase. in this case, more calls to this function will follow. + // This handler is called several times. First when the view needs to be shown, then again + // after the view is cancelled or the user logs in. Or if the user's already logged in, it's + // called just once to confirm they're authenticated. This is why no result needs to be specified + // in the presentViewController phase. In this case, more calls to this function will follow. player.authenticateHandler = (^(UIViewController *controller, NSError *error) { - if (controller) { - [root_controller presentViewController:controller animated:YES completion:nil]; - } - else { - Dictionary ret; - ret["type"] = "authentication"; - if (player.isAuthenticated) { - ret["result"] = "ok"; - GameCenter::get_singleton()->connected = true; - } else { - ret["result"] = "error"; - ret["error_code"] = error.code; - ret["error_description"] = [error.localizedDescription UTF8String]; - GameCenter::get_singleton()->connected = false; - }; - - pending_events.push_back(ret); - }; - + if (controller) { + [root_controller presentViewController:controller animated:YES completion:nil]; + } else { + Dictionary ret; + ret["type"] = "authentication"; + if (player.isAuthenticated) { + ret["result"] = "ok"; + GameCenter::get_singleton()->connected = true; + } else { + ret["result"] = "error"; + ret["error_code"] = error.code; + ret["error_description"] = [error.localizedDescription UTF8String]; + GameCenter::get_singleton()->connected = false; + }; + + pending_events.push_back(ret); + }; }); return OK; @@ -115,26 +115,27 @@ Error GameCenter::post_score(Variant p_score) { float score = params["score"]; String category = params["category"]; - NSString* cat_str = [[[NSString alloc] initWithUTF8String:category.utf8().get_data()] autorelease]; - GKScore* reporter = [[[GKScore alloc] initWithCategory:cat_str] autorelease]; + NSString *cat_str = [[[NSString alloc] initWithUTF8String:category.utf8().get_data()] autorelease]; + GKScore *reporter = [[[GKScore alloc] initWithCategory:cat_str] autorelease]; reporter.value = score; ERR_FAIL_COND_V([GKScore respondsToSelector:@selector(reportScores)], ERR_UNAVAILABLE); - [GKScore reportScores:@[reporter] withCompletionHandler:^(NSError* error) { + [GKScore reportScores:@[ reporter ] + withCompletionHandler:^(NSError *error) { - Dictionary ret; - ret["type"] = "post_score"; - if (error == nil) { - ret["result"] = "ok"; - } else { - ret["result"] = "error"; - ret["error_code"] = error.code; - ret["error_description"] = [error.localizedDescription UTF8String]; - }; + Dictionary ret; + ret["type"] = "post_score"; + if (error == nil) { + ret["result"] = "ok"; + } else { + ret["result"] = "error"; + ret["error_code"] = error.code; + ret["error_description"] = [error.localizedDescription UTF8String]; + }; - pending_events.push_back(ret); - }]; + pending_events.push_back(ret); + }]; return OK; }; @@ -146,8 +147,8 @@ Error GameCenter::award_achievement(Variant p_params) { String name = params["name"]; float progress = params["progress"]; - NSString* name_str = [[[NSString alloc] initWithUTF8String:name.utf8().get_data()] autorelease]; - GKAchievement* achievement = [[[GKAchievement alloc] initWithIdentifier: name_str] autorelease]; + NSString *name_str = [[[NSString alloc] initWithUTF8String:name.utf8().get_data()] autorelease]; + GKAchievement *achievement = [[[GKAchievement alloc] initWithIdentifier:name_str] autorelease]; ERR_FAIL_COND_V(!achievement, FAILED); ERR_FAIL_COND_V([GKAchievement respondsToSelector:@selector(reportAchievements)], ERR_UNAVAILABLE); @@ -158,19 +159,20 @@ Error GameCenter::award_achievement(Variant p_params) { achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO; } - [GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) { + [GKAchievement reportAchievements:@[ achievement ] + withCompletionHandler:^(NSError *error) { - Dictionary ret; - ret["type"] = "award_achievement"; - if (error == nil) { - ret["result"] = "ok"; - } else { - ret["result"] = "error"; - ret["error_code"] = error.code; - }; + Dictionary ret; + ret["type"] = "award_achievement"; + if (error == nil) { + ret["result"] = "ok"; + } else { + ret["result"] = "error"; + ret["error_code"] = error.code; + }; - pending_events.push_back(ret); - }]; + pending_events.push_back(ret); + }]; return OK; }; @@ -191,11 +193,11 @@ void GameCenter::request_achievement_descriptions() { Array hidden; Array replayable; - for (int i=0; i<[descriptions count]; i++) { + for (int i = 0; i < [descriptions count]; i++) { - GKAchievementDescription* description = [descriptions objectAtIndex:i]; + GKAchievementDescription *description = [descriptions objectAtIndex:i]; - const char* str = [description.identifier UTF8String]; + const char *str = [description.identifier UTF8String]; names.push_back(String::utf8(str != NULL ? str : "")); str = [description.title UTF8String]; @@ -231,7 +233,6 @@ void GameCenter::request_achievement_descriptions() { }]; }; - void GameCenter::request_achievements() { [GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) { @@ -243,10 +244,10 @@ void GameCenter::request_achievements() { PoolStringArray names; PoolRealArray percentages; - for (int i=0; i<[achievements count]; i++) { + for (int i = 0; i < [achievements count]; i++) { - GKAchievement* achievement = [achievements objectAtIndex:i]; - const char* str = [achievement.identifier UTF8String]; + GKAchievement *achievement = [achievements objectAtIndex:i]; + const char *str = [achievement.identifier UTF8String]; names.push_back(String::utf8(str != NULL ? str : "")); percentages.push_back(achievement.percentComplete); @@ -266,8 +267,7 @@ void GameCenter::request_achievements() { void GameCenter::reset_achievements() { - [GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error) - { + [GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error) { Dictionary ret; ret["type"] = "reset_achievements"; if (error == nil) { @@ -292,17 +292,13 @@ Error GameCenter::show_game_center(Variant p_params) { String view_name = params["view"]; if (view_name == "default") { view_state = GKGameCenterViewControllerStateDefault; - } - else if (view_name == "leaderboards") { + } else if (view_name == "leaderboards") { view_state = GKGameCenterViewControllerStateLeaderboards; - } - else if (view_name == "achievements") { + } else if (view_name == "achievements") { view_state = GKGameCenterViewControllerStateAchievements; - } - else if (view_name == "challenges") { + } else if (view_name == "challenges") { view_state = GKGameCenterViewControllerStateChallenges; - } - else { + } else { return ERR_INVALID_PARAMETER; } } @@ -310,7 +306,7 @@ Error GameCenter::show_game_center(Variant p_params) { GKGameCenterViewController *controller = [[GKGameCenterViewController alloc] init]; ERR_FAIL_COND_V(!controller, FAILED); - ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController; + ViewController *root_controller = (ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController; ERR_FAIL_COND_V(!root_controller, FAILED); controller.gameCenterDelegate = root_controller; @@ -319,12 +315,12 @@ Error GameCenter::show_game_center(Variant p_params) { controller.leaderboardIdentifier = nil; if (params.has("leaderboard_name")) { String name = params["leaderboard_name"]; - NSString* name_str = [[[NSString alloc] initWithUTF8String:name.utf8().get_data()] autorelease]; + NSString *name_str = [[[NSString alloc] initWithUTF8String:name.utf8().get_data()] autorelease]; controller.leaderboardIdentifier = name_str; } } - [root_controller presentViewController: controller animated: YES completion:nil]; + [root_controller presentViewController:controller animated:YES completion:nil]; return OK; }; @@ -332,7 +328,7 @@ Error GameCenter::show_game_center(Variant p_params) { void GameCenter::game_center_closed() { Dictionary ret; - ret["type"] = "show_game_center"; + ret["type"] = "show_game_center"; ret["result"] = "ok"; pending_events.push_back(ret); } @@ -350,7 +346,7 @@ Variant GameCenter::pop_pending_event() { return front; }; -GameCenter* GameCenter::get_singleton() { +GameCenter *GameCenter::get_singleton() { return instance; }; @@ -360,9 +356,6 @@ GameCenter::GameCenter() { connected = false; }; - -GameCenter::~GameCenter() { - -}; +GameCenter::~GameCenter(){}; #endif diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index 735235e73d..6270fa85f2 100755..100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -27,15 +27,15 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#import "gl_view.h" -#import <QuartzCore/QuartzCore.h> -#import <OpenGLES/EAGLDrawable.h> -#include "os_iphone.h" -#include "core/os/keyboard.h" #include "core/global_config.h" +#include "core/os/keyboard.h" +#include "os_iphone.h" #include "servers/audio_server.h" -#import "gl_view.h" +#import <OpenGLES/EAGLDrawable.h> +#import <QuartzCore/QuartzCore.h> /* @interface GLView (private) @@ -48,7 +48,7 @@ int gl_view_base_fb; static String keyboard_text; -static GLView* _instance = NULL; +static GLView *_instance = NULL; static bool video_found_error = false; static bool video_playing = false; @@ -79,21 +79,22 @@ void _hide_keyboard() { bool _play_video(String p_path, float p_volume, String p_audio_track, String p_subtitle_track) { p_path = GlobalConfig::get_singleton()->globalize_path(p_path); - NSString* file_path = [[[NSString alloc] initWithUTF8String:p_path.utf8().get_data()] autorelease]; + NSString *file_path = [[[NSString alloc] initWithUTF8String:p_path.utf8().get_data()] autorelease]; _instance.avAsset = [AVAsset assetWithURL:[NSURL fileURLWithPath:file_path]]; - _instance.avPlayerItem =[[AVPlayerItem alloc]initWithAsset:_instance.avAsset]; + _instance.avPlayerItem = [[AVPlayerItem alloc] initWithAsset:_instance.avAsset]; [_instance.avPlayerItem addObserver:_instance forKeyPath:@"status" options:0 context:nil]; - _instance.avPlayer = [[AVPlayer alloc]initWithPlayerItem:_instance.avPlayerItem]; - _instance.avPlayerLayer =[AVPlayerLayer playerLayerWithPlayer:_instance.avPlayer]; + _instance.avPlayer = [[AVPlayer alloc] initWithPlayerItem:_instance.avPlayerItem]; + _instance.avPlayerLayer = [AVPlayerLayer playerLayerWithPlayer:_instance.avPlayer]; [_instance.avPlayer addObserver:_instance forKeyPath:@"status" options:0 context:nil]; - [[NSNotificationCenter defaultCenter] addObserver:_instance - selector:@selector(playerItemDidReachEnd:) - name:AVPlayerItemDidPlayToEndTimeNotification - object:[_instance.avPlayer currentItem]]; + [[NSNotificationCenter defaultCenter] + addObserver:_instance + selector:@selector(playerItemDidReachEnd:) + name:AVPlayerItemDidPlayToEndTimeNotification + object:[_instance.avPlayer currentItem]]; [_instance.avPlayer addObserver:_instance forKeyPath:@"rate" options:NSKeyValueObservingOptionNew context:0]; @@ -101,16 +102,14 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s [_instance.layer addSublayer:_instance.avPlayerLayer]; [_instance.avPlayer play]; - AVMediaSelectionGroup *audioGroup = [_instance.avAsset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicAudible]; + AVMediaSelectionGroup *audioGroup = [_instance.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicAudible]; NSMutableArray *allAudioParams = [NSMutableArray array]; - for (id track in audioGroup.options) - { - NSString* language = [[track locale] localeIdentifier]; + for (id track in audioGroup.options) { + NSString *language = [[track locale] localeIdentifier]; NSLog(@"subtitle lang: %@", language); - if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]]) - { + if ([language isEqualToString:[NSString stringWithUTF8String:p_audio_track.utf8()]]) { AVMutableAudioMixInputParameters *audioInputParams = [AVMutableAudioMixInputParameters audioMixInputParameters]; [audioInputParams setVolume:p_volume atTime:kCMTimeZero]; [audioInputParams setTrackID:[track trackID]]; @@ -119,26 +118,24 @@ bool _play_video(String p_path, float p_volume, String p_audio_track, String p_s AVMutableAudioMix *audioMix = [AVMutableAudioMix audioMix]; [audioMix setInputParameters:allAudioParams]; - [_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: audioGroup]; + [_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup:audioGroup]; [_instance.avPlayer.currentItem setAudioMix:audioMix]; - break; - } + break; + } } - AVMediaSelectionGroup *subtitlesGroup = [_instance.avAsset mediaSelectionGroupForMediaCharacteristic: AVMediaCharacteristicLegible]; + AVMediaSelectionGroup *subtitlesGroup = [_instance.avAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible]; NSArray *useableTracks = [AVMediaSelectionGroup mediaSelectionOptionsFromArray:subtitlesGroup.options withoutMediaCharacteristics:[NSArray arrayWithObject:AVMediaCharacteristicContainsOnlyForcedSubtitles]]; - for (id track in useableTracks) - { - NSString* language = [[track locale] localeIdentifier]; + for (id track in useableTracks) { + NSString *language = [[track locale] localeIdentifier]; NSLog(@"subtitle lang: %@", language); - if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]]) - { - [_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup: subtitlesGroup]; - break; - } + if ([language isEqualToString:[NSString stringWithUTF8String:p_subtitle_track.utf8()]]) { + [_instance.avPlayer.currentItem selectMediaOption:track inMediaSelectionGroup:subtitlesGroup]; + break; + } } video_playing = true; @@ -182,19 +179,19 @@ void _stop_video() { @synthesize animationInterval; static const int max_touches = 8; -static UITouch* touches[max_touches]; +static UITouch *touches[max_touches]; static void init_touches() { - for (int i=0; i<max_touches; i++) { + for (int i = 0; i < max_touches; i++) { touches[i] = NULL; }; }; -static int get_touch_id(UITouch* p_touch) { +static int get_touch_id(UITouch *p_touch) { int first = -1; - for (int i=0; i<max_touches; i++) { + for (int i = 0; i < max_touches; i++) { if (first == -1 && touches[i] == NULL) { first = i; continue; @@ -211,10 +208,10 @@ static int get_touch_id(UITouch* p_touch) { return -1; }; -static int remove_touch(UITouch* p_touch) { +static int remove_touch(UITouch *p_touch) { int remaining = 0; - for (int i=0; i<max_touches; i++) { + for (int i = 0; i < max_touches; i++) { if (touches[i] == NULL) continue; @@ -226,9 +223,9 @@ static int remove_touch(UITouch* p_touch) { return remaining; }; -static int get_first_id(UITouch* p_touch) { +static int get_first_id(UITouch *p_touch) { - for (int i=0; i<max_touches; i++) { + for (int i = 0; i < max_touches; i++) { if (touches[i] != NULL) return i; @@ -238,7 +235,7 @@ static int get_first_id(UITouch* p_touch) { static void clear_touches() { - for (int i=0; i<max_touches; i++) { + for (int i = 0; i < max_touches; i++) { touches[i] = NULL; }; @@ -246,39 +243,36 @@ static void clear_touches() { // Implement this to override the default layer class (which is [CALayer class]). // We do this so that our view will be backed by a layer that is capable of OpenGL ES rendering. -+ (Class) layerClass -{ ++ (Class)layerClass { return [CAEAGLLayer class]; } //The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder: -- (id)initWithCoder:(NSCoder*)coder -{ +- (id)initWithCoder:(NSCoder *)coder { active = FALSE; - if((self = [super initWithCoder:coder])) - { + if ((self = [super initWithCoder:coder])) { self = [self initGLES]; } return self; } --(id)initGLES -{ +- (id)initGLES { // Get our backing layer - CAEAGLLayer *eaglLayer = (CAEAGLLayer*) self.layer; + CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; // Configure it so that it is opaque, does not retain the contents of the backbuffer when displayed, and uses RGBA8888 color. eaglLayer.opaque = YES; - eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: - [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, - kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, - nil]; + eaglLayer.drawableProperties = [NSDictionary + dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], + kEAGLDrawablePropertyRetainedBacking, + kEAGLColorFormatRGBA8, + kEAGLDrawablePropertyColorFormat, + nil]; // Create our EAGLContext, and if successful make it current and create our framebuffer. context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES3]; - if(!context || ![EAGLContext setCurrentContext:context] || ![self createFramebuffer]) - { + if (!context || ![EAGLContext setCurrentContext:context] || ![self createFramebuffer]) { [self release]; return nil; } @@ -288,14 +282,12 @@ static void clear_touches() { return self; } --(id<GLViewDelegate>)delegate -{ +- (id<GLViewDelegate>)delegate { return delegate; } // Update the delegate, and if it needs a -setupView: call, set our internal flag so that it will be called. --(void)setDelegate:(id<GLViewDelegate>)d -{ +- (void)setDelegate:(id<GLViewDelegate>)d { delegate = d; delegateSetup = ![delegate respondsToSelector:@selector(setupView:)]; } @@ -306,21 +298,18 @@ static void clear_touches() { // This is the perfect opportunity to also update the framebuffer so that it is // the same size as our display area. --(void)layoutSubviews -{ +- (void)layoutSubviews { //printf("HERE\n"); [EAGLContext setCurrentContext:context]; [self destroyFramebuffer]; [self createFramebuffer]; [self drawView]; [self drawView]; - } -- (BOOL)createFramebuffer -{ +- (BOOL)createFramebuffer { // Generate IDs for a framebuffer object and a color renderbuffer - UIScreen* mainscr = [UIScreen mainScreen]; + UIScreen *mainscr = [UIScreen mainScreen]; printf("******** screen size %i, %i\n", (int)mainscr.currentMode.size.width, (int)mainscr.currentMode.size.height); float minPointSize = MIN(mainscr.bounds.size.width, mainscr.bounds.size.height); float minScreenSize = MIN(mainscr.currentMode.size.width, mainscr.currentMode.size.height); @@ -345,8 +334,7 @@ static void clear_touches() { glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_DEPTH_COMPONENT16_OES, backingWidth, backingHeight); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_DEPTH_ATTACHMENT_OES, GL_RENDERBUFFER_OES, depthRenderbuffer); - if(glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) - { + if (glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES) != GL_FRAMEBUFFER_COMPLETE_OES) { NSLog(@"failed to make complete framebuffer object %x", glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES)); return NO; } @@ -366,22 +354,19 @@ static void clear_touches() { } // Clean up any buffers we have allocated. -- (void)destroyFramebuffer -{ +- (void)destroyFramebuffer { glDeleteFramebuffersOES(1, &viewFramebuffer); viewFramebuffer = 0; glDeleteRenderbuffersOES(1, &viewRenderbuffer); viewRenderbuffer = 0; - if(depthRenderbuffer) - { + if (depthRenderbuffer) { glDeleteRenderbuffersOES(1, &depthRenderbuffer); depthRenderbuffer = 0; } } -- (void)startAnimation -{ +- (void)startAnimation { if (active) return; active = TRUE; @@ -390,26 +375,23 @@ static void clear_touches() { // Approximate frame rate // assumes device refreshes at 60 fps - int frameInterval = (int) floor(animationInterval * 60.0f); + int frameInterval = (int)floor(animationInterval * 60.0f); displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView)]; [displayLink setFrameInterval:frameInterval]; // Setup DisplayLink in main thread [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; - } - else { + } else { animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES]; } - if (video_playing) - { + if (video_playing) { _unpause_video(); } } -- (void)stopAnimation -{ +- (void)stopAnimation { if (!active) return; active = FALSE; @@ -418,41 +400,38 @@ static void clear_touches() { if (useCADisplayLink) { [displayLink invalidate]; displayLink = nil; - } - else { + } else { [animationTimer invalidate]; animationTimer = nil; } clear_touches(); - if (video_playing) - { + if (video_playing) { // save position } } -- (void)setAnimationInterval:(NSTimeInterval)interval -{ +- (void)setAnimationInterval:(NSTimeInterval)interval { animationInterval = interval; - if ( (useCADisplayLink && displayLink) || ( !useCADisplayLink && animationTimer ) ) { + if ((useCADisplayLink && displayLink) || (!useCADisplayLink && animationTimer)) { [self stopAnimation]; [self startAnimation]; } } // Updates the OpenGL view when the timer fires -- (void)drawView -{ +- (void)drawView { if (useCADisplayLink) { // Pause the CADisplayLink to avoid recursion - [displayLink setPaused: YES]; + [displayLink setPaused:YES]; // Process all input events - while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource); + while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource) + ; // We are good to go, resume the CADisplayLink - [displayLink setPaused: NO]; + [displayLink setPaused:NO]; } if (!active) { @@ -464,8 +443,7 @@ static void clear_touches() { [EAGLContext setCurrentContext:context]; // If our drawing delegate needs to have the view setup, then call -setupView: and flag that it won't need to be called again. - if(!delegateSetup) - { + if (!delegateSetup) { [delegate setupView:self]; delegateSetup = YES; } @@ -479,19 +457,18 @@ static void clear_touches() { #ifdef DEBUG_ENABLED GLenum err = glGetError(); - if(err) + if (err) NSLog(@"%x error", err); #endif } -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - NSArray* tlist = [[event allTouches] allObjects]; - for (unsigned int i=0; i< [tlist count]; i++) { +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + NSArray *tlist = [[event allTouches] allObjects]; + for (unsigned int i = 0; i < [tlist count]; i++) { - if ( [touches containsObject:[tlist objectAtIndex:i]] ) { + if ([touches containsObject:[tlist objectAtIndex:i]]) { - UITouch* touch = [tlist objectAtIndex:i]; + UITouch *touch = [tlist objectAtIndex:i]; if (touch.phase != UITouchPhaseBegan) continue; int tid = get_touch_id(touch); @@ -502,15 +479,14 @@ static void clear_touches() { }; } -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - NSArray* tlist = [[event allTouches] allObjects]; - for (unsigned int i=0; i< [tlist count]; i++) { + NSArray *tlist = [[event allTouches] allObjects]; + for (unsigned int i = 0; i < [tlist count]; i++) { - if ( [touches containsObject:[tlist objectAtIndex:i]] ) { + if ([touches containsObject:[tlist objectAtIndex:i]]) { - UITouch* touch = [tlist objectAtIndex:i]; + UITouch *touch = [tlist objectAtIndex:i]; if (touch.phase != UITouchPhaseMoved) continue; int tid = get_touch_id(touch); @@ -521,17 +497,15 @@ static void clear_touches() { OSIPhone::get_singleton()->mouse_move(tid, prev_point.x * self.contentScaleFactor, prev_point.y * self.contentScaleFactor, touchPoint.x * self.contentScaleFactor, touchPoint.y * self.contentScaleFactor, first == tid); }; }; - } -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - NSArray* tlist = [[event allTouches] allObjects]; - for (unsigned int i=0; i< [tlist count]; i++) { +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + NSArray *tlist = [[event allTouches] allObjects]; + for (unsigned int i = 0; i < [tlist count]; i++) { - if ( [touches containsObject:[tlist objectAtIndex:i]] ) { + if ([touches containsObject:[tlist objectAtIndex:i]]) { - UITouch* touch = [tlist objectAtIndex:i]; + UITouch *touch = [tlist objectAtIndex:i]; if (touch.phase != UITouchPhaseEnded) continue; int tid = get_touch_id(touch); @@ -553,7 +527,6 @@ static void clear_touches() { return YES; }; - - (void)open_keyboard { //keyboard_text = p_existing; [self becomeFirstResponder]; @@ -578,12 +551,11 @@ static void clear_touches() { String character; character.parse_utf8([p_text UTF8String]); keyboard_text = keyboard_text + character; - OSIPhone::get_singleton()->key(character[0] == 10 ? KEY_ENTER : character[0] , true); + OSIPhone::get_singleton()->key(character[0] == 10 ? KEY_ENTER : character[0], true); printf("inserting text with character %i\n", character[0]); }; -- (void)audioRouteChangeListenerCallback:(NSNotification*)notification -{ +- (void)audioRouteChangeListenerCallback:(NSNotification *)notification { printf("*********** route changed!\n"); NSDictionary *interuptionDict = notification.userInfo; @@ -591,49 +563,48 @@ static void clear_touches() { switch (routeChangeReason) { - case AVAudioSessionRouteChangeReasonNewDeviceAvailable: + case AVAudioSessionRouteChangeReasonNewDeviceAvailable: { NSLog(@"AVAudioSessionRouteChangeReasonNewDeviceAvailable"); NSLog(@"Headphone/Line plugged in"); - break; + }; break; - case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: + case AVAudioSessionRouteChangeReasonOldDeviceUnavailable: { NSLog(@"AVAudioSessionRouteChangeReasonOldDeviceUnavailable"); NSLog(@"Headphone/Line was pulled. Resuming video play...."); if (_is_video_playing()) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [_instance.avPlayer play]; // NOTE: change this line according your current player implementation - NSLog(@"resumed play"); + [_instance.avPlayer play]; // NOTE: change this line according your current player implementation + NSLog(@"resumed play"); }); }; - break; + }; break; - case AVAudioSessionRouteChangeReasonCategoryChange: + case AVAudioSessionRouteChangeReasonCategoryChange: { // called at start - also when other audio wants to play NSLog(@"AVAudioSessionRouteChangeReasonCategoryChange"); - break; + }; break; } } - // When created via code however, we get initWithFrame --(id)initWithFrame:(CGRect)frame -{ +- (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; _instance = self; printf("after init super %p\n", self); - if(self != nil) - { + if (self != nil) { self = [self initGLES]; printf("after init gles %p\n", self); } init_touches(); - self. multipleTouchEnabled = YES; + self.multipleTouchEnabled = YES; printf("******** adding observer for sound routing changes\n"); - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioRouteChangeListenerCallback:) - name:AVAudioSessionRouteChangeNotification - object:nil]; + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(audioRouteChangeListenerCallback:) + name:AVAudioSessionRouteChangeNotification + object:nil]; //self.autoresizesSubviews = YES; //[self setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth]; @@ -641,21 +612,19 @@ static void clear_touches() { return self; } -// -(BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers { -// return YES; -// } +//- (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers { +// return YES; +//} -// - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ -// return YES; -// } +//- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{ +// return YES; +//} // Stop animating and release resources when they are no longer needed. -- (void)dealloc -{ +- (void)dealloc { [self stopAnimation]; - if([EAGLContext currentContext] == context) - { + if ([EAGLContext currentContext] == context) { [EAGLContext setCurrentContext:nil]; } @@ -665,32 +634,31 @@ static void clear_touches() { [super dealloc]; } -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object - change:(NSDictionary *)change context:(void *)context { +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (object == _instance.avPlayerItem && [keyPath isEqualToString:@"status"]) { - if (_instance.avPlayerItem.status == AVPlayerStatusFailed || _instance.avPlayer.status == AVPlayerStatusFailed) { - _stop_video(); - video_found_error = true; - } + if (_instance.avPlayerItem.status == AVPlayerStatusFailed || _instance.avPlayer.status == AVPlayerStatusFailed) { + _stop_video(); + video_found_error = true; + } - if(_instance.avPlayer.status == AVPlayerStatusReadyToPlay && - _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay && - CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) { + if (_instance.avPlayer.status == AVPlayerStatusReadyToPlay && + _instance.avPlayerItem.status == AVPlayerItemStatusReadyToPlay && + CMTIME_COMPARE_INLINE(video_current_time, ==, kCMTimeZero)) { - //NSLog(@"time: %@", video_current_time); + //NSLog(@"time: %@", video_current_time); - [_instance.avPlayer seekToTime:video_current_time]; - video_current_time = kCMTimeZero; + [_instance.avPlayer seekToTime:video_current_time]; + video_current_time = kCMTimeZero; } - } + } if (object == _instance.avPlayer && [keyPath isEqualToString:@"rate"]) { NSLog(@"Player playback rate changed: %.5f", _instance.avPlayer.rate); if (_is_video_playing() && _instance.avPlayer.rate == 0.0 && !_instance.avPlayer.error) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5f * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [_instance.avPlayer play]; // NOTE: change this line according your current player implementation - NSLog(@"resumed play"); + [_instance.avPlayer play]; // NOTE: change this line according your current player implementation + NSLog(@"resumed play"); }); NSLog(@" . . . PAUSED (or just started)"); @@ -699,40 +667,40 @@ static void clear_touches() { } - (void)playerItemDidReachEnd:(NSNotification *)notification { - _stop_video(); + _stop_video(); } /* - (void)moviePlayBackDidFinish:(NSNotification*)notification { - NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; - switch ([reason intValue]) { - case MPMovieFinishReasonPlaybackEnded: - //NSLog(@"Playback Ended"); - break; - case MPMovieFinishReasonPlaybackError: - //NSLog(@"Playback Error"); - video_found_error = true; - break; - case MPMovieFinishReasonUserExited: - //NSLog(@"User Exited"); - video_found_error = true; - break; - default: - //NSLog(@"Unsupported reason!"); - break; - } - - MPMoviePlayerController *player = [notification object]; - - [[NSNotificationCenter defaultCenter] - removeObserver:self - name:MPMoviePlayerPlaybackDidFinishNotification - object:player]; - - [_instance.moviePlayerController stop]; - [_instance.moviePlayerController.view removeFromSuperview]; + NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey]; + switch ([reason intValue]) { + case MPMovieFinishReasonPlaybackEnded: + //NSLog(@"Playback Ended"); + break; + case MPMovieFinishReasonPlaybackError: + //NSLog(@"Playback Error"); + video_found_error = true; + break; + case MPMovieFinishReasonUserExited: + //NSLog(@"User Exited"); + video_found_error = true; + break; + default: + //NSLog(@"Unsupported reason!"); + break; + } + + MPMoviePlayerController *player = [notification object]; + + [[NSNotificationCenter defaultCenter] + removeObserver:self + name:MPMoviePlayerPlaybackDidFinishNotification + object:player]; + + [_instance.moviePlayerController stop]; + [_instance.moviePlayerController.view removeFromSuperview]; //[[MPMusicPlayerController applicationMusicPlayer] setVolume: video_previous_volume]; video_playing = false; diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm index 180e38ba81..94c3d2ef91 100644 --- a/platform/iphone/icloud.mm +++ b/platform/iphone/icloud.mm @@ -35,24 +35,25 @@ extern "C" { #endif -#import <Foundation/Foundation.h> #import "app_delegate.h" +#import <Foundation/Foundation.h> + #ifndef __IPHONE_9_0 }; #endif -ICloud* ICloud::instance = NULL; +ICloud *ICloud::instance = NULL; void ICloud::_bind_methods() { - ClassDB::bind_method(D_METHOD("remove_key"),&ICloud::remove_key); - ClassDB::bind_method(D_METHOD("set_key_values"),&ICloud::set_key_values); - ClassDB::bind_method(D_METHOD("get_key_value"),&ICloud::get_key_value); - ClassDB::bind_method(D_METHOD("synchronize_key_values"),&ICloud::synchronize_key_values); - ClassDB::bind_method(D_METHOD("get_all_key_values"),&ICloud::get_all_key_values); - - ClassDB::bind_method(D_METHOD("get_pending_event_count"),&ICloud::get_pending_event_count); - ClassDB::bind_method(D_METHOD("pop_pending_event"),&ICloud::pop_pending_event); + ClassDB::bind_method(D_METHOD("remove_key"), &ICloud::remove_key); + ClassDB::bind_method(D_METHOD("set_key_values"), &ICloud::set_key_values); + ClassDB::bind_method(D_METHOD("get_key_value"), &ICloud::get_key_value); + ClassDB::bind_method(D_METHOD("synchronize_key_values"), &ICloud::synchronize_key_values); + ClassDB::bind_method(D_METHOD("get_all_key_values"), &ICloud::get_all_key_values); + + ClassDB::bind_method(D_METHOD("get_pending_event_count"), &ICloud::get_pending_event_count); + ClassDB::bind_method(D_METHOD("pop_pending_event"), &ICloud::pop_pending_event); }; int ICloud::get_pending_event_count() { @@ -68,19 +69,18 @@ Variant ICloud::pop_pending_event() { return front; }; -ICloud* ICloud::get_singleton() { +ICloud *ICloud::get_singleton() { return instance; }; //convert from apple's abstract type to godot's abstract type.... -Variant nsobject_to_variant(NSObject* object) { +Variant nsobject_to_variant(NSObject *object) { if ([object isKindOfClass:[NSString class]]) { - const char* str = [(NSString*)object UTF8String]; + const char *str = [(NSString *)object UTF8String]; return String::utf8(str != NULL ? str : ""); - } - else if ([object isKindOfClass:[NSData class]]) { + } else if ([object isKindOfClass:[NSData class]]) { PoolByteArray ret; - NSData* data = (NSData*)object; + NSData *data = (NSData *)object; if ([data length] > 0) { ret.resize([data length]); { @@ -89,95 +89,78 @@ Variant nsobject_to_variant(NSObject* object) { } } return ret; - } - else if ([object isKindOfClass:[NSArray class]]) { + } else if ([object isKindOfClass:[NSArray class]]) { Array result; - NSArray* array = (NSArray*)object; + NSArray *array = (NSArray *)object; for (unsigned int i = 0; i < [array count]; ++i) { - NSObject* value = [array objectAtIndex:i]; + NSObject *value = [array objectAtIndex:i]; result.push_back(nsobject_to_variant(value)); } return result; - } - else if ([object isKindOfClass:[NSDictionary class]]) { + } else if ([object isKindOfClass:[NSDictionary class]]) { Dictionary result; - NSDictionary* dic = (NSDictionary*)object; + NSDictionary *dic = (NSDictionary *)object; - - NSArray* keys = [dic allKeys]; + NSArray *keys = [dic allKeys]; int count = [keys count]; - for (int i=0; i < count; ++i) { - NSObject* k = [ keys objectAtIndex:i]; - NSObject* v = [dic objectForKey:k]; + for (int i = 0; i < count; ++i) { + NSObject *k = [keys objectAtIndex:i]; + NSObject *v = [dic objectForKey:k]; result[nsobject_to_variant(k)] = nsobject_to_variant(v); } return result; - } - else if ([object isKindOfClass:[NSNumber class]]) { + } else if ([object isKindOfClass:[NSNumber class]]) { //Every type except numbers can reliably identify its type. The following is comparing to the *internal* representation, which isn't guaranteed to match the type that was used to create it, and is not advised, particularly when dealing with potential platform differences (ie, 32/64 bit) //To avoid errors, we'll cast as broadly as possible, and only return int or float. //bool, char, int, uint, longlong -> int //float, double -> float - NSNumber* num = (NSNumber*)object; - if(strcmp([num objCType], @encode(BOOL)) == 0) { + NSNumber *num = (NSNumber *)object; + if (strcmp([num objCType], @encode(BOOL)) == 0) { return Variant((int)[num boolValue]); - } - else if(strcmp([num objCType], @encode(char)) == 0) { + } else if (strcmp([num objCType], @encode(char)) == 0) { return Variant((int)[num charValue]); - } - else if(strcmp([num objCType], @encode(int)) == 0) { + } else if (strcmp([num objCType], @encode(int)) == 0) { return Variant([num intValue]); - } - else if(strcmp([num objCType], @encode(unsigned int)) == 0) { + } else if (strcmp([num objCType], @encode(unsigned int)) == 0) { return Variant((int)[num unsignedIntValue]); - } - else if(strcmp([num objCType], @encode(long long)) == 0) { + } else if (strcmp([num objCType], @encode(long long)) == 0) { return Variant((int)[num longValue]); - } - else if(strcmp([num objCType], @encode(float)) == 0) { + } else if (strcmp([num objCType], @encode(float)) == 0) { return Variant([num floatValue]); - } - else if(strcmp([num objCType], @encode(double)) == 0) { + } else if (strcmp([num objCType], @encode(double)) == 0) { return Variant((float)[num doubleValue]); } - } - else if ([object isKindOfClass:[NSDate class]]) { + } else if ([object isKindOfClass:[NSDate class]]) { //this is a type that icloud supports...but how did you submit it in the first place? //I guess this is a type that *might* show up, if you were, say, trying to make your game //compatible with existing cloud data written by another engine's version of your game WARN_PRINT("NSDate unsupported, returning null Variant") return Variant(); - } - else if ([object isKindOfClass:[NSNull class]] or object == nil) { + } else if ([object isKindOfClass:[NSNull class]] or object == nil) { return Variant(); - } - else { + } else { WARN_PRINT("Trying to convert unknown NSObject type to Variant"); return Variant(); } } -NSObject* variant_to_nsobject(Variant v) { +NSObject *variant_to_nsobject(Variant v) { if (v.get_type() == Variant::STRING) { return [[[NSString alloc] initWithUTF8String:((String)v).utf8().get_data()] autorelease]; - } - else if (v.get_type() == Variant::REAL) { + } else if (v.get_type() == Variant::REAL) { return [NSNumber numberWithDouble:(double)v]; - } - else if (v.get_type() == Variant::INT) { + } else if (v.get_type() == Variant::INT) { return [NSNumber numberWithLongLong:(long)(int)v]; - } - else if (v.get_type() == Variant::BOOL) { + } else if (v.get_type() == Variant::BOOL) { return [NSNumber numberWithBool:BOOL((bool)v)]; - } - else if (v.get_type() == Variant::DICTIONARY) { - NSMutableDictionary* result = [[[NSMutableDictionary alloc] init] autorelease]; + } else if (v.get_type() == Variant::DICTIONARY) { + NSMutableDictionary *result = [[[NSMutableDictionary alloc] init] autorelease]; Dictionary dic = v; Array keys = dic.keys(); for (unsigned int i = 0; i < keys.size(); ++i) { - NSString* key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease]; - NSObject* value = variant_to_nsobject(dic[keys[i]]); + NSString *key = [[[NSString alloc] initWithUTF8String:((String)(keys[i])).utf8().get_data()] autorelease]; + NSObject *value = variant_to_nsobject(dic[keys[i]]); if (key == NULL || value == NULL) { return NULL; @@ -186,12 +169,11 @@ NSObject* variant_to_nsobject(Variant v) { [result setObject:value forKey:key]; } return result; - } - else if (v.get_type() == Variant::ARRAY) { - NSMutableArray* result = [[[NSMutableArray alloc] init] autorelease]; + } else if (v.get_type() == Variant::ARRAY) { + NSMutableArray *result = [[[NSMutableArray alloc] init] autorelease]; Array arr = v; for (unsigned int i = 0; i < arr.size(); ++i) { - NSObject* value = variant_to_nsobject(arr[i]); + NSObject *value = variant_to_nsobject(arr[i]); if (value == NULL) { //trying to add something unsupported to the array. cancel the whole array return NULL; @@ -199,21 +181,19 @@ NSObject* variant_to_nsobject(Variant v) { [result addObject:value]; } return result; - } - else if (v.get_type() == Variant::POOL_BYTE_ARRAY) { + } else if (v.get_type() == Variant::POOL_BYTE_ARRAY) { PoolByteArray arr = v; PoolByteArray::Read r = arr.read(); - NSData* result = [NSData dataWithBytes:r.ptr() length:arr.size()]; + NSData *result = [NSData dataWithBytes:r.ptr() length:arr.size()]; return result; } - WARN_PRINT(String("Could not add unsupported type to iCloud: '" + Variant::get_type_name(v.get_type())+"'").utf8().get_data()); + WARN_PRINT(String("Could not add unsupported type to iCloud: '" + Variant::get_type_name(v.get_type()) + "'").utf8().get_data()); return NULL; } - Error ICloud::remove_key(Variant p_param) { String param = p_param; - NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; + NSString *key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; @@ -236,13 +216,13 @@ Variant ICloud::set_key_values(Variant p_params) { String variant_key = keys[i]; Variant variant_value = params[variant_key]; - NSString* key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease]; + NSString *key = [[[NSString alloc] initWithUTF8String:variant_key.utf8().get_data()] autorelease]; if (key == NULL) { error_keys.push_back(variant_key); continue; } - NSObject* value = variant_to_nsobject(variant_value); + NSObject *value = variant_to_nsobject(variant_value); if (value == NULL) { error_keys.push_back(variant_key); @@ -259,7 +239,7 @@ Variant ICloud::set_key_values(Variant p_params) { Variant ICloud::get_key_value(Variant p_param) { String param = p_param; - NSString* key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; + NSString *key = [[[NSString alloc] initWithUTF8String:param.utf8().get_data()] autorelease]; NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; if (![[store dictionaryRepresentation] objectForKey:key]) { @@ -274,16 +254,16 @@ Variant ICloud::get_key_value(Variant p_param) { Variant ICloud::get_all_key_values() { Dictionary result; - NSUbiquitousKeyValueStore* store = [NSUbiquitousKeyValueStore defaultStore]; - NSDictionary* store_dictionary = [store dictionaryRepresentation]; + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; + NSDictionary *store_dictionary = [store dictionaryRepresentation]; - NSArray* keys = [store_dictionary allKeys]; + NSArray *keys = [store_dictionary allKeys]; int count = [keys count]; - for (int i=0; i < count; ++i) { - NSString* k = [ keys objectAtIndex:i]; - NSObject* v = [store_dictionary objectForKey:k]; + for (int i = 0; i < count; ++i) { + NSString *k = [keys objectAtIndex:i]; + NSObject *v = [store_dictionary objectForKey:k]; - const char* str = [k UTF8String]; + const char *str = [k UTF8String]; if (str != NULL) { result[String::utf8(str)] = nsobject_to_variant(v); } @@ -297,8 +277,7 @@ Error ICloud::synchronize_key_values() { BOOL result = [store synchronize]; if (result == YES) { return OK; - } - else { + } else { return FAILED; } } @@ -307,14 +286,14 @@ Error ICloud::initial_sync() { //you sometimes have to write something to the store to get it to download new data. go apple! NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; if ([store boolForKey:@"isb"]) - { - [store setBool:NO forKey:@"isb"]; - } - else - { - [store setBool:YES forKey:@"isb"]; - } - return synchronize(); + { + [store setBool:NO forKey:@"isb"]; + } + else + { + [store setBool:YES forKey:@"isb"]; + } + return synchronize(); } */ ICloud::ICloud() { @@ -322,65 +301,56 @@ ICloud::ICloud() { instance = this; //connected = false; - [ - //[NSNotificationCenter defaultCenter] addObserverForName: @"notify" - [NSNotificationCenter defaultCenter] addObserverForName: NSUbiquitousKeyValueStoreDidChangeExternallyNotification - object: [NSUbiquitousKeyValueStore defaultStore] - queue: nil - usingBlock: ^ (NSNotification * notification) { - NSDictionary* userInfo = [notification userInfo]; - NSInteger change = [[userInfo objectForKey:NSUbiquitousKeyValueStoreChangeReasonKey] integerValue]; - - Dictionary ret; - ret["type"] = "key_value_changed"; - - //PoolStringArray result_keys; - //Array result_values; - Dictionary keyValues; - String reason = ""; - - if (change == NSUbiquitousKeyValueStoreServerChange) { - reason = "server"; - } - else if (change == NSUbiquitousKeyValueStoreInitialSyncChange) { - reason = "initial_sync"; - } - else if (change == NSUbiquitousKeyValueStoreQuotaViolationChange) { - reason = "quota_violation"; - } - else if (change == NSUbiquitousKeyValueStoreAccountChange) { - reason = "account"; - } - - ret["reason"] = reason; - - - NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; - - NSArray * keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey]; - for (NSString* key in keys) { - const char* str = [key UTF8String]; - if (str == NULL) { - continue; - } - - NSObject* object = [store objectForKey:key]; - - //figure out what kind of object it is - Variant value = nsobject_to_variant(object); - - keyValues[String::utf8(str)] = value; - } - - ret["changed_values"] = keyValues; - pending_events.push_back(ret); - } - ]; + [[NSNotificationCenter defaultCenter] + addObserverForName:NSUbiquitousKeyValueStoreDidChangeExternallyNotification + object:[NSUbiquitousKeyValueStore defaultStore] + queue:nil + usingBlock:^(NSNotification *notification) { + NSDictionary *userInfo = [notification userInfo]; + NSInteger change = [[userInfo objectForKey:NSUbiquitousKeyValueStoreChangeReasonKey] integerValue]; + + Dictionary ret; + ret["type"] = "key_value_changed"; + + //PoolStringArray result_keys; + //Array result_values; + Dictionary keyValues; + String reason = ""; + + if (change == NSUbiquitousKeyValueStoreServerChange) { + reason = "server"; + } else if (change == NSUbiquitousKeyValueStoreInitialSyncChange) { + reason = "initial_sync"; + } else if (change == NSUbiquitousKeyValueStoreQuotaViolationChange) { + reason = "quota_violation"; + } else if (change == NSUbiquitousKeyValueStoreAccountChange) { + reason = "account"; + } + + ret["reason"] = reason; + + NSUbiquitousKeyValueStore *store = [NSUbiquitousKeyValueStore defaultStore]; + + NSArray *keys = [userInfo objectForKey:NSUbiquitousKeyValueStoreChangedKeysKey]; + for (NSString *key in keys) { + const char *str = [key UTF8String]; + if (str == NULL) { + continue; + } + + NSObject *object = [store objectForKey:key]; + + //figure out what kind of object it is + Variant value = nsobject_to_variant(object); + + keyValues[String::utf8(str)] = value; + } + + ret["changed_values"] = keyValues; + pending_events.push_back(ret); + }]; } - -ICloud::~ICloud() { - -}; +ICloud::~ICloud(){}; #endif diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm index 6f4d0f927c..710df0f757 100644 --- a/platform/iphone/in_app_store.mm +++ b/platform/iphone/in_app_store.mm @@ -29,30 +29,29 @@ /*************************************************************************/ #ifdef STOREKIT_ENABLED +#include "in_app_store.h" + #ifdef MODULE_FUSEBOXX_ENABLED #import "modules/fuseboxx/ios/FuseSDK.h" #endif -#include "in_app_store.h" - extern "C" { -#import <StoreKit/StoreKit.h> #import <Foundation/Foundation.h> +#import <StoreKit/StoreKit.h> }; bool auto_finish_transactions = true; -NSMutableDictionary* pending_transactions = [NSMutableDictionary dictionary]; +NSMutableDictionary *pending_transactions = [NSMutableDictionary dictionary]; @interface SKProduct (LocalizedPrice) -@property (nonatomic, readonly) NSString *localizedPrice; +@property(nonatomic, readonly) NSString *localizedPrice; @end //----------------------------------// // SKProduct extension //----------------------------------// @implementation SKProduct (LocalizedPrice) -- (NSString *)localizedPrice -{ +- (NSString *)localizedPrice { NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init]; [numberFormatter setFormatterBehavior:NSNumberFormatterBehavior10_4]; [numberFormatter setNumberStyle:NSNumberFormatterCurrencyStyle]; @@ -63,30 +62,28 @@ NSMutableDictionary* pending_transactions = [NSMutableDictionary dictionary]; } @end - -InAppStore* InAppStore::instance = NULL; +InAppStore *InAppStore::instance = NULL; void InAppStore::_bind_methods() { - ClassDB::bind_method(D_METHOD("request_product_info"),&InAppStore::request_product_info); - ClassDB::bind_method(D_METHOD("purchase"),&InAppStore::purchase); + ClassDB::bind_method(D_METHOD("request_product_info"), &InAppStore::request_product_info); + ClassDB::bind_method(D_METHOD("purchase"), &InAppStore::purchase); - ClassDB::bind_method(D_METHOD("get_pending_event_count"),&InAppStore::get_pending_event_count); - ClassDB::bind_method(D_METHOD("pop_pending_event"),&InAppStore::pop_pending_event); - ClassDB::bind_method(D_METHOD("finish_transaction"),&InAppStore::finish_transaction); - ClassDB::bind_method(D_METHOD("set_auto_finish_transaction"),&InAppStore::set_auto_finish_transaction); + ClassDB::bind_method(D_METHOD("get_pending_event_count"), &InAppStore::get_pending_event_count); + ClassDB::bind_method(D_METHOD("pop_pending_event"), &InAppStore::pop_pending_event); + ClassDB::bind_method(D_METHOD("finish_transaction"), &InAppStore::finish_transaction); + ClassDB::bind_method(D_METHOD("set_auto_finish_transaction"), &InAppStore::set_auto_finish_transaction); }; -@interface ProductsDelegate : NSObject<SKProductsRequestDelegate> { - +@interface ProductsDelegate : NSObject <SKProductsRequestDelegate> { }; @end @implementation ProductsDelegate -- (void)productsRequest:(SKProductsRequest*)request didReceiveResponse:(SKProductsResponse*)response { +- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { - NSArray* products = response.products; + NSArray *products = response.products; Dictionary ret; ret["type"] = "product_info"; ret["result"] = "ok"; @@ -96,11 +93,11 @@ void InAppStore::_bind_methods() { PoolStringArray ids; PoolStringArray localized_prices; - for (int i=0; i<[products count]; i++) { + for (int i = 0; i < [products count]; i++) { - SKProduct* product = [products objectAtIndex:i]; + SKProduct *product = [products objectAtIndex:i]; - const char* str = [product.localizedTitle UTF8String]; + const char *str = [product.localizedTitle UTF8String]; titles.push_back(String::utf8(str != NULL ? str : "")); str = [product.localizedDescription UTF8String]; @@ -117,7 +114,7 @@ void InAppStore::_bind_methods() { PoolStringArray invalid_ids; - for (NSString* ipid in response.invalidProductIdentifiers) { + for (NSString *ipid in response.invalidProductIdentifiers) { invalid_ids.push_back(String::utf8([ipid UTF8String])); }; @@ -138,15 +135,15 @@ Error InAppStore::request_product_info(Variant p_params) { PoolStringArray pids = params["product_ids"]; printf("************ request product info! %i\n", pids.size()); - NSMutableArray* array = [[[NSMutableArray alloc] initWithCapacity:pids.size()] autorelease]; - for (int i=0; i<pids.size(); i++) { + NSMutableArray *array = [[[NSMutableArray alloc] initWithCapacity:pids.size()] autorelease]; + for (int i = 0; i < pids.size(); i++) { printf("******** adding %ls to product list\n", pids[i].c_str()); - NSString* pid = [[[NSString alloc] initWithUTF8String:pids[i].utf8().get_data()] autorelease]; + NSString *pid = [[[NSString alloc] initWithUTF8String:pids[i].utf8().get_data()] autorelease]; [array addObject:pid]; }; - NSSet* products = [[[NSSet alloc] initWithArray:array] autorelease]; - SKProductsRequest* request = [[SKProductsRequest alloc] initWithProductIdentifiers:products]; + NSSet *products = [[[NSSet alloc] initWithArray:array] autorelease]; + SKProductsRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers:products]; ProductsDelegate *delegate = [[ProductsDelegate alloc] init]; @@ -156,131 +153,123 @@ Error InAppStore::request_product_info(Variant p_params) { return OK; }; -@interface TransObserver : NSObject<SKPaymentTransactionObserver> { - +@interface TransObserver : NSObject <SKPaymentTransactionObserver> { }; @end @implementation TransObserver -- (void)paymentQueue:(SKPaymentQueue*)queue updatedTransactions:(NSArray*) transactions { +- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions { - printf("transactions updated!\n"); - for (SKPaymentTransaction* transaction in transactions) { + printf("transactions updated!\n"); + for (SKPaymentTransaction *transaction in transactions) { switch (transaction.transactionState) { + case SKPaymentTransactionStatePurchased: { + printf("status purchased!\n"); + String pid = String::utf8([transaction.payment.productIdentifier UTF8String]); + String transactionId = String::utf8([transaction.transactionIdentifier UTF8String]); + InAppStore::get_singleton()->_record_purchase(pid); + Dictionary ret; + ret["type"] = "purchase"; + ret["result"] = "ok"; + ret["product_id"] = pid; + ret["transaction_id"] = transactionId; + + NSData *receipt = nil; + int sdk_version = 6; + + if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { + + NSURL *receiptFileURL = nil; + NSBundle *bundle = [NSBundle mainBundle]; + if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) { + + // Get the transaction receipt file path location in the app bundle. + receiptFileURL = [bundle appStoreReceiptURL]; + + // Read in the contents of the transaction file. + receipt = [NSData dataWithContentsOfURL:receiptFileURL]; + sdk_version = 7; + + } else { + // Fall back to deprecated transaction receipt, + // which is still available in iOS 7. + + // Use SKPaymentTransaction's transactionReceipt. + receipt = transaction.transactionReceipt; + } + + } else { + receipt = transaction.transactionReceipt; + } + + NSString *receipt_to_send = nil; + if (receipt != nil) { + receipt_to_send = [receipt description]; + } + Dictionary receipt_ret; + receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : ""); + receipt_ret["sdk"] = sdk_version; + ret["receipt"] = receipt_ret; + + InAppStore::get_singleton()->_post_event(ret); + + if (auto_finish_transactions) { + [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; + } else { + [pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier]; + } - case SKPaymentTransactionStatePurchased: { - printf("status purchased!\n"); - String pid = String::utf8([transaction.payment.productIdentifier UTF8String]); - String transactionId = String::utf8([transaction.transactionIdentifier UTF8String]); - InAppStore::get_singleton()->_record_purchase(pid); - Dictionary ret; - ret["type"] = "purchase"; - ret["result"] = "ok"; - ret["product_id"] = pid; - ret["transaction_id"] = transactionId; - - NSData* receipt = nil; - int sdk_version = 6; - - if([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0){ - - NSURL *receiptFileURL = nil; - NSBundle *bundle = [NSBundle mainBundle]; - if ([bundle respondsToSelector:@selector(appStoreReceiptURL)]) { - - // Get the transaction receipt file path location in the app bundle. - receiptFileURL = [bundle appStoreReceiptURL]; - - // Read in the contents of the transaction file. - receipt = [NSData dataWithContentsOfURL:receiptFileURL]; - sdk_version = 7; - - } else { - // Fall back to deprecated transaction receipt, - // which is still available in iOS 7. - - // Use SKPaymentTransaction's transactionReceipt. - receipt = transaction.transactionReceipt; - } - - }else{ - receipt = transaction.transactionReceipt; - } - - NSString* receipt_to_send = nil; - if (receipt != nil) - { - receipt_to_send = [receipt description]; - } - Dictionary receipt_ret; - receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : ""); - receipt_ret["sdk"] = sdk_version; - ret["receipt"] = receipt_ret; - - InAppStore::get_singleton()->_post_event(ret); - - if (auto_finish_transactions){ - [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; - } - else{ - [pending_transactions setObject:transaction forKey:transaction.payment.productIdentifier]; - } - - #ifdef MODULE_FUSEBOXX_ENABLED - printf("Registering transaction on Fuseboxx!\n"); - [FuseSDK registerInAppPurchase: transaction]; - #endif - } break; - case SKPaymentTransactionStateFailed: { - printf("status transaction failed!\n"); - String pid = String::utf8([transaction.payment.productIdentifier UTF8String]); - Dictionary ret; - ret["type"] = "purchase"; - ret["result"] = "error"; - ret["product_id"] = pid; - InAppStore::get_singleton()->_post_event(ret); - [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; - } break; - case SKPaymentTransactionStateRestored: { - printf("status transaction restored!\n"); - String pid = String::utf8([transaction.originalTransaction.payment.productIdentifier UTF8String]); - InAppStore::get_singleton()->_record_purchase(pid); - [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; - } break; - - default: - printf("status default %i!\n", (int)transaction.transactionState); - - break; +#ifdef MODULE_FUSEBOXX_ENABLED + printf("Registering transaction on Fuseboxx!\n"); + [FuseSDK registerInAppPurchase:transaction]; +#endif + }; break; + case SKPaymentTransactionStateFailed: { + printf("status transaction failed!\n"); + String pid = String::utf8([transaction.payment.productIdentifier UTF8String]); + Dictionary ret; + ret["type"] = "purchase"; + ret["result"] = "error"; + ret["product_id"] = pid; + InAppStore::get_singleton()->_post_event(ret); + [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; + } break; + case SKPaymentTransactionStateRestored: { + printf("status transaction restored!\n"); + String pid = String::utf8([transaction.originalTransaction.payment.productIdentifier UTF8String]); + InAppStore::get_singleton()->_record_purchase(pid); + [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; + } break; + default: { + printf("status default %i!\n", (int)transaction.transactionState); + }; break; }; }; }; @end - Error InAppStore::purchase(Variant p_params) { ERR_FAIL_COND_V(![SKPaymentQueue canMakePayments], ERR_UNAVAILABLE); if (![SKPaymentQueue canMakePayments]) return ERR_UNAVAILABLE; - printf("purchasing!\n"); + printf("purchasing!\n"); Dictionary params = p_params; ERR_FAIL_COND_V(!params.has("product_id"), ERR_INVALID_PARAMETER); NSString *pid = [[[NSString alloc] initWithUTF8String:String(params["product_id"]).utf8().get_data()] autorelease]; SKPayment *payment = [SKPayment paymentWithProductIdentifier:pid]; - SKPaymentQueue* defq = [SKPaymentQueue defaultQueue]; + SKPaymentQueue *defq = [SKPaymentQueue defaultQueue]; [defq addPayment:payment]; - printf("purchase sent!\n"); + printf("purchase sent!\n"); return OK; }; - int InAppStore::get_pending_event_count() { return pending_events.size(); }; @@ -300,13 +289,13 @@ void InAppStore::_post_event(Variant p_event) { void InAppStore::_record_purchase(String product_id) { - String skey = "purchased/"+product_id; - NSString* key = [[[NSString alloc] initWithUTF8String:skey.utf8().get_data()] autorelease]; + String skey = "purchased/" + product_id; + NSString *key = [[[NSString alloc] initWithUTF8String:skey.utf8().get_data()] autorelease]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:key]; [[NSUserDefaults standardUserDefaults] synchronize]; }; -InAppStore* InAppStore::get_singleton() { +InAppStore *InAppStore::get_singleton() { return instance; }; @@ -316,27 +305,24 @@ InAppStore::InAppStore() { instance = this; auto_finish_transactions = false; - TransObserver* observer = [[TransObserver alloc] init]; + TransObserver *observer = [[TransObserver alloc] init]; [[SKPaymentQueue defaultQueue] addTransactionObserver:observer]; - //pending_transactions = [NSMutableDictionary dictionary]; + //pending_transactions = [NSMutableDictionary dictionary]; }; -void InAppStore::finish_transaction(String product_id){ - NSString* prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding]; +void InAppStore::finish_transaction(String product_id) { + NSString *prod_id = [NSString stringWithCString:product_id.utf8().get_data() encoding:NSUTF8StringEncoding]; - if ([pending_transactions objectForKey:prod_id]){ + if ([pending_transactions objectForKey:prod_id]) { [[SKPaymentQueue defaultQueue] finishTransaction:[pending_transactions objectForKey:prod_id]]; - [pending_transactions removeObjectForKey:prod_id]; + [pending_transactions removeObjectForKey:prod_id]; } }; -void InAppStore::set_auto_finish_transaction(bool b){ - auto_finish_transactions = b; +void InAppStore::set_auto_finish_transaction(bool b) { + auto_finish_transactions = b; } -InAppStore::~InAppStore() { - -}; - +InAppStore::~InAppStore(){}; #endif diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm index fe8412d5fd..cd64bbfafc 100644 --- a/platform/iphone/ios.mm +++ b/platform/iphone/ios.mm @@ -33,7 +33,7 @@ void iOS::_bind_methods() { - ClassDB::bind_method(D_METHOD("get_rate_url","app_id"),&iOS::get_rate_url); + ClassDB::bind_method(D_METHOD("get_rate_url", "app_id"), &iOS::get_rate_url); }; String iOS::get_rate_url(int p_app_id) const { @@ -44,14 +44,11 @@ String iOS::get_rate_url(int p_app_id) const { //ios7 before String ret = templ; - // iOS 7 needs a different templateReviewURL @see https://github.com/arashpayan/appirater/issues/131 - if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 7.1) - { + if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 && [[[UIDevice currentDevice] systemVersion] floatValue] < 7.1) { + // iOS 7 needs a different templateReviewURL @see https://github.com/arashpayan/appirater/issues/131 ret = templ_iOS7; - } - // iOS 8 needs a different templateReviewURL also @see https://github.com/arashpayan/appirater/issues/182 - else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) - { + } else if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0) { + // iOS 8 needs a different templateReviewURL also @see https://github.com/arashpayan/appirater/issues/182 ret = templ_iOS8; } @@ -62,4 +59,4 @@ String iOS::get_rate_url(int p_app_id) const { return ret; }; -iOS::iOS() {}; +iOS::iOS(){}; diff --git a/platform/iphone/main.m b/platform/iphone/main.m index 43c3c8c8cc..6757cc8146 100644 --- a/platform/iphone/main.m +++ b/platform/iphone/main.m @@ -27,25 +27,24 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#import <UIKit/UIKit.h> #import "app_delegate.h" + +#import <UIKit/UIKit.h> #include <stdio.h> int gargc; -char** gargv; +char **gargv; -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { printf("*********** main.m\n"); gargc = argc; gargv = argv; NSAutoreleasePool *pool = [NSAutoreleasePool new]; - AppDelegate* app = [AppDelegate alloc]; + AppDelegate *app = [AppDelegate alloc]; printf("running app main\n"); UIApplicationMain(argc, argv, nil, @"AppDelegate"); printf("main done, pool release\n"); [pool release]; return 0; } - diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index 0f693cd2cc..bc25afabea 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -233,7 +233,7 @@ void OSIPhone::mouse_button(int p_idx, int p_x, int p_y, bool p_pressed, bool p_ //mouse_list.pressed[p_idx] = p_pressed; - input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); + input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); ev.mouse_button.button_index = BUTTON_LEFT; ev.mouse_button.doubleclick = p_doubleclick; ev.mouse_button.pressed = p_pressed; @@ -276,7 +276,7 @@ void OSIPhone::mouse_move(int p_idx, int p_prev_x, int p_prev_y, int p_x, int p_ ev.mouse_motion.relative_y = ev.mouse_motion.y - p_prev_x; }; - input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); + input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); ev.mouse_motion.speed_x = input->get_last_mouse_speed().x; ev.mouse_motion.speed_y = input->get_last_mouse_speed().y; ev.mouse_motion.button_mask = 1; // pressed @@ -393,7 +393,7 @@ bool OSIPhone::is_mouse_grab_enabled() const { return true; }; -Point2 OSIPhone::get_mouse_pos() const { +Point2 OSIPhone::get_mouse_position() const { return Point2(); }; diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index b5fe93240a..754dea073f 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -150,7 +150,7 @@ public: virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index 773ca62d2e..574598e1d3 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -33,44 +33,43 @@ extern "C" { -int add_path(int, char**); -int add_cmdline(int, char**); +int add_path(int, char **); +int add_cmdline(int, char **); -int add_path(int p_argc, char** p_args) { +int add_path(int p_argc, char **p_args) { - NSString* str = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_path"]; + NSString *str = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_path"]; if (!str) return p_argc; p_args[p_argc++] = "-path"; [str retain]; // memory leak lol (maybe make it static here and delete it in ViewController destructor? @todo - p_args[p_argc++] = (char*)[str cString]; + p_args[p_argc++] = (char *)[str cString]; p_args[p_argc] = NULL; return p_argc; }; -int add_cmdline(int p_argc, char** p_args) { +int add_cmdline(int p_argc, char **p_args) { - NSArray* arr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_cmdline"]; + NSArray *arr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"godot_cmdline"]; if (!arr) return p_argc; - for (int i=0; i < [arr count]; i++) { + for (int i = 0; i < [arr count]; i++) { - NSString* str = [arr objectAtIndex:i]; + NSString *str = [arr objectAtIndex:i]; if (!str) continue; [str retain]; // @todo delete these at some point - p_args[p_argc++] = (char*)[str cString]; + p_args[p_argc++] = (char *)[str cString]; }; p_args[p_argc] = NULL; return p_argc; }; - -}; +}; // extern "C" @interface ViewController () @@ -85,59 +84,58 @@ int add_cmdline(int p_argc, char** p_args) { - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)p_orientation { - if (/*OSIPhone::get_singleton() == NULL*/TRUE) { + if (/*OSIPhone::get_singleton() == NULL*/ TRUE) { printf("checking on info.plist\n"); - NSArray* arr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]; - switch(p_orientation) { + NSArray *arr = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"]; + switch (p_orientation) { - case UIInterfaceOrientationLandscapeLeft: - return [arr indexOfObject:@"UIInterfaceOrientationLandscapeLeft"] != NSNotFound ? YES : NO; + case UIInterfaceOrientationLandscapeLeft: + return [arr indexOfObject:@"UIInterfaceOrientationLandscapeLeft"] != NSNotFound ? YES : NO; - case UIInterfaceOrientationLandscapeRight: - return [arr indexOfObject:@"UIInterfaceOrientationLandscapeRight"] != NSNotFound ? YES : NO; + case UIInterfaceOrientationLandscapeRight: + return [arr indexOfObject:@"UIInterfaceOrientationLandscapeRight"] != NSNotFound ? YES : NO; - case UIInterfaceOrientationPortrait: - return [arr indexOfObject:@"UIInterfaceOrientationPortrait"] != NSNotFound ? YES : NO; + case UIInterfaceOrientationPortrait: + return [arr indexOfObject:@"UIInterfaceOrientationPortrait"] != NSNotFound ? YES : NO; - case UIInterfaceOrientationPortraitUpsideDown: - return [arr indexOfObject:@"UIInterfaceOrientationPortraitUpsideDown"] != NSNotFound ? YES : NO; + case UIInterfaceOrientationPortraitUpsideDown: + return [arr indexOfObject:@"UIInterfaceOrientationPortraitUpsideDown"] != NSNotFound ? YES : NO; - default: - return NO; + default: + return NO; } }; uint8_t supported = OSIPhone::get_singleton()->get_orientations(); - switch(p_orientation) { + switch (p_orientation) { - case UIInterfaceOrientationLandscapeLeft: - return supported & (1<<OSIPhone::LandscapeLeft) ? YES : NO; + case UIInterfaceOrientationLandscapeLeft: + return supported & (1 << OSIPhone::LandscapeLeft) ? YES : NO; - case UIInterfaceOrientationLandscapeRight: - return supported & (1<<OSIPhone::LandscapeRight) ? YES : NO; + case UIInterfaceOrientationLandscapeRight: + return supported & (1 << OSIPhone::LandscapeRight) ? YES : NO; - case UIInterfaceOrientationPortrait: - return supported & (1<<OSIPhone::PortraitDown) ? YES : NO; + case UIInterfaceOrientationPortrait: + return supported & (1 << OSIPhone::PortraitDown) ? YES : NO; - case UIInterfaceOrientationPortraitUpsideDown: - return supported & (1<<OSIPhone::PortraitUp) ? YES : NO; + case UIInterfaceOrientationPortraitUpsideDown: + return supported & (1 << OSIPhone::PortraitUp) ? YES : NO; - default: - return NO; + default: + return NO; } }; -- (BOOL)prefersStatusBarHidden -{ +- (BOOL)prefersStatusBarHidden { return YES; } #ifdef GAME_CENTER_ENABLED -- (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController*) gameCenterViewController { - //[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone - GameCenter::get_singleton()->game_center_closed(); - [gameCenterViewController dismissViewControllerAnimated:YES completion:nil]; +- (void)gameCenterViewControllerDidFinish:(GKGameCenterViewController *)gameCenterViewController { + //[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone + GameCenter::get_singleton()->game_center_closed(); + [gameCenterViewController dismissViewControllerAnimated:YES completion:nil]; } #endif diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 84312fd059..71754502cb 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -332,9 +332,9 @@ bool OS_JavaScript::is_mouse_grab_enabled() const { return false; } -Point2 OS_JavaScript::get_mouse_pos() const { +Point2 OS_JavaScript::get_mouse_position() const { - return input->get_mouse_pos(); + return input->get_mouse_position(); } int OS_JavaScript::get_mouse_button_state() const { @@ -522,7 +522,7 @@ void OS_JavaScript::push_input(const InputEvent &p_ev) { InputEvent ev = p_ev; if (ev.type == InputEvent::MOUSE_MOTION) { - input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); + input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); } else if (ev.type == InputEvent::MOUSE_BUTTON) { last_button_mask = ev.mouse_button.button_mask; } @@ -604,7 +604,7 @@ void OS_JavaScript::process_touch(int p_what, int p_pointer, const Vector<TouchP ev.mouse_motion.button_mask = BUTTON_MASK_LEFT; ev.mouse_motion.x = p_points[0].pos.x; ev.mouse_motion.y = p_points[0].pos.y; - input->set_mouse_pos(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); + input->set_mouse_position(Point2(ev.mouse_motion.x, ev.mouse_motion.y)); ev.mouse_motion.speed_x = input->get_last_mouse_speed().x; ev.mouse_motion.speed_y = input->get_last_mouse_speed().y; ev.mouse_motion.relative_x = p_points[0].pos.x - last_mouse.x; diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index fe0be859e2..ea906c560f 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -122,7 +122,7 @@ public: virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm index 931629e5c1..37ba0e6b19 100644 --- a/platform/osx/dir_access_osx.mm +++ b/platform/osx/dir_access_osx.mm @@ -35,17 +35,14 @@ #include <Foundation/NSString.h> - -String DirAccessOSX::fix_unicode_name(const char* p_name) const { +String DirAccessOSX::fix_unicode_name(const char *p_name) const { String fname; - NSString* nsstr = [[NSString stringWithUTF8String: p_name] precomposedStringWithCanonicalMapping]; + NSString *nsstr = [[NSString stringWithUTF8String:p_name] precomposedStringWithCanonicalMapping]; fname.parse_utf8([nsstr UTF8String]); return fname; } - - #endif //posix_enabled diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm index 5a16869c86..0bf678f9b7 100644 --- a/platform/osx/godot_main_osx.mm +++ b/platform/osx/godot_main_osx.mm @@ -27,68 +27,62 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "os_osx.h" #include "main/main.h" +#include "os_osx.h" + #include <string.h> #include <unistd.h> -//#define main godot_main - -int main(int argc, char** argv) { +int main(int argc, char **argv) { int first_arg = 1; - const char* dbg_arg = "-NSDocumentRevisionsDebugMode"; + const char *dbg_arg = "-NSDocumentRevisionsDebugMode"; printf("arguments\n"); - for (int i=0; i<argc; i++) { + for (int i = 0; i < argc; i++) { if (strcmp(dbg_arg, argv[i]) == 0) - first_arg = i+2; + first_arg = i + 2; printf("%i: %s\n", i, argv[i]); }; - - if (argc>=1 && argv[0][0]=='/') { + if (argc >= 1 && argv[0][0] == '/') { //potentially launched from finder int len = strlen(argv[0]); while (len--) { if (argv[0][len] == '/') break; } - if (len>=0) { - char *path = (char *)malloc(len+1); + if (len >= 0) { + char *path = (char *)malloc(len + 1); memcpy(path, argv[0], len); - path[len]=0; + path[len] = 0; - char *pathinfo = (char*)malloc(strlen(path)+strlen("/../Info.plist")+1); - //in real code you would check for errors in malloc here + char *pathinfo = (char *)malloc(strlen(path) + strlen("/../Info.plist") + 1); + //in real code you would check for errors in malloc here strcpy(pathinfo, path); strcat(pathinfo, "/../Info.plist"); - FILE*f=fopen(pathinfo,"rb"); + FILE *f = fopen(pathinfo, "rb"); if (f) { //running from app bundle, as Info.plist was found fclose(f); chdir(path); chdir("../Resources"); //data.pck, or just the files are here - } free(path); free(pathinfo); } - - - } OS_OSX os; - - Error err = Main::setup(argv[0],argc-first_arg,&argv[first_arg]); - if (err!=OK) + Error err = Main::setup(argv[0], argc - first_arg, &argv[first_arg]); + if (err != OK) return 255; if (Main::start()) os.run(); // it is actually the OS that decides how to run + Main::cleanup(); return 0; diff --git a/platform/osx/godot_osx.mm b/platform/osx/godot_osx.mm index 76762213bf..626406ad1d 100644 --- a/platform/osx/godot_osx.mm +++ b/platform/osx/godot_osx.mm @@ -27,144 +27,139 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ +#include "godot_osx.h" + #include <sys/param.h> /* for MAXPATHLEN */ #include <unistd.h> -#include "godot_osx.h" /* For some reaon, Apple removed setAppleMenu from the headers in 10.4, but the method still is there and works. To avoid warnings, we declare it ourselves here. */ -@interface NSApplication() +@interface NSApplication () - (void)setAppleMenu:(NSMenu *)menu; @end -static int global_argc; -static char **global_argv; -static BOOL gCalledAppMainline = FALSE; +static int global_argc; +static char **global_argv; +static BOOL gCalledAppMainline = FALSE; -static NSString *getApplicationName(void) -{ - const NSDictionary *dict; - NSString *appName = 0; +static NSString *getApplicationName(void) { + const NSDictionary *dict; + NSString *appName = 0; - /* Determine the application name */ - dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); - if (dict) - appName = [dict objectForKey: @"CFBundleName"]; + /* Determine the application name */ + dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle()); + if (dict) + appName = [dict objectForKey:@"CFBundleName"]; - if (![appName length]) - appName = [[NSProcessInfo processInfo] processName]; + if (![appName length]) + appName = [[NSProcessInfo processInfo] processName]; - return appName; + return appName; } /* The main class of the application, the application's delegate */ @implementation GodotMain -static void setApplicationMenu(void) -{ - /* warning: this code is very odd */ - NSMenu *appleMenu; - NSMenuItem *menuItem; - NSString *title; - NSString *appName; +static void setApplicationMenu(void) { + /* warning: this code is very odd */ + NSMenu *appleMenu; + NSMenuItem *menuItem; + NSString *title; + NSString *appName; - appName = getApplicationName(); - appleMenu = [[NSMenu alloc] initWithTitle:@""]; + appName = getApplicationName(); + appleMenu = [[NSMenu alloc] initWithTitle:@""]; - /* Add menu items */ - title = [@"About " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; + /* Add menu items */ + title = [@"About " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""]; - [appleMenu addItem:[NSMenuItem separatorItem]]; + [appleMenu addItem:[NSMenuItem separatorItem]]; - title = [@"Hide " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; + title = [@"Hide " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; - menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; + [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)]; - [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; + [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; - [appleMenu addItem:[NSMenuItem separatorItem]]; + [appleMenu addItem:[NSMenuItem separatorItem]]; - title = [@"Quit " stringByAppendingString:appName]; - [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + title = [@"Quit " stringByAppendingString:appName]; + [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; + /* Put menu into the menubar */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; + [menuItem setSubmenu:appleMenu]; + [[NSApp mainMenu] addItem:menuItem]; - /* Put menu into the menubar */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""]; - [menuItem setSubmenu:appleMenu]; - [[NSApp mainMenu] addItem:menuItem]; + /* Tell the application object that this is now the application menu */ + [NSApp setAppleMenu:appleMenu]; - /* Tell the application object that this is now the application menu */ - [NSApp setAppleMenu:appleMenu]; - - /* Finally give up our references to the objects */ - [appleMenu release]; - [menuItem release]; + /* Finally give up our references to the objects */ + [appleMenu release]; + [menuItem release]; } /* Create a window menu */ -static void setupWindowMenu(void) -{ - NSMenu *windowMenu; - NSMenuItem *windowMenuItem; - NSMenuItem *menuItem; - - windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; - - /* "Minimize" item */ - menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; - [windowMenu addItem:menuItem]; - [menuItem release]; - - /* Put menu into the menubar */ - windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; - [windowMenuItem setSubmenu:windowMenu]; - [[NSApp mainMenu] addItem:windowMenuItem]; - - /* Tell the application object that this is now the window menu */ - [NSApp setWindowsMenu:windowMenu]; - - /* Finally give up our references to the objects */ - [windowMenu release]; - [windowMenuItem release]; +static void setupWindowMenu(void) { + NSMenu *windowMenu; + NSMenuItem *windowMenuItem; + NSMenuItem *menuItem; + + windowMenu = [[NSMenu alloc] initWithTitle:@"Window"]; + + /* "Minimize" item */ + menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"]; + [windowMenu addItem:menuItem]; + [menuItem release]; + + /* Put menu into the menubar */ + windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""]; + [windowMenuItem setSubmenu:windowMenu]; + [[NSApp mainMenu] addItem:windowMenuItem]; + + /* Tell the application object that this is now the window menu */ + [NSApp setWindowsMenu:windowMenu]; + + /* Finally give up our references to the objects */ + [windowMenu release]; + [windowMenuItem release]; } /* Replacement for NSApplicationMain */ -static void CustomApplicationMain (int argc, char **argv) -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; - GodotMain *main; +static void CustomApplicationMain(int argc, char **argv) { + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + GodotMain *main; - /* Ensure the application object is initialised */ - [NSApplication sharedApplication]; + /* Ensure the application object is initialised */ + [NSApplication sharedApplication]; - /* Set up the menubar */ - [NSApp setMainMenu:[[NSMenu alloc] init]]; - setApplicationMenu(); - setupWindowMenu(); + /* Set up the menubar */ + [NSApp setMainMenu:[[NSMenu alloc] init]]; + setApplicationMenu(); + setupWindowMenu(); main = [[main alloc] init]; [NSApp setDelegate:main]; - /* Start the main event loop */ - [NSApp run]; + /* Start the main event loop */ + [NSApp run]; [main release]; - [pool release]; + [pool release]; } -extern int godot_main(int argc, char** argv); +extern int godot_main(int argc, char **argv); /* Called when the internal event loop has just started running */ -- (void) applicationDidFinishLaunching: (NSNotification *) note -{ - int status; +- (void)applicationDidFinishLaunching:(NSNotification *)note { + int status; - /* Hand off to main application code */ - gCalledAppMainline = TRUE; + /* Hand off to main application code */ + gCalledAppMainline = TRUE; int ret = godot_main(global_argc, global_argv); @@ -173,16 +168,14 @@ extern int godot_main(int argc, char** argv); @end #ifdef main -# undef main +#undef main #endif - -int main (int argc, char **argv) -{ - /* Copy the arguments into a global variable */ - /* This is passed if we are launched by double-clicking */ - if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { - global_argv = (char **) malloc(sizeof (char *) * 2); +int main(int argc, char **argv) { + /* Copy the arguments into a global variable */ + /* This is passed if we are launched by double-clicking */ + if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) { + global_argv = (char **)malloc(sizeof(char *) * 2); global_argv[0] = argv[0]; global_argv[1] = NULL; global_argc = 1; @@ -190,27 +183,26 @@ int main (int argc, char **argv) // chdir to binary's dir when launched from finder int len = strlen(global_argv[0]); - while (len--){ + while (len--) { if (global_argv[0][len] == '/') break; } - if (len>=0) { - char *path = (char *)malloc(len+1); + if (len >= 0) { + char *path = (char *)malloc(len + 1); memcpy(path, global_argv[0], len); - path[len]=0; + path[len] = 0; printf("Path: %s\n", path); chdir(path); } - } else { - int i; + } else { + int i; global_argc = argc; - global_argv = (char **) malloc(sizeof (char *) * (argc+1)); - for (i = 0; i <= argc; i++) + global_argv = (char **)malloc(sizeof(char *) * (argc + 1)); + for (i = 0; i <= argc; i++) global_argv[i] = argv[i]; - } + } - CustomApplicationMain (argc, argv); - return 0; + CustomApplicationMain(argc, argv); + return 0; } - diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 01817d1b88..2ecc379a7f 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -145,7 +145,7 @@ public: virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; virtual void warp_mouse_pos(const Point2 &p_to); - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index 47b4aed491..c6c2e6dab1 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -27,35 +27,32 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#import <Cocoa/Cocoa.h> +#include "os_osx.h" + +#include "dir_access_osx.h" +#include "drivers/gles3/rasterizer_gles3.h" +#include "main/main.h" +#include "os/keyboard.h" +#include "print_string.h" +#include "sem_osx.h" +#include "servers/physics/physics_server_sw.h" +#include "servers/visual/visual_server_raster.h" #include <Carbon/Carbon.h> -#include <IOKit/IOKitLib.h> +#import <Cocoa/Cocoa.h> #include <IOKit/IOCFPlugIn.h> -#include <IOKit/hid/IOHIDLib.h> +#include <IOKit/IOKitLib.h> #include <IOKit/hid/IOHIDKeys.h> +#include <IOKit/hid/IOHIDLib.h> -#include "sem_osx.h" -#include "servers/visual/visual_server_raster.h" -//#include "drivers/opengl/rasterizer_gl.h" -//#include "drivers/gles2/rasterizer_gles2.h" -#include "drivers/gles3/rasterizer_gles3.h" -#include "os_osx.h" +#include <fcntl.h> +#include <libproc.h> #include <stdio.h> #include <stdlib.h> -#include "print_string.h" -#include "servers/physics/physics_server_sw.h" -// #include "drivers/gles2/rasterizer_instance_gles2.h" -// #include "servers/visual/visual_server_wrap_mt.h" -#include "main/main.h" -#include "os/keyboard.h" -#include "dir_access_osx.h" - -#include <sys/types.h> #include <sys/stat.h> -#include <fcntl.h> +#include <sys/types.h> #include <unistd.h> -#include <libproc.h> + //uses portions of glfw //======================================================================== @@ -88,33 +85,29 @@ static NSRect convertRectToBacking(NSRect contentRect) { #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) - return [OS_OSX::singleton->window_view convertRectToBacking:contentRect]; - else + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) + return [OS_OSX::singleton->window_view convertRectToBacking:contentRect]; + else #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ - return contentRect; - + return contentRect; } -static InputModifierState translateFlags(NSUInteger flags) -{ - InputModifierState mod; - +static InputModifierState translateFlags(NSUInteger flags) { + InputModifierState mod; - mod.shift = (flags & NSShiftKeyMask); - mod.control = (flags & NSControlKeyMask); - mod.alt = (flags & NSAlternateKeyMask); - mod.meta = (flags & NSCommandKeyMask); + mod.shift = (flags & NSShiftKeyMask); + mod.control = (flags & NSControlKeyMask); + mod.alt = (flags & NSAlternateKeyMask); + mod.meta = (flags & NSCommandKeyMask); - return mod; + return mod; } -static int mouse_x=0; -static int mouse_y=0; -static int prev_mouse_x=0; -static int prev_mouse_y=0; -static int button_mask=0; - +static int mouse_x = 0; +static int mouse_y = 0; +static int prev_mouse_x = 0; +static int prev_mouse_y = 0; +static int button_mask = 0; @interface GodotApplication : NSApplication @end @@ -124,12 +117,11 @@ static int button_mask=0; // From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost // This works around an AppKit bug, where key up events while holding // down the command key don't get sent to the key window. -- (void)sendEvent:(NSEvent *)event -{ - if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) - [[self keyWindow] sendEvent:event]; - else - [super sendEvent:event]; +- (void)sendEvent:(NSEvent *)event { + if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) + [[self keyWindow] sendEvent:event]; + else + [super sendEvent:event]; } @end @@ -139,45 +131,39 @@ static int button_mask=0; @implementation GodotApplicationDelegate -- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender -{ +- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender { if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST); return NSTerminateCancel; } -- (void)applicationDidHide:(NSNotification *)notification -{ +- (void)applicationDidHide:(NSNotification *)notification { /* _Godotwindow* window; for (window = _Godot.windowListHead; window; window = window->next) _GodotInputWindowVisibility(window, GL_FALSE); - */ +*/ } -- (void)applicationDidUnhide:(NSNotification *)notification -{ +- (void)applicationDidUnhide:(NSNotification *)notification { /* _Godotwindow* window; - for (window = _Godot.windowListHead; window; window = window->next) - { - if ([window_object isVisible]) - _GodotInputWindowVisibility(window, GL_TRUE); + for (window = _Godot.windowListHead; window; window = window->next) { + if ([window_object isVisible]) + _GodotInputWindowVisibility(window, GL_TRUE); } - */ +*/ } -- (void)applicationDidChangeScreenParameters:(NSNotification *) notification -{ +- (void)applicationDidChangeScreenParameters:(NSNotification *)notification { //_GodotInputMonitorChange(); } @end -@interface GodotWindowDelegate : NSObject -{ +@interface GodotWindowDelegate : NSObject { //_Godotwindow* window; } @@ -185,28 +171,22 @@ static int button_mask=0; @implementation GodotWindowDelegate - -- (BOOL)windowShouldClose:(id)sender -{ +- (BOOL)windowShouldClose:(id)sender { //_GodotInputWindowCloseRequest(window); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST); - return NO; -} - - - -- (void)windowDidResize:(NSNotification *)notification -{ - [OS_OSX::singleton->context update]; + return NO; +} - const NSRect contentRect = [OS_OSX::singleton->window_view frame]; - const NSRect fbRect = contentRect;//convertRectToBacking(contentRect); +- (void)windowDidResize:(NSNotification *)notification { + [OS_OSX::singleton->context update]; - OS_OSX::singleton->window_size.width=fbRect.size.width*OS_OSX::singleton->display_scale; - OS_OSX::singleton->window_size.height=fbRect.size.height*OS_OSX::singleton->display_scale; + const NSRect contentRect = [OS_OSX::singleton->window_view frame]; + const NSRect fbRect = contentRect; //convertRectToBacking(contentRect); + OS_OSX::singleton->window_size.width = fbRect.size.width * OS_OSX::singleton->display_scale; + OS_OSX::singleton->window_size.height = fbRect.size.height * OS_OSX::singleton->display_scale; /* _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); @@ -215,11 +195,10 @@ static int button_mask=0; if (window->cursorMode == Godot_CURSOR_DISABLED) centerCursor(window); - */ +*/ } -- (void)windowDidMove:(NSNotification *)notification -{ +- (void)windowDidMove:(NSNotification *)notification { /* [window->nsgl.context update]; @@ -229,35 +208,30 @@ static int button_mask=0; if (window->cursorMode == Godot_CURSOR_DISABLED) centerCursor(window); - */ +*/ } -- (void)windowDidBecomeKey:(NSNotification *)notification -{ +- (void)windowDidBecomeKey:(NSNotification *)notification { //_GodotInputWindowFocus(window, GL_TRUE); //_GodotPlatformSetCursorMode(window, window->cursorMode); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); } -- (void)windowDidResignKey:(NSNotification *)notification -{ +- (void)windowDidResignKey:(NSNotification *)notification { //_GodotInputWindowFocus(window, GL_FALSE); //_GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); } -- (void)windowDidMiniaturize:(NSNotification*)notification -{ +- (void)windowDidMiniaturize:(NSNotification *)notification { OS_OSX::singleton->wm_minimized(true); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT); }; -- (void)windowDidDeminiaturize:(NSNotification*)notification -{ - +- (void)windowDidDeminiaturize:(NSNotification *)notification { OS_OSX::singleton->wm_minimized(false); if (OS_OSX::singleton->get_main_loop()) OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN); @@ -265,549 +239,525 @@ static int button_mask=0; @end -@interface GodotContentView : NSView -{ - NSTrackingArea* trackingArea; +@interface GodotContentView : NSView { + NSTrackingArea *trackingArea; } - - @end @implementation GodotContentView -+ (void)initialize -{ - if (self == [GodotContentView class]) - { ++ (void)initialize { + if (self == [GodotContentView class]) { /* - if (_glfw.ns.cursor == nil) - { + if (_glfw.ns.cursor == nil) { NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)]; _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data hotSpot:NSZeroPoint]; [data release]; } - */ +*/ } } -- (id)init -{ - self = [super init]; - trackingArea = nil; - [self updateTrackingAreas]; - [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; - return self; +- (id)init { + self = [super init]; + trackingArea = nil; + [self updateTrackingAreas]; + [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]]; + return self; } - --(void)dealloc -{ - [trackingArea release]; - [super dealloc]; +- (void)dealloc { + [trackingArea release]; + [super dealloc]; } -- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender { - return NSDragOperationCopy; +- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender { + return NSDragOperationCopy; } - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender { - return NSDragOperationCopy; + return NSDragOperationCopy; } - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { + NSPasteboard *pboard = [sender draggingPasteboard]; + NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; + + Vector<String> files; + for (int i = 0; i < filenames.count; i++) { + NSString *ns = [filenames objectAtIndex:i]; + char *utfs = strdup([ns UTF8String]); + String ret; + ret.parse_utf8(utfs); + free(utfs); + files.push_back(ret); + } - NSPasteboard *pboard = [sender draggingPasteboard]; - NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; - - Vector<String> files; - for(int i=0;i<filenames.count;i++) { - NSString *ns = [filenames objectAtIndex:i]; - char *utfs = strdup([ns UTF8String]); - String ret; - ret.parse_utf8(utfs); - free(utfs); - files.push_back(ret); - - - } - - if (files.size()) { - OS_OSX::singleton->main_loop->drop_files(files,0); - OS_OSX::singleton->move_window_to_foreground(); - } + if (files.size()) { + OS_OSX::singleton->main_loop->drop_files(files, 0); + OS_OSX::singleton->move_window_to_foreground(); + } - return NO; + return NO; } - -- (BOOL)isOpaque -{ - return YES; +- (BOOL)isOpaque { + return YES; } -- (BOOL)canBecomeKeyView -{ - return YES; +- (BOOL)canBecomeKeyView { + return YES; } -- (BOOL)acceptsFirstResponder -{ - return YES; +- (BOOL)acceptsFirstResponder { + return YES; } -- (void)cursorUpdate:(NSEvent *)event -{ - // setModeCursor(window, window->cursorMode); +- (void)cursorUpdate:(NSEvent *)event { + //setModeCursor(window, window->cursorMode); } -- (void)mouseDown:(NSEvent *)event -{ +- (void)mouseDown:(NSEvent *)event { //print_line("mouse down:"); - button_mask|=BUTTON_MASK_LEFT; + button_mask |= BUTTON_MASK_LEFT; InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=BUTTON_LEFT; - ev.mouse_button.pressed=true; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; - ev.mouse_button.doubleclick = [event clickCount]==2; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = BUTTON_LEFT; + ev.mouse_button.pressed = true; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; + ev.mouse_button.doubleclick = [event clickCount] == 2; ev.mouse_button.mod = translateFlags([event modifierFlags]); OS_OSX::singleton->push_input(ev); - - /* _glfwInputMouseClick(window, - GLFW_MOUSE_BUTTON_LEFT, - GLFW_PRESS, - translateFlags([event modifierFlags]));*/ + /* + _glfwInputMouseClick(window, + GLFW_MOUSE_BUTTON_LEFT, + GLFW_PRESS, + translateFlags([event modifierFlags])); +*/ } -- (void)mouseDragged:(NSEvent *)event -{ - [self mouseMoved:event]; +- (void)mouseDragged:(NSEvent *)event { + [self mouseMoved:event]; } -- (void)mouseUp:(NSEvent *)event -{ +- (void)mouseUp:(NSEvent *)event { - button_mask&=~BUTTON_MASK_LEFT; + button_mask &= ~BUTTON_MASK_LEFT; InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=BUTTON_LEFT; - ev.mouse_button.pressed=false; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = BUTTON_LEFT; + ev.mouse_button.pressed = false; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; ev.mouse_button.mod = translateFlags([event modifierFlags]); OS_OSX::singleton->push_input(ev); - /* _glfwInputMouseClick(window, - GLFW_MOUSE_BUTTON_LEFT, - GLFW_RELEASE, - translateFlags([event modifierFlags]));*/ + /* + _glfwInputMouseClick(window, + GLFW_MOUSE_BUTTON_LEFT, + GLFW_RELEASE, + translateFlags([event modifierFlags])); +*/ } -- (void)mouseMoved:(NSEvent *)event -{ +- (void)mouseMoved:(NSEvent *)event { InputEvent ev; - ev.type=InputEvent::MOUSE_MOTION; - ev.mouse_motion.button_mask=button_mask; - prev_mouse_x=mouse_x; - prev_mouse_y=mouse_y; + ev.type = InputEvent::MOUSE_MOTION; + ev.mouse_motion.button_mask = button_mask; + prev_mouse_x = mouse_x; + prev_mouse_y = mouse_y; const NSRect contentRect = [OS_OSX::singleton->window_view frame]; const NSPoint p = [event locationInWindow]; mouse_x = p.x * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]); mouse_y = (contentRect.size.height - p.y) * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]); - ev.mouse_motion.x=mouse_x; - ev.mouse_motion.y=mouse_y; - ev.mouse_motion.global_x=mouse_x; - ev.mouse_motion.global_y=mouse_y; - ev.mouse_motion.relative_x=[event deltaX] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]); - ev.mouse_motion.relative_y=[event deltaY] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]); + ev.mouse_motion.x = mouse_x; + ev.mouse_motion.y = mouse_y; + ev.mouse_motion.global_x = mouse_x; + ev.mouse_motion.global_y = mouse_y; + ev.mouse_motion.relative_x = [event deltaX] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]); + ev.mouse_motion.relative_y = [event deltaY] * OS_OSX::singleton->_mouse_scale([[event window] backingScaleFactor]); ev.mouse_motion.mod = translateFlags([event modifierFlags]); - OS_OSX::singleton->input->set_mouse_pos(Point2(mouse_x,mouse_y)); + OS_OSX::singleton->input->set_mouse_position(Point2(mouse_x, mouse_y)); OS_OSX::singleton->push_input(ev); + /* + if (window->cursorMode == GLFW_CURSOR_DISABLED) + _glfwInputCursorMotion(window, [event deltaX], [event deltaY]); + else { + const NSRect contentRect = [window->ns.view frame]; + const NSPoint p = [event locationInWindow]; - /* if (window->cursorMode == GLFW_CURSOR_DISABLED) - _glfwInputCursorMotion(window, [event deltaX], [event deltaY]); - else - { - const NSRect contentRect = [window->ns.view frame]; - const NSPoint p = [event locationInWindow]; - - _glfwInputCursorMotion(window, p.x, contentRect.size.height - p.y); - }*/ + _glfwInputCursorMotion(window, p.x, contentRect.size.height - p.y); + } +*/ } -- (void)rightMouseDown:(NSEvent *)event -{ +- (void)rightMouseDown:(NSEvent *)event { - button_mask|=BUTTON_MASK_RIGHT; + button_mask |= BUTTON_MASK_RIGHT; InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=BUTTON_RIGHT; - ev.mouse_button.pressed=true; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = BUTTON_RIGHT; + ev.mouse_button.pressed = true; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; ev.mouse_button.mod = translateFlags([event modifierFlags]); OS_OSX::singleton->push_input(ev); - /* _glfwInputMouseClick(window, - GLFW_MOUSE_BUTTON_RIGHT, - GLFW_PRESS, - translateFlags([event modifierFlags]));*/ + /* + _glfwInputMouseClick(window, + GLFW_MOUSE_BUTTON_RIGHT, + GLFW_PRESS, + translateFlags([event modifierFlags])); +*/ } -- (void)rightMouseDragged:(NSEvent *)event -{ - [self mouseMoved:event]; +- (void)rightMouseDragged:(NSEvent *)event { + [self mouseMoved:event]; } -- (void)rightMouseUp:(NSEvent *)event -{ +- (void)rightMouseUp:(NSEvent *)event { - button_mask&=~BUTTON_MASK_RIGHT; + button_mask &= ~BUTTON_MASK_RIGHT; InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=BUTTON_RIGHT; - ev.mouse_button.pressed=false; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = BUTTON_RIGHT; + ev.mouse_button.pressed = false; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; ev.mouse_button.mod = translateFlags([event modifierFlags]); OS_OSX::singleton->push_input(ev); - /*_glfwInputMouseClick(window, - GLFW_MOUSE_BUTTON_RIGHT, - GLFW_RELEASE, - translateFlags([event modifierFlags]));*/ + /* + _glfwInputMouseClick(window, + GLFW_MOUSE_BUTTON_RIGHT, + GLFW_RELEASE, + translateFlags([event modifierFlags])); +*/ } -- (void)otherMouseDown:(NSEvent *)event -{ +- (void)otherMouseDown:(NSEvent *)event { - if ((int) [event buttonNumber]!=2) + if ((int)[event buttonNumber] != 2) return; - button_mask|=BUTTON_MASK_MIDDLE; + button_mask |= BUTTON_MASK_MIDDLE; InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=BUTTON_MIDDLE; - ev.mouse_button.pressed=true; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = BUTTON_MIDDLE; + ev.mouse_button.pressed = true; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; ev.mouse_button.mod = translateFlags([event modifierFlags]); OS_OSX::singleton->push_input(ev); - /*_glfwInputMouseClick(window, - (int) [event buttonNumber], - GLFW_PRESS, - translateFlags([event modifierFlags]));*/ + /* + _glfwInputMouseClick(window, + (int) [event buttonNumber], + GLFW_PRESS, + translateFlags([event modifierFlags])); +*/ } -- (void)otherMouseDragged:(NSEvent *)event -{ - [self mouseMoved:event]; +- (void)otherMouseDragged:(NSEvent *)event { + [self mouseMoved:event]; } -- (void)otherMouseUp:(NSEvent *)event -{ +- (void)otherMouseUp:(NSEvent *)event { - if ((int) [event buttonNumber]!=2) + if ((int)[event buttonNumber] != 2) return; - button_mask&=~BUTTON_MASK_MIDDLE; + button_mask &= ~BUTTON_MASK_MIDDLE; InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=BUTTON_MIDDLE; - ev.mouse_button.pressed=false; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = BUTTON_MIDDLE; + ev.mouse_button.pressed = false; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; ev.mouse_button.mod = translateFlags([event modifierFlags]); OS_OSX::singleton->push_input(ev); - /* _glfwInputMouseClick(window, - (int) [event buttonNumber], - GLFW_RELEASE, - translateFlags([event modifierFlags]));*/ + + /* + _glfwInputMouseClick(window, + (int) [event buttonNumber], + GLFW_RELEASE, + translateFlags([event modifierFlags])); +*/ } -- (void)mouseExited:(NSEvent *)event -{ +- (void)mouseExited:(NSEvent *)event { if (!OS_OSX::singleton) return; - if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode!=OS::MOUSE_MODE_CAPTURED) + if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED) OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT); if (OS_OSX::singleton->input) OS_OSX::singleton->input->set_mouse_in_window(false); - // _glfwInputCursorEnter(window, GL_FALSE); + //_glfwInputCursorEnter(window, GL_FALSE); } -- (void)mouseEntered:(NSEvent *)event -{ - // _glfwInputCursorEnter(window, GL_TRUE); +- (void)mouseEntered:(NSEvent *)event { + //_glfwInputCursorEnter(window, GL_TRUE); if (!OS_OSX::singleton) return; - if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode!=OS::MOUSE_MODE_CAPTURED) + if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED) OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER); if (OS_OSX::singleton->input) OS_OSX::singleton->input->set_mouse_in_window(true); - } -- (void)viewDidChangeBackingProperties -{ - /* const NSRect contentRect = [window->ns.view frame]; - const NSRect fbRect = convertRectToBacking(window, contentRect); +- (void)viewDidChangeBackingProperties { + /* + const NSRect contentRect = [window->ns.view frame]; + const NSRect fbRect = convertRectToBacking(window, contentRect); - _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);*/ + _glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height); +*/ } -- (void)updateTrackingAreas -{ - if (trackingArea != nil) - { - [self removeTrackingArea:trackingArea]; - [trackingArea release]; - } +- (void)updateTrackingAreas { + if (trackingArea != nil) { + [self removeTrackingArea:trackingArea]; + [trackingArea release]; + } - NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | - NSTrackingActiveInKeyWindow | - NSTrackingCursorUpdate | - NSTrackingInVisibleRect; + NSTrackingAreaOptions options = + NSTrackingMouseEnteredAndExited | + NSTrackingActiveInKeyWindow | + NSTrackingCursorUpdate | + NSTrackingInVisibleRect; - trackingArea = [[NSTrackingArea alloc] initWithRect:[self bounds] - options:options - owner:self - userInfo:nil]; + trackingArea = [[NSTrackingArea alloc] + initWithRect:[self bounds] + options:options + owner:self + userInfo:nil]; - [self addTrackingArea:trackingArea]; - [super updateTrackingAreas]; + [self addTrackingArea:trackingArea]; + [super updateTrackingAreas]; } // Translates a OS X keycode to a Godot keycode // -static int translateKey(unsigned int key) -{ - // Keyboard symbol translation table - static const unsigned int table[128] = - { - /* 00 */ KEY_A, - /* 01 */ KEY_S, - /* 02 */ KEY_D, - /* 03 */ KEY_F, - /* 04 */ KEY_H, - /* 05 */ KEY_G, - /* 06 */ KEY_Z, - /* 07 */ KEY_X, - /* 08 */ KEY_C, - /* 09 */ KEY_V, - /* 0a */ KEY_UNKNOWN, - /* 0b */ KEY_B, - /* 0c */ KEY_Q, - /* 0d */ KEY_W, - /* 0e */ KEY_E, - /* 0f */ KEY_R, - /* 10 */ KEY_Y, - /* 11 */ KEY_T, - /* 12 */ KEY_1, - /* 13 */ KEY_2, - /* 14 */ KEY_3, - /* 15 */ KEY_4, - /* 16 */ KEY_6, - /* 17 */ KEY_5, - /* 18 */ KEY_EQUAL, - /* 19 */ KEY_9, - /* 1a */ KEY_7, - /* 1b */ KEY_MINUS, - /* 1c */ KEY_8, - /* 1d */ KEY_0, - /* 1e */ KEY_BRACERIGHT, - /* 1f */ KEY_O, - /* 20 */ KEY_U, - /* 21 */ KEY_BRACELEFT, - /* 22 */ KEY_I, - /* 23 */ KEY_P, - /* 24 */ KEY_RETURN, - /* 25 */ KEY_L, - /* 26 */ KEY_J, - /* 27 */ KEY_APOSTROPHE, - /* 28 */ KEY_K, - /* 29 */ KEY_SEMICOLON, - /* 2a */ KEY_BACKSLASH, - /* 2b */ KEY_COMMA, - /* 2c */ KEY_SLASH, - /* 2d */ KEY_N, - /* 2e */ KEY_M, - /* 2f */ KEY_PERIOD, - /* 30 */ KEY_TAB, - /* 31 */ KEY_SPACE, - /* 32 */ KEY_QUOTELEFT, - /* 33 */ KEY_BACKSPACE, - /* 34 */ KEY_UNKNOWN, - /* 35 */ KEY_ESCAPE, - /* 36 */ KEY_META, - /* 37 */ KEY_META, - /* 38 */ KEY_SHIFT, - /* 39 */ KEY_CAPSLOCK, - /* 3a */ KEY_ALT, - /* 3b */ KEY_CONTROL, - /* 3c */ KEY_SHIFT, - /* 3d */ KEY_ALT, - /* 3e */ KEY_CONTROL, - /* 3f */ KEY_UNKNOWN, /* Function */ - /* 40 */ KEY_UNKNOWN, - /* 41 */ KEY_KP_PERIOD, - /* 42 */ KEY_UNKNOWN, - /* 43 */ KEY_KP_MULTIPLY, - /* 44 */ KEY_UNKNOWN, - /* 45 */ KEY_KP_ADD, - /* 46 */ KEY_UNKNOWN, - /* 47 */ KEY_NUMLOCK, /* Really KeypadClear... */ - /* 48 */ KEY_UNKNOWN, /* VolumeUp */ - /* 49 */ KEY_UNKNOWN, /* VolumeDown */ - /* 4a */ KEY_UNKNOWN, /* Mute */ - /* 4b */ KEY_KP_DIVIDE, - /* 4c */ KEY_KP_ENTER, - /* 4d */ KEY_UNKNOWN, - /* 4e */ KEY_KP_SUBTRACT, - /* 4f */ KEY_UNKNOWN, - /* 50 */ KEY_UNKNOWN, - /* 51 */ KEY_EQUAL, //wtf equal? - /* 52 */ KEY_KP_0, - /* 53 */ KEY_KP_1, - /* 54 */ KEY_KP_2, - /* 55 */ KEY_KP_3, - /* 56 */ KEY_KP_4, - /* 57 */ KEY_KP_5, - /* 58 */ KEY_KP_6, - /* 59 */ KEY_KP_7, - /* 5a */ KEY_UNKNOWN, - /* 5b */ KEY_KP_8, - /* 5c */ KEY_KP_9, - /* 5d */ KEY_UNKNOWN, - /* 5e */ KEY_UNKNOWN, - /* 5f */ KEY_UNKNOWN, - /* 60 */ KEY_F5, - /* 61 */ KEY_F6, - /* 62 */ KEY_F7, - /* 63 */ KEY_F3, - /* 64 */ KEY_F8, - /* 65 */ KEY_F9, - /* 66 */ KEY_UNKNOWN, - /* 67 */ KEY_F11, - /* 68 */ KEY_UNKNOWN, - /* 69 */ KEY_F13, - /* 6a */ KEY_F16, - /* 6b */ KEY_F14, - /* 6c */ KEY_UNKNOWN, - /* 6d */ KEY_F10, - /* 6e */ KEY_UNKNOWN, - /* 6f */ KEY_F12, - /* 70 */ KEY_UNKNOWN, - /* 71 */ KEY_F15, - /* 72 */ KEY_INSERT, /* Really Help... */ - /* 73 */ KEY_HOME, - /* 74 */ KEY_PAGEUP, - /* 75 */ KEY_DELETE, - /* 76 */ KEY_F4, - /* 77 */ KEY_END, - /* 78 */ KEY_F2, - /* 79 */ KEY_PAGEDOWN, - /* 7a */ KEY_F1, - /* 7b */ KEY_LEFT, - /* 7c */ KEY_RIGHT, - /* 7d */ KEY_DOWN, - /* 7e */ KEY_UP, - /* 7f */ KEY_UNKNOWN, - }; - - if (key >= 128) - return KEY_UNKNOWN; - - return table[key]; -} -- (void)keyDown:(NSEvent *)event -{ - InputEvent ev; - ev.type=InputEvent::KEY; - ev.key.pressed=true; - ev.key.mod=translateFlags([event modifierFlags]); - ev.key.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode])); - ev.key.echo = [event isARepeat]; - - NSString* characters = [event characters]; - NSUInteger i, length = [characters length]; - - - if (length>0 && keycode_has_unicode(ev.key.scancode)) { - - - for (i = 0; i < length; i++) { - ev.key.unicode=[characters characterAtIndex:i]; +static int translateKey(unsigned int key) { + // Keyboard symbol translation table + static const unsigned int table[128] = { + /* 00 */ KEY_A, + /* 01 */ KEY_S, + /* 02 */ KEY_D, + /* 03 */ KEY_F, + /* 04 */ KEY_H, + /* 05 */ KEY_G, + /* 06 */ KEY_Z, + /* 07 */ KEY_X, + /* 08 */ KEY_C, + /* 09 */ KEY_V, + /* 0a */ KEY_UNKNOWN, + /* 0b */ KEY_B, + /* 0c */ KEY_Q, + /* 0d */ KEY_W, + /* 0e */ KEY_E, + /* 0f */ KEY_R, + /* 10 */ KEY_Y, + /* 11 */ KEY_T, + /* 12 */ KEY_1, + /* 13 */ KEY_2, + /* 14 */ KEY_3, + /* 15 */ KEY_4, + /* 16 */ KEY_6, + /* 17 */ KEY_5, + /* 18 */ KEY_EQUAL, + /* 19 */ KEY_9, + /* 1a */ KEY_7, + /* 1b */ KEY_MINUS, + /* 1c */ KEY_8, + /* 1d */ KEY_0, + /* 1e */ KEY_BRACERIGHT, + /* 1f */ KEY_O, + /* 20 */ KEY_U, + /* 21 */ KEY_BRACELEFT, + /* 22 */ KEY_I, + /* 23 */ KEY_P, + /* 24 */ KEY_RETURN, + /* 25 */ KEY_L, + /* 26 */ KEY_J, + /* 27 */ KEY_APOSTROPHE, + /* 28 */ KEY_K, + /* 29 */ KEY_SEMICOLON, + /* 2a */ KEY_BACKSLASH, + /* 2b */ KEY_COMMA, + /* 2c */ KEY_SLASH, + /* 2d */ KEY_N, + /* 2e */ KEY_M, + /* 2f */ KEY_PERIOD, + /* 30 */ KEY_TAB, + /* 31 */ KEY_SPACE, + /* 32 */ KEY_QUOTELEFT, + /* 33 */ KEY_BACKSPACE, + /* 34 */ KEY_UNKNOWN, + /* 35 */ KEY_ESCAPE, + /* 36 */ KEY_META, + /* 37 */ KEY_META, + /* 38 */ KEY_SHIFT, + /* 39 */ KEY_CAPSLOCK, + /* 3a */ KEY_ALT, + /* 3b */ KEY_CONTROL, + /* 3c */ KEY_SHIFT, + /* 3d */ KEY_ALT, + /* 3e */ KEY_CONTROL, + /* 3f */ KEY_UNKNOWN, /* Function */ + /* 40 */ KEY_UNKNOWN, + /* 41 */ KEY_KP_PERIOD, + /* 42 */ KEY_UNKNOWN, + /* 43 */ KEY_KP_MULTIPLY, + /* 44 */ KEY_UNKNOWN, + /* 45 */ KEY_KP_ADD, + /* 46 */ KEY_UNKNOWN, + /* 47 */ KEY_NUMLOCK, /* Really KeypadClear... */ + /* 48 */ KEY_UNKNOWN, /* VolumeUp */ + /* 49 */ KEY_UNKNOWN, /* VolumeDown */ + /* 4a */ KEY_UNKNOWN, /* Mute */ + /* 4b */ KEY_KP_DIVIDE, + /* 4c */ KEY_KP_ENTER, + /* 4d */ KEY_UNKNOWN, + /* 4e */ KEY_KP_SUBTRACT, + /* 4f */ KEY_UNKNOWN, + /* 50 */ KEY_UNKNOWN, + /* 51 */ KEY_EQUAL, //wtf equal? + /* 52 */ KEY_KP_0, + /* 53 */ KEY_KP_1, + /* 54 */ KEY_KP_2, + /* 55 */ KEY_KP_3, + /* 56 */ KEY_KP_4, + /* 57 */ KEY_KP_5, + /* 58 */ KEY_KP_6, + /* 59 */ KEY_KP_7, + /* 5a */ KEY_UNKNOWN, + /* 5b */ KEY_KP_8, + /* 5c */ KEY_KP_9, + /* 5d */ KEY_UNKNOWN, + /* 5e */ KEY_UNKNOWN, + /* 5f */ KEY_UNKNOWN, + /* 60 */ KEY_F5, + /* 61 */ KEY_F6, + /* 62 */ KEY_F7, + /* 63 */ KEY_F3, + /* 64 */ KEY_F8, + /* 65 */ KEY_F9, + /* 66 */ KEY_UNKNOWN, + /* 67 */ KEY_F11, + /* 68 */ KEY_UNKNOWN, + /* 69 */ KEY_F13, + /* 6a */ KEY_F16, + /* 6b */ KEY_F14, + /* 6c */ KEY_UNKNOWN, + /* 6d */ KEY_F10, + /* 6e */ KEY_UNKNOWN, + /* 6f */ KEY_F12, + /* 70 */ KEY_UNKNOWN, + /* 71 */ KEY_F15, + /* 72 */ KEY_INSERT, /* Really Help... */ + /* 73 */ KEY_HOME, + /* 74 */ KEY_PAGEUP, + /* 75 */ KEY_DELETE, + /* 76 */ KEY_F4, + /* 77 */ KEY_END, + /* 78 */ KEY_F2, + /* 79 */ KEY_PAGEDOWN, + /* 7a */ KEY_F1, + /* 7b */ KEY_LEFT, + /* 7c */ KEY_RIGHT, + /* 7d */ KEY_DOWN, + /* 7e */ KEY_UP, + /* 7f */ KEY_UNKNOWN, + }; + + if (key >= 128) + return KEY_UNKNOWN; + + return table[key]; +} + +- (void)keyDown:(NSEvent *)event { + InputEvent ev; + ev.type = InputEvent::KEY; + ev.key.pressed = true; + ev.key.mod = translateFlags([event modifierFlags]); + ev.key.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode])); + ev.key.echo = [event isARepeat]; + + NSString *characters = [event characters]; + NSUInteger i, length = [characters length]; + + if (length > 0 && keycode_has_unicode(ev.key.scancode)) { + for (i = 0; i < length; i++) { + ev.key.unicode = [characters characterAtIndex:i]; + OS_OSX::singleton->push_input(ev); + ev.key.scancode = 0; + } + } else { OS_OSX::singleton->push_input(ev); - ev.key.scancode=0; } - - } else { - OS_OSX::singleton->push_input(ev); - } } -- (void)flagsChanged:(NSEvent *)event -{ +- (void)flagsChanged:(NSEvent *)event { InputEvent ev; int key = [event keyCode]; int mod = [event modifierFlags]; - ev.type=InputEvent::KEY; + ev.type = InputEvent::KEY; if (key == 0x36 || key == 0x37) { if (mod & NSCommandKeyMask) { - mod&= ~NSCommandKeyMask; + mod &= ~NSCommandKeyMask; ev.key.pressed = true; } else { ev.key.pressed = false; } } else if (key == 0x38 || key == 0x3c) { if (mod & NSShiftKeyMask) { - mod&= ~NSShiftKeyMask; + mod &= ~NSShiftKeyMask; ev.key.pressed = true; } else { ev.key.pressed = false; } } else if (key == 0x3a || key == 0x3d) { if (mod & NSAlternateKeyMask) { - mod&= ~NSAlternateKeyMask; + mod &= ~NSAlternateKeyMask; ev.key.pressed = true; } else { ev.key.pressed = false; } } else if (key == 0x3b || key == 0x3e) { if (mod & NSControlKeyMask) { - mod&= ~NSControlKeyMask; + mod &= ~NSControlKeyMask; ev.key.pressed = true; } else { ev.key.pressed = false; @@ -816,108 +766,102 @@ static int translateKey(unsigned int key) return; } - ev.key.mod=translateFlags(mod); + ev.key.mod = translateFlags(mod); ev.key.scancode = latin_keyboard_keycode_convert(translateKey(key)); OS_OSX::singleton->push_input(ev); } -- (void)keyUp:(NSEvent *)event -{ +- (void)keyUp:(NSEvent *)event { InputEvent ev; - ev.type=InputEvent::KEY; - ev.key.pressed=false; - ev.key.mod=translateFlags([event modifierFlags]); + ev.type = InputEvent::KEY; + ev.key.pressed = false; + ev.key.mod = translateFlags([event modifierFlags]); ev.key.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode])); OS_OSX::singleton->push_input(ev); - - /* const int key = translateKey([event keyCode]); - const int mods = translateFlags([event modifierFlags]); - _glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods);*/ + /* + const int key = translateKey([event keyCode]); + const int mods = translateFlags([event modifierFlags]); + _glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods); +*/ } -- (void)scrollWheel:(NSEvent *)event -{ - - double deltaX, deltaY; +- (void)scrollWheel:(NSEvent *)event { + double deltaX, deltaY; #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) - { - deltaX = [event scrollingDeltaX]; - deltaY = [event scrollingDeltaY]; - - if ([event hasPreciseScrollingDeltas]) - { - deltaX *= 0.1; - deltaY *= 0.1; + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { + deltaX = [event scrollingDeltaX]; + deltaY = [event scrollingDeltaY]; + + if ([event hasPreciseScrollingDeltas]) { + deltaX *= 0.1; + deltaY *= 0.1; + } + } else { + deltaX = [event deltaX]; + deltaY = [event deltaY]; } - } - else -#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ - { +#else deltaX = [event deltaX]; deltaY = [event deltaY]; - } - +#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ if (fabs(deltaY)) { InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=deltaY >0 ? BUTTON_WHEEL_UP : BUTTON_WHEEL_DOWN; - ev.mouse_button.pressed=true; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = deltaY > 0 ? BUTTON_WHEEL_UP : BUTTON_WHEEL_DOWN; + ev.mouse_button.pressed = true; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; OS_OSX::singleton->push_input(ev); - ev.mouse_button.pressed=false; + ev.mouse_button.pressed = false; OS_OSX::singleton->push_input(ev); } if (fabs(deltaX)) { InputEvent ev; - ev.type=InputEvent::MOUSE_BUTTON; - ev.mouse_button.button_index=deltaX < 0 ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT; - ev.mouse_button.pressed=true; - ev.mouse_button.x=mouse_x; - ev.mouse_button.y=mouse_y; - ev.mouse_button.global_x=mouse_x; - ev.mouse_button.global_y=mouse_y; - ev.mouse_button.button_mask=button_mask; + ev.type = InputEvent::MOUSE_BUTTON; + ev.mouse_button.button_index = deltaX < 0 ? BUTTON_WHEEL_RIGHT : BUTTON_WHEEL_LEFT; + ev.mouse_button.pressed = true; + ev.mouse_button.x = mouse_x; + ev.mouse_button.y = mouse_y; + ev.mouse_button.global_x = mouse_x; + ev.mouse_button.global_y = mouse_y; + ev.mouse_button.button_mask = button_mask; OS_OSX::singleton->push_input(ev); - ev.mouse_button.pressed=false; + ev.mouse_button.pressed = false; OS_OSX::singleton->push_input(ev); } } @end -@interface GodotWindow : NSWindow {} +@interface GodotWindow : NSWindow { +} @end @implementation GodotWindow - -- (BOOL)canBecomeKeyWindow -{ - // Required for NSBorderlessWindowMask windows - return YES; +- (BOOL)canBecomeKeyWindow { + // Required for NSBorderlessWindowMask windows + return YES; } @end - int OS_OSX::get_video_driver_count() const { - return 1; } -const char * OS_OSX::get_video_driver_name(int p_driver) const { + +const char *OS_OSX::get_video_driver_name(int p_driver) const { return "GLES2"; } @@ -925,14 +869,13 @@ const char * OS_OSX::get_video_driver_name(int p_driver) const { OS::VideoMode OS_OSX::get_default_video_mode() const { VideoMode vm; - vm.width=1024; - vm.height=600; - vm.fullscreen=false; - vm.resizable=true; + vm.width = 1024; + vm.height = 600; + vm.fullscreen = false; + vm.resizable = true; return vm; } - void OS_OSX::initialize_core() { OS_Unix::initialize_core(); @@ -942,7 +885,6 @@ void OS_OSX::initialize_core() { DirAccess::make_default<DirAccessOSX>(DirAccess::ACCESS_FILESYSTEM); SemaphoreOSX::make_default(); - } static bool keyboard_layout_dirty = true; @@ -950,7 +892,7 @@ static void keyboardLayoutChanged(CFNotificationCenterRef center, void *observer keyboard_layout_dirty = true; } -void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audio_driver) { +void OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) { /*** OSX INITIALIZATION ***/ /*** OSX INITIALIZATION ***/ @@ -960,43 +902,42 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi // Register to be notified on keyboard layout changes CFNotificationCenterAddObserver(CFNotificationCenterGetDistributedCenter(), - NULL, keyboardLayoutChanged, - kTISNotifySelectedKeyboardInputSourceChanged, NULL, - CFNotificationSuspensionBehaviorDeliverImmediately); + NULL, keyboardLayoutChanged, + kTISNotifySelectedKeyboardInputSourceChanged, NULL, + CFNotificationSuspensionBehaviorDeliverImmediately); if (is_hidpi_allowed() && [[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) { - for (NSScreen *screen in [NSScreen screens]) { - float s = [screen backingScaleFactor]; - if (s > display_scale) { - display_scale=s; - } - } + for (NSScreen *screen in [NSScreen screens]) { + float s = [screen backingScaleFactor]; + if (s > display_scale) { + display_scale = s; + } + } } window_delegate = [[GodotWindowDelegate alloc] init]; - // Don't use accumulation buffer support; it's not accelerated - // Aux buffers probably aren't accelerated either - - unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable?NSResizableWindowMask:0); + // Don't use accumulation buffer support; it's not accelerated + // Aux buffers probably aren't accelerated either + unsigned int styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable ? NSResizableWindowMask : 0); window_object = [[GodotWindow alloc] - initWithContentRect:NSMakeRect(0, 0, p_desired.width/display_scale, p_desired.height/display_scale) - styleMask:styleMask - backing:NSBackingStoreBuffered - defer:NO]; + initWithContentRect:NSMakeRect(0, 0, p_desired.width / display_scale, p_desired.height / display_scale) + styleMask:styleMask + backing:NSBackingStoreBuffered + defer:NO]; - ERR_FAIL_COND( window_object==nil ); + ERR_FAIL_COND(window_object == nil); window_view = [[GodotContentView alloc] init]; window_size.width = p_desired.width; window_size.height = p_desired.height; - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale>1) { - [window_view setWantsBestResolutionOpenGLSurface:YES]; - //if (current_videomode.resizable) + if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale > 1) { + [window_view setWantsBestResolutionOpenGLSurface:YES]; + //if (current_videomode.resizable) [window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; } @@ -1014,11 +955,15 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi // OS X needs non-zero color size, so set resonable values int colorBits = 32; - // Fail if a robustness strategy was requested +// Fail if a robustness strategy was requested - -#define ADD_ATTR(x) { attributes[attributeCount++] = x; } -#define ADD_ATTR2(x, y) { ADD_ATTR(x); ADD_ATTR(y); } +#define ADD_ATTR(x) \ + { attributes[attributeCount++] = x; } +#define ADD_ATTR2(x, y) \ + { \ + ADD_ATTR(x); \ + ADD_ATTR(y); \ + } // Arbitrary array size here NSOpenGLPixelFormatAttribute attributes[40]; @@ -1031,21 +976,26 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi ADD_ATTR2(NSOpenGLPFAColorSize, colorBits); - /* if (fbconfig->alphaBits > 0) - ADD_ATTR2(NSOpenGLPFAAlphaSize, fbconfig->alphaBits);*/ + /* + if (fbconfig->alphaBits > 0) + ADD_ATTR2(NSOpenGLPFAAlphaSize, fbconfig->alphaBits); +*/ ADD_ATTR2(NSOpenGLPFADepthSize, 24); ADD_ATTR2(NSOpenGLPFAStencilSize, 8); - /*if (fbconfig->stereo) - ADD_ATTR(NSOpenGLPFAStereo);*/ + /* + if (fbconfig->stereo) + ADD_ATTR(NSOpenGLPFAStereo); +*/ - /* if (fbconfig->samples > 0) - { - ADD_ATTR2(NSOpenGLPFASampleBuffers, 1); - ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples); - }*/ + /* + if (fbconfig->samples > 0) { + ADD_ATTR2(NSOpenGLPFASampleBuffers, 1); + ADD_ATTR2(NSOpenGLPFASamples, fbconfig->samples); + } +*/ // NOTE: All NSOpenGLPixelFormats on the relevant cards support sRGB // frambuffer, so there's no need (and no way) to request it @@ -1056,14 +1006,11 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi #undef ADD_ATTR2 pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; - ERR_FAIL_COND( pixelFormat == nil); - + ERR_FAIL_COND(pixelFormat == nil); - context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat - shareContext:nil]; - - ERR_FAIL_COND(context==nil); + context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; + ERR_FAIL_COND(context == nil); [context setView:window_view]; @@ -1080,79 +1027,77 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi /*** END OSX INITIALIZATION ***/ /*** END OSX INITIALIZATION ***/ - bool use_gl2=p_video_driver!=1; - - + bool use_gl2 = p_video_driver != 1; AudioDriverManager::add_driver(&audio_driver_osx); - // only opengl support here... + // only opengl support here... RasterizerGLES3::register_config(); RasterizerGLES3::make_current(); //rasterizer = instance_RasterizerGLES2(); //visual_server = memnew( VisualServerRaster(rasterizer) ); - visual_server = memnew( VisualServerRaster ); + visual_server = memnew(VisualServerRaster); // FIXME: Reimplement threaded rendering? Or remove? /* if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) { visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD)); } - */ +*/ visual_server->init(); visual_server->cursor_set_visible(false, 0); AudioDriverManager::get_driver(p_audio_driver)->set_singleton(); - if (AudioDriverManager::get_driver(p_audio_driver)->init()!=OK) { + if (AudioDriverManager::get_driver(p_audio_driver)->init() != OK) { ERR_PRINT("Initializing audio failed."); } // - physics_server = memnew( PhysicsServerSW ); + physics_server = memnew(PhysicsServerSW); physics_server->init(); //physics_2d_server = memnew( Physics2DServerSW ); physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>(); physics_2d_server->init(); - input = memnew( InputDefault ); - joypad_osx = memnew( JoypadOSX ); + input = memnew(InputDefault); + joypad_osx = memnew(JoypadOSX); - power_manager = memnew( power_osx ); + power_manager = memnew(power_osx); _ensure_data_dir(); NSArray *screenArray = [NSScreen screens]; printf("nscreen count %i\n", (int)[screenArray count]); - for (int i=0; i<[screenArray count]; i++) { + for (int i = 0; i < [screenArray count]; i++) { float displayScale = 1.0; - if (display_scale>1.0 && [[screenArray objectAtIndex: i] respondsToSelector:@selector(backingScaleFactor)]) { - displayScale = [[screenArray objectAtIndex: i] backingScaleFactor]; + if (display_scale > 1.0 && [[screenArray objectAtIndex:i] respondsToSelector:@selector(backingScaleFactor)]) { + displayScale = [[screenArray objectAtIndex:i] backingScaleFactor]; } - NSRect nsrect = [[screenArray objectAtIndex: i] visibleFrame]; + NSRect nsrect = [[screenArray objectAtIndex:i] visibleFrame]; Rect2 rect = Rect2(nsrect.origin.x, nsrect.origin.y, nsrect.size.width, nsrect.size.height); - rect.pos*=displayScale; - rect.size*=displayScale; + rect.pos *= displayScale; + rect.size *= displayScale; screens.push_back(rect); - NSDictionary *description = [[screenArray objectAtIndex: i] deviceDescription]; + NSDictionary *description = [[screenArray objectAtIndex:i] deviceDescription]; NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue]; CGSize displayPhysicalSize = CGDisplayScreenSize( - [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); + [[description objectForKey:@"NSScreenNumber"] unsignedIntValue]); //printf("width: %i pwidth %i rect width %i\n",int(displayPixelSize.width*displayScale),int(displayPhysicalSize.width*displayScale),int(nsrect.size.width)); - int dpi = (displayPixelSize.width * 25.4f / displayPhysicalSize.width)*displayScale; + int dpi = (displayPixelSize.width * 25.4f / displayPhysicalSize.width) * displayScale; screen_dpi.push_back(dpi); - }; restore_rect = Rect2(get_window_position(), get_window_size()); } + void OS_OSX::finalize() { CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL); @@ -1172,15 +1117,12 @@ void OS_OSX::finalize() { memdelete(physics_2d_server); screens.clear(); - - } -void OS_OSX::set_main_loop( MainLoop * p_main_loop ) { +void OS_OSX::set_main_loop(MainLoop *p_main_loop) { - main_loop=p_main_loop; + main_loop = p_main_loop; input->set_main_loop(p_main_loop); - } void OS_OSX::delete_main_loop() { @@ -1188,16 +1130,15 @@ void OS_OSX::delete_main_loop() { if (!main_loop) return; memdelete(main_loop); - main_loop=NULL; + main_loop = NULL; } - String OS_OSX::get_name() { return "OSX"; } -void OS_OSX::alert(const String& p_alert, const String& p_title) { +void OS_OSX::alert(const String &p_alert, const String &p_title) { // Set OS X-compliant variables NSAlert *window = [[NSAlert alloc] init]; NSString *ns_title = [NSString stringWithUTF8String:p_title.utf8().get_data()]; @@ -1215,10 +1156,10 @@ void OS_OSX::alert(const String& p_alert, const String& p_title) { void OS_OSX::set_cursor_shape(CursorShape p_shape) { - if (cursor_shape==p_shape) + if (cursor_shape == p_shape) return; - switch(p_shape) { + switch (p_shape) { case CURSOR_ARROW: [[NSCursor arrowCursor] set]; break; case CURSOR_IBEAM: [[NSCursor IBeamCursor] set]; break; case CURSOR_POINTING_HAND: [[NSCursor pointingHandCursor] set]; break; @@ -1239,101 +1180,100 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) { default: {}; } - cursor_shape=p_shape; + cursor_shape = p_shape; } void OS_OSX::set_mouse_show(bool p_show) { - } -void OS_OSX::set_mouse_grab(bool p_grab) { +void OS_OSX::set_mouse_grab(bool p_grab) { } + bool OS_OSX::is_mouse_grab_enabled() const { return mouse_grab; } -void OS_OSX::warp_mouse_pos(const Point2& p_to) { +void OS_OSX::warp_mouse_pos(const Point2 &p_to) { - //copied from windows impl with osx native calls - if (mouse_mode == MOUSE_MODE_CAPTURED){ - mouse_x = p_to.x; - mouse_y = p_to.y; - } - else{ //set OS position + //copied from windows impl with osx native calls + if (mouse_mode == MOUSE_MODE_CAPTURED) { + mouse_x = p_to.x; + mouse_y = p_to.y; + } else { //set OS position - /* this code has not been tested, please be a kind soul and fix it if it fails! */ + /* this code has not been tested, please be a kind soul and fix it if it fails! */ - //local point in window coords - NSPoint localPoint = { p_to.x, p_to.y }; + //local point in window coords + NSPoint localPoint = { p_to.x, p_to.y }; - NSPoint pointInWindow = [window_view convertPoint:localPoint toView:nil]; - NSRect pointInWindowRect; - pointInWindowRect.origin = pointInWindow; - NSPoint pointOnScreen = [[window_view window] convertRectToScreen:pointInWindowRect].origin; + NSPoint pointInWindow = [window_view convertPoint:localPoint toView:nil]; + NSRect pointInWindowRect; + pointInWindowRect.origin = pointInWindow; + NSPoint pointOnScreen = [[window_view window] convertRectToScreen:pointInWindowRect].origin; - //point in scren coords - CGPoint lMouseWarpPos = { pointOnScreen.x, pointOnScreen.y}; + //point in scren coords + CGPoint lMouseWarpPos = { pointOnScreen.x, pointOnScreen.y }; - //do the warping - CGEventSourceRef lEventRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); - CGEventSourceSetLocalEventsSuppressionInterval(lEventRef, 0.0); - CGAssociateMouseAndMouseCursorPosition(false); - CGWarpMouseCursorPosition(lMouseWarpPos); - CGAssociateMouseAndMouseCursorPosition(true); - } + //do the warping + CGEventSourceRef lEventRef = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); + CGEventSourceSetLocalEventsSuppressionInterval(lEventRef, 0.0); + CGAssociateMouseAndMouseCursorPosition(false); + CGWarpMouseCursorPosition(lMouseWarpPos); + CGAssociateMouseAndMouseCursorPosition(true); + } } -Point2 OS_OSX::get_mouse_pos() const { +Point2 OS_OSX::get_mouse_position() const { - return Vector2(mouse_x,mouse_y); + return Vector2(mouse_x, mouse_y); } + int OS_OSX::get_mouse_button_state() const { return button_mask; } -void OS_OSX::set_window_title(const String& p_title) { - [window_object setTitle:[NSString stringWithUTF8String:p_title.utf8().get_data()]]; +void OS_OSX::set_window_title(const String &p_title) { + [window_object setTitle:[NSString stringWithUTF8String:p_title.utf8().get_data()]]; } -void OS_OSX::set_icon(const Image& p_icon) { +void OS_OSX::set_icon(const Image &p_icon) { - Image img=p_icon; + Image img = p_icon; img.convert(Image::FORMAT_RGBA8); - NSBitmapImageRep *imgrep= [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL - pixelsWide: p_icon.get_width() - pixelsHigh: p_icon.get_height() - bitsPerSample: 8 - samplesPerPixel: 4 - hasAlpha: YES - isPlanar: NO - colorSpaceName: NSDeviceRGBColorSpace - bytesPerRow: p_icon.get_width()*4 - bitsPerPixel: 32] autorelease]; - ERR_FAIL_COND(imgrep==nil); + NSBitmapImageRep *imgrep = [[[NSBitmapImageRep alloc] + initWithBitmapDataPlanes:NULL + pixelsWide:p_icon.get_width() + pixelsHigh:p_icon.get_height() + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSDeviceRGBColorSpace + bytesPerRow:p_icon.get_width() * 4 + bitsPerPixel:32] autorelease]; + ERR_FAIL_COND(imgrep == nil); uint8_t *pixels = [imgrep bitmapData]; - int len = img.get_width()*img.get_height(); + int len = img.get_width() * img.get_height(); PoolVector<uint8_t> data = img.get_data(); PoolVector<uint8_t>::Read r = data.read(); /* Premultiply the alpha channel */ - for (int i = 0; i<len ; i++) { - uint8_t alpha = r[i*4+3]; - pixels[i*4+0] = (uint8_t)(((uint16_t)r[i*4+0] * alpha) / 255); - pixels[i*4+1] = (uint8_t)(((uint16_t)r[i*4+1] * alpha) / 255); - pixels[i*4+2] = (uint8_t)(((uint16_t)r[i*4+2] * alpha) / 255); - pixels[i*4+3] = alpha; - + for (int i = 0; i < len; i++) { + uint8_t alpha = r[i * 4 + 3]; + pixels[i * 4 + 0] = (uint8_t)(((uint16_t)r[i * 4 + 0] * alpha) / 255); + pixels[i * 4 + 1] = (uint8_t)(((uint16_t)r[i * 4 + 1] * alpha) / 255); + pixels[i * 4 + 2] = (uint8_t)(((uint16_t)r[i * 4 + 2] * alpha) / 255); + pixels[i * 4 + 3] = alpha; } - NSImage *nsimg = [[[NSImage alloc] initWithSize: NSMakeSize(img.get_width(),img.get_height())] autorelease]; + NSImage *nsimg = [[[NSImage alloc] initWithSize:NSMakeSize(img.get_width(), img.get_height())] autorelease]; ERR_FAIL_COND(nsimg == nil); - [nsimg addRepresentation: imgrep]; + [nsimg addRepresentation:imgrep]; [NSApp setApplicationIconImage:nsimg]; - } MainLoop *OS_OSX::get_main_loop() const { @@ -1346,27 +1286,26 @@ bool OS_OSX::can_draw() const { return true; } -void OS_OSX::set_clipboard(const String& p_text) { +void OS_OSX::set_clipboard(const String &p_text) { - NSArray* types = [NSArray arrayWithObjects:NSStringPboardType, nil]; + NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil]; - NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; [pasteboard declareTypes:types owner:nil]; [pasteboard setString:[NSString stringWithUTF8String:p_text.utf8().get_data()] - forType:NSStringPboardType]; + forType:NSStringPboardType]; } + String OS_OSX::get_clipboard() const { - NSPasteboard* pasteboard = [NSPasteboard generalPasteboard]; + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; - if (![[pasteboard types] containsObject:NSStringPboardType]) - { + if (![[pasteboard types] containsObject:NSStringPboardType]) { return ""; } - NSString* object = [pasteboard stringForType:NSStringPboardType]; - if (!object) - { + NSString *object = [pasteboard stringForType:NSStringPboardType]; + if (!object) { return ""; } @@ -1381,12 +1320,11 @@ String OS_OSX::get_clipboard() const { void OS_OSX::release_rendering_thread() { [NSOpenGLContext clearCurrentContext]; - } + void OS_OSX::make_rendering_thread() { [context makeCurrentContext]; - } Error OS_OSX::shell_open(String p_uri) { @@ -1396,14 +1334,13 @@ Error OS_OSX::shell_open(String p_uri) { } String OS_OSX::get_locale() const { - NSString* preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0]; + NSString *preferredLang = [[NSLocale preferredLanguages] objectAtIndex:0]; return [preferredLang UTF8String]; } void OS_OSX::swap_buffers() { [context flushBuffer]; - } void OS_OSX::wm_minimized(bool p_minimized) { @@ -1411,23 +1348,21 @@ void OS_OSX::wm_minimized(bool p_minimized) { minimized = p_minimized; }; -void OS_OSX::set_video_mode(const VideoMode& p_video_mode,int p_screen) { - +void OS_OSX::set_video_mode(const VideoMode &p_video_mode, int p_screen) { } OS::VideoMode OS_OSX::get_video_mode(int p_screen) const { VideoMode vm; - vm.width=window_size.width; - vm.height=window_size.height; + vm.width = window_size.width; + vm.height = window_size.height; return vm; } -void OS_OSX::get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen) const { +void OS_OSX::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { } - int OS_OSX::get_screen_count() const { return screens.size(); @@ -1464,35 +1399,33 @@ Size2 OS_OSX::get_screen_size(int p_screen) const { Point2 OS_OSX::get_window_position() const { Size2 wp([window_object frame].origin.x, [window_object frame].origin.y); - wp*=display_scale; + wp *= display_scale; return wp; }; +void OS_OSX::set_window_position(const Point2 &p_position) { -void OS_OSX::set_window_position(const Point2& p_position) { - - Point2 size=p_position; - size/=display_scale; + Point2 size = p_position; + size /= display_scale; [window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES]; }; Size2 OS_OSX::get_window_size() const { return window_size; - }; void OS_OSX::set_window_size(const Size2 p_size) { - Size2 size=p_size; + Size2 size = p_size; // NSRect used by setFrame includes the title bar, so add it to our size.y CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; if (menuBarHeight != 0.f) { - size.y+= menuBarHeight; + size.y += menuBarHeight; #if MAC_OS_X_VERSION_MAX_ALLOWED <= 101104 } else { - size.y+= [[NSStatusBar systemStatusBar] thickness]; + size.y += [[NSStatusBar systemStatusBar] thickness]; #endif } NSRect frame = [window_object frame]; @@ -1514,7 +1447,7 @@ void OS_OSX::set_window_fullscreen(bool p_enabled) { bool OS_OSX::is_window_fullscreen() const { #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 - if ( [window_object respondsToSelector:@selector(isZoomed)] ) + if ([window_object respondsToSelector:@selector(isZoomed)]) return [window_object isZoomed]; #endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ @@ -1524,9 +1457,9 @@ bool OS_OSX::is_window_fullscreen() const { void OS_OSX::set_window_resizable(bool p_enabled) { if (p_enabled) - [window_object setStyleMask:[window_object styleMask] | NSResizableWindowMask ]; + [window_object setStyleMask:[window_object styleMask] | NSResizableWindowMask]; else - [window_object setStyleMask:[window_object styleMask] & ~NSResizableWindowMask ]; + [window_object setStyleMask:[window_object styleMask] & ~NSResizableWindowMask]; }; bool OS_OSX::is_window_resizable() const { @@ -1544,13 +1477,12 @@ void OS_OSX::set_window_minimized(bool p_enabled) { bool OS_OSX::is_window_minimized() const { - if ( [window_object respondsToSelector:@selector(isMiniaturized)]) + if ([window_object respondsToSelector:@selector(isMiniaturized)]) return [window_object isMiniaturized]; return minimized; }; - void OS_OSX::set_window_maximized(bool p_enabled) { if (p_enabled) { @@ -1569,7 +1501,6 @@ bool OS_OSX::is_window_maximized() const { return maximized; }; - void OS_OSX::move_window_to_foreground() { [window_object orderFrontRegardless]; @@ -1587,8 +1518,8 @@ String OS_OSX::get_executable_path() const { char pathbuf[PROC_PIDPATHINFO_MAXSIZE]; pid = getpid(); - ret = proc_pidpath (pid, pathbuf, sizeof(pathbuf)); - if ( ret <= 0 ) { + ret = proc_pidpath(pid, pathbuf, sizeof(pathbuf)); + if (ret <= 0) { return OS::get_executable_path(); } else { String path; @@ -1596,7 +1527,6 @@ String OS_OSX::get_executable_path() const { return path; } - } // Returns string representation of keys, if they are printable. @@ -1616,22 +1546,22 @@ static NSString *createStringForKeys(const CGKeyCode *keyCode, int length) { OSStatus err; CFMutableStringRef output = CFStringCreateMutable(NULL, 0); - for (int i=0; i<length; ++i) { + for (int i = 0; i < length; ++i) { UInt32 keysDown = 0; UniChar chars[4]; UniCharCount realLength; err = UCKeyTranslate(keyboardLayout, - keyCode[i], - kUCKeyActionDisplay, - 0, - LMGetKbdType(), - kUCKeyTranslateNoDeadKeysBit, - &keysDown, - sizeof(chars) / sizeof(chars[0]), - &realLength, - chars); + keyCode[i], + kUCKeyActionDisplay, + 0, + LMGetKbdType(), + kUCKeyTranslateNoDeadKeysBit, + &keysDown, + sizeof(chars) / sizeof(chars[0]), + &realLength, + chars); if (err != noErr) { CFRelease(output); @@ -1645,6 +1575,7 @@ static NSString *createStringForKeys(const CGKeyCode *keyCode, int length) { return (NSString *)output; } + OS::LatinKeyboardVariant OS_OSX::get_latin_keyboard_variant() const { static LatinKeyboardVariant layout = LATIN_KEYBOARD_QWERTY; @@ -1653,7 +1584,7 @@ OS::LatinKeyboardVariant OS_OSX::get_latin_keyboard_variant() const { layout = LATIN_KEYBOARD_QWERTY; - CGKeyCode keys[] = {kVK_ANSI_Q, kVK_ANSI_W, kVK_ANSI_E, kVK_ANSI_R, kVK_ANSI_T, kVK_ANSI_Y}; + CGKeyCode keys[] = { kVK_ANSI_Q, kVK_ANSI_W, kVK_ANSI_E, kVK_ANSI_R, kVK_ANSI_T, kVK_ANSI_Y }; NSString *test = createStringForKeys(keys, 6); if ([test isEqualToString:@"qwertz"]) { @@ -1680,10 +1611,12 @@ OS::LatinKeyboardVariant OS_OSX::get_latin_keyboard_variant() const { void OS_OSX::process_events() { while (true) { - NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask - untilDate:[NSDate distantPast] - inMode:NSDefaultRunLoopMode - dequeue:YES]; + NSEvent *event = [NSApp + nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantPast] + inMode:NSDefaultRunLoopMode + dequeue:YES]; + if (event == nil) break; @@ -1694,11 +1627,9 @@ void OS_OSX::process_events() { autoreleasePool = [[NSAutoreleasePool alloc] init]; } +void OS_OSX::push_input(const InputEvent &p_event) { - -void OS_OSX::push_input(const InputEvent& p_event) { - - InputEvent ev=p_event; + InputEvent ev = p_event; //print_line("EV: "+String(ev)); input->parse_input_event(ev); } @@ -1726,7 +1657,7 @@ void OS_OSX::run() { process_events(); // get rid of pending events joypad_osx->process_joypads(); - if (Main::iteration()==true) + if (Main::iteration() == true) break; }; @@ -1735,32 +1666,31 @@ void OS_OSX::run() { void OS_OSX::set_mouse_mode(MouseMode p_mode) { - if (p_mode==mouse_mode) - return; + if (p_mode == mouse_mode) + return; - if (p_mode==MOUSE_MODE_CAPTURED) { - // Apple Docs state that the display parameter is not used. - // "This parameter is not used. By default, you may pass kCGDirectMainDisplay." - // https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/Quartz_Services_Ref/Reference/reference.html - CGDisplayHideCursor(kCGDirectMainDisplay); - CGAssociateMouseAndMouseCursorPosition(false); - } else if (p_mode==MOUSE_MODE_HIDDEN) { - CGDisplayHideCursor(kCGDirectMainDisplay); - CGAssociateMouseAndMouseCursorPosition(true); - } else { - CGDisplayShowCursor(kCGDirectMainDisplay); - CGAssociateMouseAndMouseCursorPosition(true); - } + if (p_mode == MOUSE_MODE_CAPTURED) { + // Apple Docs state that the display parameter is not used. + // "This parameter is not used. By default, you may pass kCGDirectMainDisplay." + // https://developer.apple.com/library/mac/documentation/graphicsimaging/reference/Quartz_Services_Ref/Reference/reference.html + CGDisplayHideCursor(kCGDirectMainDisplay); + CGAssociateMouseAndMouseCursorPosition(false); + } else if (p_mode == MOUSE_MODE_HIDDEN) { + CGDisplayHideCursor(kCGDirectMainDisplay); + CGAssociateMouseAndMouseCursorPosition(true); + } else { + CGDisplayShowCursor(kCGDirectMainDisplay); + CGAssociateMouseAndMouseCursorPosition(true); + } - mouse_mode=p_mode; + mouse_mode = p_mode; } OS::MouseMode OS_OSX::get_mouse_mode() const { - return mouse_mode; + return mouse_mode; } - String OS_OSX::get_joy_guid(int p_device) const { return input->get_joy_guid_remapped(p_device); } @@ -1777,13 +1707,13 @@ int OS_OSX::get_power_percent_left() { return power_manager->get_power_percent_left(); } -OS_OSX* OS_OSX::singleton=NULL; +OS_OSX *OS_OSX::singleton = NULL; OS_OSX::OS_OSX() { - - mouse_mode=OS::MOUSE_MODE_VISIBLE; - main_loop=NULL; - singleton=this; + + mouse_mode = OS::MOUSE_MODE_VISIBLE; + main_loop = NULL; + singleton = this; autoreleasePool = [[NSAutoreleasePool alloc] init]; eventSource = CGEventSourceCreate(kCGEventSourceStateHIDSystemState); @@ -1791,13 +1721,12 @@ OS_OSX::OS_OSX() { CGEventSourceSetLocalEventsSuppressionInterval(eventSource, 0.0); - - /*if (pthread_key_create(&_Godot.nsgl.current, NULL) != 0) - { - _GodotInputError(Godot_PLATFORM_ERROR, - "NSGL: Failed to create context TLS"); - return GL_FALSE; - }*/ + /* + if (pthread_key_create(&_Godot.nsgl.current, NULL) != 0) { + _GodotInputError(Godot_PLATFORM_ERROR, "NSGL: Failed to create context TLS"); + return GL_FALSE; + } +*/ framework = CFBundleGetBundleWithIdentifier(CFSTR("com.apple.opengl")); ERR_FAIL_COND(!framework); @@ -1808,12 +1737,12 @@ OS_OSX::OS_OSX() { // In case we are unbundled, make us a proper UI application [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - #if 0 +#if 0 // Menu bar setup must go between sharedApplication above and // finishLaunching below, in order to properly emulate the behavior // of NSApplicationMain createMenuBar(); - #endif +#endif [NSApp finishLaunching]; @@ -1821,14 +1750,13 @@ OS_OSX::OS_OSX() { ERR_FAIL_COND(!delegate); [NSApp setDelegate:delegate]; - - cursor_shape=CURSOR_ARROW; + cursor_shape = CURSOR_ARROW; current_screen = 0; maximized = false; minimized = false; - window_size=Vector2(1024,600); + window_size = Vector2(1024, 600); zoomed = false; - display_scale=1.0; + display_scale = 1.0; } diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index 5e1034a392..89af785d29 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -143,7 +143,7 @@ int OS_Server::get_mouse_button_state() const { return 0; } -Point2 OS_Server::get_mouse_pos() const { +Point2 OS_Server::get_mouse_position() const { return Point2(); } diff --git a/platform/server/os_server.h b/platform/server/os_server.h index b360a1e183..7c29b1e232 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -88,7 +88,7 @@ public: virtual void set_mouse_show(bool p_show); virtual void set_mouse_grab(bool p_grab); virtual bool is_mouse_grab_enabled() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index bcce368ac4..8b7e821ab3 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -532,7 +532,7 @@ OSUWP::MouseMode OSUWP::get_mouse_mode() const { return mouse_mode; } -Point2 OSUWP::get_mouse_pos() const { +Point2 OSUWP::get_mouse_position() const { return Point2(old_x, old_y); } diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index eac98c80a1..88a1dddae3 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -190,7 +190,7 @@ public: void set_mouse_mode(MouseMode p_mode); MouseMode get_mouse_mode() const; - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 6080c6f1dc..5e56c1db49 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -242,7 +242,7 @@ def configure(env): env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) env.Append(LINKFLAGS=['/DEBUG']) - env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo']) + env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo']) env.Append(CXXFLAGS=['/TP']) env.Append(CPPFLAGS=['/DMSVC', '/GR', ]) env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"]) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 13c4da58e0..99b6890913 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -402,7 +402,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) SetCursorPos(pos.x, pos.y); } - input->set_mouse_pos(Point2(mm.x, mm.y)); + input->set_mouse_position(Point2(mm.x, mm.y)); mm.speed_x = input->get_last_mouse_speed().x; mm.speed_y = input->get_last_mouse_speed().y; @@ -1318,7 +1318,7 @@ void OS_Windows::warp_mouse_pos(const Point2 &p_to) { } } -Point2 OS_Windows::get_mouse_pos() const { +Point2 OS_Windows::get_mouse_position() const { return Point2(old_x, old_y); } @@ -1990,7 +1990,6 @@ String OS_Windows::get_executable_path() const { wchar_t bufname[4096]; GetModuleFileNameW(NULL, bufname, 4096); String s = bufname; - print_line("EXEC PATHP??: " + s); return s; } diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 4c8c2c950f..87eceafa02 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -191,7 +191,7 @@ public: MouseMode get_mouse_mode() const; virtual void warp_mouse_pos(const Point2 &p_to); - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index d2650684c3..2e2fe3ba8a 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -548,7 +548,7 @@ void OS_X11::set_mouse_mode(MouseMode p_mode) { XWarpPointer(x11_display, None, x11_window, 0, 0, 0, 0, (int)center.x, (int)center.y); - input->set_mouse_pos(center); + input->set_mouse_position(center); } else { do_mouse_warp = false; } @@ -580,7 +580,7 @@ int OS_X11::get_mouse_button_state() const { return last_button_state; } -Point2 OS_X11::get_mouse_pos() const { +Point2 OS_X11::get_mouse_position() const { return last_mouse_pos; } @@ -1451,7 +1451,7 @@ void OS_X11::process_xevents() { motion_event.mouse_motion.button_mask = get_mouse_button_state(event.xmotion.state); motion_event.mouse_motion.x = pos.x; motion_event.mouse_motion.y = pos.y; - input->set_mouse_pos(pos); + input->set_mouse_position(pos); motion_event.mouse_motion.global_x = pos.x; motion_event.mouse_motion.global_y = pos.y; motion_event.mouse_motion.speed_x = input->get_last_mouse_speed().x; diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 6bc072099c..44994e40ec 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -202,7 +202,7 @@ public: MouseMode get_mouse_mode() const; virtual void warp_mouse_pos(const Point2 &p_to); - virtual Point2 get_mouse_pos() const; + virtual Point2 get_mouse_position() const; virtual int get_mouse_button_state() const; virtual void set_window_title(const String &p_title); diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 8c8ac835e8..f699c8f0e8 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -695,16 +695,16 @@ InputEvent CanvasItem::make_input_local(const InputEvent &p_event) const { return p_event.xform_by((get_canvas_transform() * get_global_transform()).affine_inverse()); } -Vector2 CanvasItem::get_global_mouse_pos() const { +Vector2 CanvasItem::get_global_mouse_position() const { ERR_FAIL_COND_V(!get_viewport(), Vector2()); - return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_pos()); + return get_canvas_transform().affine_inverse().xform(get_viewport()->get_mouse_position()); } Vector2 CanvasItem::get_local_mouse_pos() const { ERR_FAIL_COND_V(!get_viewport(), Vector2()); - return get_global_transform().affine_inverse().xform(get_global_mouse_pos()); + return get_global_transform().affine_inverse().xform(get_global_mouse_position()); } void CanvasItem::_bind_methods() { @@ -771,7 +771,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("get_viewport_rect"), &CanvasItem::get_viewport_rect); ClassDB::bind_method(D_METHOD("get_canvas_transform"), &CanvasItem::get_canvas_transform); ClassDB::bind_method(D_METHOD("get_local_mouse_pos"), &CanvasItem::get_local_mouse_pos); - ClassDB::bind_method(D_METHOD("get_global_mouse_pos"), &CanvasItem::get_global_mouse_pos); + ClassDB::bind_method(D_METHOD("get_global_mouse_position"), &CanvasItem::get_global_mouse_position); ClassDB::bind_method(D_METHOD("get_canvas"), &CanvasItem::get_canvas); ClassDB::bind_method(D_METHOD("get_world_2d"), &CanvasItem::get_world_2d); //ClassDB::bind_method(D_METHOD("get_viewport"),&CanvasItem::get_viewport); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index ce72f7e0c9..72fe5b93da 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -212,7 +212,7 @@ public: InputEvent make_input_local(const InputEvent &pevent) const; Vector2 make_canvas_pos_local(const Vector2 &screen_point) const; - Vector2 get_global_mouse_pos() const; + Vector2 get_global_mouse_position() const; Vector2 get_local_mouse_pos() const; void set_notify_local_transform(bool p_enable); diff --git a/scene/2d/particles_2d.cpp b/scene/2d/particles_2d.cpp index 2d047f0096..b91d9b835c 100644 --- a/scene/2d/particles_2d.cpp +++ b/scene/2d/particles_2d.cpp @@ -571,13 +571,13 @@ void Particles2D::_notification(int p_what) { src_rect.pos.x = size.x * (frame % h_frames); src_rect.pos.y = size.y * (frame / h_frames); } - + Rect2 dst_rect(Point2(), size); if (flip_h) - src_rect.size.x = -src_rect.size.x; + dst_rect.size.x = -dst_rect.size.x; if (flip_v) - src_rect.size.y = -src_rect.size.y; + dst_rect.size.y = -dst_rect.size.y; - texture->draw_rect_region(ci, Rect2(Point2(), size), src_rect, color); + texture->draw_rect_region(ci, dst_rect, src_rect, color); //VisualServer::get_singleton()->canvas_item_add_texture_rect(ci,r,texrid,false,color); } else { VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2(Point2(), size), color); @@ -1046,7 +1046,7 @@ void Particles2D::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "config/amount", PROPERTY_HINT_EXP_RANGE, "1,1024"), "set_amount", "get_amount"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "config/lifetime", PROPERTY_HINT_EXP_RANGE, "0.1,3600,0.1"), "set_lifetime", "get_lifetime"); ADD_PROPERTYNO(PropertyInfo(Variant::REAL, "config/time_scale", PROPERTY_HINT_EXP_RANGE, "0.01,128,0.01"), "set_time_scale", "get_time_scale"); - ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "config/preprocess", PROPERTY_HINT_EXP_RANGE, "0.1,3600,0.1"), "set_pre_process_time", "get_pre_process_time"); + ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "config/preprocess", PROPERTY_HINT_EXP_RANGE, "0,3600,0.1"), "set_pre_process_time", "get_pre_process_time"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "config/emit_timeout", PROPERTY_HINT_RANGE, "0,3600,0.1"), "set_emit_timeout", "get_emit_timeout"); ADD_PROPERTYNO(PropertyInfo(Variant::BOOL, "config/emitting"), "set_emitting", "is_emitting"); ADD_PROPERTY(PropertyInfo(Variant::INT, "config/process_mode", PROPERTY_HINT_ENUM, "Fixed,Idle"), "set_process_mode", "get_process_mode"); diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp index 06d1e128c6..080276eb25 100644 --- a/scene/2d/tile_map.cpp +++ b/scene/2d/tile_map.cpp @@ -877,6 +877,26 @@ void TileMap::set_collision_mask(uint32_t p_mask) { } } +void TileMap::set_collision_layer_bit(int p_bit, bool p_value) { + + uint32_t layer = get_collision_layer(); + if (p_value) + layer |= 1 << p_bit; + else + layer &= ~(1 << p_bit); + set_collision_layer(layer); +} + +void TileMap::set_collision_mask_bit(int p_bit, bool p_value) { + + uint32_t mask = get_collision_mask(); + if (p_value) + mask |= 1 << p_bit; + else + mask &= ~(1 << p_bit); + set_collision_mask(mask); +} + bool TileMap::get_collision_use_kinematic() const { return use_kinematic; @@ -928,6 +948,16 @@ uint32_t TileMap::get_collision_mask() const { return collision_mask; } +bool TileMap::get_collision_layer_bit(int p_bit) const { + + return get_collision_layer() & (1 << p_bit); +} + +bool TileMap::get_collision_mask_bit(int p_bit) const { + + return get_collision_mask() & (1 << p_bit); +} + void TileMap::set_mode(Mode p_mode) { _clear_quadrants(); @@ -1197,12 +1227,18 @@ void TileMap::_bind_methods() { ClassDB::bind_method(D_METHOD("set_collision_use_kinematic", "use_kinematic"), &TileMap::set_collision_use_kinematic); ClassDB::bind_method(D_METHOD("get_collision_use_kinematic"), &TileMap::get_collision_use_kinematic); - ClassDB::bind_method(D_METHOD("set_collision_layer", "mask"), &TileMap::set_collision_layer); + ClassDB::bind_method(D_METHOD("set_collision_layer", "layer"), &TileMap::set_collision_layer); ClassDB::bind_method(D_METHOD("get_collision_layer"), &TileMap::get_collision_layer); ClassDB::bind_method(D_METHOD("set_collision_mask", "mask"), &TileMap::set_collision_mask); ClassDB::bind_method(D_METHOD("get_collision_mask"), &TileMap::get_collision_mask); + ClassDB::bind_method(D_METHOD("set_collision_layer_bit", "bit", "value"), &TileMap::set_collision_layer_bit); + ClassDB::bind_method(D_METHOD("get_collision_layer_bit", "bit"), &TileMap::get_collision_layer_bit); + + ClassDB::bind_method(D_METHOD("set_collision_mask_bit", "bit", "value"), &TileMap::set_collision_mask_bit); + ClassDB::bind_method(D_METHOD("get_collision_mask_bit", "bit"), &TileMap::get_collision_mask_bit); + ClassDB::bind_method(D_METHOD("set_collision_friction", "value"), &TileMap::set_collision_friction); ClassDB::bind_method(D_METHOD("get_collision_friction"), &TileMap::get_collision_friction); diff --git a/scene/2d/tile_map.h b/scene/2d/tile_map.h index 8979476aa5..3468854a61 100644 --- a/scene/2d/tile_map.h +++ b/scene/2d/tile_map.h @@ -233,6 +233,12 @@ public: void set_collision_mask(uint32_t p_mask); uint32_t get_collision_mask() const; + void set_collision_layer_bit(int p_bit, bool p_value); + bool get_collision_layer_bit(int p_bit) const; + + void set_collision_mask_bit(int p_bit, bool p_value); + bool get_collision_mask_bit(int p_bit) const; + void set_collision_use_kinematic(bool p_use_kinematic); bool get_collision_use_kinematic() const; diff --git a/scene/3d/particles.cpp b/scene/3d/particles.cpp index b7ee26de57..038ca33a41 100644 --- a/scene/3d/particles.cpp +++ b/scene/3d/particles.cpp @@ -71,15 +71,12 @@ void Particles::set_randomness_ratio(float p_ratio) { randomness_ratio = p_ratio; VS::get_singleton()->particles_set_randomness_ratio(particles, randomness_ratio); } -void Particles::set_custom_aabb(const Rect3 &p_aabb) { +void Particles::set_visibility_aabb(const Rect3 &p_aabb) { - custom_aabb = p_aabb; - VS::get_singleton()->particles_set_custom_aabb(particles, custom_aabb); -} -void Particles::set_gravity(const Vector3 &p_gravity) { - - gravity = p_gravity; - VS::get_singleton()->particles_set_gravity(particles, gravity); + visibility_aabb = p_aabb; + VS::get_singleton()->particles_set_custom_aabb(particles, visibility_aabb); + update_gizmo(); + _change_notify("visibility_aabb"); } void Particles::set_use_local_coordinates(bool p_enable) { @@ -93,6 +90,14 @@ void Particles::set_process_material(const Ref<Material> &p_material) { if (process_material.is_valid()) material_rid = process_material->get_rid(); VS::get_singleton()->particles_set_process_material(particles, material_rid); + + update_configuration_warning(); +} + +void Particles::set_speed_scale(float p_scale) { + + speed_scale = p_scale; + VS::get_singleton()->particles_set_speed_scale(particles, p_scale); } bool Particles::is_emitting() const { @@ -119,13 +124,9 @@ float Particles::get_randomness_ratio() const { return randomness_ratio; } -Rect3 Particles::get_custom_aabb() const { - - return custom_aabb; -} -Vector3 Particles::get_gravity() const { +Rect3 Particles::get_visibility_aabb() const { - return gravity; + return visibility_aabb; } bool Particles::get_use_local_coordinates() const { @@ -136,6 +137,11 @@ Ref<Material> Particles::get_process_material() const { return process_material; } +float Particles::get_speed_scale() const { + + return speed_scale; +} + void Particles::set_draw_order(DrawOrder p_order) { draw_order = p_order; @@ -170,6 +176,8 @@ void Particles::set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh) { mesh_rid = p_mesh->get_rid(); VS::get_singleton()->particles_set_draw_pass_mesh(particles, p_pass, mesh_rid); + + update_configuration_warning(); } Ref<Mesh> Particles::get_draw_pass_mesh(int p_pass) const { @@ -197,6 +205,37 @@ bool Particles::get_fractional_delta() const { return fractional_delta; } +String Particles::get_configuration_warning() const { + + String warnings; + + bool meshes_found = false; + + for (int i = 0; i < draw_passes.size(); i++) { + if (draw_passes[i].is_valid()) { + meshes_found = true; + break; + } + } + + if (!meshes_found) { + warnings += "- " + TTR("Nothing is visible because meshes have not been assigned to draw passes."); + } + + if (process_material.is_null()) { + if (warnings != String()) + warnings += "\n"; + warnings += "- " + TTR("A material to process the particles is not assigned, so no behavior is imprinted."); + } + + return warnings; +} + +Rect3 Particles::capture_aabb() const { + + return VS::get_singleton()->particles_get_current_aabb(particles); +} + void Particles::_validate_property(PropertyInfo &property) const { if (property.name.begins_with("draw_pass_")) { @@ -216,12 +255,12 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("set_pre_process_time", "secs"), &Particles::set_pre_process_time); ClassDB::bind_method(D_METHOD("set_explosiveness_ratio", "ratio"), &Particles::set_explosiveness_ratio); ClassDB::bind_method(D_METHOD("set_randomness_ratio", "ratio"), &Particles::set_randomness_ratio); - ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &Particles::set_custom_aabb); - ClassDB::bind_method(D_METHOD("set_gravity", "accel_vec"), &Particles::set_gravity); + ClassDB::bind_method(D_METHOD("set_visibility_aabb", "aabb"), &Particles::set_visibility_aabb); ClassDB::bind_method(D_METHOD("set_use_local_coordinates", "enable"), &Particles::set_use_local_coordinates); ClassDB::bind_method(D_METHOD("set_fixed_fps", "fps"), &Particles::set_fixed_fps); ClassDB::bind_method(D_METHOD("set_fractional_delta", "enable"), &Particles::set_fractional_delta); ClassDB::bind_method(D_METHOD("set_process_material", "material:Material"), &Particles::set_process_material); + ClassDB::bind_method(D_METHOD("set_speed_scale", "scale"), &Particles::set_speed_scale); ClassDB::bind_method(D_METHOD("is_emitting"), &Particles::is_emitting); ClassDB::bind_method(D_METHOD("get_amount"), &Particles::get_amount); @@ -229,12 +268,12 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("get_pre_process_time"), &Particles::get_pre_process_time); ClassDB::bind_method(D_METHOD("get_explosiveness_ratio"), &Particles::get_explosiveness_ratio); ClassDB::bind_method(D_METHOD("get_randomness_ratio"), &Particles::get_randomness_ratio); - ClassDB::bind_method(D_METHOD("get_custom_aabb"), &Particles::get_custom_aabb); - ClassDB::bind_method(D_METHOD("get_gravity"), &Particles::get_gravity); + ClassDB::bind_method(D_METHOD("get_visibility_aabb"), &Particles::get_visibility_aabb); ClassDB::bind_method(D_METHOD("get_use_local_coordinates"), &Particles::get_use_local_coordinates); ClassDB::bind_method(D_METHOD("get_fixed_fps"), &Particles::get_fixed_fps); ClassDB::bind_method(D_METHOD("get_fractional_delta"), &Particles::get_fractional_delta); ClassDB::bind_method(D_METHOD("get_process_material:Material"), &Particles::get_process_material); + ClassDB::bind_method(D_METHOD("get_speed_scale"), &Particles::get_speed_scale); ClassDB::bind_method(D_METHOD("set_draw_order", "order"), &Particles::set_draw_order); @@ -246,20 +285,23 @@ void Particles::_bind_methods() { ClassDB::bind_method(D_METHOD("get_draw_passes"), &Particles::get_draw_passes); ClassDB::bind_method(D_METHOD("get_draw_pass_mesh:Mesh", "pass"), &Particles::get_draw_pass_mesh); + ClassDB::bind_method(D_METHOD("capture_aabb"), &Particles::capture_aabb); + ADD_GROUP("Parameters", ""); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "emitting"), "set_emitting", "is_emitting"); ADD_PROPERTY(PropertyInfo(Variant::INT, "amount", PROPERTY_HINT_RANGE, "1,100000,1"), "set_amount", "get_amount"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "lifetime", PROPERTY_HINT_RANGE, "0.01,600.0,0.01"), "set_lifetime", "get_lifetime"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "preprocess", PROPERTY_HINT_RANGE, "0.00,600.0,0.01"), "set_pre_process_time", "get_pre_process_time"); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "speed_scale", PROPERTY_HINT_RANGE, "0.01,64,0.01"), "set_speed_scale", "get_speed_scale"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "explosiveness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_explosiveness_ratio", "get_explosiveness_ratio"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "randomness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_randomness_ratio", "get_randomness_ratio"); - ADD_PROPERTY(PropertyInfo(Variant::RECT3, "custom_aabb"), "set_custom_aabb", "get_custom_aabb"); - ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity"), "set_gravity", "get_gravity"); + ADD_PROPERTY(PropertyInfo(Variant::RECT3, "visibility_aabb"), "set_visibility_aabb", "get_visibility_aabb"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "local_coords"), "set_use_local_coordinates", "get_use_local_coordinates"); ADD_PROPERTY(PropertyInfo(Variant::INT, "fixed_fps", PROPERTY_HINT_RANGE, "0,1000,1"), "set_fixed_fps", "get_fixed_fps"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "fract_delta"), "set_fractional_delta", "get_fractional_delta"); - ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "process_material", PROPERTY_HINT_RESOURCE_TYPE, "ParticlesMaterial,ShaderMaterial"), "set_process_material", "get_process_material"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_order", PROPERTY_HINT_ENUM, "Index,Lifetime,View Depth"), "set_draw_order", "get_draw_order"); + ADD_GROUP("Process Material", ""); + ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "process_material", PROPERTY_HINT_RESOURCE_TYPE, "ParticlesMaterial,ShaderMaterial"), "set_process_material", "get_process_material"); ADD_GROUP("Draw Passes", "draw_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "draw_passes", PROPERTY_HINT_RANGE, "0," + itos(MAX_DRAW_PASSES) + ",1"), "set_draw_passes", "get_draw_passes"); for (int i = 0; i < MAX_DRAW_PASSES; i++) { @@ -278,16 +320,18 @@ Particles::Particles() { particles = VS::get_singleton()->particles_create(); set_base(particles); set_emitting(true); - set_amount(100); + set_amount(8); set_lifetime(1); set_fixed_fps(0); set_fractional_delta(true); set_pre_process_time(0); set_explosiveness_ratio(0); set_randomness_ratio(0); - set_gravity(Vector3(0, -9.8, 0)); + set_visibility_aabb(Rect3(Vector3(-4, -4, -4), Vector3(8, 8, 8))); set_use_local_coordinates(true); set_draw_passes(1); + set_draw_order(DRAW_ORDER_INDEX); + set_speed_scale(1); } Particles::~Particles() { @@ -362,6 +406,8 @@ void ParticlesMaterial::init_shaders() { shader_names->trail_divisor = "trail_divisor"; shader_names->trail_size_modifier = "trail_size_modifier"; shader_names->trail_color_modifier = "trail_color_modifier"; + + shader_names->gravity = "gravity"; } void ParticlesMaterial::finish_shaders() { @@ -437,6 +483,8 @@ void ParticlesMaterial::_update_shader() { code += "uniform int trail_divisor;\n"; + code += "uniform vec3 gravity;\n"; + if (color_ramp.is_valid()) code += "uniform sampler2D color_ramp;\n"; @@ -633,7 +681,7 @@ void ParticlesMaterial::_update_shader() { else code += " float tex_anim_offset = 0.0;\n"; - code += " vec3 force = vec3(0.0); \n"; + code += " vec3 force = gravity; \n"; code += " vec3 pos = TRANSFORM[3].xyz; \n"; code += " //apply linear acceleration\n"; code += " force+=normalize(VELOCITY) * (linear_accel+tex_linear_accel)*mix(1.0,rand_from_seed(alt_seed),linear_accel_random);\n"; @@ -643,7 +691,7 @@ void ParticlesMaterial::_update_shader() { code += " //org=p_transform.origin;\n"; code += " force+=normalize(pos-org) * (radial_accel+tex_radial_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random);\n"; code += " //apply tangential acceleration;\n"; - code += " force+=normalize(cross(normalize(pos-org),normalize(GRAVITY))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n"; + code += " force+=normalize(cross(normalize(pos-org),normalize(gravity))) * ((tangent_accel+tex_tangent_accel)*mix(1.0,rand_from_seed(alt_seed),radial_accel_random));\n"; code += " //apply attractor forces\n"; code += " VELOCITY+=force * DELTA;\n"; if (tex_parameters[PARAM_INITIAL_LINEAR_VELOCITY].is_valid()) @@ -1168,6 +1216,21 @@ Ref<GradientTexture> ParticlesMaterial::get_trail_color_modifier() const { return trail_color_modifier; } +void ParticlesMaterial::set_gravity(const Vector3 &p_gravity) { + + gravity = p_gravity; + Vector3 gset = gravity; + if (gset == Vector3()) { + gset = Vector3(0, -0.000001, 0); //as gravity is used as upvector in some calculations + } + VisualServer::get_singleton()->material_set_param(_get_material(), shader_names->gravity, gset); +} + +Vector3 ParticlesMaterial::get_gravity() const { + + return gravity; +} + void ParticlesMaterial::_validate_property(PropertyInfo &property) const { if (property.name == "color" && color_ramp.is_valid()) { @@ -1248,6 +1311,9 @@ void ParticlesMaterial::_bind_methods() { ClassDB::bind_method(D_METHOD("set_trail_color_modifier", "texture:GradientTexture"), &ParticlesMaterial::set_trail_color_modifier); ClassDB::bind_method(D_METHOD("get_trail_color_modifier:GradientTexture"), &ParticlesMaterial::get_trail_color_modifier); + ClassDB::bind_method(D_METHOD("get_gravity"), &ParticlesMaterial::get_gravity); + ClassDB::bind_method(D_METHOD("set_gravity", "accel_vec"), &ParticlesMaterial::set_gravity); + ADD_GROUP("Trail", "trail_"); ADD_PROPERTY(PropertyInfo(Variant::INT, "trail_divisor", PROPERTY_HINT_RANGE, "1,1000000,1"), "set_trail_divisor", "get_trail_divisor"); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "trail_size_modifier", PROPERTY_HINT_RESOURCE_TYPE, "CurveTexture"), "set_trail_size_modifier", "get_trail_size_modifier"); @@ -1265,6 +1331,8 @@ void ParticlesMaterial::_bind_methods() { ADD_GROUP("Spread", ""); ADD_PROPERTY(PropertyInfo(Variant::REAL, "spread", PROPERTY_HINT_RANGE, "0,180,0.01"), "set_spread", "get_spread"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "flatness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_flatness", "get_flatness"); + ADD_GROUP("Gravity", ""); + ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "gravity"), "set_gravity", "get_gravity"); ADD_GROUP("Initial Velocity", "initial_"); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity", PROPERTY_HINT_RANGE, "0,1000,0.01"), "set_param", "get_param", PARAM_INITIAL_LINEAR_VELOCITY); ADD_PROPERTYI(PropertyInfo(Variant::REAL, "initial_velocity_random", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_param_randomness", "get_param_randomness", PARAM_INITIAL_LINEAR_VELOCITY); @@ -1361,6 +1429,7 @@ ParticlesMaterial::ParticlesMaterial() set_emission_sphere_radius(1); set_emission_box_extents(Vector3(1, 1, 1)); set_trail_divisor(1); + set_gravity(Vector3(0, -9.8, 0)); emission_point_count = 1; for (int i = 0; i < PARAM_MAX; i++) { diff --git a/scene/3d/particles.h b/scene/3d/particles.h index 3a46269396..63ebd7ed7b 100644 --- a/scene/3d/particles.h +++ b/scene/3d/particles.h @@ -63,8 +63,8 @@ private: float pre_process_time; float explosiveness_ratio; float randomness_ratio; - Rect3 custom_aabb; - Vector3 gravity; + float speed_scale; + Rect3 visibility_aabb; bool local_coords; int fixed_fps; bool fractional_delta; @@ -89,10 +89,10 @@ public: void set_pre_process_time(float p_time); void set_explosiveness_ratio(float p_ratio); void set_randomness_ratio(float p_ratio); - void set_custom_aabb(const Rect3 &p_aabb); - void set_gravity(const Vector3 &p_gravity); + void set_visibility_aabb(const Rect3 &p_aabb); void set_use_local_coordinates(bool p_enable); void set_process_material(const Ref<Material> &p_material); + void set_speed_scale(float p_scale); bool is_emitting() const; int get_amount() const; @@ -100,10 +100,10 @@ public: float get_pre_process_time() const; float get_explosiveness_ratio() const; float get_randomness_ratio() const; - Rect3 get_custom_aabb() const; - Vector3 get_gravity() const; + Rect3 get_visibility_aabb() const; bool get_use_local_coordinates() const; Ref<Material> get_process_material() const; + float get_speed_scale() const; void set_fixed_fps(int p_count); int get_fixed_fps() const; @@ -120,6 +120,9 @@ public: void set_draw_pass_mesh(int p_pass, const Ref<Mesh> &p_mesh); Ref<Mesh> get_draw_pass_mesh(int p_pass) const; + virtual String get_configuration_warning() const; + + Rect3 capture_aabb() const; Particles(); ~Particles(); }; @@ -270,6 +273,8 @@ private: StringName trail_divisor; StringName trail_size_modifier; StringName trail_color_modifier; + + StringName gravity; }; static ShaderNames *shader_names; @@ -304,6 +309,8 @@ private: Ref<CurveTexture> trail_size_modifier; Ref<GradientTexture> trail_color_modifier; + Vector3 gravity; + //do not save emission points here protected: @@ -358,6 +365,9 @@ public: void set_trail_color_modifier(const Ref<GradientTexture> &p_trail_color_modifier); Ref<GradientTexture> get_trail_color_modifier() const; + void set_gravity(const Vector3 &p_gravity); + Vector3 get_gravity() const; + static void init_shaders(); static void finish_shaders(); static void flush_changes(); diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index d6c68a1d82..c4ea42d461 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -611,7 +611,7 @@ void AnimationPlayer::_animation_update_transforms() { case SP_NONE: pa->object->set(pa->prop,pa->value_accum); break; //you are not speshul - case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_pos(pa->value_accum); break; + case SP_NODE2D_POS: static_cast<Node2D*>(pa->object)->set_position(pa->value_accum); break; case SP_NODE2D_ROT: static_cast<Node2D*>(pa->object)->set_rot(Math::deg2rad(pa->value_accum)); break; case SP_NODE2D_SCALE: static_cast<Node2D*>(pa->object)->set_scale(pa->value_accum); break; }*/ diff --git a/scene/gui/color_picker.cpp b/scene/gui/color_picker.cpp index 8a94d4918f..adb5e2f0b6 100644 --- a/scene/gui/color_picker.cpp +++ b/scene/gui/color_picker.cpp @@ -591,7 +591,7 @@ void ColorPickerButton::_color_changed(const Color &p_color) { void ColorPickerButton::pressed() { Size2 ms = Size2(300, picker->get_combined_minimum_size().height + 10); - popup->set_pos(get_global_pos() - Size2(0, ms.height)); + popup->set_position(get_global_position() - Size2(0, ms.height)); popup->set_size(ms); popup->popup(); picker->set_focus_on_line_edit(); diff --git a/scene/gui/color_ramp_edit.cpp b/scene/gui/color_ramp_edit.cpp index 0bc9205175..c6f73fe6e6 100644 --- a/scene/gui/color_ramp_edit.cpp +++ b/scene/gui/color_ramp_edit.cpp @@ -62,7 +62,7 @@ void ColorRampEdit::_show_color_picker() { return; Size2 ms = Size2(350, picker->get_combined_minimum_size().height + 10); picker->set_pick_color(points[grabbed].color); - popup->set_pos(get_global_pos() - Vector2(ms.width - get_size().width, ms.height)); + popup->set_position(get_global_position() - Vector2(ms.width - get_size().width, ms.height)); popup->set_size(ms); popup->popup(); } diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp index d3096d7806..c428d524a4 100644 --- a/scene/gui/container.cpp +++ b/scene/gui/container.cpp @@ -107,7 +107,7 @@ void Container::fit_child_in_rect(Control *p_child, const Rect2 &p_rect) { for (int i = 0; i < 4; i++) p_child->set_anchor(Margin(i), ANCHOR_BEGIN); - p_child->set_pos(r.pos); + p_child->set_position(r.pos); p_child->set_size(r.size); p_child->set_rotation(0); p_child->set_scale(Vector2(1, 1)); diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index bda54181c7..e62a993651 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -58,7 +58,7 @@ void Control::edit_set_state(const Variant &p_state) { Dictionary s = p_state; Rect2 state = s["rect"]; - set_pos(state.pos); + set_position(state.pos); set_size(state.size); set_rotation(s["rot"]); set_scale(s["scale"]); @@ -96,13 +96,13 @@ void Control::edit_set_rect(const Rect2 &p_edit_rect) { postxf.set_rotation_and_scale(data.rotation, data.scale); Vector2 new_pos = postxf.xform(p_edit_rect.pos); - Vector2 pos = get_pos() + new_pos; + Vector2 pos = get_position() + new_pos; Rect2 new_rect = get_rect(); new_rect.pos = pos.snapped(Vector2(1, 1)); new_rect.size = p_edit_rect.size.snapped(Vector2(1, 1)); - set_pos(new_rect.pos); + set_position(new_rect.pos); set_size(new_rect.size); } @@ -353,7 +353,7 @@ void Control::remove_child_notify(Node *p_child) { void Control::_update_canvas_item_transform() { - Transform2D xform = Transform2D(data.rotation, get_pos()); + Transform2D xform = Transform2D(data.rotation, get_position()); xform.scale_basis(data.scale); VisualServer::get_singleton()->canvas_item_set_transform(get_canvas_item(), xform); } @@ -1390,12 +1390,12 @@ Size2 Control::get_end() const { return Size2(data.margin[2], data.margin[3]); } -Point2 Control::get_global_pos() const { +Point2 Control::get_global_position() const { return get_global_transform().get_origin(); } -void Control::set_global_pos(const Point2 &p_point) { +void Control::set_global_position(const Point2 &p_point) { Transform2D inv; @@ -1404,10 +1404,10 @@ void Control::set_global_pos(const Point2 &p_point) { inv = data.parent_canvas_item->get_global_transform().affine_inverse(); } - set_pos(inv.xform(p_point)); + set_position(inv.xform(p_point)); } -void Control::set_pos(const Size2 &p_point) { +void Control::set_position(const Size2 &p_point) { float pw = _get_parent_range(0); float ph = _get_parent_range(1); @@ -1459,7 +1459,7 @@ void Control::set_size(const Size2 &p_size) { _size_changed(); } -Size2 Control::get_pos() const { +Size2 Control::get_position() const { return data.pos_cache; } @@ -1471,7 +1471,7 @@ Size2 Control::get_size() const { Rect2 Control::get_global_rect() const { - return Rect2(get_global_pos(), get_size()); + return Rect2(get_global_position(), get_size()); } Rect2 Control::get_window_rect() const { @@ -1483,7 +1483,7 @@ Rect2 Control::get_window_rect() const { Rect2 Control::get_rect() const { - return Rect2(get_pos(), get_size()); + return Rect2(get_position(), get_size()); } Rect2 Control::get_item_rect() const { @@ -1886,7 +1886,7 @@ Control::CursorShape Control::get_cursor_shape(const Point2 &p_pos) const { Transform2D Control::get_transform() const { - Transform2D xform = Transform2D(data.rotation, get_pos()); + Transform2D xform = Transform2D(data.rotation, get_position()); xform.scale_basis(data.scale); return xform; } @@ -2315,10 +2315,10 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("set_anchor_and_margin", "margin", "anchor_mode", "offset"), &Control::set_anchor_and_margin); ClassDB::bind_method(D_METHOD("set_begin", "pos"), &Control::set_begin); ClassDB::bind_method(D_METHOD("set_end", "pos"), &Control::set_end); - ClassDB::bind_method(D_METHOD("set_pos", "pos"), &Control::set_pos); + ClassDB::bind_method(D_METHOD("set_position", "pos"), &Control::set_position); ClassDB::bind_method(D_METHOD("set_size", "size"), &Control::set_size); ClassDB::bind_method(D_METHOD("set_custom_minimum_size", "size"), &Control::set_custom_minimum_size); - ClassDB::bind_method(D_METHOD("set_global_pos", "pos"), &Control::set_global_pos); + ClassDB::bind_method(D_METHOD("set_global_position", "pos"), &Control::set_global_position); ClassDB::bind_method(D_METHOD("set_rotation", "radians"), &Control::set_rotation); ClassDB::bind_method(D_METHOD("set_rotation_deg", "degrees"), &Control::set_rotation_deg); // TODO: Obsolete this method (old name) properly (GH-4397) @@ -2327,7 +2327,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("get_margin", "margin"), &Control::get_margin); ClassDB::bind_method(D_METHOD("get_begin"), &Control::get_begin); ClassDB::bind_method(D_METHOD("get_end"), &Control::get_end); - ClassDB::bind_method(D_METHOD("get_pos"), &Control::get_pos); + ClassDB::bind_method(D_METHOD("get_position"), &Control::get_position); ClassDB::bind_method(D_METHOD("get_size"), &Control::get_size); ClassDB::bind_method(D_METHOD("get_rotation"), &Control::get_rotation); ClassDB::bind_method(D_METHOD("get_rotation_deg"), &Control::get_rotation_deg); @@ -2336,7 +2336,7 @@ void Control::_bind_methods() { ClassDB::bind_method(D_METHOD("get_scale"), &Control::get_scale); ClassDB::bind_method(D_METHOD("get_custom_minimum_size"), &Control::get_custom_minimum_size); ClassDB::bind_method(D_METHOD("get_parent_area_size"), &Control::get_size); - ClassDB::bind_method(D_METHOD("get_global_pos"), &Control::get_global_pos); + ClassDB::bind_method(D_METHOD("get_global_position"), &Control::get_global_position); ClassDB::bind_method(D_METHOD("get_rect"), &Control::get_rect); ClassDB::bind_method(D_METHOD("get_global_rect"), &Control::get_global_rect); ClassDB::bind_method(D_METHOD("set_area_as_parent_rect", "margin"), &Control::set_area_as_parent_rect, DEFVAL(0)); @@ -2438,7 +2438,7 @@ void Control::_bind_methods() { ADD_PROPERTYINZ(PropertyInfo(Variant::INT, "margin_bottom", PROPERTY_HINT_RANGE, "-4096,4096"), "set_margin", "get_margin", MARGIN_BOTTOM); ADD_GROUP("Rect", "rect_"); - ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_pos", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_pos", "get_pos"); + ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_position", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_position", "get_position"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), "set_size", "get_size"); ADD_PROPERTYNZ(PropertyInfo(Variant::VECTOR2, "rect_min_size"), "set_custom_minimum_size", "get_custom_minimum_size"); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "rect_rotation", PROPERTY_HINT_RANGE, "-1080,1080,0.01"), "set_rotation_deg", "get_rotation_deg"); diff --git a/scene/gui/control.h b/scene/gui/control.h index 9075c5a6ed..5834d1550a 100644 --- a/scene/gui/control.h +++ b/scene/gui/control.h @@ -277,12 +277,12 @@ public: Point2 get_begin() const; Point2 get_end() const; - void set_pos(const Point2 &p_point); + void set_position(const Point2 &p_point); void set_size(const Size2 &p_size); - void set_global_pos(const Point2 &p_point); + void set_global_position(const Point2 &p_point); - Point2 get_pos() const; - Point2 get_global_pos() const; + Point2 get_position() const; + Point2 get_global_position() const; Size2 get_size() const; Rect2 get_rect() const; Rect2 get_global_rect() const; diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index c53b2bdb21..835775e13b 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -36,6 +36,8 @@ #include "editor/editor_node.h" #endif +// WindowDialog + void WindowDialog::_post_popup() { drag_type = DRAG_NONE; // just in case @@ -46,20 +48,20 @@ void WindowDialog::_fix_size() { // Perhaps this should be called when the viewport resizes as well or windows go out of bounds... // Ensure the whole window is visible. - Point2i pos = get_global_pos(); + Point2i pos = get_global_position(); Size2i size = get_size(); Size2i viewport_size = get_viewport_rect().size; // Windows require additional padding to keep the window chrome visible. - Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog"); - float top = panel->get_margin(MARGIN_TOP); - float left = panel->get_margin(MARGIN_LEFT); - float bottom = panel->get_margin(MARGIN_BOTTOM); - float right = panel->get_margin(MARGIN_RIGHT); + Ref<StyleBoxTexture> panel = get_stylebox("panel", "WindowDialog"); + float top = panel->get_expand_margin_size(MARGIN_TOP); + float left = panel->get_expand_margin_size(MARGIN_LEFT); + float bottom = panel->get_expand_margin_size(MARGIN_BOTTOM); + float right = panel->get_expand_margin_size(MARGIN_RIGHT); pos.x = MAX(left, MIN(pos.x, viewport_size.x - size.x - right)); pos.y = MAX(top, MIN(pos.y, viewport_size.y - size.y - bottom)); - set_global_pos(pos); + set_global_position(pos); // Also resize the window to fit if a resize should be possible at all. if (resizable) { @@ -74,9 +76,9 @@ bool WindowDialog::has_point(const Point2 &p_point) const { Rect2 r(Point2(), get_size()); // Enlarge upwards for title bar. - int titlebar_height = get_constant("titlebar_height", "WindowDialog"); - r.pos.y -= titlebar_height; - r.size.y += titlebar_height; + int title_height = get_constant("title_height", "WindowDialog"); + r.pos.y -= title_height; + r.size.y += title_height; // Inflate by the resizable border thickness. if (resizable) { @@ -98,8 +100,8 @@ void WindowDialog::_gui_input(const InputEvent &p_event) { // Begin a possible dragging operation. drag_type = _drag_hit_test(Point2(p_event.mouse_button.x, p_event.mouse_button.y)); if (drag_type != DRAG_NONE) - drag_offset = get_global_mouse_pos() - get_pos(); - drag_offset_far = get_pos() + get_size() - get_global_mouse_pos(); + drag_offset = get_global_mouse_position() - get_position(); + drag_offset_far = get_position() + get_size() - get_global_mouse_position(); } else if (drag_type != DRAG_NONE && !p_event.mouse_button.pressed) { // End a dragging operation. drag_type = DRAG_NONE; @@ -136,7 +138,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) { set_default_cursor_shape(cursor); } else { // Update while in a dragging operation. - Point2 global_pos = get_global_mouse_pos(); + Point2 global_pos = get_global_mouse_position(); global_pos.y = MAX(global_pos.y, 0); // Ensure title bar stays visible. Rect2 rect = get_rect(); @@ -164,7 +166,7 @@ void WindowDialog::_gui_input(const InputEvent &p_event) { } set_size(rect.size); - set_pos(rect.pos); + set_position(rect.pos); } } } @@ -173,30 +175,21 @@ void WindowDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_DRAW: { - RID canvas = get_canvas_item(); - Size2 size = get_size(); + // Draw the background. Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog"); - int margin_left = static_cast<int>(panel->get_margin(MARGIN_LEFT)); - int margin_top = static_cast<int>(panel->get_margin(MARGIN_TOP)); - int margin_right = static_cast<int>(panel->get_margin(MARGIN_RIGHT)); - int margin_bottom = static_cast<int>(panel->get_margin(MARGIN_BOTTOM)); - - Rect2 rect; - rect.pos.x = -margin_left; - rect.pos.y = -margin_top; - rect.size.width = size.width + margin_left + margin_right; - rect.size.height = size.height + margin_top + margin_bottom; - - panel->draw(canvas, rect); + Size2 size = get_size(); + panel->draw(canvas, Rect2(0, 0, size.x, size.y)); - int title_height = get_constant("title_height", "WindowDialog"); + // Draw the title bar text. + Ref<Font> title_font = get_font("title_font", "WindowDialog"); Color title_color = get_color("title_color", "WindowDialog"); - Ref<Font> font = get_font("title_font", "WindowDialog"); - int ofs = (size.width - font->get_string_size(title).width) / 2; - draw_string(font, Point2(ofs, -title_height + font->get_ascent()), title, title_color, size.width - panel->get_minimum_size().width); - + int title_height = get_constant("title_height", "WindowDialog"); + int font_height = title_font->get_height() - title_font->get_descent() * 2; + int x = (size.x - title_font->get_string_size(title).x) / 2; + int y = (-title_height + font_height) / 2; + title_font->draw(canvas, Point2(x, y), title, title_color, size.x - panel->get_minimum_size().x); } break; case NOTIFICATION_THEME_CHANGED: @@ -238,12 +231,12 @@ int WindowDialog::_drag_hit_test(const Point2 &pos) const { int drag_type = DRAG_NONE; if (resizable) { - int titlebar_height = get_constant("titlebar_height", "WindowDialog"); + int title_height = get_constant("title_height", "WindowDialog"); int scaleborder_size = get_constant("scaleborder_size", "WindowDialog"); Rect2 rect = get_rect(); - if (pos.y < (-titlebar_height + scaleborder_size)) + if (pos.y < (-title_height + scaleborder_size)) drag_type = DRAG_RESIZE_TOP; else if (pos.y >= (rect.size.height - scaleborder_size)) drag_type = DRAG_RESIZE_BOTTOM; @@ -317,6 +310,8 @@ WindowDialog::WindowDialog() { WindowDialog::~WindowDialog() { } +// PopupDialog + void PopupDialog::_notification(int p_what) { if (p_what == NOTIFICATION_DRAW) { @@ -416,14 +411,14 @@ void AcceptDialog::_update_child_rects() { if (c == hbc || c == label || c == get_close_button() || c->is_set_as_toplevel()) continue; - c->set_pos(cpos); + c->set_position(cpos); c->set_size(csize); } cpos.y += csize.y + margin; csize.y = hminsize.y; - hbc->set_pos(cpos); + hbc->set_position(cpos); hbc->set_size(csize); } @@ -554,6 +549,8 @@ AcceptDialog::AcceptDialog() { AcceptDialog::~AcceptDialog() { } +// ConfirmationDialog + void ConfirmationDialog::_bind_methods() { ClassDB::bind_method(D_METHOD("get_cancel:Button"), &ConfirmationDialog::get_cancel); diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp index 76baf20526..0c092a4e17 100644 --- a/scene/gui/graph_edit.cpp +++ b/scene/gui/graph_edit.cpp @@ -140,13 +140,13 @@ void GraphEdit::_update_scroll_offset() { Point2 pos = gn->get_offset() * zoom; pos -= Point2(h_scroll->get_value(), v_scroll->get_value()); - gn->set_pos(pos); + gn->set_position(pos); if (gn->get_scale() != Vector2(zoom, zoom)) { gn->set_scale(Vector2(zoom, zoom)); } } - connections_layer->set_pos(-Point2(h_scroll->get_value(), v_scroll->get_value())); + connections_layer->set_position(-Point2(h_scroll->get_value(), v_scroll->get_value())); set_block_minimum_size_adjust(false); awaiting_scroll_offset_update = false; } @@ -350,14 +350,14 @@ bool GraphEdit::_filter_input(const Point2 &p_point) { for (int j = 0; j < gn->get_connection_output_count(); j++) { - Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position(); if (pos.distance_to(p_point) < grab_r) return true; } for (int j = 0; j < gn->get_connection_input_count(); j++) { - Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position(); if (pos.distance_to(p_point) < grab_r) { return true; } @@ -383,7 +383,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { for (int j = 0; j < gn->get_connection_output_count(); j++) { - Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position(); if (pos.distance_to(mpos) < grab_r) { if (valid_left_disconnect_types.has(gn->get_connection_output_type(j))) { @@ -430,7 +430,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { for (int j = 0; j < gn->get_connection_input_count(); j++) { - Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position(); if (pos.distance_to(mpos) < grab_r) { @@ -497,7 +497,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { if (!connecting_out) { for (int j = 0; j < gn->get_connection_output_count(); j++) { - Vector2 pos = gn->get_connection_output_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_output_pos(j) + gn->get_position(); int type = gn->get_connection_output_type(j); if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) { @@ -512,7 +512,7 @@ void GraphEdit::_top_layer_input(const InputEvent &p_ev) { for (int j = 0; j < gn->get_connection_input_count(); j++) { - Vector2 pos = gn->get_connection_input_pos(j) + gn->get_pos(); + Vector2 pos = gn->get_connection_input_pos(j) + gn->get_position(); int type = gn->get_connection_input_type(j); if ((type == connecting_type || valid_connection_types.has(ConnType(type, connecting_type))) && pos.distance_to(mpos) < grab_r) { connecting_target = true; @@ -704,7 +704,7 @@ void GraphEdit::_top_layer_draw() { pos = from->get_connection_output_pos(connecting_index); else pos = from->get_connection_input_pos(connecting_index); - pos += from->get_pos(); + pos += from->get_position(); Vector2 topos; topos = connecting_to; @@ -1229,7 +1229,7 @@ GraphEdit::GraphEdit() { HBoxContainer *zoom_hb = memnew(HBoxContainer); top_layer->add_child(zoom_hb); - zoom_hb->set_pos(Vector2(10, 10)); + zoom_hb->set_position(Vector2(10, 10)); zoom_minus = memnew(ToolButton); zoom_hb->add_child(zoom_minus); diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp index 30bc4d1663..9abf9649c0 100644 --- a/scene/gui/line_edit.cpp +++ b/scene/gui/line_edit.cpp @@ -51,7 +51,7 @@ void LineEdit::_gui_input(InputEvent p_event) { const InputEventMouseButton &b = p_event.mouse_button; if (b.pressed && b.button_index == BUTTON_RIGHT) { - menu->set_pos(get_global_transform().xform(get_local_mouse_pos())); + menu->set_position(get_global_transform().xform(get_local_mouse_pos())); menu->set_size(Vector2(1, 1)); menu->popup(); grab_focus(); diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 16277ed0d0..cf468f2257 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -50,10 +50,10 @@ void MenuButton::pressed() { emit_signal("about_to_show"); Size2 size = get_size(); - Point2 gp = get_global_pos(); - popup->set_global_pos(gp + Size2(0, size.height)); + Point2 gp = get_global_position(); + popup->set_global_position(gp + Size2(0, size.height)); popup->set_size(Size2(size.width, 0)); - popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_pos()), get_size())); + popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size())); popup->popup(); popup->call_deferred("grab_click_focus"); popup->set_invalidate_click_until_motion(); diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 0bb68e7fa1..0806d35d48 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -87,7 +87,7 @@ void OptionButton::_selected(int p_which) { void OptionButton::pressed() { Size2 size = get_size(); - popup->set_global_pos(get_global_pos() + Size2(0, size.height)); + popup->set_global_position(get_global_position() + Size2(0, size.height)); popup->set_size(Size2(size.width, 0)); popup->popup(); diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 523633166c..7d0b91a366 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -58,12 +58,12 @@ void Popup::_notification(int p_what) { void Popup::_fix_size() { #if 0 - Point2 pos = get_pos(); + Point2 pos = get_position(); Size2 size = get_size(); Point2 window_size = window==this ? get_parent_area_size() :window->get_size(); #else - Point2 pos = get_global_pos(); + Point2 pos = get_global_position(); Size2 size = get_size(); Point2 window_size = get_viewport_rect().size; @@ -79,10 +79,10 @@ void Popup::_fix_size() { pos.y = 0; #if 0 if (pos!=get_pos()) - set_pos(pos); + set_position(pos); #else - if (pos != get_pos()) - set_global_pos(pos); + if (pos != get_position()) + set_global_position(pos); #endif } @@ -171,7 +171,7 @@ void Popup::popup_centered(const Size2 &p_size) { rect.size = p_size == Size2() ? get_size() : p_size; rect.pos = ((window_size - rect.size) / 2.0).floor(); - set_pos(rect.pos); + set_position(rect.pos); set_size(rect.size); show_modal(exclusive); @@ -194,7 +194,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) { Point2 window_size = get_viewport_rect().size; rect.size = (window_size * p_screen_ratio).floor(); rect.pos = ((window_size - rect.size) / 2.0).floor(); - set_pos(rect.pos); + set_position(rect.pos); set_size(rect.size); show_modal(exclusive); @@ -216,7 +216,7 @@ void Popup::popup(const Rect2 &bounds) { // Fit the popup into the optionally provided bounds. if (!bounds.has_no_area()) { - set_pos(bounds.pos); + set_position(bounds.pos); set_size(bounds.size); } _fix_size(); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index de16f3c525..6ac6eac655 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -169,7 +169,7 @@ void PopupMenu::_activate_submenu(int over) { if (pm->is_visible_in_tree()) return; //already visible! - Point2 p = get_global_pos(); + Point2 p = get_global_position(); Rect2 pr(p, get_size()); Ref<StyleBox> style = get_stylebox("panel"); @@ -179,13 +179,13 @@ void PopupMenu::_activate_submenu(int over) { if (pos.x + size.width > get_viewport_rect().size.width) pos.x = p.x - size.width; - pm->set_pos(pos); + pm->set_position(pos); pm->popup(); PopupMenu *pum = pm->cast_to<PopupMenu>(); if (pum) { - pr.pos -= pum->get_global_pos(); + pr.pos -= pum->get_global_position(); pum->clear_autohide_areas(); pum->add_autohide_area(Rect2(pr.pos.x, pr.pos.y, pr.size.x, items[over]._ofs_cache)); if (over < items.size() - 1) { @@ -266,15 +266,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) { case BUTTON_WHEEL_DOWN: { - if (get_global_pos().y + get_size().y > get_viewport_rect().size.y) { + if (get_global_position().y + get_size().y > get_viewport_rect().size.y) { int vseparation = get_constant("vseparation"); Ref<Font> font = get_font("font"); - Point2 pos = get_pos(); + Point2 pos = get_position(); int s = (vseparation + font->get_height()) * 3; pos.y -= s; - set_pos(pos); + set_position(pos); //update hover InputEvent ie; @@ -286,15 +286,15 @@ void PopupMenu::_gui_input(const InputEvent &p_event) { } break; case BUTTON_WHEEL_UP: { - if (get_global_pos().y < 0) { + if (get_global_position().y < 0) { int vseparation = get_constant("vseparation"); Ref<Font> font = get_font("font"); - Point2 pos = get_pos(); + Point2 pos = get_position(); int s = (vseparation + font->get_height()) * 3; pos.y += s; - set_pos(pos); + set_position(pos); //update hover InputEvent ie; diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp index 0ef6fbdebd..0c7a58dc16 100644 --- a/scene/gui/tab_container.cpp +++ b/scene/gui/tab_container.cpp @@ -79,11 +79,11 @@ void TabContainer::_gui_input(const InputEvent &p_event) { if (popup && pos.x > size.width - menu->get_width()) { emit_signal("pre_popup_pressed"); - Vector2 popup_pos = get_global_pos(); + Vector2 popup_pos = get_global_position(); popup_pos.x += size.width - popup->get_size().width; popup_pos.y += menu->get_height(); - popup->set_global_pos(popup_pos); + popup->set_global_position(popup_pos); popup->popup(); return; } diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 8cbd6675f0..3c8545bd75 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -101,15 +101,15 @@ void TextEdit::Text::set_font(const Ref<Font> &p_font) { font = p_font; } -void TextEdit::Text::set_tab_size(int p_tab_size) { +void TextEdit::Text::set_indent_size(int p_indent_size) { - tab_size = p_tab_size; + indent_size = p_indent_size; } void TextEdit::Text::_update_line_cache(int p_line) const { int w = 0; - int tab_w = font->get_char_size(' ').width * tab_size; + int tab_w = font->get_char_size(' ').width * indent_size; int len = text[p_line].data.length(); const CharType *str = text[p_line].data.c_str(); @@ -360,7 +360,7 @@ void TextEdit::_click_selection_held() { if (Input::get_singleton()->is_mouse_button_pressed(BUTTON_LEFT) && selection.selecting_mode != Selection::MODE_NONE) { - Point2 mp = Input::get_singleton()->get_mouse_pos() - get_global_pos(); + Point2 mp = Input::get_singleton()->get_mouse_position() - get_global_position(); int row, col; _get_mouse_pos(Point2i(mp.x, mp.y), row, col); @@ -456,7 +456,7 @@ void TextEdit::_notification(int p_what) { int visible_rows = get_visible_rows(); - int tab_w = cache.font->get_char_size(' ').width * tab_size; + int tab_w = cache.font->get_char_size(' ').width * indent_size; Color color = cache.font_color; int in_region = -1; @@ -1305,7 +1305,38 @@ void TextEdit::backspace_at_cursor() { _is_pair_left_symbol(text[cursor.line][cursor.column - 1])) { _consume_backspace_for_pair_symbol(prev_line, prev_column); } else { - _remove_text(prev_line, prev_column, cursor.line, cursor.column); + // handle space indentation + if (cursor.column - indent_size >= 0 && indent_using_spaces) { + + // if there is enough spaces to count as a tab + bool unindent = true; + for (int i = 1; i <= indent_size; i++) { + if (text[cursor.line][cursor.column - i] != ' ') { + unindent = false; + break; + } + } + + // and it is before the first character + int i = 0; + while (i < cursor.column && i < text[cursor.line].length()) { + if (text[cursor.line][i] != ' ' && text[cursor.line][i] != '\t') { + unindent = false; + break; + } + i++; + } + + // then we can remove it as a single character. + if (unindent) { + _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column); + prev_column = cursor.column - indent_size; + } else { + _remove_text(prev_line, prev_column, cursor.line, cursor.column); + } + } else { + _remove_text(prev_line, prev_column, cursor.line, cursor.column); + } } cursor_set_line(prev_line); @@ -1328,7 +1359,11 @@ void TextEdit::indent_selection_right() { for (int i = start_line; i <= end_line; i++) { String line_text = get_line(i); - line_text = '\t' + line_text; + if (indent_using_spaces) { + line_text = space_indent + line_text; + } else { + line_text = '\t' + line_text; + } set_line(i, line_text); } @@ -1359,8 +1394,8 @@ void TextEdit::indent_selection_left() { if (line_text.begins_with("\t")) { line_text = line_text.substr(1, line_text.length()); set_line(i, line_text); - } else if (line_text.begins_with(" ")) { - line_text = line_text.substr(4, line_text.length()); + } else if (line_text.begins_with(space_indent)) { + line_text = line_text.substr(indent_size, line_text.length()); set_line(i, line_text); } } @@ -1586,7 +1621,7 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) { if (mb.button_index == BUTTON_RIGHT && context_menu_enabled) { - menu->set_pos(get_global_transform().xform(get_local_mouse_pos())); + menu->set_position(get_global_transform().xform(get_local_mouse_pos())); menu->set_size(Vector2(1, 1)); menu->popup(); grab_focus(); @@ -1931,17 +1966,39 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) { String ins = "\n"; //keep indentation + int space_count = 0; for (int i = 0; i < text[cursor.line].length(); i++) { - if (text[cursor.line][i] == '\t') - ins += "\t"; - else + if (text[cursor.line][i] == '\t') { + if (indent_using_spaces) { + ins += space_indent; + } else { + ins += "\t"; + } + space_count = 0; + } else if (text[cursor.line][i] == ' ') { + space_count++; + + if (space_count == indent_size) { + if (indent_using_spaces) { + ins += space_indent; + } else { + ins += "\t"; + } + space_count = 0; + } + } else { break; + } } if (auto_indent) { // indent once again if previous line will end with ':' // (i.e. colon precedes current cursor position) if (cursor.column > 0 && text[cursor.line][cursor.column - 1] == ':') { - ins += "\t"; + if (indent_using_spaces) { + ins += space_indent; + } else { + ins += "\t"; + } } } @@ -1987,15 +2044,36 @@ void TextEdit::_gui_input(const InputEvent &p_gui_input) { } else { if (k.mod.shift) { + //simple unindent int cc = cursor.column; - if (cc > 0 && cc <= text[cursor.line].length() && text[cursor.line][cursor.column - 1] == '\t') { - //simple unindent + if (cc > 0 && cc <= text[cursor.line].length()) { + if (text[cursor.line][cursor.column - 1] == '\t') { + backspace_at_cursor(); + } else { + if (cursor.column - indent_size >= 0) { + + bool unindent = true; + for (int i = 1; i <= indent_size; i++) { + if (text[cursor.line][cursor.column - i] != ' ') { + unindent = false; + break; + } + } - backspace_at_cursor(); + if (unindent) { + _remove_text(cursor.line, cursor.column - indent_size, cursor.line, cursor.column); + cursor_set_column(cursor.column - indent_size); + } + } + } } } else { //simple indent - _insert_text_at_cursor("\t"); + if (indent_using_spaces) { + _insert_text_at_cursor(space_indent); + } else { + _insert_text_at_cursor("\t"); + } } } @@ -3103,7 +3181,7 @@ int TextEdit::get_char_pos_for(int p_px, String p_str) const { int px = 0; int c = 0; - int tab_w = cache.font->get_char_size(' ').width * tab_size; + int tab_w = cache.font->get_char_size(' ').width * indent_size; while (c < p_str.length()) { @@ -3135,7 +3213,7 @@ int TextEdit::get_column_x_offset(int p_char, String p_str) { int px = 0; - int tab_w = cache.font->get_char_size(' ').width * tab_size; + int tab_w = cache.font->get_char_size(' ').width * indent_size; for (int i = 0; i < p_char; i++) { @@ -3952,10 +4030,24 @@ void TextEdit::_push_current_op() { current_op.chain_forward = false; } -void TextEdit::set_tab_size(const int p_size) { +void TextEdit::set_indent_using_spaces(const bool p_use_spaces) { + indent_using_spaces = p_use_spaces; +} + +bool TextEdit::is_indent_using_spaces() const { + return indent_using_spaces; +} + +void TextEdit::set_indent_size(const int p_size) { ERR_FAIL_COND(p_size <= 0); - tab_size = p_size; - text.set_tab_size(p_size); + indent_size = p_size; + text.set_indent_size(p_size); + + space_indent = ""; + for (int i = 0; i < p_size; i++) { + space_indent += " "; + } + update(); } @@ -4542,8 +4634,8 @@ TextEdit::TextEdit() { cache.breakpoint_gutter_width = 0; breakpoint_gutter_width = 0; - tab_size = 4; - text.set_tab_size(tab_size); + indent_size = 4; + text.set_indent_size(indent_size); text.clear(); //text.insert(1,"Mongolia.."); //text.insert(2,"PAIS GENEROSO!!"); @@ -4631,6 +4723,8 @@ TextEdit::TextEdit() { auto_brace_completion_enabled = false; brace_matching_enabled = false; highlight_all_occurrences = false; + indent_using_spaces = false; + space_indent = " "; auto_indent = false; insert_mode = false; window_has_focus = true; diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index d5fe2950f4..905ea46bd7 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -141,12 +141,12 @@ class TextEdit : public Control { const Vector<ColorRegion> *color_regions; mutable Vector<Line> text; Ref<Font> font; - int tab_size; + int indent_size; void _update_line_cache(int p_line) const; public: - void set_tab_size(int p_tab_size); + void set_indent_size(int p_indent_size); void set_font(const Ref<Font> &p_font); void set_color_regions(const Vector<ColorRegion> *p_regions) { color_regions = p_regions; } int get_line_width(int p_line) const; @@ -163,7 +163,7 @@ class TextEdit : public Control { void clear(); void clear_caches(); _FORCE_INLINE_ const String &operator[](int p_line) const { return text[p_line].data; } - Text() { tab_size = 4; } + Text() { indent_size = 4; } }; struct TextOperation { @@ -221,7 +221,9 @@ class TextEdit : public Control { int max_chars; bool readonly; bool syntax_coloring; - int tab_size; + bool indent_using_spaces; + int indent_size; + String space_indent; Timer *caret_blink_timer; bool caret_blink_enabled; @@ -461,7 +463,9 @@ public: void redo(); void clear_undo_history(); - void set_tab_size(const int p_size); + void set_indent_using_spaces(const bool p_use_spaces); + bool is_indent_using_spaces() const; + void set_indent_size(const int p_size); void set_draw_tabs(bool p_draw); bool is_drawing_tabs() const; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 1cfaa58b92..bc7b7485d8 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1041,7 +1041,7 @@ int Tree::draw_item(const Point2i &p_pos, const Point2 &p_draw_ofs, const Size2 cache.selected->draw(ci, r); } if (text_editor->is_visible_in_tree()) { - text_editor->set_pos(get_global_pos() + r.pos); + text_editor->set_position(get_global_position() + r.pos); } } @@ -1503,7 +1503,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool cache.click_id = c.buttons[j].id; cache.click_item = p_item; cache.click_column = col; - cache.click_pos = get_global_mouse_pos() - get_global_pos(); + cache.click_pos = get_global_mouse_position() - get_global_position(); update(); //emit_signal("button_pressed"); return -1; @@ -1627,7 +1627,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool } popup_menu->set_size(Size2(col_width, 0)); - popup_menu->set_pos(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); + popup_menu->set_position(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h) - cache.offset); popup_menu->popup(); popup_edited_item = p_item; popup_edited_item_col = col; @@ -1693,7 +1693,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool case TreeItem::CELL_MODE_CUSTOM: { edited_item = p_item; edited_col = col; - custom_popup_rect = Rect2i(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); + custom_popup_rect = Rect2i(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs + item_h - cache.offset.y), Size2(get_column_width(col), item_h)); emit_signal("custom_popup_edited", ((bool)(x >= (col_width - item_h / 2)))); bring_up_editor = false; @@ -1710,7 +1710,7 @@ int Tree::propagate_mouse_event(const Point2i &p_pos, int x_ofs, int y_ofs, bool popup_edited_item = p_item; popup_edited_item_col = col; - pressing_item_rect = Rect2(get_global_pos() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h)); + pressing_item_rect = Rect2(get_global_position() + Point2i(col_ofs, _get_title_button_height() + y_ofs) - cache.offset, Size2(col_width, item_h)); pressing_for_editor_text = editor_text; pressing_for_editor = true; @@ -2379,7 +2379,7 @@ bool Tree::edit_selected() { edited_item = s; edited_col = col; - custom_popup_rect = Rect2i(get_global_pos() + rect.pos, rect.size); + custom_popup_rect = Rect2i(get_global_position() + rect.pos, rect.size); emit_signal("custom_popup_edited", false); item_edited(col, s); @@ -2394,7 +2394,7 @@ bool Tree::edit_selected() { } popup_menu->set_size(Size2(rect.size.width, 0)); - popup_menu->set_pos(get_global_pos() + rect.pos + Point2i(0, rect.size.height)); + popup_menu->set_position(get_global_position() + rect.pos + Point2i(0, rect.size.height)); popup_menu->popup(); popup_edited_item = s; popup_edited_item_col = col; @@ -2402,8 +2402,8 @@ bool Tree::edit_selected() { } else if (c.mode == TreeItem::CELL_MODE_STRING || c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - Point2i textedpos = get_global_pos() + rect.pos; - text_editor->set_pos(textedpos); + Point2i textedpos = get_global_position() + rect.pos; + text_editor->set_position(textedpos); text_editor->set_size(rect.size); text_editor->clear(); text_editor->set_text(c.mode == TreeItem::CELL_MODE_STRING ? c.text : String::num(c.val, Math::step_decimals(c.step))); @@ -2411,7 +2411,7 @@ bool Tree::edit_selected() { if (c.mode == TreeItem::CELL_MODE_RANGE || c.mode == TreeItem::CELL_MODE_RANGE_EXPRESSION) { - value_editor->set_pos(textedpos + Point2i(0, text_editor->get_size().height)); + value_editor->set_position(textedpos + Point2i(0, text_editor->get_size().height)); value_editor->set_size(Size2(rect.size.width, 1)); value_editor->show_modal(); updating_value_editor = true; @@ -2529,7 +2529,7 @@ void Tree::_notification(int p_what) { if (p_what == NOTIFICATION_DRAG_BEGIN) { single_select_defer = NULL; - if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_pos() - get_global_pos())) { + if (cache.scroll_speed > 0 && get_rect().has_point(get_viewport()->get_mouse_position() - get_global_position())) { scrolling = true; set_fixed_process(true); } @@ -2577,7 +2577,7 @@ void Tree::_notification(int p_what) { } if (scrolling) { - Point2 point = get_viewport()->get_mouse_pos() - get_global_pos(); + Point2 point = get_viewport()->get_mouse_position() - get_global_position(); if (point.x < cache.scroll_border) { point.x -= cache.scroll_border; } else if (point.x > get_size().width - cache.scroll_border) { diff --git a/scene/io/resource_format_wav.cpp b/scene/io/resource_format_wav.cpp index 53eefd26fe..dabbb79de3 100644 --- a/scene/io/resource_format_wav.cpp +++ b/scene/io/resource_format_wav.cpp @@ -98,7 +98,7 @@ RES ResourceFormatLoaderWAV::load(const String &p_path, const String& p_original /* chunk size */ uint32_t chunksize=file->get_32(); - uint32_t file_pos=file->get_pos(); //save file pos, so we can skip to next chunk safely + uint32_t file_pos=file->get_position(); //save file pos, so we can skip to next chunk safely if (file->eof_reached()) { diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp index 83f60bb9e9..be28479f39 100644 --- a/scene/main/scene_main_loop.cpp +++ b/scene/main/scene_main_loop.cpp @@ -2317,7 +2317,7 @@ SceneTree::SceneTree() { stretch_aspect = STRETCH_ASPECT_IGNORE; last_screen_size = Size2(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height); - root->set_size(last_screen_size); + _update_root_rect(); if (ScriptDebugger::get_singleton()) { ScriptDebugger::get_singleton()->set_request_scene_tree_message_func(_debugger_request_tree, this); diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 31c9cb15a8..406640275c 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1444,9 +1444,9 @@ void Viewport::_vp_unhandled_input(const InputEvent &p_ev) { unhandled_input(ev); } -Vector2 Viewport::get_mouse_pos() const { +Vector2 Viewport::get_mouse_position() const { - return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_pos() - _get_window_offset()); + return (get_final_transform().affine_inverse() * _get_input_pre_xform()).xform(Input::get_singleton()->get_mouse_position() - _get_window_offset()); } void Viewport::warp_mouse(const Vector2 &p_pos) { @@ -1538,7 +1538,7 @@ void Viewport::_gui_show_tooltip() { else if (r.pos.y < 0) r.pos.y = 0; - gui.tooltip_popup->set_global_pos(r.pos); + gui.tooltip_popup->set_global_position(r.pos); gui.tooltip_popup->set_size(r.size); gui.tooltip_popup->raise(); @@ -1640,7 +1640,7 @@ Control *Viewport::_gui_find_control_at_pos(CanvasItem *p_node, const Point2 &p_ Control *c = p_node->cast_to<Control>(); if (c) { - //print_line("at "+String(c->get_path())+" POS "+c->get_pos()+" bt "+p_xform); + //print_line("at "+String(c->get_path())+" POS "+c->get_position()+" bt "+p_xform); } //subwindows first!! @@ -1993,7 +1993,7 @@ void Viewport::_gui_input_event(InputEvent p_event) { gui.mouse_over = over; if (gui.drag_preview) { - gui.drag_preview->set_pos(mpos); + gui.drag_preview->set_position(mpos); } if (!over) { @@ -2237,7 +2237,7 @@ void Viewport::_gui_set_drag_preview(Control *p_base, Control *p_control) { memdelete(gui.drag_preview); } p_control->set_as_toplevel(true); - p_control->set_pos(gui.last_mouse_pos); + p_control->set_position(gui.last_mouse_pos); p_base->get_root_parent_control()->add_child(p_control); //add as child of viewport p_control->raise(); if (gui.drag_preview) { @@ -2649,7 +2649,7 @@ void Viewport::_bind_methods() { ClassDB::bind_method(D_METHOD("is_audio_listener_2d", "enable"), &Viewport::is_audio_listener_2d); ClassDB::bind_method(D_METHOD("set_attach_to_screen_rect", "rect"), &Viewport::set_attach_to_screen_rect); - ClassDB::bind_method(D_METHOD("get_mouse_pos"), &Viewport::get_mouse_pos); + ClassDB::bind_method(D_METHOD("get_mouse_position"), &Viewport::get_mouse_position); ClassDB::bind_method(D_METHOD("warp_mouse", "to_pos"), &Viewport::warp_mouse); ClassDB::bind_method(D_METHOD("gui_has_modal_stack"), &Viewport::gui_has_modal_stack); diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 242ee4b4e6..d784fc8ee9 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -400,7 +400,7 @@ public: void set_attach_to_screen_rect(const Rect2 &p_rect); Rect2 get_attach_to_screen_rect() const; - Vector2 get_mouse_pos() const; + Vector2 get_mouse_position() const; void warp_mouse(const Vector2 &p_pos); void set_physics_object_picking(bool p_enable); diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 595c0ecfd8..3a824a56a3 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -284,16 +284,10 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< // ToolButton - Ref<StyleBox> tb_empty = memnew(StyleBoxEmpty); - tb_empty->set_default_margin(MARGIN_LEFT, 6 * scale); - tb_empty->set_default_margin(MARGIN_RIGHT, 6 * scale); - tb_empty->set_default_margin(MARGIN_TOP, 4 * scale); - tb_empty->set_default_margin(MARGIN_BOTTOM, 4 * scale); - - t->set_stylebox("normal", "ToolButton", tb_empty); - t->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4)); - t->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4)); - t->set_stylebox("disabled", "ToolButton", make_empty_stylebox(4, 4, 4, 4)); + t->set_stylebox("normal", "ToolButton", make_empty_stylebox(6, 4, 6, 4)); + t->set_stylebox("pressed", "ToolButton", make_stylebox(button_pressed_png, 4, 4, 4, 4, 6, 4, 6, 4)); + t->set_stylebox("hover", "ToolButton", make_stylebox(button_normal_png, 4, 4, 4, 4, 6, 4, 6, 4)); + t->set_stylebox("disabled", "ToolButton", make_empty_stylebox(6, 4, 6, 4)); t->set_stylebox("focus", "ToolButton", focus); t->set_font("font", "ToolButton", default_font); @@ -538,10 +532,8 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref< // WindowDialog - Ref<StyleBoxTexture> style_pp_win = sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6); - t->set_stylebox("panel", "WindowDialog", style_pp_win); - t->set_constant("titlebar_height", "WindowDialog", 20 * scale); - t->set_constant("scaleborder_size", "WindowDialog", 4); + t->set_stylebox("panel", "WindowDialog", sb_expand(make_stylebox(popup_window_png, 10, 26, 10, 8), 8, 24, 8, 6)); + t->set_constant("scaleborder_size", "WindowDialog", 4 * scale); t->set_font("title_font", "WindowDialog", large_font); t->set_color("title_color", "WindowDialog", Color(0, 0, 0)); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 7738157330..50fbb6a162 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -1775,7 +1775,7 @@ void PackedScene::set_path(const String &p_path, bool p_take_over) { void PackedScene::_bind_methods() { ClassDB::bind_method(D_METHOD("pack", "path:Node"), &PackedScene::pack); - ClassDB::bind_method(D_METHOD("instance:Node", "edit_state"), &PackedScene::instance, DEFVAL(false)); + ClassDB::bind_method(D_METHOD("instance:Node", "edit_state"), &PackedScene::instance, DEFVAL(GEN_EDIT_STATE_DISABLED)); ClassDB::bind_method(D_METHOD("can_instance"), &PackedScene::can_instance); ClassDB::bind_method(D_METHOD("_set_bundled_scene"), &PackedScene::_set_bundled_scene); ClassDB::bind_method(D_METHOD("_get_bundled_scene"), &PackedScene::_get_bundled_scene); diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index 35158806ca..13529c8572 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -138,6 +138,11 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const { texture->get_rect_region(rect, src_rect, rect, src_rect); + rect.pos.x -= expand_margin[MARGIN_LEFT]; + rect.pos.y -= expand_margin[MARGIN_TOP]; + rect.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT]; + rect.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM]; + VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, rect, src_rect, texture->get_rid(), Vector2(margin[MARGIN_LEFT], margin[MARGIN_TOP]), Vector2(margin[MARGIN_RIGHT], margin[MARGIN_BOTTOM]), VS::NINE_PATCH_STRETCH, VS::NINE_PATCH_STRETCH, draw_center, modulate); } diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp index 1b1ed45862..f3bba4ae90 100644 --- a/servers/audio_server.cpp +++ b/servers/audio_server.cpp @@ -761,6 +761,10 @@ void AudioServer::finish() { } buses.clear(); + + if (AudioDriver::get_singleton()) { + AudioDriver::get_singleton()->finish(); + } } void AudioServer::update() { } diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h index 3a8126f300..ff679bc15f 100644 --- a/servers/visual/rasterizer.h +++ b/servers/visual/rasterizer.h @@ -441,7 +441,7 @@ public: virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0; virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0; virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) = 0; - virtual void particles_set_gravity(RID p_particles, const Vector3 &p_gravity) = 0; + virtual void particles_set_speed_scale(RID p_particles, float p_scale) = 0; virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0; virtual void particles_set_process_material(RID p_particles, RID p_material) = 0; virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0; @@ -886,6 +886,7 @@ public: }; virtual void canvas_begin() = 0; + virtual void canvas_end() = 0; virtual void canvas_render_items(Item *p_item_list, int p_z, const Color &p_modulate, Light *p_light) = 0; virtual void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) = 0; @@ -930,6 +931,8 @@ public: virtual RasterizerCanvas *get_canvas() = 0; virtual RasterizerScene *get_scene() = 0; + virtual void set_boot_image(const Image &p_image, const Color &p_color, bool p_scale) = 0; + virtual void initialize() = 0; virtual void begin_frame() = 0; virtual void set_current_render_target(RID p_render_target) = 0; diff --git a/servers/visual/shader_types.cpp b/servers/visual/shader_types.cpp index cbde41427c..8d72ee3f34 100644 --- a/servers/visual/shader_types.cpp +++ b/servers/visual/shader_types.cpp @@ -203,8 +203,6 @@ ShaderTypes::ShaderTypes() { shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["DELTA"] = ShaderLanguage::TYPE_FLOAT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["NUMBER"] = ShaderLanguage::TYPE_UINT; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["INDEX"] = ShaderLanguage::TYPE_INT; - shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["SEED"] = ShaderLanguage::TYPE_UINT; - shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["GRAVITY"] = ShaderLanguage::TYPE_VEC3; shader_modes[VS::SHADER_PARTICLES].functions["vertex"]["EMISSION_TRANSFORM"] = ShaderLanguage::TYPE_MAT4; shader_modes[VS::SHADER_PARTICLES].modes.insert("billboard"); diff --git a/servers/visual/visual_server_canvas.cpp b/servers/visual/visual_server_canvas.cpp index ecd1b24826..3a83ba887d 100644 --- a/servers/visual/visual_server_canvas.cpp +++ b/servers/visual/visual_server_canvas.cpp @@ -231,6 +231,9 @@ void VisualServerCanvas::render_canvas(Canvas *p_canvas, const Transform2D &p_tr } } } + + VSG::canvas_render->canvas_end(); + } RID VisualServerCanvas::canvas_create() { diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 93a2b67088..5ba975d193 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -122,6 +122,9 @@ int VisualServerRaster::get_render_info(RenderInfo p_info) { /* TESTING */ void VisualServerRaster::set_boot_image(const Image &p_image, const Color &p_color, bool p_scale) { + + redraw_request(); + VSG::rasterizer->set_boot_image(p_image, p_color, p_scale); } void VisualServerRaster::set_default_clear_color(const Color &p_color) { } diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 11f6d58f95..7de497d529 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -852,7 +852,7 @@ public: BIND2(particles_set_explosiveness_ratio, RID, float) BIND2(particles_set_randomness_ratio, RID, float) BIND2(particles_set_custom_aabb, RID, const Rect3 &) - BIND2(particles_set_gravity, RID, const Vector3 &) + BIND2(particles_set_speed_scale, RID, float) BIND2(particles_set_use_local_coordinates, RID, bool) BIND2(particles_set_process_material, RID, RID) BIND2(particles_set_fixed_fps, RID, int) diff --git a/servers/visual_server.h b/servers/visual_server.h index 04afc6dfaf..7accc7d904 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -480,7 +480,7 @@ public: virtual void particles_set_explosiveness_ratio(RID p_particles, float p_ratio) = 0; virtual void particles_set_randomness_ratio(RID p_particles, float p_ratio) = 0; virtual void particles_set_custom_aabb(RID p_particles, const Rect3 &p_aabb) = 0; - virtual void particles_set_gravity(RID p_particles, const Vector3 &p_gravity) = 0; + virtual void particles_set_speed_scale(RID p_particles, float p_scale) = 0; virtual void particles_set_use_local_coordinates(RID p_particles, bool p_enable) = 0; virtual void particles_set_process_material(RID p_particles, RID p_material) = 0; virtual void particles_set_fixed_fps(RID p_particles, int p_fps) = 0; diff --git a/thirdparty/README.md b/thirdparty/README.md index f35a95df37..f6edff490f 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -156,7 +156,7 @@ TODO. ## opus - Upstream: https://opus-codec.org -- Version: 1.1.3 (opus) and 0.8 (opusfile) +- Version: 1.1.4 (opus) and 0.8 (opusfile) - License: BSD-3-Clause Files extracted from upstream source: @@ -164,6 +164,7 @@ Files extracted from upstream source: - all .c and .h files in src/ (both opus and opusfile), except `opus_demo.c` - all .h files in include/ (both opus and opusfile) as opus/ +- celt/ and silk/ subfolders - COPYING @@ -204,7 +205,7 @@ Files extracted from upstream source: ## squish - Upstream: https://sourceforge.net/projects/libsquish -- Version: 1.14 +- Version: 1.15 - License: MIT Files extracted from upstream source: diff --git a/thirdparty/libpng/png.c b/thirdparty/libpng/png.c index 78ce39f46d..2c9fea2123 100644 --- a/thirdparty/libpng/png.c +++ b/thirdparty/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.28 [January 5, 2017] + * Last changed in libpng 1.6.29 [March 16, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_28 Your_png_h_is_not_version_1_6_28; +typedef png_libpng_version_1_6_29 Your_png_h_is_not_version_1_6_29; /* Tells libpng that we have already handled the first "num_bytes" bytes * of the PNG file signature. If the PNG data is embedded into another @@ -776,14 +776,14 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.28 - January 5, 2017" PNG_STRING_NEWLINE \ + "libpng version 1.6.29 - March 16, 2017" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.28 - January 5, 2017\ + return "libpng version 1.6.29 - March 16, 2017\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -4260,13 +4260,13 @@ png_set_option(png_structrp png_ptr, int option, int onoff) if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT && (option & 1) == 0) { - png_uint_32 mask = 3 << option; - png_uint_32 setting = (2 + (onoff != 0)) << option; + png_uint_32 mask = 3U << option; + png_uint_32 setting = (2U + (onoff != 0)) << option; png_uint_32 current = png_ptr->options; png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff); - return (current & mask) >> option; + return (int)(current & mask) >> option; } return PNG_OPTION_INVALID; diff --git a/thirdparty/libpng/png.h b/thirdparty/libpng/png.h index e4cf032816..2431e0dfc0 100644 --- a/thirdparty/libpng/png.h +++ b/thirdparty/libpng/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.28, January 5, 2017 + * libpng version 1.6.29, March 16, 2017 * * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -12,7 +12,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.6.28, January 5, 2017: + * libpng versions 0.97, January 1998, through 1.6.29, March 16, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are + * libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -38,6 +38,8 @@ * Gilles Vollant * James Yu * Mandar Sahastrabuddhe + * Google Inc. + * Vadim Barkov * * and with the following additions to the disclaimer: * @@ -211,7 +213,7 @@ * ... * 1.5.28 15 10527 15.so.15.28[.0] * ... - * 1.6.28 16 10628 16.so.16.28[.0] + * 1.6.29 16 10629 16.so.16.29[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -239,13 +241,13 @@ * Y2K compliance in libpng: * ========================= * - * January 5, 2017 + * March 16, 2017 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.6.28 are Y2K compliant. It is my belief that + * upward through 1.6.29 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -307,8 +309,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.28" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.28 - January 5, 2017\n" +#define PNG_LIBPNG_VER_STRING "1.6.29" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.29 - March 16, 2017\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -316,7 +318,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 28 +#define PNG_LIBPNG_VER_RELEASE 29 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -347,7 +349,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10628 /* 1.6.28 */ +#define PNG_LIBPNG_VER 10629 /* 1.6.29 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -457,7 +459,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_28; +typedef char* png_libpng_version_1_6_29; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -3224,7 +3226,10 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory, # define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */ #endif #define PNG_IGNORE_ADLER32 8 -#define PNG_OPTION_NEXT 10 /* Next option - numbers must be even */ +#ifdef PNG_POWERPC_VSX_API_SUPPORTED +# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */ +#endif +#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */ /* Return values: NOTE: there are four values and 'off' is *not* zero */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ diff --git a/thirdparty/libpng/pngconf.h b/thirdparty/libpng/pngconf.h index 5e8b40bcfb..78d8b92b0e 100644 --- a/thirdparty/libpng/pngconf.h +++ b/thirdparty/libpng/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.6.28, January 5, 2017 + * libpng version 1.6.29, March 16, 2017 * * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/thirdparty/libpng/pnglibconf.h b/thirdparty/libpng/pnglibconf.h index ee70573605..82f6ba4619 100644 --- a/thirdparty/libpng/pnglibconf.h +++ b/thirdparty/libpng/pnglibconf.h @@ -1,8 +1,8 @@ -/* libpng 1.6.28 STANDARD API DEFINITION */ +/* libpng 1.6.29 STANDARD API DEFINITION */ /* pnglibconf.h - library build configuration */ -/* Libpng version 1.6.28 - January 5, 2017 */ +/* Libpng version 1.6.29 - March 16, 2017 */ /* Copyright (c) 1998-2015 Glenn Randers-Pehrson */ @@ -20,6 +20,8 @@ #define PNG_ALIGNED_MEMORY_SUPPORTED /*#undef PNG_ARM_NEON_API_SUPPORTED*/ /*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/ +/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/ #define PNG_BENIGN_ERRORS_SUPPORTED #define PNG_BENIGN_READ_ERRORS_SUPPORTED /*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/ diff --git a/thirdparty/libpng/pngpriv.h b/thirdparty/libpng/pngpriv.h index ed61165b2d..6d2e424d2e 100644 --- a/thirdparty/libpng/pngpriv.h +++ b/thirdparty/libpng/pngpriv.h @@ -1,8 +1,8 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.29 [March 16, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -190,6 +190,50 @@ # endif #endif +#ifndef PNG_POWERPC_VSX_OPT +# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__) +# define PNG_POWERPC_VSX_OPT 2 +# else +# define PNG_POWERPC_VSX_OPT 0 +# endif +#endif + +#ifndef PNG_INTEL_SSE_OPT +# ifdef PNG_INTEL_SSE + /* Only check for SSE if the build configuration has been modified to + * enable SSE optimizations. This means that these optimizations will + * be off by default. See contrib/intel for more details. + */ +# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \ + defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_OPT 1 +# endif +# endif +#endif + +#if PNG_INTEL_SSE_OPT > 0 +# ifndef PNG_INTEL_SSE_IMPLEMENTATION +# if defined(__SSE4_1__) || defined(__AVX__) + /* We are not actually using AVX, but checking for AVX is the best + way we can detect SSE4.1 and SSSE3 on MSVC. + */ +# define PNG_INTEL_SSE_IMPLEMENTATION 3 +# elif defined(__SSSE3__) +# define PNG_INTEL_SSE_IMPLEMENTATION 2 +# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \ + (defined(_M_IX86_FP) && _M_IX86_FP >= 2) +# define PNG_INTEL_SSE_IMPLEMENTATION 1 +# else +# define PNG_INTEL_SSE_IMPLEMENTATION 0 +# endif +# endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2 +# endif +#endif + #if PNG_MIPS_MSA_OPT > 0 # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa # ifndef PNG_MIPS_MSA_IMPLEMENTATION @@ -210,6 +254,11 @@ # endif #endif /* PNG_MIPS_MSA_OPT > 0 */ +#if PNG_POWERPC_VSX_OPT > 0 +# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx +# define PNG_POWERPC_VSX_IMPLEMENTATION 1 +#endif + /* Is this a build of a DLL where compilation of the object modules requires * different preprocessor settings to those required for a simple library? If @@ -1256,6 +1305,38 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); #endif +#if PNG_POWERPC_VSX_OPT > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info, + png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + +#if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop + row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); +#endif + /* Choose the best filter to use and filter the row data */ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, png_row_infop row_info),PNG_EMPTY); @@ -1991,6 +2072,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon, PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); #endif + +# if PNG_INTEL_SSE_IMPLEMENTATION > 0 +PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2, + (png_structp png_ptr, unsigned int bpp), PNG_EMPTY); +# endif #endif PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, diff --git a/thirdparty/libpng/pngrtran.c b/thirdparty/libpng/pngrtran.c index 0b4f4f9068..16c1ed6086 100644 --- a/thirdparty/libpng/pngrtran.c +++ b/thirdparty/libpng/pngrtran.c @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.24 [August 4, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.29 [March 16, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -4302,7 +4302,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row, if (num_trans > 0) { sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { @@ -4463,7 +4463,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, { gray = gray & 0xff; sp = row + (png_size_t)row_width - 1; - dp = row + (png_size_t)(row_width << 1) - 1; + dp = row + ((png_size_t)row_width << 1) - 1; for (i = 0; i < row_width; i++) { @@ -4519,7 +4519,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green = (png_byte)(trans_color->green & 0xff); png_byte blue = (png_byte)(trans_color->blue & 0xff); sp = row + (png_size_t)row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 2) - 1; + dp = row + ((png_size_t)row_width << 2) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) @@ -4542,7 +4542,7 @@ png_do_expand(png_row_infop row_info, png_bytep row, png_byte green_low = (png_byte)(trans_color->green & 0xff); png_byte blue_low = (png_byte)(trans_color->blue & 0xff); sp = row + row_info->rowbytes - 1; - dp = row + (png_size_t)(row_width << 3) - 1; + dp = row + ((png_size_t)row_width << 3) - 1; for (i = 0; i < row_width; i++) { if (*(sp - 5) == red_high && diff --git a/thirdparty/libpng/pngrutil.c b/thirdparty/libpng/pngrutil.c index bee0ea1158..76f079a69f 100644 --- a/thirdparty/libpng/pngrutil.c +++ b/thirdparty/libpng/pngrutil.c @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.27 [January 5, 2017] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.29 [March 16, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -418,7 +418,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner) png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; } -#if ZLIB_VERNUM >= 0x1281 && \ +#if ZLIB_VERNUM >= 0x1290 && \ defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON) /* Turn off validation of the ADLER32 checksum in IDAT chunks */ diff --git a/thirdparty/libpng/pngwutil.c b/thirdparty/libpng/pngwutil.c index d1a82d45e1..0f98d582da 100644 --- a/thirdparty/libpng/pngwutil.c +++ b/thirdparty/libpng/pngwutil.c @@ -675,6 +675,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, int interlace_type) { png_byte buf[13]; /* Buffer to store the IHDR info */ + int is_invalid_depth; png_debug(1, "in png_write_IHDR"); @@ -700,11 +701,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_RGB: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGB image"); png_ptr->channels = 3; @@ -726,18 +727,22 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height, break; case PNG_COLOR_TYPE_GRAY_ALPHA: - if (bit_depth != 8 && bit_depth != 16) + is_invalid_depth = (bit_depth != 8); +#ifdef PNG_WRITE_16BIT_SUPPORTED + is_invalid_depth = (is_invalid_depth && bit_depth != 16); +#endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); png_ptr->channels = 2; break; case PNG_COLOR_TYPE_RGB_ALPHA: + is_invalid_depth = (bit_depth != 8); #ifdef PNG_WRITE_16BIT_SUPPORTED - if (bit_depth != 8 && bit_depth != 16) -#else - if (bit_depth != 8) + is_invalid_depth = (is_invalid_depth && bit_depth != 16); #endif + if (is_invalid_depth) png_error(png_ptr, "Invalid bit depth for RGBA image"); png_ptr->channels = 4; diff --git a/thirdparty/opus/silk/NLSF_stabilize.c b/thirdparty/opus/silk/NLSF_stabilize.c index 1fa1ea379b..8f3426b91e 100644 --- a/thirdparty/opus/silk/NLSF_stabilize.c +++ b/thirdparty/opus/silk/NLSF_stabilize.c @@ -130,7 +130,7 @@ void silk_NLSF_stabilize( /* Keep delta_min distance between the NLSFs */ for( i = 1; i < L; i++ ) - NLSF_Q15[i] = silk_max_int( NLSF_Q15[i], NLSF_Q15[i-1] + NDeltaMin_Q15[i] ); + NLSF_Q15[i] = silk_max_int( NLSF_Q15[i], silk_ADD_SAT16( NLSF_Q15[i-1], NDeltaMin_Q15[i] ) ); /* Last NLSF should be no higher than 1 - NDeltaMin[L] */ NLSF_Q15[L-1] = silk_min_int( NLSF_Q15[L-1], (1<<15) - NDeltaMin_Q15[L] ); diff --git a/thirdparty/squish/squish.cpp b/thirdparty/squish/squish.cpp index d3cbabbafd..1d22a64ad6 100644 --- a/thirdparty/squish/squish.cpp +++ b/thirdparty/squish/squish.cpp @@ -177,13 +177,17 @@ void CompressImage( u8 const* rgba, int width, int height, int pitch, void* bloc // fix any bad flags flags = FixFlags( flags ); - // initialise the block output - u8* targetBlock = reinterpret_cast< u8* >( blocks ); - int bytesPerBlock = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16; - // loop over blocks +#ifdef SQUISH_USE_OPENMP +# pragma omp parallel for +#endif for( int y = 0; y < height; y += 4 ) { + // initialise the block output + u8* targetBlock = reinterpret_cast< u8* >( blocks ); + int bytesPerBlock = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16; + targetBlock += ( (y / 4) * ( (width + 3) / 4) ) * bytesPerBlock; + for( int x = 0; x < width; x += 4 ) { // build the 4x4 block of pixels @@ -232,13 +236,17 @@ void DecompressImage( u8* rgba, int width, int height, int pitch, void const* bl // fix any bad flags flags = FixFlags( flags ); - // initialise the block input - u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks ); - int bytesPerBlock = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16; - // loop over blocks +#ifdef SQUISH_USE_OPENMP +# pragma omp parallel for +#endif for( int y = 0; y < height; y += 4 ) { + // initialise the block input + u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks ); + int bytesPerBlock = ( ( flags & ( kDxt1 | kBc4 ) ) != 0 ) ? 8 : 16; + sourceBlock += ( (y / 4) * ( (width + 3) / 4) ) * bytesPerBlock; + for( int x = 0; x < width; x += 4 ) { // decompress the block diff --git a/thirdparty/squish/squish.h b/thirdparty/squish/squish.h index 7c46e37ff1..14c9bb59fb 100644 --- a/thirdparty/squish/squish.h +++ b/thirdparty/squish/squish.h @@ -239,6 +239,15 @@ int GetStorageRequirements( int width, int height, int flags ); allows for pixels outside the image to take arbitrary values. The function squish::GetStorageRequirements can be called to compute the amount of memory to allocate for the compressed output. + + Note on compression quality: When compressing textures with + libsquish it is recommended to apply a gamma-correction + beforehand. This will reduce the blockiness in dark areas. The + level of necessary gamma-correction is platform dependent. For + example, a gamma correction with gamma = 0.5 before compression + and gamma = 2.0 after decompression yields good results on the + Windows platform but for other platforms like MacOS X a different + gamma value may be more suitable. */ void CompressImage( u8 const* rgba, int width, int height, int pitch, void* blocks, int flags, float* metric = 0 ); void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags, float* metric = 0 ); |