diff options
| author | BastiaanOlij <mux213@gmail.com> | 2017-11-23 22:50:05 +1100 |
|---|---|---|
| committer | BastiaanOlij <mux213@gmail.com> | 2017-11-23 22:50:05 +1100 |
| commit | 0f773c2d72a4666e2ecf7235201f035773775f71 (patch) | |
| tree | aea20447f52162fc269c7d138bd2dda6c2d4d4bb /include/core | |
| parent | e72f4beec1b091edf6f16a0fe27d5ed13ca450c2 (diff) | |
| download | redot-cpp-0f773c2d72a4666e2ecf7235201f035773775f71.tar.gz | |
Update bindings to use new Api extensions and rename Rect3->AABB
Diffstat (limited to 'include/core')
| -rw-r--r-- | include/core/AABB.hpp (renamed from include/core/Rect3.hpp) | 30 | ||||
| -rw-r--r-- | include/core/CoreTypes.hpp | 2 | ||||
| -rw-r--r-- | include/core/Defs.hpp | 2 | ||||
| -rw-r--r-- | include/core/Godot.hpp | 14 | ||||
| -rw-r--r-- | include/core/GodotGlobal.hpp | 3 | ||||
| -rw-r--r-- | include/core/NodePath.hpp | 2 | ||||
| -rw-r--r-- | include/core/String.hpp | 5 | ||||
| -rw-r--r-- | include/core/Transform.hpp | 6 | ||||
| -rw-r--r-- | include/core/Variant.hpp | 6 |
9 files changed, 36 insertions, 34 deletions
diff --git a/include/core/Rect3.hpp b/include/core/AABB.hpp index acd674f..8b96a74 100644 --- a/include/core/Rect3.hpp +++ b/include/core/AABB.hpp @@ -1,5 +1,5 @@ -#ifndef RECT3_H -#define RECT3_H +#ifndef AABB_H +#define AABB_H #include "Vector3.hpp" @@ -9,7 +9,7 @@ namespace godot { -class Rect3 { +class AABB { public: Vector3 pos; Vector3 size; @@ -31,16 +31,16 @@ public: inline void set_size(const Vector3& p_size) { size=p_size; } - bool operator==(const Rect3& p_rval) const; - bool operator!=(const Rect3& p_rval) const; + bool operator==(const AABB& p_rval) const; + bool operator!=(const AABB& p_rval) const; - bool intersects(const Rect3& p_aabb) const; /// Both AABBs overlap - bool intersects_inclusive(const Rect3& p_aabb) const; /// Both AABBs (or their faces) overlap - bool encloses(const Rect3 & p_aabb) const; /// p_aabb is completely inside this + bool intersects(const AABB& p_aabb) const; /// Both AABBs overlap + bool intersects_inclusive(const AABB& p_aabb) const; /// Both AABBs (or their faces) overlap + bool encloses(const AABB & p_aabb) const; /// p_aabb is completely inside this - Rect3 merge(const Rect3& p_with) const; - void merge_with(const Rect3& p_aabb); ///merge with another AABB - Rect3 intersection(const Rect3& p_aabb) const; ///get box where two intersect, empty if no intersection occurs + AABB merge(const AABB& p_with) const; + void merge_with(const AABB& p_aabb); ///merge with another AABB + AABB intersection(const AABB& p_aabb) const; ///get box where two intersect, empty if no intersection occurs bool intersects_segment(const Vector3& p_from, const Vector3& p_to,Vector3* r_clip=NULL,Vector3* r_normal=NULL) const; bool intersects_ray(const Vector3& p_from, const Vector3& p_dir,Vector3* r_clip=NULL,Vector3* r_normal=NULL) const; bool smits_intersect_ray(const Vector3 &from,const Vector3& p_dir, real_t t0, real_t t1) const; @@ -60,20 +60,20 @@ public: int get_shortest_axis_index() const; real_t get_shortest_axis_size() const; - Rect3 grow(real_t p_by) const; + AABB grow(real_t p_by) const; void grow_by(real_t p_amount); void get_edge(int p_edge,Vector3& r_from,Vector3& r_to) const; Vector3 get_endpoint(int p_point) const; - Rect3 expand(const Vector3& p_vector) const; + AABB expand(const Vector3& p_vector) const; void project_range_in_plane(const Plane& p_plane,real_t &r_min,real_t& r_max) const; void expand_to(const Vector3& p_vector); /** expand to contain a point if necesary */ operator String() const; - inline Rect3() {} - inline Rect3(const Vector3 &p_pos,const Vector3& p_size) { pos=p_pos; size=p_size; } + inline AABB() {} + inline AABB(const Vector3 &p_pos,const Vector3& p_size) { pos=p_pos; size=p_size; } }; diff --git a/include/core/CoreTypes.hpp b/include/core/CoreTypes.hpp index 2ee91a4..8f72c4c 100644 --- a/include/core/CoreTypes.hpp +++ b/include/core/CoreTypes.hpp @@ -3,6 +3,7 @@ #include "Defs.hpp" +#include "AABB.hpp" #include "Array.hpp" #include "Basis.hpp" #include "Color.hpp" @@ -12,7 +13,6 @@ #include "PoolArrays.hpp" #include "Quat.hpp" #include "Rect2.hpp" -#include "Rect3.hpp" #include "RID.hpp" #include "String.hpp" #include "Transform.hpp" diff --git a/include/core/Defs.hpp b/include/core/Defs.hpp index d3a87d8..f8c76d3 100644 --- a/include/core/Defs.hpp +++ b/include/core/Defs.hpp @@ -87,7 +87,7 @@ typedef float real_t; #ifndef ERR_PRINT -#define ERR_PRINT(msg) fprintf(stderr, "ERROR: %s\n", (msg).c_string()) +#define ERR_PRINT(msg) fprintf(stderr, "ERROR: %S\n", (msg).unicode_str()) #endif #ifndef ERR_FAIL_INDEX_V diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp index f54a2e5..972a00f 100644 --- a/include/core/Godot.hpp +++ b/include/core/Godot.hpp @@ -86,7 +86,7 @@ struct _ArgCast<Variant> { template<class T> T *as(Object *obj) { - return (T *) godot::api->godot_nativescript_get_userdata(obj); + return (T *) godot::nativescript_api->godot_nativescript_get_userdata(obj); } // instance and destroy funcs @@ -118,7 +118,7 @@ void register_class() destroy.destroy_func = _godot_class_destroy_func<T>; - godot::api->godot_nativescript_register_class(godot::_RegisterState::nativescript_handle, T::___get_type_name(), T::___get_base_type_name(), create, destroy); + godot::nativescript_api->godot_nativescript_register_class(godot::_RegisterState::nativescript_handle, T::___get_type_name(), T::___get_base_type_name(), create, destroy); T::_register_methods(); } @@ -132,7 +132,7 @@ void register_tool_class() destroy.destroy_func = _godot_class_destroy_func<T>; - godot::api->godot_nativescript_register_tool_class(godot::_RegisterState::nativescript_handle, T::___get_type_name(), T::___get_base_type_name(), create, destroy); + godot::nativescript_api->godot_nativescript_register_tool_class(godot::_RegisterState::nativescript_handle, T::___get_type_name(), T::___get_base_type_name(), create, destroy); T::_register_methods(); } @@ -285,7 +285,7 @@ void register_method(const char *name, M method_ptr, godot_method_rpc_mode rpc_t godot_method_attributes attr = {}; attr.rpc_type = rpc_type; - godot::api->godot_nativescript_register_method(godot::_RegisterState::nativescript_handle, ___get_method_class_name(method_ptr), name, attr, method); + godot::nativescript_api->godot_nativescript_register_method(godot::_RegisterState::nativescript_handle, ___get_method_class_name(method_ptr), name, attr, method); } @@ -403,7 +403,7 @@ void register_property(const char *name, P (T::*var), P default_value, godot_met get_func.free_func = godot::api->godot_free; get_func.get_func = &_PropertyDefaultGetFunc<T, P>::_wrapped_getter; - godot::api->godot_nativescript_register_property(godot::_RegisterState::nativescript_handle, T::___get_type_name(), name, &attr, set_func, get_func); + godot::nativescript_api->godot_nativescript_register_property(godot::_RegisterState::nativescript_handle, T::___get_type_name(), name, &attr, set_func, get_func); } @@ -437,7 +437,7 @@ void register_property(const char *name, void (T::*setter)(P), P (T::*getter)(), get_func.free_func = godot::api->godot_free; get_func.get_func = &_PropertyGetFunc<T, P>::_wrapped_getter; - godot::api->godot_nativescript_register_property(godot::_RegisterState::nativescript_handle, T::___get_type_name(), name, &attr, set_func, get_func); + godot::nativescript_api->godot_nativescript_register_property(godot::_RegisterState::nativescript_handle, T::___get_type_name(), name, &attr, set_func, get_func); } @@ -466,7 +466,7 @@ void register_signal(String name, Dictionary args = Dictionary()) signal.args[i].type = args.values()[i]; } - godot::api->godot_nativescript_register_signal(godot::_RegisterState::nativescript_handle, T::___get_type_name(), &signal); + godot::nativescript_api->godot_nativescript_register_signal(godot::_RegisterState::nativescript_handle, T::___get_type_name(), &signal); for (int i = 0; i < signal.num_args; i++) { godot::api->godot_string_destroy(&signal.args[i].name); diff --git a/include/core/GodotGlobal.hpp b/include/core/GodotGlobal.hpp index fe7344d..5263e9d 100644 --- a/include/core/GodotGlobal.hpp +++ b/include/core/GodotGlobal.hpp @@ -7,7 +7,8 @@ namespace godot { -extern "C" const godot_gdnative_api_struct *api; +extern "C" const godot_gdnative_core_api_struct *api; +extern "C" const godot_gdnative_ext_nativescript_api_struct *nativescript_api; class Godot { diff --git a/include/core/NodePath.hpp b/include/core/NodePath.hpp index 235c95e..026414b 100644 --- a/include/core/NodePath.hpp +++ b/include/core/NodePath.hpp @@ -24,8 +24,6 @@ public: int get_name_count() const; - String get_property() const; - String get_subname(const int idx) const; int get_subname_count() const; diff --git a/include/core/String.hpp b/include/core/String.hpp index 43da4a3..63e2119 100644 --- a/include/core/String.hpp +++ b/include/core/String.hpp @@ -40,7 +40,8 @@ public: operator NodePath() const; int length() const; - const char *c_string() const; + const wchar_t *unicode_str() const; + void get_c_string(char *p_dest, int *p_size) const; int64_t find(String p_what) const; int64_t find_from(String p_what, int64_t p_from) const; @@ -106,6 +107,8 @@ public: }; String operator+(const char *a, const String &b); +String operator+(const wchar_t *a, const String &b); + } #endif // STRING_H diff --git a/include/core/Transform.hpp b/include/core/Transform.hpp index c6b9b14..ebe83f7 100644 --- a/include/core/Transform.hpp +++ b/include/core/Transform.hpp @@ -4,7 +4,7 @@ #include "Basis.hpp" #include "Plane.hpp" -#include "Rect3.hpp" +#include "AABB.hpp" namespace godot { @@ -53,8 +53,8 @@ public: Plane xform(const Plane& p_plane) const; Plane xform_inv(const Plane& p_plane) const; - Rect3 xform(const Rect3& p_aabb) const; - Rect3 xform_inv(const Rect3& p_aabb) const; + AABB xform(const AABB& p_aabb) const; + AABB xform_inv(const AABB& p_aabb) const; void operator*=(const Transform& p_transform); Transform operator*(const Transform& p_transform) const; diff --git a/include/core/Variant.hpp b/include/core/Variant.hpp index b4741f9..718561b 100644 --- a/include/core/Variant.hpp +++ b/include/core/Variant.hpp @@ -5,6 +5,7 @@ #include "Defs.hpp" +#include "AABB.hpp" #include "Basis.hpp" #include "Color.hpp" #include "NodePath.hpp" @@ -12,7 +13,6 @@ #include "PoolArrays.hpp" #include "Quat.hpp" #include "Rect2.hpp" -#include "Rect3.hpp" #include "RID.hpp" #include "String.hpp" #include "Transform.hpp" @@ -154,7 +154,7 @@ public: Variant(const Plane& p_plane); - Variant(const Rect3& p_aabb); + Variant(const AABB& p_aabb); Variant(const Quat& p_quat); @@ -215,7 +215,7 @@ public: operator Rect2() const; operator Vector3() const; operator Plane() const; - operator Rect3() const; + operator AABB() const; operator Quat() const; operator Basis() const; operator Transform() const; |
