summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--core/math/a_star.cpp25
-rw-r--r--core/math/a_star.h3
-rw-r--r--core/math/math_2d.cpp22
-rw-r--r--core/math/math_2d.h2
-rw-r--r--core/math/vector3.h20
-rw-r--r--core/os/os.h4
-rw-r--r--core/script_language.h2
-rw-r--r--core/variant_call.cpp12
-rw-r--r--doc/base/classes.xml37
-rwxr-xr-xdoc/tools/doc_status.py2
-rw-r--r--drivers/gles3/rasterizer_canvas_gles3.cpp26
-rw-r--r--drivers/unix/os_unix.cpp31
-rw-r--r--drivers/unix/os_unix.h4
-rw-r--r--editor/editor_node.cpp2
-rw-r--r--editor/filesystem_dock.cpp2
-rw-r--r--editor/property_editor.cpp2
-rw-r--r--editor/scene_tree_editor.cpp1
-rw-r--r--main/input_default.cpp17
-rw-r--r--modules/cscript/SCsub7
-rw-r--r--modules/cscript/godot_c.cpp29
-rw-r--r--modules/cscript/godot_c.h567
-rw-r--r--modules/dlscript/SCsub14
-rw-r--r--modules/dlscript/api_generator.cpp391
-rw-r--r--modules/dlscript/api_generator.h9
-rw-r--r--modules/dlscript/config.py (renamed from modules/cscript/config.py)2
-rw-r--r--modules/dlscript/dl_script.cpp1048
-rw-r--r--modules/dlscript/dl_script.h404
-rw-r--r--modules/dlscript/godot.cpp202
-rw-r--r--modules/dlscript/godot.h389
-rw-r--r--modules/dlscript/godot/godot_array.cpp271
-rw-r--r--modules/dlscript/godot/godot_array.h88
-rw-r--r--modules/dlscript/godot/godot_basis.cpp58
-rw-r--r--modules/dlscript/godot/godot_basis.h34
-rw-r--r--modules/dlscript/godot/godot_color.cpp34
-rw-r--r--modules/dlscript/godot/godot_color.h29
-rw-r--r--modules/dlscript/godot/godot_dictionary.cpp109
-rw-r--r--modules/dlscript/godot/godot_dictionary.h51
-rw-r--r--modules/dlscript/godot/godot_image.cpp85
-rw-r--r--modules/dlscript/godot/godot_image.h95
-rw-r--r--modules/dlscript/godot/godot_input_event.cpp280
-rw-r--r--modules/dlscript/godot/godot_input_event.h206
-rw-r--r--modules/dlscript/godot/godot_node_path.cpp87
-rw-r--r--modules/dlscript/godot/godot_node_path.h38
-rw-r--r--modules/dlscript/godot/godot_plane.cpp48
-rw-r--r--modules/dlscript/godot/godot_plane.h37
-rw-r--r--modules/dlscript/godot/godot_pool_arrays.cpp558
-rw-r--r--modules/dlscript/godot/godot_pool_arrays.h256
-rw-r--r--modules/dlscript/godot/godot_quat.cpp79
-rw-r--r--modules/dlscript/godot/godot_quat.h33
-rw-r--r--modules/dlscript/godot/godot_rect2.cpp48
-rw-r--r--modules/dlscript/godot/godot_rect2.h31
-rw-r--r--modules/dlscript/godot/godot_rect3.cpp48
-rw-r--r--modules/dlscript/godot/godot_rect3.h31
-rw-r--r--modules/dlscript/godot/godot_rid.cpp36
-rw-r--r--modules/dlscript/godot/godot_rid.h28
-rw-r--r--modules/dlscript/godot/godot_string.cpp83
-rw-r--r--modules/dlscript/godot/godot_string.h42
-rw-r--r--modules/dlscript/godot/godot_transform.cpp44
-rw-r--r--modules/dlscript/godot/godot_transform.h29
-rw-r--r--modules/dlscript/godot/godot_transform2d.cpp59
-rw-r--r--modules/dlscript/godot/godot_transform2d.h48
-rw-r--r--modules/dlscript/godot/godot_variant.cpp476
-rw-r--r--modules/dlscript/godot/godot_variant.h150
-rw-r--r--modules/dlscript/godot/godot_vector2.cpp124
-rw-r--r--modules/dlscript/godot/godot_vector2.h78
-rw-r--r--modules/dlscript/godot/godot_vector3.cpp150
-rw-r--r--modules/dlscript/godot/godot_vector3.h82
-rw-r--r--modules/dlscript/register_types.cpp (renamed from modules/cscript/register_types.cpp)39
-rw-r--r--modules/dlscript/register_types.h (renamed from modules/cscript/register_types.h)4
-rw-r--r--modules/gdscript/gd_tokenizer.cpp1
-rw-r--r--platform/windows/export/export.cpp29
-rw-r--r--platform/windows/os_windows.cpp26
-rw-r--r--platform/windows/os_windows.h4
-rw-r--r--scene/2d/canvas_item.cpp4
-rw-r--r--scene/2d/node_2d.cpp22
-rw-r--r--scene/2d/physics_body_2d.cpp13
-rw-r--r--scene/2d/physics_body_2d.h2
-rw-r--r--scene/2d/screen_button.cpp31
-rw-r--r--scene/2d/screen_button.h4
-rw-r--r--scene/3d/spatial.cpp9
-rw-r--r--scene/gui/control.cpp14
-rw-r--r--scene/gui/dialogs.cpp13
-rw-r--r--scene/gui/patch_9_rect.cpp34
-rw-r--r--scene/gui/range.cpp10
-rw-r--r--scene/gui/split_container.cpp2
-rw-r--r--scene/main/scene_main_loop.cpp5
-rw-r--r--scene/main/scene_main_loop.h1
-rwxr-xr-xscene/main/timer.cpp6
-rw-r--r--scene/resources/default_theme/default_theme.cpp2
-rw-r--r--scene/resources/style_box.cpp14
-rw-r--r--scene/scene_string_names.cpp3
-rw-r--r--scene/scene_string_names.h3
93 files changed, 6890 insertions, 748 deletions
diff --git a/README.md b/README.md
index 935170479d..701982da11 100644
--- a/README.md
+++ b/README.md
@@ -35,7 +35,7 @@ Official binaries for the Godot editor and the export templates can be found
#### Compiling from source
-[See the official docs](http://docs.godotengine.org/en/latest/reference/_compiling.html)
+[See the official docs](http://docs.godotengine.org/en/latest/development/compiling/)
for compilation instructions for every supported platform.
### Community
@@ -52,7 +52,7 @@ on Freenode.
The official documentation is hosted on [ReadTheDocs](http://docs.godotengine.org).
It is maintained by the Godot community in its own [GitHub repository](https://github.com/godotengine/godot-docs).
-The [class reference](http://docs.godotengine.org/en/latest/classes/_classes.html)
+The [class reference](http://docs.godotengine.org/en/latest/classes/)
is also accessible from within the engine.
The official demos are maintained in their own [GitHub repository](https://github.com/godotengine/godot-demo-projects)
diff --git a/core/math/a_star.cpp b/core/math/a_star.cpp
index 110185c2d2..c82a40f30d 100644
--- a/core/math/a_star.cpp
+++ b/core/math/a_star.cpp
@@ -28,6 +28,8 @@
/*************************************************************************/
#include "a_star.h"
#include "geometry.h"
+#include "scene/scene_string_names.h"
+#include "script_language.h"
int AStar::get_available_point_id() const {
@@ -187,7 +189,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
Point *n = begin_point->neighbours[i];
n->prev_point = begin_point;
- n->distance = n->pos.distance_to(begin_point->pos);
+ n->distance = _compute_cost(n->id, begin_point->id);
n->distance *= n->weight_scale;
n->last_pass = pass;
open_list.add(&n->list);
@@ -215,7 +217,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
Point *p = E->self();
real_t cost = p->distance;
- cost += p->pos.distance_to(end_point->pos);
+ cost += _estimate_cost(p->id, end_point->id);
cost *= p->weight_scale;
if (cost < least_cost) {
@@ -233,7 +235,7 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
Point *e = p->neighbours[i];
- real_t distance = p->pos.distance_to(e->pos) + p->distance;
+ real_t distance = _compute_cost(p->id, e->id) + p->distance;
distance *= e->weight_scale;
if (e->last_pass == pass) {
@@ -274,6 +276,20 @@ bool AStar::_solve(Point *begin_point, Point *end_point) {
return found_route;
}
+float AStar::_estimate_cost(int p_from_id, int p_to_id) {
+ if (get_script_instance() && get_script_instance()->has_method(SceneStringNames::get_singleton()->_estimate_cost))
+ return get_script_instance()->call(SceneStringNames::get_singleton()->_estimate_cost, p_from_id, p_to_id);
+
+ return points[p_from_id]->pos.distance_to(points[p_to_id]->pos);
+}
+
+float AStar::_compute_cost(int p_from_id, int p_to_id) {
+ if (get_script_instance() && get_script_instance()->has_method(SceneStringNames::get_singleton()->_compute_cost))
+ return get_script_instance()->call(SceneStringNames::get_singleton()->_compute_cost, p_from_id, p_to_id);
+
+ return points[p_from_id]->pos.distance_to(points[p_to_id]->pos);
+}
+
PoolVector<Vector3> AStar::get_point_path(int p_from_id, int p_to_id) {
ERR_FAIL_COND_V(!points.has(p_from_id), PoolVector<Vector3>());
@@ -395,6 +411,9 @@ void AStar::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_point_path", "from_id", "to_id"), &AStar::get_point_path);
ClassDB::bind_method(D_METHOD("get_id_path", "from_id", "to_id"), &AStar::get_id_path);
+
+ BIND_VMETHOD(MethodInfo("_estimate_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
+ BIND_VMETHOD(MethodInfo("_compute_cost", PropertyInfo(Variant::INT, "from_id"), PropertyInfo(Variant::INT, "to_id")));
}
AStar::AStar() {
diff --git a/core/math/a_star.h b/core/math/a_star.h
index 2ac855737c..43c9c4457a 100644
--- a/core/math/a_star.h
+++ b/core/math/a_star.h
@@ -93,6 +93,9 @@ class AStar : public Reference {
protected:
static void _bind_methods();
+ virtual float _estimate_cost(int p_from_id, int p_to_id);
+ virtual float _compute_cost(int p_from_id, int p_to_id);
+
public:
int get_available_point_id() const;
diff --git a/core/math/math_2d.cpp b/core/math/math_2d.cpp
index 8f942c423f..77cff6a052 100644
--- a/core/math/math_2d.cpp
+++ b/core/math/math_2d.cpp
@@ -61,6 +61,10 @@ Vector2 Vector2::normalized() const {
return v;
}
+bool Vector2::is_normalized() const {
+ return Math::isequal_approx(length(), (real_t)1.0);
+}
+
real_t Vector2::distance_to(const Vector2 &p_vector2) const {
return Math::sqrt((x - p_vector2.x) * (x - p_vector2.x) + (y - p_vector2.y) * (y - p_vector2.y));
@@ -274,13 +278,23 @@ Vector2 Vector2::cubic_interpolate(const Vector2 &p_b, const Vector2 &p_pre_a, c
*/
}
-Vector2 Vector2::slide(const Vector2 &p_vec) const {
+// slide returns the component of the vector along the given plane, specified by its normal vector.
+Vector2 Vector2::slide(const Vector2 &p_n) const {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+#endif
+ return *this - p_n * this->dot(p_n);
+}
- return p_vec - *this * this->dot(p_vec);
+Vector2 Vector2::bounce(const Vector2 &p_n) const {
+ return -reflect(p_n);
}
-Vector2 Vector2::reflect(const Vector2 &p_vec) const {
- return p_vec - *this * this->dot(p_vec) * 2.0;
+Vector2 Vector2::reflect(const Vector2 &p_n) const {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector2());
+#endif
+ return 2.0 * p_n * this->dot(p_n) - *this;
}
bool Rect2::intersects_segment(const Point2 &p_from, const Point2 &p_to, Point2 *r_pos, Point2 *r_normal) const {
diff --git a/core/math/math_2d.h b/core/math/math_2d.h
index af6437d7f1..50ebcb845f 100644
--- a/core/math/math_2d.h
+++ b/core/math/math_2d.h
@@ -82,6 +82,7 @@ struct Vector2 {
void normalize();
Vector2 normalized() const;
+ bool is_normalized() const;
real_t length() const;
real_t length_squared() const;
@@ -106,6 +107,7 @@ struct Vector2 {
Vector2 cubic_interpolate_soft(const Vector2 &p_b, const Vector2 &p_pre_a, const Vector2 &p_post_b, real_t p_t) const;
Vector2 slide(const Vector2 &p_vec) const;
+ Vector2 bounce(const Vector2 &p_vec) const;
Vector2 reflect(const Vector2 &p_vec) const;
Vector2 operator+(const Vector2 &p_v) const;
diff --git a/core/math/vector3.h b/core/math/vector3.h
index 951380e898..8550ae7009 100644
--- a/core/math/vector3.h
+++ b/core/math/vector3.h
@@ -107,6 +107,7 @@ struct Vector3 {
_FORCE_INLINE_ real_t angle_to(const Vector3 &p_b) const;
_FORCE_INLINE_ Vector3 slide(const Vector3 &p_vec) const;
+ _FORCE_INLINE_ Vector3 bounce(const Vector3 &p_vec) const;
_FORCE_INLINE_ Vector3 reflect(const Vector3 &p_vec) const;
/* Operators */
@@ -400,14 +401,23 @@ void Vector3::zero() {
x = y = z = 0;
}
-Vector3 Vector3::slide(const Vector3 &p_vec) const {
-
- return p_vec - *this * this->dot(p_vec);
+// slide returns the component of the vector along the given plane, specified by its normal vector.
+Vector3 Vector3::slide(const Vector3 &p_n) const {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+#endif
+ return *this - p_n * this->dot(p_n);
}
-Vector3 Vector3::reflect(const Vector3 &p_vec) const {
+Vector3 Vector3::bounce(const Vector3 &p_n) const {
+ return -reflect(p_n);
+}
- return p_vec - *this * this->dot(p_vec) * 2.0;
+Vector3 Vector3::reflect(const Vector3 &p_n) const {
+#ifdef DEBUG_ENABLED
+ ERR_FAIL_COND_V(p_n.is_normalized() == false, Vector3());
+#endif
+ return 2.0 * p_n * this->dot(p_n) - *this;
}
#endif
diff --git a/core/os/os.h b/core/os/os.h
index 46e57e5186..0febfb70cf 100644
--- a/core/os/os.h
+++ b/core/os/os.h
@@ -177,6 +177,10 @@ public:
virtual void set_borderless_window(int p_borderless) {}
virtual bool get_borderless_window() { return 0; }
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle) { return ERR_UNAVAILABLE; };
+ virtual Error close_dynamic_library(void *p_library_handle) { return ERR_UNAVAILABLE; };
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) { return ERR_UNAVAILABLE; };
+
virtual void set_keep_screen_on(bool p_enabled);
virtual bool is_keep_screen_on() const;
virtual void set_low_processor_usage_mode(bool p_enabled);
diff --git a/core/script_language.h b/core/script_language.h
index 6c37074639..88584e4ef9 100644
--- a/core/script_language.h
+++ b/core/script_language.h
@@ -43,7 +43,7 @@ typedef void (*ScriptEditRequestFunction)(const String &p_path);
class ScriptServer {
enum {
- MAX_LANGUAGES = 4
+ MAX_LANGUAGES = 16
};
static ScriptLanguage *_languages[MAX_LANGUAGES];
diff --git a/core/variant_call.cpp b/core/variant_call.cpp
index 758500a873..9c435ea0e5 100644
--- a/core/variant_call.cpp
+++ b/core/variant_call.cpp
@@ -340,6 +340,7 @@ struct _VariantCall {
VCALL_LOCALMEM0R(Vector2, aspect);
VCALL_LOCALMEM1R(Vector2, dot);
VCALL_LOCALMEM1R(Vector2, slide);
+ VCALL_LOCALMEM1R(Vector2, bounce);
VCALL_LOCALMEM1R(Vector2, reflect);
VCALL_LOCALMEM0R(Vector2, angle);
//VCALL_LOCALMEM1R(Vector2,cross);
@@ -377,6 +378,7 @@ struct _VariantCall {
VCALL_LOCALMEM1R(Vector3, distance_squared_to);
VCALL_LOCALMEM1R(Vector3, angle_to);
VCALL_LOCALMEM1R(Vector3, slide);
+ VCALL_LOCALMEM1R(Vector3, bounce);
VCALL_LOCALMEM1R(Vector3, reflect);
VCALL_LOCALMEM0R(Plane, normalized);
@@ -1438,8 +1440,9 @@ void register_variant_methods() {
ADDFUNC1(VECTOR2, VECTOR2, Vector2, snapped, VECTOR2, "by", varray());
ADDFUNC0(VECTOR2, REAL, Vector2, aspect, varray());
ADDFUNC1(VECTOR2, REAL, Vector2, dot, VECTOR2, "with", varray());
- ADDFUNC1(VECTOR2, VECTOR2, Vector2, slide, VECTOR2, "vec", varray());
- ADDFUNC1(VECTOR2, VECTOR2, Vector2, reflect, VECTOR2, "vec", varray());
+ ADDFUNC1(VECTOR2, VECTOR2, Vector2, slide, VECTOR2, "n", varray());
+ ADDFUNC1(VECTOR2, VECTOR2, Vector2, bounce, VECTOR2, "n", varray());
+ ADDFUNC1(VECTOR2, VECTOR2, Vector2, reflect, VECTOR2, "n", varray());
//ADDFUNC1(VECTOR2,REAL,Vector2,cross,VECTOR2,"with",varray());
ADDFUNC0(VECTOR2, VECTOR2, Vector2, abs, varray());
ADDFUNC1(VECTOR2, VECTOR2, Vector2, clamped, REAL, "length", varray());
@@ -1475,8 +1478,9 @@ void register_variant_methods() {
ADDFUNC1(VECTOR3, REAL, Vector3, distance_to, VECTOR3, "b", varray());
ADDFUNC1(VECTOR3, REAL, Vector3, distance_squared_to, VECTOR3, "b", varray());
ADDFUNC1(VECTOR3, REAL, Vector3, angle_to, VECTOR3, "to", varray());
- ADDFUNC1(VECTOR3, VECTOR3, Vector3, slide, VECTOR3, "by", varray());
- ADDFUNC1(VECTOR3, VECTOR3, Vector3, reflect, VECTOR3, "by", varray());
+ ADDFUNC1(VECTOR3, VECTOR3, Vector3, slide, VECTOR3, "n", varray());
+ ADDFUNC1(VECTOR3, VECTOR3, Vector3, bounce, VECTOR3, "n", varray());
+ ADDFUNC1(VECTOR3, VECTOR3, Vector3, reflect, VECTOR3, "n", varray());
ADDFUNC0(PLANE, PLANE, Plane, normalized, varray());
ADDFUNC0(PLANE, VECTOR3, Plane, center, varray());
diff --git a/doc/base/classes.xml b/doc/base/classes.xml
index f3d73deaf0..5bb85aedc1 100644
--- a/doc/base/classes.xml
+++ b/doc/base/classes.xml
@@ -21836,6 +21836,8 @@
</argument>
<argument index="3" name="max_bounces" type="int" default="4">
</argument>
+ <argument index="4" name="floor_max_angle" type="float" default="0.785398">
+ </argument>
<description>
</description>
</method>
@@ -21846,6 +21848,7 @@
</argument>
<description>
Move the body to the given position. This is not a teleport, and the body will stop if there is an obstacle. The returned vector is how much movement was remaining before being stopped.
+ [code]floor_max_angle[/code] is in radians (default is pi/4), and filters which obstacles should be considered as floors/cellings instead of walls.
</description>
</method>
<method name="revert_motion">
@@ -46992,6 +46995,15 @@ do_property].
Returns the ratio of X to Y.
</description>
</method>
+ <method name="bounce">
+ <return type="Vector2">
+ </return>
+ <argument index="0" name="n" type="Vector2">
+ </argument>
+ <description>
+ Bounce returns the vector "bounced off" from the given plane, specified by its normal vector.
+ </description>
+ </method>
<method name="clamped">
<return type="Vector2">
</return>
@@ -47084,10 +47096,10 @@ do_property].
<method name="reflect">
<return type="Vector2">
</return>
- <argument index="0" name="vec" type="Vector2">
+ <argument index="0" name="n" type="Vector2">
</argument>
<description>
- Like "slide", but reflects the Vector instead of continuing along the wall.
+ Reflects the vector along the given plane, specified by its normal vector.
</description>
</method>
<method name="rotated">
@@ -47102,10 +47114,10 @@ do_property].
<method name="slide">
<return type="Vector2">
</return>
- <argument index="0" name="vec" type="Vector2">
+ <argument index="0" name="n" type="Vector2">
</argument>
<description>
- Slides the vector by the other vector.
+ Slide returns the component of the vector along the given plane, specified by its normal vector.
</description>
</method>
<method name="snapped">
@@ -47178,6 +47190,15 @@ do_property].
<description>
</description>
</method>
+ <method name="bounce">
+ <return type="Vector3">
+ </return>
+ <argument index="0" name="n" type="Vector3">
+ </argument>
+ <description>
+ Bounce returns the vector "bounced off" from the given plane, specified by its normal vector.
+ </description>
+ </method>
<method name="ceil">
<return type="Vector3">
</return>
@@ -47308,10 +47329,10 @@ do_property].
<method name="reflect">
<return type="Vector3">
</return>
- <argument index="0" name="by" type="Vector3">
+ <argument index="0" name="n" type="Vector3">
</argument>
<description>
- Like "slide", but reflects the Vector instead of continuing along the wall.
+ Reflects the vector along the given plane, specified by its normal vector.
</description>
</method>
<method name="rotated">
@@ -47328,10 +47349,10 @@ do_property].
<method name="slide">
<return type="Vector3">
</return>
- <argument index="0" name="by" type="Vector3">
+ <argument index="0" name="n" type="Vector3">
</argument>
<description>
- Slides the vector along a wall.
+ Slide returns the component of the vector along the given plane, specified by its normal vector.
</description>
</method>
<method name="snapped">
diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py
index 78f39fc7ec..1386e91ce1 100755
--- a/doc/tools/doc_status.py
+++ b/doc/tools/doc_status.py
@@ -206,7 +206,7 @@ class ClassStatus:
output['overall'] = (description_progress + items_progress).to_colored_string('{percent}%', '{pad_percent}{s}')
if self.name.startswith('Total'):
- output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/_classes.html')
+ output['url'] = color('url', 'http://docs.godotengine.org/en/latest/classes/')
if flags['s']:
output['comment'] = color('part_good', 'ALL OK')
else:
diff --git a/drivers/gles3/rasterizer_canvas_gles3.cpp b/drivers/gles3/rasterizer_canvas_gles3.cpp
index 26d13bad89..34a5858729 100644
--- a/drivers/gles3/rasterizer_canvas_gles3.cpp
+++ b/drivers/gles3/rasterizer_canvas_gles3.cpp
@@ -535,49 +535,49 @@ void RasterizerCanvasGLES3::_canvas_item_render_commands(Item *p_item, Item *cur
//top left
DSTRECT(np->rect.pos.x, np->rect.pos.y, np->margin[MARGIN_LEFT], np->margin[MARGIN_TOP]);
- SRCRECT(0, 0, np->margin[MARGIN_LEFT], np->margin[MARGIN_TOP]);
+ SRCRECT(np->source.pos.x, np->source.pos.y, np->margin[MARGIN_LEFT], np->margin[MARGIN_TOP]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//top right
- DSTRECT(np->rect.pos.x + np->rect.size.x - np->margin[MARGIN_RIGHT], np->rect.pos.y, np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
- SRCRECT(texture->width - np->margin[MARGIN_RIGHT], 0, np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
+ DSTRECT(np->rect.pos.x + np->rect.size.width - np->margin[MARGIN_RIGHT], np->rect.pos.y, np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
+ SRCRECT(np->source.pos.x + np->source.size.width - np->margin[MARGIN_RIGHT], np->source.pos.y, np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//bottom right
- DSTRECT(np->rect.pos.x + np->rect.size.x - np->margin[MARGIN_RIGHT], np->rect.pos.y + np->rect.size.y - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_RIGHT], np->margin[MARGIN_BOTTOM]);
- SRCRECT(texture->width - np->margin[MARGIN_RIGHT], texture->height - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_RIGHT], np->margin[MARGIN_BOTTOM]);
+ DSTRECT(np->rect.pos.x + np->rect.size.width - np->margin[MARGIN_RIGHT], np->rect.pos.y + np->rect.size.height - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_RIGHT], np->margin[MARGIN_BOTTOM]);
+ SRCRECT(np->source.pos.x + np->source.size.width - np->margin[MARGIN_RIGHT], np->source.pos.y + np->source.size.height - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_RIGHT], np->margin[MARGIN_BOTTOM]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//bottom left
- DSTRECT(np->rect.pos.x, np->rect.pos.y + np->rect.size.y - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_LEFT], np->margin[MARGIN_BOTTOM]);
- SRCRECT(0, texture->height - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_LEFT], np->margin[MARGIN_BOTTOM]);
+ DSTRECT(np->rect.pos.x, np->rect.pos.y + np->rect.size.height - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_LEFT], np->margin[MARGIN_BOTTOM]);
+ SRCRECT(np->source.pos.x, np->source.pos.y + np->source.size.height - np->margin[MARGIN_BOTTOM], np->margin[MARGIN_LEFT], np->margin[MARGIN_BOTTOM]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//top
DSTRECT(np->rect.pos.x + np->margin[MARGIN_LEFT], np->rect.pos.y, np->rect.size.width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
- SRCRECT(np->margin[MARGIN_LEFT], 0, texture->width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
+ SRCRECT(np->source.pos.x + np->margin[MARGIN_LEFT], np->source.pos.y, np->source.size.width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//bottom
- DSTRECT(np->rect.pos.x + np->margin[MARGIN_LEFT], np->rect.pos.y + np->rect.size.y - np->margin[MARGIN_BOTTOM], np->rect.size.width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
- SRCRECT(np->margin[MARGIN_LEFT], texture->height - np->margin[MARGIN_BOTTOM], texture->width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_LEFT], np->margin[MARGIN_TOP]);
+ DSTRECT(np->rect.pos.x + np->margin[MARGIN_LEFT], np->rect.pos.y + np->rect.size.height - np->margin[MARGIN_BOTTOM], np->rect.size.width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP]);
+ SRCRECT(np->source.pos.x + np->margin[MARGIN_LEFT], np->source.pos.y + np->source.size.height - np->margin[MARGIN_BOTTOM], np->source.size.width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_LEFT], np->margin[MARGIN_TOP]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//left
DSTRECT(np->rect.pos.x, np->rect.pos.y + np->margin[MARGIN_TOP], np->margin[MARGIN_LEFT], np->rect.size.height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
- SRCRECT(0, np->margin[MARGIN_TOP], np->margin[MARGIN_LEFT], texture->height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
+ SRCRECT(np->source.pos.x, np->source.pos.y + np->margin[MARGIN_TOP], np->margin[MARGIN_LEFT], np->source.size.height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
//right
DSTRECT(np->rect.pos.x + np->rect.size.width - np->margin[MARGIN_RIGHT], np->rect.pos.y + np->margin[MARGIN_TOP], np->margin[MARGIN_RIGHT], np->rect.size.height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
- SRCRECT(texture->width - np->margin[MARGIN_RIGHT], np->margin[MARGIN_TOP], np->margin[MARGIN_RIGHT], texture->height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
+ SRCRECT(np->source.pos.x + np->source.size.width - np->margin[MARGIN_RIGHT], np->source.pos.y + np->margin[MARGIN_TOP], np->margin[MARGIN_RIGHT], np->source.size.height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
if (np->draw_center) {
//center
DSTRECT(np->rect.pos.x + np->margin[MARGIN_LEFT], np->rect.pos.y + np->margin[MARGIN_TOP], np->rect.size.x - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->rect.size.height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
- SRCRECT(np->margin[MARGIN_LEFT], np->margin[MARGIN_TOP], texture->width - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], texture->height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
+ SRCRECT(np->source.pos.x + np->margin[MARGIN_LEFT], np->source.pos.y + np->margin[MARGIN_TOP], np->source.size.x - np->margin[MARGIN_LEFT] - np->margin[MARGIN_RIGHT], np->source.size.height - np->margin[MARGIN_TOP] - np->margin[MARGIN_BOTTOM]);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
}
diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp
index e2a544b676..6e0674d060 100644
--- a/drivers/unix/os_unix.cpp
+++ b/drivers/unix/os_unix.cpp
@@ -54,6 +54,7 @@
#endif
#include "global_config.h"
#include <assert.h>
+#include <dlfcn.h>
#include <errno.h>
#include <poll.h>
#include <signal.h>
@@ -435,6 +436,36 @@ String OS_Unix::get_locale() const {
return locale;
}
+Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle) {
+ p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW);
+ if (!p_library_handle) {
+ ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror());
+ ERR_FAIL_V(ERR_CANT_OPEN);
+ }
+ return OK;
+}
+
+Error OS_Unix::close_dynamic_library(void *p_library_handle) {
+ if (dlclose(p_library_handle)) {
+ return FAILED;
+ }
+ return OK;
+}
+
+Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) {
+ char *error;
+ dlerror(); // Clear existing errors
+
+ p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data());
+
+ error = dlerror();
+ if (error != NULL) {
+ ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + error);
+ ERR_FAIL_V(ERR_CANT_RESOLVE);
+ }
+ return OK;
+}
+
Error OS_Unix::set_cwd(const String &p_cwd) {
if (chdir(p_cwd.utf8().get_data()) != 0)
diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h
index 3ac4f46109..ff259ab0f0 100644
--- a/drivers/unix/os_unix.h
+++ b/drivers/unix/os_unix.h
@@ -82,6 +82,10 @@ public:
//virtual VideoMode get_video_mode() const;
//virtual void get_fullscreen_mode_list(List<VideoMode> *p_list) const;
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+ virtual Error close_dynamic_library(void *p_library_handle);
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle);
+
virtual Error set_cwd(const String &p_cwd);
virtual String get_name();
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 18c16af5af..5b5f500178 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -5681,7 +5681,7 @@ EditorNode::EditorNode() {
overridden_default_layout = -1;
default_layout.instance();
default_layout->set_value(docks_section, "dock_3", TTR("FileSystem"));
- default_layout->set_value(docks_section, "dock_5", TTR("Scene"));
+ default_layout->set_value(docks_section, "dock_5", TTR("Scene") + "," + TTR("Import"));
default_layout->set_value(docks_section, "dock_6", TTR("Inspector") + "," + TTR("Node"));
for (int i = 0; i < DOCK_SLOT_MAX / 2; i++)
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index fe1f984f39..3e0a2c712a 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1101,7 +1101,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(files->get_global_pos() + p_pos);
+ folder_options->set_pos(tree->get_global_pos() + p_pos);
folder_options->popup();
}
diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp
index cc26769939..f2a79a2f47 100644
--- a/editor/property_editor.cpp
+++ b/editor/property_editor.cpp
@@ -3846,8 +3846,8 @@ void PropertyEditor::_item_edited() {
} break;
case Variant::BOOL: {
- _edit_set(name, item->is_checked(1), refresh_all);
item->set_tooltip(1, item->is_checked(1) ? "True" : "False");
+ _edit_set(name, item->is_checked(1), refresh_all);
} break;
case Variant::INT:
case Variant::REAL: {
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index 3310405ae9..5f0bc8841b 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -1113,6 +1113,7 @@ SceneTreeEditor::SceneTreeEditor(bool p_label, bool p_can_rename, bool p_can_ope
tree->set_anchor(MARGIN_BOTTOM, ANCHOR_END);
tree->set_begin(Point2(0, p_label ? 18 : 0));
tree->set_end(Point2(0, 0));
+ tree->add_constant_override("button_margin", 0);
add_child(tree);
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 131e9e3b90..0a5d06c0d3 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -485,12 +485,27 @@ void InputDefault::warp_mouse_pos(const Vector2 &p_to) {
Point2i InputDefault::warp_mouse_motion(const InputEventMouseMotion &p_motion, const Rect2 &p_rect) {
- const Point2i rel_warped(Math::fmod(p_motion.relative_x, p_rect.size.x), Math::fmod(p_motion.relative_y, p_rect.size.y));
+ // The relative distance reported for the next event after a warp is in the boundaries of the
+ // size of the rect on that axis, but it may be greater, in which case there's not problem as fmod()
+ // will warp it, but if the pointer has moved in the opposite direction between the pointer relocation
+ // and the subsequent event, the reported relative distance will be less than the size of the rect
+ // and thus fmod() will be disabled for handling the situation.
+ // And due to this mouse warping mechanism being stateless, we need to apply some heuristics to
+ // detect the warp: if the relative distance is greater than the half of the size of the relevant rect
+ // (checked per each axis), it will be considered as the consequence of a former pointer warp.
+
+ const Point2i rel_sgn(p_motion.relative_x >= 0.0f ? 1 : -1, p_motion.relative_y >= 0.0 ? 1 : -1);
+ const Size2i warp_margin = p_rect.size * 0.5f;
+ const Point2i rel_warped(
+ Math::fmod(p_motion.relative_x + rel_sgn.x * warp_margin.x, p_rect.size.x) - rel_sgn.x * warp_margin.x,
+ Math::fmod(p_motion.relative_y + rel_sgn.y * warp_margin.y, p_rect.size.y) - rel_sgn.y * warp_margin.y);
+
const Point2i pos_local = Point2i(p_motion.global_x, p_motion.global_y) - p_rect.pos;
const Point2i pos_warped(Math::fposmod(pos_local.x, p_rect.size.x), Math::fposmod(pos_local.y, p_rect.size.y));
if (pos_warped != pos_local) {
OS::get_singleton()->warp_mouse_pos(pos_warped + p_rect.pos);
}
+
return rel_warped;
}
diff --git a/modules/cscript/SCsub b/modules/cscript/SCsub
deleted file mode 100644
index 0882406761..0000000000
--- a/modules/cscript/SCsub
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/env python
-
-Import('env')
-
-env.add_source_files(env.modules_sources, "*.cpp")
-
-Export('env')
diff --git a/modules/cscript/godot_c.cpp b/modules/cscript/godot_c.cpp
deleted file mode 100644
index f754f2bb21..0000000000
--- a/modules/cscript/godot_c.cpp
+++ /dev/null
@@ -1,29 +0,0 @@
-/*************************************************************************/
-/* godot_c.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* */
-/* 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_c.h"
diff --git a/modules/cscript/godot_c.h b/modules/cscript/godot_c.h
deleted file mode 100644
index 58acbf8bf9..0000000000
--- a/modules/cscript/godot_c.h
+++ /dev/null
@@ -1,567 +0,0 @@
-/*************************************************************************/
-/* godot_c.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* */
-/* 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_C_H
-#define GODOT_C_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(GDAPI_BUILT_IN) || !defined(WINDOWS_ENABLED)
-#define GDAPI
-#elif defined(GDAPI_EXPORTS)
-#define GDAPI __declspec(dllexport)
-#else
-#define GDAPI __declspec(dllimport)
-#endif
-
-#define GODOT_API_VERSION 1
-
-typedef int godot_bool;
-
-#define GODOT_FALSE 0
-#define GODOT_TRUE 1
-
-////// Image
-
-#define GODOT_IMAGE_FORMAT_GRAYSCALE 0
-#define GODOT_IMAGE_FORMAT_INTENSITY 1
-#define GODOT_IMAGE_FORMAT_GRAYSCALE_ALPHA 2
-#define GODOT_IMAGE_FORMAT_RGB 3
-#define GODOT_IMAGE_FORMAT_RGBA 4
-#define GODOT_IMAGE_FORMAT_INDEXED 5
-#define GODOT_IMAGE_FORMAT_INDEXED_ALPHA 6
-#define GODOT_IMAGE_FORMAT_YUV_422 7
-#define GODOT_IMAGE_FORMAT_YUV_444 8
-#define GODOT_IMAGE_FORMAT_BC1 9
-#define GODOT_IMAGE_FORMAT_BC2 10
-#define GODOT_IMAGE_FORMAT_BC3 11
-#define GODOT_IMAGE_FORMAT_BC4 12
-#define GODOT_IMAGE_FORMAT_BC5 13
-#define GODOT_IMAGE_FORMAT_PVRTC2 14
-#define GODOT_IMAGE_FORMAT_PVRTC2_ALPHA 15
-#define GODOT_IMAGE_FORMAT_PVRTC4 16
-#define GODOT_IMAGE_FORMAT_PVRTC4_ALPHA 17
-#define GODOT_IMAGE_FORMAT_ETC 18
-#define GODOT_IMAGE_FORMAT_ATC 19
-#define GODOT_IMAGE_FORMAT_ATC_ALPHA_EXPLICIT 20
-#define GODOT_IMAGE_FORMAT_ATC_ALPHA_INTERPOLATED 21
-
-typedef void *godot_image;
-
-godot_image GDAPI godot_image_create_empty();
-godot_image GDAPI godot_image_create(int p_width, int p_height, int p_format, int p_use_mipmaps);
-godot_image GDAPI godot_image_create_with_data(int p_width, int p_height, int p_format, int p_use_mipmaps, unsigned char *p_buffer);
-int GDAPI godot_image_get_width(godot_image p_image);
-int GDAPI godot_image_get_height(godot_image p_image);
-int GDAPI godot_image_get_format(godot_image p_image);
-int GDAPI godot_image_get_mipmap_count(godot_image p_image);
-godot_image GDAPI godot_image_copy(godot_image p_image);
-void GDAPI godot_image_free(godot_image p_image);
-
-////// RID
-
-typedef void *godot_rid;
-
-godot_rid GDAPI godot_rid_create();
-godot_rid GDAPI godot_rid_copy(godot_rid p_rid);
-void GDAPI godot_rid_free(godot_rid p_rid);
-
-////// Variant (forward declared)
-
-typedef void *godot_variant;
-
-////// Dictionary
-
-typedef void *godot_dictionary;
-
-godot_dictionary GDAPI godot_dictionary_create();
-void GDAPI godot_dictionary_has(godot_dictionary p_dictionary, godot_variant p_key);
-godot_variant GDAPI godot_dictionary_get(godot_dictionary p_dictionary, godot_variant p_key);
-void GDAPI godot_dictionary_insert(godot_dictionary p_dictionary, godot_variant p_key, godot_variant p_value);
-void GDAPI godot_dictionary_remove(godot_dictionary p_dictionary, godot_variant p_key);
-void GDAPI godot_dictionary_clear(godot_dictionary p_dictionary);
-int GDAPI godot_dictionary_get_size(godot_dictionary p_dictionary);
-void GDAPI godot_dictionary_get_keys(godot_dictionary p_dictionary, godot_variant *p_keys);
-godot_dictionary GDAPI godot_dictionary_copy(godot_dictionary p_dictionary);
-void GDAPI godot_dictionary_free(godot_dictionary p_dictionary);
-
-////// Array
-
-typedef void *godot_array;
-
-godot_array GDAPI godot_array_create();
-godot_variant GDAPI godot_array_get(godot_array p_array, int p_index);
-void GDAPI godot_array_set(godot_array p_array, int p_index, godot_variant p_value);
-void GDAPI godot_array_resize(godot_array p_array, int p_size);
-void GDAPI godot_array_insert(godot_array p_array, int p_position, godot_variant p_value);
-void GDAPI godot_array_remove(godot_array p_array, int p_position);
-void GDAPI godot_array_clear(godot_array p_array);
-int GDAPI godot_array_get_size(godot_array p_array);
-int GDAPI godot_array_find(godot_array p_array, godot_variant p_value, int p_from_pos = -1);
-godot_array GDAPI godot_array_copy(godot_array p_array);
-void GDAPI godot_array_free(godot_array p_array);
-
-////// InputEvent
-
-#define INPUT_EVENT_BUTTON_LEFT 1
-#define INPUT_EVENT_BUTTON_RIGHT 2
-#define INPUT_EVENT_BUTTON_MIDDLE 3
-#define INPUT_EVENT_BUTTON_WHEEL_UP 4
-#define INPUT_EVENT_BUTTON_WHEEL_DOWN 5
-#define INPUT_EVENT_BUTTON_WHEEL_LEFT 6
-#define INPUT_EVENT_BUTTON_WHEEL_RIGHT 7
-#define INPUT_EVENT_BUTTON_MASK_LEFT (1 << (INPUT_EVENT_BUTTON_LEFT - 1))
-#define INPUT_EVENT_BUTTON_MASK_RIGHT (1 << (INPUT_EVENT_BUTTON_RIGHT - 1))
-#define INPUT_EVENT_BUTTON_MASK_MIDDLE (1 << (INPUT_EVENT_BUTTON_MIDDLE - 1))
-
-#define INPUT_EVENT_TYPE_NONE 0
-#define INPUT_EVENT_TYPE_KEY 1
-#define INPUT_EVENT_TYPE_MOUSE_MOTION 2
-#define INPUT_EVENT_TYPE_MOUSE_BUTTON 3
-#define INPUT_EVENT_TYPE_JOYPAD_MOTION 4
-#define INPUT_EVENT_TYPE_JOYPAD_BUTTON 5
-#define INPUT_EVENT_TYPE_SCREEN_TOUCH 6
-#define INPUT_EVENT_TYPE_SCREEN_DRAG 7
-#define INPUT_EVENT_TYPE_ACTION 8
-
-typedef void *godot_input_event;
-
-godot_input_event GDAPI godot_input_event_create();
-godot_input_event GDAPI godot_input_event_copy(godot_input_event p_input_event);
-void GDAPI godot_input_event_free(godot_input_event p_input_event);
-
-int GDAPI godot_input_event_get_type(godot_input_event p_event);
-int GDAPI godot_input_event_get_device(godot_input_event p_event);
-
-godot_bool GDAPI godot_input_event_mod_has_alt(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_ctrl(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_command(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_shift(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mod_has_meta(godot_input_event p_event);
-
-int GDAPI godot_input_event_key_get_scancode(godot_input_event p_event);
-int GDAPI godot_input_event_key_get_unicode(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_key_is_pressed(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_key_is_echo(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_get_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_y(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_global_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_global_y(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_get_button_mask(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mouse_button_is_pressed(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_mouse_button_is_doubleclick(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_motion_get_relative_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_motion_get_relative_y(godot_input_event p_event);
-
-int GDAPI godot_input_event_mouse_motion_get_speed_x(godot_input_event p_event);
-int GDAPI godot_input_event_mouse_motion_get_speed_y(godot_input_event p_event);
-
-int GDAPI godot_input_event_joypad_motion_get_axis(godot_input_event p_event);
-float GDAPI godot_input_event_joypad_motion_get_axis_value(godot_input_event p_event);
-
-int GDAPI godot_input_event_joypad_button_get_button_index(godot_input_event p_event);
-godot_bool GDAPI godot_input_event_joypad_button_is_pressed(godot_input_event p_event);
-float GDAPI godot_input_event_joypad_button_get_pressure(godot_input_event p_event);
-
-int GDAPI godot_input_event_screen_touch_get_index(godot_input_event p_event);
-int GDAPI godot_input_event_screen_touch_get_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_touch_get_y(godot_input_event p_event);
-int GDAPI godot_input_event_screen_touch_is_pressed(godot_input_event p_event);
-
-int GDAPI godot_input_event_screen_drag_get_index(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_y(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_relative_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_relative_y(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_speed_x(godot_input_event p_event);
-int GDAPI godot_input_event_screen_drag_get_speed_y(godot_input_event p_event);
-
-int GDAPI godot_input_event_is_action(godot_input_event p_event, char *p_action);
-int GDAPI godot_input_event_is_action_pressed(godot_input_event p_event, char *p_action);
-
-////// ByteArray
-
-typedef void *godot_byte_array;
-
-godot_byte_array GDAPI godot_byte_array_create();
-godot_byte_array GDAPI godot_byte_array_copy(godot_byte_array p_byte_array);
-void GDAPI godot_byte_array_free(godot_byte_array p_byte_array);
-
-int GDAPI godot_byte_array_get_size(godot_byte_array p_byte_array);
-unsigned char GDAPI godot_byte_array_get(godot_byte_array p_byte_array, int p_index);
-void GDAPI godot_byte_array_set(godot_byte_array p_byte_array, int p_index, unsigned char p_value);
-void GDAPI godot_byte_array_remove(godot_byte_array p_byte_array, int p_index);
-void GDAPI godot_byte_array_clear(godot_byte_array p_byte_array);
-
-typedef void *godot_byte_array_lock;
-
-godot_byte_array_lock GDAPI godot_byte_array_get_lock(godot_byte_array p_byte_array);
-unsigned char GDAPI *godot_byte_array_lock_get_pointer(godot_byte_array_lock p_byte_array_lock);
-void GDAPI godot_byte_array_lock_free(godot_byte_array_lock p_byte_array_lock);
-
-godot_image GDAPI godot_image_create_with_array(int p_width, int p_height, int p_format, int p_use_mipmaps, godot_array p_array);
-godot_byte_array GDAPI godot_image_get_data(godot_image p_image);
-
-////// IntArray
-
-typedef void *godot_int_array;
-
-godot_int_array GDAPI godot_int_array_create();
-godot_int_array GDAPI godot_int_array_copy(godot_int_array p_int_array);
-void GDAPI godot_int_array_free(godot_int_array p_int_array);
-
-int GDAPI godot_int_array_get_size(godot_int_array p_int_array);
-int GDAPI godot_int_array_get(godot_int_array p_int_array, int p_index);
-void GDAPI godot_int_array_set(godot_int_array p_int_array, int p_index, int p_value);
-void GDAPI godot_int_array_remove(godot_int_array p_int_array, int p_index);
-void GDAPI godot_int_array_clear(godot_int_array p_int_array);
-
-typedef void *godot_int_array_lock;
-
-godot_int_array_lock GDAPI godot_int_array_get_lock(godot_int_array p_int_array);
-int GDAPI *godot_int_array_lock_get_pointer(godot_int_array_lock p_int_array_lock);
-void GDAPI godot_int_array_lock_free(godot_int_array_lock p_int_array_lock);
-
-////// RealArray
-
-typedef void *godot_real_array;
-
-godot_real_array GDAPI godot_real_array_create();
-godot_real_array GDAPI godot_real_array_copy(godot_real_array p_real_array);
-void GDAPI godot_real_array_free(godot_real_array p_real_array);
-
-int GDAPI godot_real_array_get_size(godot_real_array p_real_array);
-float GDAPI godot_real_array_get(godot_real_array p_real_array, int p_index);
-void GDAPI godot_real_array_set(godot_real_array p_real_array, int p_index, float p_value);
-void GDAPI godot_real_array_remove(godot_real_array p_real_array, int p_index);
-void GDAPI godot_real_array_clear(godot_real_array p_real_array);
-
-typedef void *godot_real_array_lock;
-
-godot_real_array_lock GDAPI godot_real_array_get_lock(godot_real_array p_real_array);
-float GDAPI *godot_real_array_lock_get_pointer(godot_real_array_lock p_real_array_lock);
-void GDAPI godot_real_array_lock_free(godot_real_array_lock p_real_array_lock);
-
-////// StringArray
-
-typedef void *godot_string_array;
-
-godot_string_array GDAPI godot_string_array_create();
-godot_string_array GDAPI godot_string_array_copy(godot_string_array p_string_array);
-void GDAPI godot_string_array_free(godot_string_array p_string_array);
-
-int GDAPI godot_string_array_get_size(godot_string_array p_string_array);
-int GDAPI godot_string_array_get(godot_string_array p_string_array, int p_index, unsigned char *p_string, int p_max_len);
-void GDAPI godot_string_array_set(godot_string_array p_string_array, int p_index, unsigned char *p_string);
-void GDAPI godot_string_array_remove(godot_string_array p_string_array, int p_index);
-void GDAPI godot_string_array_clear(godot_string_array p_string_array);
-
-////// Vector2Array
-
-typedef void *godot_vector2_array;
-
-godot_vector2_array GDAPI godot_vector2_array_create();
-godot_vector2_array GDAPI godot_vector2_array_copy(godot_vector2_array p_vector2_array);
-void GDAPI godot_vector2_array_free(godot_vector2_array p_vector2_array);
-
-int GDAPI godot_vector2_array_get_size(godot_vector2_array p_vector2_array);
-int GDAPI godot_vector2_array_get_stride(godot_vector2_array p_vector2_array);
-void GDAPI godot_vector2_array_get(godot_vector2_array p_vector2_array, int p_index, float *p_vector2);
-void GDAPI godot_vector2_array_set(godot_vector2_array p_vector2_array, int p_index, float *p_vector2);
-void GDAPI godot_vector2_array_remove(godot_vector2_array p_vector2_array, int p_index);
-void GDAPI godot_vector2_array_clear(godot_vector2_array p_vector2_array);
-
-typedef void *godot_vector2_array_lock;
-
-godot_vector2_array_lock GDAPI godot_vector2_array_get_lock(godot_vector2_array p_vector2_array);
-float GDAPI *godot_vector2_array_lock_get_pointer(godot_vector2_array_lock p_vector2_array_lock);
-void GDAPI godot_vector2_array_lock_free(godot_vector2_array_lock p_vector2_array_lock);
-
-////// Vector3Array
-
-typedef void *godot_vector3_array;
-
-godot_vector3_array GDAPI godot_vector3_array_create();
-godot_vector3_array GDAPI godot_vector3_array_copy(godot_vector3_array p_vector3_array);
-void GDAPI godot_vector3_array_free(godot_vector3_array p_vector3_array);
-
-int GDAPI godot_vector3_array_get_size(godot_vector3_array p_vector3_array);
-int GDAPI godot_vector3_array_get_stride(godot_vector3_array p_vector3_array);
-void GDAPI godot_vector3_array_get(godot_vector3_array p_vector3_array, int p_index, float *p_vector3);
-void GDAPI godot_vector3_array_set(godot_vector3_array p_vector3_array, int p_index, float *p_vector3);
-void GDAPI godot_vector3_array_remove(godot_vector3_array p_vector3_array, int p_index);
-void GDAPI godot_vector3_array_clear(godot_vector3_array p_vector3_array);
-
-typedef void *godot_vector3_array_lock;
-
-godot_vector3_array_lock GDAPI godot_vector3_array_get_lock(godot_vector3_array p_vector3_array);
-float GDAPI *godot_vector3_array_lock_get_pointer(godot_vector3_array_lock p_vector3_array_lock);
-void GDAPI godot_vector3_array_lock_free(godot_vector3_array_lock p_vector3_array_lock);
-
-////// ColorArray
-
-typedef void *godot_color_array;
-
-godot_color_array GDAPI godot_color_array_create();
-godot_color_array GDAPI godot_color_array_copy(godot_color_array p_color_array);
-void GDAPI godot_color_array_free(godot_color_array p_color_array);
-
-int GDAPI godot_color_array_get_size(godot_color_array p_color_array);
-int GDAPI godot_color_array_get_stride(godot_color_array p_color_array);
-void GDAPI godot_color_array_get(godot_color_array p_color_array, int p_index, float *p_color);
-void GDAPI godot_color_array_set(godot_color_array p_color_array, int p_index, float *p_color);
-void GDAPI godot_color_array_remove(godot_color_array p_color_array, int p_index);
-void GDAPI godot_color_array_clear(godot_color_array p_color_array);
-
-typedef void *godot_color_array_lock;
-
-godot_color_array_lock GDAPI godot_color_array_get_lock(godot_color_array p_color_array);
-float GDAPI *godot_color_array_lock_get_pointer(godot_color_array_lock p_color_array_lock);
-void GDAPI godot_color_array_lock_free(godot_color_array_lock p_color_array_lock);
-
-////// Instance (forward declared)
-
-typedef void *godot_instance;
-
-////// Variant
-
-#define GODOT_VARIANT_NIL 0
-#define GODOT_VARIANT_BOOL 1
-#define GODOT_VARIANT_INT 2
-#define GODOT_VARIANT_REAL 3
-#define GODOT_VARIANT_STRING 4
-#define GODOT_VARIANT_VECTOR2 5
-#define GODOT_VARIANT_RECT2 6
-#define GODOT_VARIANT_VECTOR3 7
-#define GODOT_VARIANT_MATRIX32 8
-#define GODOT_VARIANT_PLANE 9
-#define GODOT_VARIANT_QUAT 10
-#define GODOT_VARIANT_AABB 11
-#define GODOT_VARIANT_MATRIX3 12
-#define GODOT_VARIANT_TRANSFORM 13
-#define GODOT_VARIANT_COLOR 14
-#define GODOT_VARIANT_IMAGE 15
-#define GODOT_VARIANT_NODE_PATH 16
-#define GODOT_VARIANT_RID 17
-#define GODOT_VARIANT_OBJECT 18
-#define GODOT_VARIANT_INPUT_EVENT 19
-#define GODOT_VARIANT_DICTIONARY 20
-#define GODOT_VARIANT_ARRAY 21
-#define GODOT_VARIANT_BYTE_ARRAY 22
-#define GODOT_VARIANT_INT_ARRAY 23
-#define GODOT_VARIANT_REAL_ARRAY 24
-#define GODOT_VARIANT_STRING_ARRAY 25
-#define GODOT_VARIANT_VECTOR2_ARRAY 26
-#define GODOT_VARIANT_VECTOR3_ARRAY 27
-#define GODOT_VARIANT_COLOR_ARRAY 28
-#define GODOT_VARIANT_MAX 29
-
-godot_variant *godot_variant_new();
-
-int GDAPI godot_variant_get_type(godot_variant p_variant);
-
-void GDAPI godot_variant_set_null(godot_variant p_variant);
-void GDAPI godot_variant_set_bool(godot_variant p_variant, godot_bool p_bool);
-void GDAPI godot_variant_set_int(godot_variant p_variant, int p_int);
-void GDAPI godot_variant_set_float(godot_variant p_variant, int p_float);
-void GDAPI godot_variant_set_string(godot_variant p_variant, char *p_string);
-void GDAPI godot_variant_set_vector2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_rect2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_vector3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_matrix32(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_plane(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_aabb(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_matrix3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_transform(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_color(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_set_image(godot_variant p_variant, godot_image *p_image);
-void GDAPI godot_variant_set_node_path(godot_variant p_variant, char *p_path);
-void GDAPI godot_variant_set_rid(godot_variant p_variant, char *p_path);
-void GDAPI godot_variant_set_instance(godot_variant p_variant, godot_instance p_instance);
-void GDAPI godot_variant_set_input_event(godot_variant p_variant, godot_input_event p_instance);
-void GDAPI godot_variant_set_dictionary(godot_variant p_variant, godot_dictionary p_dictionary);
-void GDAPI godot_variant_set_array(godot_variant p_variant, godot_array p_array);
-void GDAPI godot_variant_set_byte_array(godot_variant p_variant, godot_byte_array p_array);
-void GDAPI godot_variant_set_int_array(godot_variant p_variant, godot_byte_array p_array);
-void GDAPI godot_variant_set_string_array(godot_variant p_variant, godot_string_array p_array);
-void GDAPI godot_variant_set_vector2_array(godot_variant p_variant, godot_vector2_array p_array);
-void GDAPI godot_variant_set_vector3_array(godot_variant p_variant, godot_vector3_array p_array);
-void GDAPI godot_variant_set_color_array(godot_variant p_variant, godot_color_array p_array);
-
-godot_bool GDAPI godot_variant_get_bool(godot_variant p_variant);
-int GDAPI godot_variant_get_int(godot_variant p_variant);
-float GDAPI godot_variant_get_float(godot_variant p_variant);
-int GDAPI godot_variant_get_string(godot_variant p_variant, char *p_string, int p_bufsize);
-void GDAPI godot_variant_get_vector2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_rect2(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_vector3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_matrix32(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_plane(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_aabb(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_matrix3(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_transform(godot_variant p_variant, float *p_elems);
-void GDAPI godot_variant_get_color(godot_variant p_variant, float *p_elems);
-godot_image GDAPI *godot_variant_get_image(godot_variant p_variant);
-int GDAPI godot_variant_get_node_path(godot_variant p_variant, char *p_path, int p_bufsize);
-godot_rid GDAPI godot_variant_get_rid(godot_variant p_variant);
-godot_instance GDAPI godot_variant_get_instance(godot_variant p_variant);
-void GDAPI godot_variant_get_input_event(godot_variant p_variant, godot_input_event);
-void GDAPI godot_variant_get_dictionary(godot_variant p_variant, godot_dictionary);
-godot_array GDAPI godot_variant_get_array(godot_variant p_variant);
-godot_byte_array GDAPI godot_variant_get_byte_array(godot_variant p_variant);
-godot_byte_array GDAPI godot_variant_get_int_array(godot_variant p_variant);
-godot_string_array GDAPI godot_variant_get_string_array(godot_variant p_variant);
-godot_vector2_array GDAPI godot_variant_get_vector2_array(godot_variant p_variant);
-godot_vector3_array GDAPI godot_variant_get_vector3_array(godot_variant p_variant);
-godot_color_array GDAPI godot_variant_get_color_array(godot_variant p_variant);
-
-void GDAPI godot_variant_delete(godot_variant p_variant);
-
-////// Class
-///
-
-char GDAPI **godot_class_get_list(); //get list of classes in array to array of strings, must be freed, use godot_list_free()
-
-int GDAPI godot_class_get_base(char *p_class, char *p_base, int p_max_len);
-int GDAPI godot_class_get_name(char *p_class, char *p_base, int p_max_len);
-
-char GDAPI **godot_class_get_method_list(char *p_class); //free with godot_list_free()
-int GDAPI godot_class_method_get_argument_count(char *p_class, char *p_method);
-int GDAPI godot_class_method_get_argument_type(char *p_class, char *p_method, int p_argument);
-godot_variant GDAPI godot_class_method_get_argument_default_value(char *p_class, char *p_method, int p_argument);
-
-char GDAPI **godot_class_get_constant_list(char *p_class); //free with godot_list_free()
-int GDAPI godot_class_constant_get_value(char *p_class, char *p_constant);
-
-////// Instance
-
-typedef int godot_call_error;
-
-#define GODOT_CALL_OK
-#define GODOT_CALL_ERROR_WRONG_ARGUMENTS
-#define GODOT_CALL_ERROR_INVALID_INSTANCE
-
-godot_instance GDAPI godot_instance_new(char *p_class);
-int GDAPI godot_instance_get_class(godot_instance p_instance, char *p_class, int p_max_len);
-
-typedef struct {
- char *name;
- int hint;
- char *hint_string;
- int usage;
-} godot_property_info;
-
-godot_call_error GDAPI godot_instance_call(godot_instance p_instance, char *p_method, ...);
-godot_call_error GDAPI godot_instance_call_ret(godot_instance p_instance, godot_variant r_return, char *p_method, ...);
-godot_bool GDAPI godot_instance_set(godot_instance p_instance, char *p_prop, godot_variant p_value);
-godot_variant GDAPI godot_instance_get(godot_instance p_instance, char *p_prop);
-
-#define GODOT_PROPERTY_HINT_NONE 0 ///< no hint provided.
-#define GODOT_PROPERTY_HINT_RANGE 1 ///< hint_text = "min,max,step,slider; //slider is optional"
-#define GODOT_PROPERTY_HINT_EXP_RANGE 2 ///< hint_text = "min,max,step", exponential edit
-#define GODOT_PROPERTY_HINT_ENUM 3 ///< hint_text= "val1,val2,val3,etc"
-#define GODOT_PROPERTY_HINT_EXP_EASING 4 /// exponential easing function (Math::ease)
-#define GODOT_PROPERTY_HINT_LENGTH 5 ///< hint_text= "length" (as integer)
-#define GODOT_PROPERTY_HINT_SPRITE_FRAME 6
-#define GODOT_PROPERTY_HINT_KEY_ACCEL 7 ///< hint_text= "length" (as integer)
-#define GODOT_PROPERTY_HINT_FLAGS 8 ///< hint_text= "flag1,flag2,etc" (as bit flags)
-#define GODOT_PROPERTY_HINT_ALL_FLAGS 9
-#define GODOT_PROPERTY_HINT_FILE 10 ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
-#define GODOT_PROPERTY_HINT_DIR 11 ///< a directort path must be passed
-#define GODOT_PROPERTY_HINT_GLOBAL_FILE 12 ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
-#define GODOT_PROPERTY_HINT_GLOBAL_DIR 13 ///< a directort path must be passed
-#define GODOT_PROPERTY_HINT_RESOURCE_TYPE 14 ///< a resource object type
-#define GODOT_PROPERTY_HINT_MULTILINE_TEXT 15 ///< used for string properties that can contain multiple lines
-#define GODOT_PROPERTY_HINT_COLOR_NO_ALPHA 16 ///< used for ignoring alpha component when editing a color
-#define GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY 17
-#define GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS 18
-#define GODOT_PROPERTY_HINT_OBJECT_ID 19
-
-#define GODOT_PROPERTY_USAGE_STORAGE 1
-#define GODOT_PROPERTY_USAGE_EDITOR 2
-#define GODOT_PROPERTY_USAGE_NETWORK 4
-#define GODOT_PROPERTY_USAGE_EDITOR_HELPER 8
-#define GODOT_PROPERTY_USAGE_CHECKABLE 16 //used for editing global variables
-#define GODOT_PROPERTY_USAGE_CHECKED 32 //used for editing global variables
-#define GODOT_PROPERTY_USAGE_INTERNATIONALIZED 64 //hint for internationalized strings
-#define GODOT_PROPERTY_USAGE_BUNDLE 128 //used for optimized bundles
-#define GODOT_PROPERTY_USAGE_CATEGORY 256
-#define GODOT_PROPERTY_USAGE_STORE_IF_NONZERO 512 //only store if nonzero
-#define GODOT_PROPERTY_USAGE_STORE_IF_NONONE 1024 //only store if false
-#define GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE 2048
-#define GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED 4096
-#define GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE 8192
-#define GODOT_PROPERTY_USAGE_STORE_IF_NULL 16384
-#define GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER 32768
-
-#define GODOT_PROPERTY_USAGE_DEFAULT GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK
-#define GODOT_PROPERTY_USAGE_DEFAULT_INTL GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED
-#define GODOT_PROPERTY_USAGE_NOEDITOR GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK
-
-godot_property_info GDAPI **godot_instance_get_property_list(godot_instance p_instance);
-void GDAPI godot_instance_free_property_list(godot_instance p_instance, godot_property_info **p_list);
-
-void GDAPI godot_list_free(char **p_name); //helper to free all the class list
-
-////// Script API
-
-typedef void *(godot_script_instance_func)(godot_instance); //passed an instance, return a pointer to your userdata
-typedef void(godot_script_free_func)(godot_instance, void *); //passed an instance, please free your userdata
-
-void GDAPI godot_script_register(char *p_base, char *p_name, godot_script_instance_func p_instance_func, godot_script_free_func p_free_func);
-void GDAPI godot_script_unregister(char *p_name);
-
-typedef GDAPI godot_variant(godot_script_func)(godot_instance, void *, godot_variant *, int); //instance,userdata,arguments,argument count. Return something or NULL. Arguments must not be freed.
-
-void GDAPI godot_script_add_function(char *p_name, char *p_function_name, godot_script_func p_func);
-void GDAPI godot_script_add_validated_function(char *p_name, char *p_function_name, godot_script_func p_func, int *p_arg_types, int p_arg_count, godot_variant *p_default_args, int p_default_arg_count);
-
-typedef void(godot_set_property_func)(godot_instance, void *, godot_variant); //instance,userdata,value. Value must not be freed.
-typedef godot_variant(godot_get_property_func)(godot_instance, void *); //instance,userdata. Return a value or NULL.
-
-void GDAPI godot_script_add_property(char *p_name, char *p_path, godot_set_property_func p_set_func, godot_get_property_func p_get_func);
-void GDAPI godot_script_add_listed_property(char *p_name, char *p_path, godot_set_property_func p_set_func, godot_get_property_func p_get_func, int p_type, int p_hint, char *p_hint_string, int p_usage);
-
-////// System Functions
-
-//using these will help Godot track how much memory is in use in debug mode
-void GDAPI *godot_alloc(int p_bytes);
-void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
-void GDAPI godot_free(void *p_ptr);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_C_H
diff --git a/modules/dlscript/SCsub b/modules/dlscript/SCsub
new file mode 100644
index 0000000000..ac13319a1d
--- /dev/null
+++ b/modules/dlscript/SCsub
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+
+Import('env')
+
+env.add_source_files(env.modules_sources, "*.cpp")
+env.add_source_files(env.modules_sources, "godot/*.cpp")
+
+env.Append(CPPFLAGS=['-DGDAPI_BUILT_IN'])
+
+if "platform" in env and env["platform"] == "x11": # there has to be a better solution?
+ env.Append(LINKFLAGS=["-rdynamic"])
+env.use_ptrcall = True
+
+Export('env')
diff --git a/modules/dlscript/api_generator.cpp b/modules/dlscript/api_generator.cpp
new file mode 100644
index 0000000000..c5c5cb46e6
--- /dev/null
+++ b/modules/dlscript/api_generator.cpp
@@ -0,0 +1,391 @@
+#include "api_generator.h"
+
+#ifdef TOOLS_ENABLED
+
+#include "class_db.h"
+#include "core/global_config.h"
+#include "os/file_access.h"
+
+// helper stuff
+
+static Error save_file(const String &p_path, const List<String> &p_content) {
+
+ FileAccessRef file = FileAccess::open(p_path, FileAccess::WRITE);
+
+ ERR_FAIL_COND_V(!file, ERR_FILE_CANT_WRITE);
+
+ for (const List<String>::Element *e = p_content.front(); e != NULL; e = e->next()) {
+ file->store_string(e->get());
+ }
+
+ file->close();
+
+ return OK;
+}
+
+// helper stuff end
+
+struct MethodAPI {
+ String method_name;
+ String return_type;
+
+ List<String> argument_types;
+ List<String> argument_names;
+
+ Map<int, Variant> default_arguments;
+
+ int argument_count;
+ bool has_varargs;
+ bool is_editor;
+ bool is_noscript;
+ bool is_const;
+ bool is_reverse;
+ bool is_virtual;
+ bool is_from_script;
+};
+
+struct PropertyAPI {
+ String name;
+ String getter;
+ String setter;
+ String type;
+};
+
+struct ConstantAPI {
+ String constant_name;
+ int constant_value;
+};
+
+struct SignalAPI {
+ String name;
+ List<String> argument_types;
+ List<String> argument_names;
+ Map<int, Variant> default_arguments;
+};
+
+struct ClassAPI {
+ String class_name;
+ String super_class_name;
+
+ ClassDB::APIType api_type;
+
+ bool is_singleton;
+ bool is_instanciable;
+ // @Unclear
+ bool is_creatable;
+ // @Unclear
+ bool memory_own;
+
+ List<MethodAPI> methods;
+ List<PropertyAPI> properties;
+ List<ConstantAPI> constants;
+ List<SignalAPI> signals_;
+};
+
+/*
+ * Reads the entire Godot API to a list
+ */
+List<ClassAPI> generate_c_api_classes() {
+
+ List<ClassAPI> api;
+
+ List<StringName> classes;
+ ClassDB::get_class_list(&classes);
+
+ for (List<StringName>::Element *e = classes.front(); e != NULL; e = e->next()) {
+ StringName class_name = e->get();
+
+ ClassAPI class_api;
+ class_api.api_type = ClassDB::get_api_type(e->get());
+ class_api.class_name = class_name;
+ class_api.super_class_name = ClassDB::get_parent_class(class_name);
+ {
+ String name = class_name;
+ if (name.begins_with("_")) {
+ name.remove(0);
+ }
+ class_api.is_singleton = GlobalConfig::get_singleton()->has_singleton(name);
+ }
+ class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name);
+
+ {
+ bool is_reference = false;
+ List<StringName> inheriters;
+ ClassDB::get_inheriters_from_class("Reference", &inheriters);
+ is_reference = inheriters.find(class_name) < 0;
+ // @Unclear
+ class_api.memory_own = !class_api.is_singleton && is_reference;
+ }
+
+ // constants
+ {
+ List<String> constant;
+ ClassDB::get_integer_constant_list(class_name, &constant, true);
+ for (List<String>::Element *c = constant.front(); c != NULL; c = c->next()) {
+ ConstantAPI constant_api;
+ constant_api.constant_name = c->get();
+ constant_api.constant_value = ClassDB::get_integer_constant(class_name, c->get());
+
+ class_api.constants.push_back(constant_api);
+ }
+ }
+
+ // signals
+ {
+ List<MethodInfo> signals_;
+ ClassDB::get_signal_list(class_name, &signals_, true);
+
+ for (int i = 0; i < signals_.size(); i++) {
+ SignalAPI signal;
+
+ MethodInfo method_info = signals_[i];
+ signal.name = method_info.name;
+
+ for (int j = 0; j < method_info.arguments.size(); j++) {
+ PropertyInfo argument = method_info.arguments[j];
+ String type;
+ String name = argument.name;
+
+ if (argument.name.find(":") != -1) {
+ type = argument.name.get_slice(":", 1);
+ name = argument.name.get_slice(":", 0);
+ } else if (argument.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ type = argument.hint_string;
+ } else if (argument.type == Variant::NIL) {
+ type = "Variant";
+ } else {
+ type = Variant::get_type_name(argument.type);
+ }
+
+ signal.argument_names.push_back(name);
+ signal.argument_types.push_back(type);
+ }
+
+ Vector<Variant> default_arguments = method_info.default_arguments;
+
+ int default_start = signal.argument_names.size() - default_arguments.size();
+
+ for (int j = 0; j < default_arguments.size(); j++) {
+ signal.default_arguments[default_start + j] = default_arguments[j];
+ }
+
+ class_api.signals_.push_back(signal);
+ }
+ }
+
+ //properties
+ {
+ List<PropertyInfo> properties;
+ ClassDB::get_property_list(class_name, &properties, true);
+
+ for (List<PropertyInfo>::Element *p = properties.front(); p != NULL; p = p->next()) {
+ PropertyAPI property_api;
+
+ property_api.name = p->get().name;
+ property_api.getter = ClassDB::get_property_getter(class_name, p->get().name);
+ property_api.setter = ClassDB::get_property_setter(class_name, p->get().name);
+
+ if (p->get().name.find(":") != -1) {
+ property_api.type = p->get().name.get_slice(":", 1);
+ property_api.name = p->get().name.get_slice(":", 0);
+ } else if (p->get().hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ property_api.type = p->get().hint_string;
+ } else if (p->get().type == Variant::NIL) {
+ property_api.type = "Variant";
+ } else {
+ property_api.type = Variant::get_type_name(p->get().type);
+ }
+
+ if (!property_api.setter.empty() || !property_api.getter.empty()) {
+ class_api.properties.push_back(property_api);
+ }
+ }
+ }
+
+ //methods
+ {
+ List<MethodInfo> methods;
+ ClassDB::get_method_list(class_name, &methods, true);
+
+ for (List<MethodInfo>::Element *m = methods.front(); m != NULL; m = m->next()) {
+ MethodAPI method_api;
+ MethodBind *method_bind = ClassDB::get_method(class_name, m->get().name);
+ MethodInfo &method_info = m->get();
+
+ //method name
+ method_api.method_name = m->get().name;
+ //method return type
+ if (method_bind && method_bind->get_return_type() != StringName()) {
+ method_api.return_type = method_bind->get_return_type();
+ } else if (method_api.method_name.find(":") != -1) {
+ method_api.return_type = method_api.method_name.get_slice(":", 1);
+ method_api.method_name = method_api.method_name.get_slice(":", 0);
+ } else if (m->get().return_val.type != Variant::NIL) {
+ method_api.return_type = m->get().return_val.hint == PROPERTY_HINT_RESOURCE_TYPE ? m->get().return_val.hint_string : Variant::get_type_name(m->get().return_val.type);
+ } else {
+ method_api.return_type = "void";
+ }
+
+ method_api.argument_count = method_info.arguments.size();
+ method_api.has_varargs = method_bind && method_bind->is_vararg();
+
+ // Method flags
+ if (method_bind && method_bind->get_hint_flags()) {
+ const uint32_t flags = method_bind->get_hint_flags();
+ method_api.is_editor = flags & METHOD_FLAG_EDITOR;
+ method_api.is_noscript = flags & METHOD_FLAG_NOSCRIPT;
+ method_api.is_const = flags & METHOD_FLAG_CONST;
+ method_api.is_reverse = flags & METHOD_FLAG_REVERSE;
+ method_api.is_virtual = flags & METHOD_FLAG_VIRTUAL;
+ method_api.is_from_script = flags & METHOD_FLAG_FROM_SCRIPT;
+ }
+
+ // method argument name and type
+
+ for (int i = 0; i < method_api.argument_count; i++) {
+ String arg_name;
+ String arg_type;
+ PropertyInfo arg_info = method_info.arguments[i];
+
+ arg_name = arg_info.name;
+
+ if (arg_info.name.find(":") != -1) {
+ arg_type = arg_info.name.get_slice(":", 1);
+ arg_name = arg_info.name.get_slice(":", 0);
+ } else if (arg_info.hint == PROPERTY_HINT_RESOURCE_TYPE) {
+ arg_type = arg_info.hint_string;
+ } else if (arg_info.type == Variant::NIL) {
+ arg_type = "Variant";
+ } else {
+ arg_type = Variant::get_type_name(arg_info.type);
+ }
+
+ method_api.argument_names.push_back(arg_name);
+ method_api.argument_types.push_back(arg_type);
+
+ if (method_bind && method_bind->has_default_argument(i)) {
+ method_api.default_arguments[i] = method_bind->get_default_argument(i);
+ }
+ }
+
+ class_api.methods.push_back(method_api);
+ }
+ }
+
+ api.push_back(class_api);
+ }
+
+ return api;
+}
+
+/*
+ * Generates the JSON source from the API in p_api
+ */
+static List<String> generate_c_api_json(const List<ClassAPI> &p_api) {
+
+ // I'm sorry for the \t mess
+
+ List<String> source;
+
+ source.push_back("[\n");
+
+ for (const List<ClassAPI>::Element *c = p_api.front(); c != NULL; c = c->next()) {
+ ClassAPI api = c->get();
+
+ source.push_back("\t{\n");
+
+ source.push_back("\t\t\"name\": \"" + api.class_name + "\",\n");
+ source.push_back("\t\t\"base_class\": \"" + api.super_class_name + "\",\n");
+ 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");
+ // @Unclear
+ // source.push_back(String("\t\t\"createable\": ") + (api.is_creatable ? "true" : "false") + ",\n");
+
+ source.push_back("\t\t\"constants\": {\n");
+ for (List<ConstantAPI>::Element *e = api.constants.front(); e; e = e->next()) {
+ source.push_back("\t\t\t\"" + e->get().constant_name + "\": " + String::num_int64(e->get().constant_value) + (e->next() ? "," : "") + "\n");
+ }
+ source.push_back("\t\t},\n");
+
+ source.push_back("\t\t\"properties\": [\n");
+ for (List<PropertyAPI>::Element *e = api.properties.front(); e; e = e->next()) {
+ source.push_back("\t\t\t{\n");
+ source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n");
+ source.push_back("\t\t\t\t\"type\": \"" + e->get().type + "\",\n");
+ source.push_back("\t\t\t\t\"getter\": \"" + e->get().getter + "\",\n");
+ source.push_back("\t\t\t\t\"setter\": \"" + e->get().setter + "\"\n");
+ source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
+ }
+ source.push_back("\t\t],\n");
+
+ source.push_back("\t\t\"signals\": [\n");
+ for (List<SignalAPI>::Element *e = api.signals_.front(); e; e = e->next()) {
+ source.push_back("\t\t\t{\n");
+ source.push_back("\t\t\t\t\"name\": \"" + e->get().name + "\",\n");
+ source.push_back("\t\t\t\t\"arguments\": [\n");
+ for (int i = 0; i < e->get().argument_names.size(); i++) {
+ 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("\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");
+ }
+ source.push_back("\t\t\t\t]\n");
+ source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
+ }
+ source.push_back("\t\t],\n");
+
+ source.push_back("\t\t\"methods\": [\n");
+ for (List<MethodAPI>::Element *e = api.methods.front(); e; e = e->next()) {
+ source.push_back("\t\t\t{\n");
+ source.push_back("\t\t\t\t\"name\": \"" + e->get().method_name + "\",\n");
+ source.push_back("\t\t\t\t\"return_type\": \"" + e->get().return_type + "\",\n");
+ source.push_back(String("\t\t\t\t\"is_editor\": ") + (e->get().is_editor ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\t\t\"is_noscript\": ") + (e->get().is_noscript ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\t\t\"is_const\": ") + (e->get().is_const ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\t\t\"is_reverse\": ") + (e->get().is_reverse ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\t\t\"is_virtual\": ") + (e->get().is_virtual ? "true" : "false") + ",\n");
+ source.push_back(String("\t\t\t\t\"is_from_script\": ") + (e->get().is_from_script ? "true" : "false") + ",\n");
+ source.push_back("\t\t\t\t\"arguments\": [\n");
+ for (int i = 0; i < e->get().argument_names.size(); i++) {
+ 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("\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");
+ }
+ source.push_back("\t\t\t\t]\n");
+ source.push_back(String("\t\t\t}") + (e->next() ? "," : "") + "\n");
+ }
+ source.push_back("\t\t]\n");
+
+ source.push_back(String("\t}") + (c->next() ? "," : "") + "\n");
+ }
+
+ source.push_back("]");
+
+ return source;
+}
+
+//
+
+#endif
+
+/*
+ * Saves the whole Godot API to a JSON file located at
+ * p_path
+ */
+Error generate_c_api(const String &p_path) {
+
+#ifndef TOOLS_ENABLED
+ return ERR_BUG;
+#else
+
+ List<ClassAPI> api = generate_c_api_classes();
+
+ List<String> json_source = generate_c_api_json(api);
+
+ return save_file(p_path, json_source);
+#endif
+}
diff --git a/modules/dlscript/api_generator.h b/modules/dlscript/api_generator.h
new file mode 100644
index 0000000000..4a8354e9d6
--- /dev/null
+++ b/modules/dlscript/api_generator.h
@@ -0,0 +1,9 @@
+#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/cscript/config.py b/modules/dlscript/config.py
index 5698a37295..9f57b9bb74 100644
--- a/modules/cscript/config.py
+++ b/modules/dlscript/config.py
@@ -5,4 +5,4 @@ def can_build(platform):
def configure(env):
- pass
+ env.use_ptrcall = True
diff --git a/modules/dlscript/dl_script.cpp b/modules/dlscript/dl_script.cpp
new file mode 100644
index 0000000000..9917018891
--- /dev/null
+++ b/modules/dlscript/dl_script.cpp
@@ -0,0 +1,1048 @@
+/*************************************************************************/
+/* dl_script.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 "dl_script.h"
+
+#include "global_config.h"
+#include "global_constants.h"
+#include "io/file_access_encrypted.h"
+#include "os/file_access.h"
+#include "os/os.h"
+
+#include "scene/resources/scene_format_text.h"
+
+#ifdef TOOLS_ENABLED
+// #include "editor/editor_import_export.h"
+#endif
+
+#if defined(TOOLS_ENABLED) && defined(DEBUG_METHODS_ENABLED)
+#include "api_generator.h"
+#endif
+
+// Script
+
+bool DLScript::can_instance() const {
+#ifdef DLSCRIPT_EDITOR_FEATURES
+ 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");
+
+ RES lib = ResourceLoader::load(path);
+
+ if (lib.is_valid() && lib->cast_to<DLLibrary>()) {
+ return true;
+ }
+ }
+
+ return script_data;
+#endif
+ //return script_data || (!tool && !ScriptServer::is_scripting_enabled());
+ // change to true enable in editor stuff.
+}
+
+Ref<Script> DLScript::get_base_script() const {
+ Ref<DLScript> 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 {
+ return script_data->base_native_type;
+}
+
+ScriptInstance *DLScript::instance_create(Object *p_this) {
+
+#ifdef TOOLS_ENABLED
+
+// find a good way to initialize stuff in the editor
+#ifdef DLSCRIPT_EDITOR_FEATURES
+ 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));
+ placeholders.insert(sins);
+
+ List<PropertyInfo> pinfo;
+ Map<StringName, Variant> values;
+
+ if (!library.is_valid())
+ return sins;
+
+ if (!library->library_handle) {
+ Error err = library->_initialize_handle(true);
+ if (err != OK) {
+ return sins;
+ }
+ }
+
+ if (!script_data) {
+ script_data = library->get_script_data(script_name);
+ }
+ if (script_data)
+ script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
+
+ if (script_data) {
+ for (Map<StringName, DLScriptData::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);
+ values[p.name] = E->get().default_value;
+ }
+ }
+
+ sins->update(pinfo, values);
+
+ return sins;
+ }
+#endif
+
+#endif
+
+ if (!library.is_valid()) {
+ String path = GLOBAL_GET("dlscript/default_dllibrary");
+
+ RES lib = ResourceLoader::load(path);
+
+ if (lib.is_valid() && lib->cast_to<DLLibrary>()) {
+ set_library(lib);
+ }
+ }
+
+ DLInstance *new_instance = memnew(DLInstance);
+
+ new_instance->owner = p_this;
+ new_instance->script = Ref<DLScript>(this);
+
+#ifndef DLSCRIPT_EDITOR_FEATURES
+ if (!ScriptServer::is_scripting_enabled()) {
+ new_instance->userdata = 0;
+ } else {
+ new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
+ }
+#else
+ new_instance->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
+#endif
+
+ instances.insert(p_this);
+ return new_instance;
+}
+
+bool DLScript::instance_has(const Object *p_this) const {
+ return instances.has((Object *)p_this); // TODO
+}
+
+bool DLScript::has_source_code() const {
+ return false;
+}
+
+String DLScript::get_source_code() const {
+ return "";
+}
+
+Error DLScript::reload(bool p_keep_state) {
+ return FAILED;
+}
+
+bool DLScript::has_method(const StringName &p_method) const {
+ if (!script_data)
+ return false;
+ return script_data->methods.has(p_method);
+}
+
+MethodInfo DLScript::get_method_info(const StringName &p_method) const {
+ if (!script_data)
+ return MethodInfo();
+ ERR_FAIL_COND_V(!script_data->methods.has(p_method), MethodInfo());
+ return script_data->methods[p_method].info;
+}
+
+void DLScript::get_script_method_list(List<MethodInfo> *p_list) const {
+ if (!script_data) return;
+ for (Map<StringName, DLScriptData::Method>::Element *E = script_data->methods.front(); E; E = E->next()) {
+ p_list->push_back(E->get().info);
+ }
+}
+
+void DLScript::get_script_property_list(List<PropertyInfo> *p_list) const {
+ if (!script_data) return;
+ for (Map<StringName, DLScriptData::Property>::Element *E = script_data->properties.front(); E; E = E->next()) {
+ p_list->push_back(E->get().info);
+ }
+}
+
+bool DLScript::get_property_default_value(const StringName &p_property, Variant &r_value) const {
+ if (!script_data) return false;
+ if (script_data->properties.has(p_property)) {
+ r_value = script_data->properties[p_property].default_value;
+ return true;
+ }
+ return false;
+}
+
+bool DLScript::is_tool() const {
+ ERR_FAIL_COND_V(!script_data, false);
+ return script_data->is_tool;
+}
+
+String DLScript::get_node_type() const {
+ return ""; // ?
+}
+
+ScriptLanguage *DLScript::get_language() const {
+ return DLScriptLanguage::singleton;
+}
+
+bool DLScript::has_script_signal(const StringName &p_signal) const {
+ if (!script_data)
+ return false;
+ return script_data->signals_.has(p_signal);
+}
+
+void DLScript::get_script_signal_list(List<MethodInfo> *r_signals) const {
+ if (!script_data)
+ return;
+ for (Map<StringName, DLScriptData::Signal>::Element *S = script_data->signals_.front(); S; S = S->next()) {
+ r_signals->push_back(S->get().signal);
+ }
+}
+
+Ref<DLLibrary> DLScript::get_library() const {
+ return library;
+}
+
+void DLScript::set_library(Ref<DLLibrary> p_library) {
+ library = p_library;
+
+#ifdef TOOLS_ENABLED
+ if (!ScriptServer::is_scripting_enabled())
+ return;
+#endif
+ if (library.is_valid()) {
+ Error initalize_status = library->_initialize_handle(!ScriptServer::is_scripting_enabled());
+ ERR_FAIL_COND(initalize_status != OK);
+ if (script_name) {
+ script_data = library->get_script_data(script_name);
+ ERR_FAIL_COND(!script_data);
+ }
+ }
+}
+
+StringName DLScript::get_script_name() const {
+ return script_name;
+}
+
+void DLScript::set_script_name(StringName p_script_name) {
+ script_name = p_script_name;
+
+ if (library.is_valid()) {
+ script_data = library->get_script_data(script_name);
+ ERR_FAIL_COND(!script_data);
+ }
+}
+
+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);
+
+ ADD_PROPERTYNZ(PropertyInfo(Variant::OBJECT, "library", PROPERTY_HINT_RESOURCE_TYPE, "DLLibrary"), "set_library", "get_library");
+ ADD_PROPERTYNZ(PropertyInfo(Variant::STRING, "script_name"), "set_script_name", "get_script_name");
+}
+
+DLScript::DLScript() {
+ script_data = NULL;
+}
+
+DLScript::~DLScript() {
+ //hmm
+}
+
+// Library
+
+DLLibrary *DLLibrary::currently_initialized_library = NULL;
+
+DLLibrary *DLLibrary::get_currently_initialized_library() {
+ return currently_initialized_library;
+}
+
+static const char *_dl_platforms_info[] = {
+ "|unix|so|Unix",
+ "unix|x11|so|X11",
+ "unix|server|so|Server",
+ "unix|android|so|Android",
+ "unix|blackberry|so|Blackberry 10",
+ "unix|haiku|so|Haiku", // Right?
+ "|mac|dynlib|Mac",
+ "mac|ios|dynlib|iOS",
+ "mac|osx|dynlib|OSX",
+ "|html5|js|HTML5",
+ "|windows|dll|Windows",
+ "windows|uwp|dll|UWP",
+ NULL // Finishing condition
+};
+
+void DLLibrary::set_platform_file(StringName p_platform, String p_file) {
+ if (p_file.empty()) {
+ platform_files.erase(p_platform);
+ } else {
+ platform_files[p_platform] = p_file;
+ }
+}
+
+String DLLibrary::get_platform_file(StringName p_platform) const {
+ if (platform_files.has(p_platform)) {
+ return platform_files[p_platform];
+ } else {
+ return "";
+ }
+}
+
+Error DLLibrary::_initialize_handle(bool p_in_editor) {
+ _THREAD_SAFE_METHOD_
+
+ void *_library_handle;
+
+ // Get the file
+
+ const String platform_name = OS::get_singleton()->get_name();
+ String platform_file("");
+ char **platform_info = (char **)_dl_platforms_info;
+
+ if (platform_files.has(platform_name.to_lower())) {
+ platform_file = platform_files[platform_name.to_lower()];
+ }
+
+ while (*platform_info) {
+ String platform_info_string(*platform_info);
+
+ if (platform_name == platform_info_string.get_slicec('|', 3)) {
+ String platform_key = platform_info_string.get_slicec('|', 1);
+ String fallback_platform_key = platform_info_string.get_slicec('|', 0);
+
+ if (platform_files.has(platform_key)) {
+ platform_file = platform_files[platform_key];
+ } else if (!fallback_platform_key.empty() && platform_files.has(fallback_platform_key)) {
+ platform_file = platform_files[fallback_platform_key];
+ } else {
+ return ERR_UNAVAILABLE;
+ }
+ }
+ platform_info++;
+ }
+ ERR_FAIL_COND_V(platform_file == "", ERR_DOES_NOT_EXIST);
+
+ library_path = GlobalConfig::get_singleton()->globalize_path(platform_file);
+
+ if (DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) {
+ *this = *DLScriptLanguage::get_singleton()->get_library_dllibrary(library_path);
+ return OK;
+ }
+
+ // Open the file
+
+ Error error;
+ error = OS::get_singleton()->open_dynamic_library(library_path, _library_handle);
+ if (error) return error;
+ ERR_FAIL_COND_V(!_library_handle, ERR_BUG);
+
+ // Get the method
+
+ void *library_init;
+ error = OS::get_singleton()->get_dynamic_library_symbol_handle(_library_handle, DLScriptLanguage::get_init_symbol_name(), library_init);
+ if (error) return error;
+ ERR_FAIL_COND_V(!library_init, ERR_BUG);
+
+ DLLibrary::currently_initialized_library = this;
+
+ void (*library_init_fpointer)(godot_dlscript_init_options *) = (void (*)(godot_dlscript_init_options *))library_init;
+
+ godot_dlscript_init_options options;
+
+ options.in_editor = p_in_editor;
+ 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?
+ /*{
+ ERR_EXPLAIN("Couldn't initialize library");
+ ERR_FAIL_V(ERR_SCRIPT_FAILED);
+ }*/
+
+ DLLibrary::currently_initialized_library = NULL;
+ library_handle = _library_handle;
+
+ DLScriptLanguage::get_singleton()->set_library_initialized(library_path, this);
+
+ return OK;
+}
+
+Error DLLibrary::_free_handle(bool p_in_editor) {
+ ERR_FAIL_COND_V(!library_handle, ERR_BUG);
+
+ if (!DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) {
+ OS::get_singleton()->close_dynamic_library(library_handle);
+ library_handle = 0;
+ return OK;
+ }
+
+ Error error = OK;
+ void *library_terminate;
+ error = OS::get_singleton()->get_dynamic_library_symbol_handle(library_handle, DLScriptLanguage::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;
+
+ godot_dlscript_terminate_options options;
+ options.in_editor = p_in_editor;
+
+ library_terminate_pointer(&options);
+
+ DLScriptLanguage::get_singleton()->set_library_uninitialized(library_path);
+
+ OS::get_singleton()->close_dynamic_library(library_handle);
+ library_handle = 0;
+
+ return OK;
+}
+
+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) {
+ ERR_FAIL_COND(scripts.has(p_name));
+
+ DLScriptData *s = memnew(DLScriptData);
+ s->base = p_base;
+ s->create_func = p_instance_func;
+ s->destroy_func = p_destroy_func;
+ Map<StringName, DLScriptData *>::Element *E = scripts.find(p_base);
+ if (E) {
+ s->base_data = E->get();
+ s->base_native_type = s->base_data->base_native_type;
+ } else {
+ if (!ClassDB::class_exists(p_base)) {
+ memdelete(s);
+ ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'");
+ ERR_FAIL();
+ }
+ s->base_native_type = p_base;
+ }
+
+ 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) {
+ ERR_FAIL_COND(scripts.has(p_name));
+
+ DLScriptData *s = memnew(DLScriptData);
+ 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 = scripts.find(p_base);
+ if (E) {
+ s->base_data = E->get();
+ s->base_native_type = s->base_data->base_native_type;
+ } else {
+ if (!ClassDB::class_exists(p_base)) {
+ memdelete(s);
+ ERR_EXPLAIN("Invalid base for registered type '" + p_name + "'");
+ ERR_FAIL();
+ }
+ s->base_native_type = p_base;
+ }
+
+ 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) {
+ ERR_FAIL_COND(!scripts.has(p_name));
+
+ p_info.name = p_method;
+ DLScriptData::Method method;
+
+ method = DLScriptData::Method(p_func, p_info, p_attr.rpc_type);
+
+ 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) {
+ ERR_FAIL_COND(!scripts.has(p_name));
+
+ DLScriptData::Property p;
+
+ PropertyInfo pi;
+ pi.name = p_path;
+
+ 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);
+ }
+
+ scripts[p_name]->properties.insert(p_path, p);
+}
+
+void DLLibrary::_register_script_signal(const StringName p_name, const godot_signal *p_signal) {
+ ERR_FAIL_COND(!scripts.has(p_name));
+ ERR_FAIL_COND(!p_signal);
+
+ DLScriptData::Signal signal;
+
+ signal.signal.name = *(String *)&p_signal->name;
+
+ {
+ List<PropertyInfo> arguments;
+ for (int i = 0; i < p_signal->num_args; i++) {
+ PropertyInfo info;
+ godot_signal_argument attrib = p_signal->args[i];
+
+ String *name = (String *)&attrib.name;
+ info.name = *name;
+ info.type = (Variant::Type)attrib.type;
+ info.hint = (PropertyHint)attrib.hint;
+ info.hint_string = *(String *)&attrib.hint_string;
+ info.usage = attrib.usage;
+
+ arguments.push_back(info);
+ }
+
+ signal.signal.arguments = arguments;
+ }
+
+ {
+ Vector<Variant> default_arguments;
+ for (int i = 0; i < p_signal->num_default_args; i++) {
+ Variant *v;
+ godot_signal_argument attrib = p_signal->args[i];
+
+ v = (Variant *)&attrib.default_value;
+
+ default_arguments.push_back(*v);
+ }
+
+ signal.signal.default_arguments = default_arguments;
+ }
+
+ scripts[p_name]->signals_.insert(*(String *)&p_signal->name, signal);
+}
+
+DLScriptData *DLLibrary::get_script_data(const StringName p_name) {
+
+ if (!scripts.has(p_name)) {
+ if (DLScriptLanguage::get_singleton()->is_library_initialized(library_path)) {
+ _update_library(*DLScriptLanguage::get_singleton()->get_library_dllibrary(library_path));
+ }
+ ERR_FAIL_COND_V(!scripts.has(p_name), NULL);
+ }
+
+ return scripts[p_name];
+}
+
+bool DLLibrary::_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);
+ return true;
+ }
+ return false;
+}
+
+bool DLLibrary::_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));
+ return true;
+ }
+ return false;
+}
+
+void DLLibrary::_get_property_list(List<PropertyInfo> *p_list) const {
+ char **platform_info = (char **)_dl_platforms_info;
+
+ Set<String> registered_platform_names;
+ {
+ List<StringName> ep;
+ // ep.push_back("X11");
+ // EditorImportExport::get_singleton()->get_export_platforms(&ep);
+ for (List<StringName>::Element *E = ep.front(); E; E = E->next()) {
+ registered_platform_names.insert(String(E->get()).to_lower());
+ }
+ }
+
+ while (*platform_info) {
+ String platform_info_string(*platform_info);
+ String fallback_platform_key = platform_info_string.get_slicec('|', 0);
+ String platform_key = platform_info_string.get_slicec('|', 1);
+ String platform_extension = platform_info_string.get_slicec('|', 2);
+ String platform_name = platform_info_string.get_slicec('|', 3);
+
+ registered_platform_names.erase(platform_name);
+
+ if (fallback_platform_key.empty()) {
+ p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension));
+
+ } else {
+ if (platform_files.has(platform_key)) {
+ p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE | PROPERTY_USAGE_CHECKED));
+ } else {
+ p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_key, PROPERTY_HINT_FILE, "*." + platform_extension, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_CHECKABLE));
+ }
+ }
+ platform_info++;
+ }
+
+ while (registered_platform_names.size()) {
+ const String platform_name = registered_platform_names.front()->get();
+ registered_platform_names.erase(platform_name);
+ p_list->push_back(PropertyInfo(Variant::STRING, "platform/" + platform_name.to_lower(), PROPERTY_HINT_FILE, "*"));
+ }
+}
+
+void DLLibrary::_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);
+}
+
+DLLibrary::DLLibrary() {
+ library_handle = NULL;
+}
+
+DLLibrary::~DLLibrary() {
+
+ for (Map<StringName, DLScriptData *>::Element *E = scripts.front(); E; E = E->next()) {
+ for (Map<StringName, DLScriptData::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);
+ }
+ }
+ memdelete(E->get());
+ }
+
+ if (library_handle) {
+ bool in_editor = false;
+#ifdef TOOLS_ENABLED
+ in_editor = !ScriptServer::is_scripting_enabled();
+#endif
+ _free_handle(in_editor);
+ }
+}
+
+// Instance
+
+bool DLInstance::set(const StringName &p_name, const Variant &p_value) {
+ if (!script->script_data)
+ return false;
+ if (script->script_data->properties.has(p_name)) {
+ script->script_data->properties[p_name].setter.set_func((godot_object *)owner, script->script_data->properties[p_name].setter.method_data, userdata, *(godot_variant *)&p_value);
+ return true;
+ }
+ return false;
+}
+
+bool DLInstance::get(const StringName &p_name, Variant &r_ret) const {
+ if (!script->script_data)
+ return false;
+ if (script->script_data->properties.has(p_name)) {
+ godot_variant value = script->script_data->properties[p_name].getter.get_func((godot_object *)owner, script->script_data->properties[p_name].getter.method_data, userdata);
+ r_ret = *(Variant *)&value;
+ return true;
+ }
+ return false;
+}
+
+void DLInstance::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 {
+ if (script->script_data->properties.has(p_name)) {
+ *r_is_valid = true;
+ return script->script_data->properties[p_name].info.type;
+ }
+ *r_is_valid = false;
+ return Variant::NIL;
+}
+
+void DLInstance::get_method_list(List<MethodInfo> *p_list) const {
+ script->get_script_method_list(p_list);
+}
+
+bool DLInstance::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) {
+ // TODO: validated methods & errors
+
+ DLScriptData *data_ptr = script->script_data;
+ while (data_ptr) {
+ Map<StringName, DLScriptData::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;
+ }
+ data_ptr = data_ptr->base_data;
+ }
+ r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
+ return Variant();
+}
+
+void DLInstance::call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount) {
+ // TODO: validated methods & errors
+
+ DLScriptData *data_ptr = script->script_data;
+ while (data_ptr) {
+ Map<StringName, DLScriptData::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);
+ }
+ data_ptr = data_ptr->base_data;
+ }
+}
+
+void DLInstance::_ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount) {
+ // TODO: validated methods & errors
+
+ if (data_ptr->base_data)
+ _ml_call_reversed(data_ptr->base_data, p_method, p_args, p_argcount);
+
+ // Variant::CallError ce;
+
+ Map<StringName, DLScriptData::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) {
+ if (script.ptr() && script->script_data) {
+ _ml_call_reversed(script->script_data, p_method, p_args, p_argcount);
+ }
+}
+
+void DLInstance::notification(int p_notification) {
+ Variant value = p_notification;
+ const Variant *args[1] = { &value };
+ call_multilevel(DLScriptLanguage::singleton->strings._notification, args, 1);
+}
+
+Ref<Script> DLInstance::get_script() const {
+ return script;
+}
+
+ScriptLanguage *DLInstance::get_language() {
+ return DLScriptLanguage::singleton;
+}
+
+ScriptInstance::RPCMode DLInstance::get_rpc_mode(const StringName &p_method) const {
+ DLScriptData::Method m = script->script_data->methods[p_method];
+ switch (m.rpc_mode) {
+ case GODOT_METHOD_RPC_MODE_DISABLED:
+ return RPC_MODE_DISABLED;
+ case GODOT_METHOD_RPC_MODE_REMOTE:
+ return RPC_MODE_REMOTE;
+ case GODOT_METHOD_RPC_MODE_SYNC:
+ return RPC_MODE_SYNC;
+ case GODOT_METHOD_RPC_MODE_MASTER:
+ return RPC_MODE_MASTER;
+ case GODOT_METHOD_RPC_MODE_SLAVE:
+ return RPC_MODE_SLAVE;
+ default:
+ return RPC_MODE_DISABLED;
+ }
+}
+
+ScriptInstance::RPCMode DLInstance::get_rset_mode(const StringName &p_variable) const {
+ DLScriptData::Property p = script->script_data->properties[p_variable];
+ switch (p.rset_mode) {
+ case GODOT_METHOD_RPC_MODE_DISABLED:
+ return RPC_MODE_DISABLED;
+ case GODOT_METHOD_RPC_MODE_REMOTE:
+ return RPC_MODE_REMOTE;
+ case GODOT_METHOD_RPC_MODE_SYNC:
+ return RPC_MODE_SYNC;
+ case GODOT_METHOD_RPC_MODE_MASTER:
+ return RPC_MODE_MASTER;
+ case GODOT_METHOD_RPC_MODE_SLAVE:
+ return RPC_MODE_SLAVE;
+ default:
+ return RPC_MODE_DISABLED;
+ }
+}
+
+DLInstance::DLInstance() {
+ owner = NULL;
+ userdata = NULL;
+}
+
+DLInstance::~DLInstance() {
+ if (script.is_valid()) {
+ if (owner) {
+ script->instances.erase(owner);
+ }
+ if (!script->script_data)
+ return;
+ script->script_data->destroy_func.destroy_func((godot_object *)owner, script->script_data->destroy_func.method_data, userdata);
+ if (script->script_data->destroy_func.free_func)
+ script->script_data->destroy_func.free_func(script->script_data->destroy_func.method_data);
+ if (script->script_data->create_func.free_func)
+ script->script_data->create_func.free_func(script->script_data->create_func.method_data);
+ }
+}
+
+// Language
+
+DLScriptLanguage *DLScriptLanguage::singleton = NULL;
+
+String DLScriptLanguage::get_name() const {
+ return "DLScript";
+}
+
+bool DLScriptLanguage::is_library_initialized(const String &p_path) {
+
+ return initialized_libraries.has(p_path);
+}
+
+void DLScriptLanguage::set_library_initialized(const String &p_path, DLLibrary *p_dllibrary) {
+
+ initialized_libraries[p_path] = p_dllibrary;
+}
+
+DLLibrary *DLScriptLanguage::get_library_dllibrary(const String &p_path) {
+
+ return initialized_libraries[p_path];
+}
+
+void DLScriptLanguage::set_library_uninitialized(const String &p_path) {
+
+ initialized_libraries.erase(p_path);
+}
+
+void DLScriptLanguage::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);
+
+// 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");
+
+ if (E && E->next()) {
+ if (generate_c_api(E->next()->get()) != OK) {
+ ERR_PRINT("Failed to generate C API\n");
+ }
+ }
+#endif
+}
+
+String DLScriptLanguage::get_type() const {
+ return "DLScript";
+}
+
+String DLScriptLanguage::get_extension() const {
+ return "dl";
+}
+
+Error DLScriptLanguage::execute_file(const String &p_path) {
+ return OK; // ??
+}
+
+void DLScriptLanguage::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() {
+ _api_anchor();
+}
+
+Ref<Script> DLScriptLanguage::get_template(const String &p_class_name, const String &p_base_class_name) const {
+ DLScript *src = memnew(DLScript);
+ src->set_script_name(p_class_name);
+ return Ref<DLScript>(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 {
+ return false; // TODO
+}
+
+Script *DLScriptLanguage::create_script() const {
+ DLScript *scr = memnew(DLScript);
+ return scr;
+}
+
+bool DLScriptLanguage::has_named_classes() const {
+ return true;
+}
+
+int DLScriptLanguage::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 {
+ return ""; // No source code!
+}
+
+void DLScriptLanguage::add_global_constant(const StringName &p_variable, const Variant &p_value) {
+ // TODO TODO TODO
+}
+
+// TODO: Any debugging? (research)
+String DLScriptLanguage::debug_get_error() const {
+ return "";
+}
+
+int DLScriptLanguage::debug_get_stack_level_count() const {
+ return 1; // ?
+}
+
+int DLScriptLanguage::debug_get_stack_level_line(int p_level) const {
+ return -1;
+}
+
+String DLScriptLanguage::debug_get_stack_level_function(int p_level) const {
+ return "[native code]"; // ?
+}
+
+String DLScriptLanguage::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 DLScriptLanguage::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) {
+ return ""; // ??
+}
+
+void DLScriptLanguage::reload_all_scripts() {
+ // @Todo
+}
+
+void DLScriptLanguage::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 DLScriptLanguage::get_public_functions(List<MethodInfo> *p_functions) const {
+}
+
+void DLScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_constants) const {
+}
+
+// TODO: all profilling
+void DLScriptLanguage::profiling_start() {
+}
+
+void DLScriptLanguage::profiling_stop() {
+}
+
+int DLScriptLanguage::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) {
+ return 0;
+}
+
+void DLScriptLanguage::frame() {
+}
+
+String DLScriptLanguage::get_init_symbol_name() {
+ return "godot_dlscript_init"; // TODO: Maybe make some internal function which would do the actual stuff
+}
+
+String DLScriptLanguage::get_terminate_symbol_name() {
+ return "godot_dlscript_terminate";
+}
+
+DLScriptLanguage::DLScriptLanguage() {
+ ERR_FAIL_COND(singleton);
+ strings._notification = StringName("_notification");
+ singleton = this;
+ initialized_libraries = Map<String, DLLibrary *>();
+}
+
+DLScriptLanguage::~DLScriptLanguage() {
+ singleton = NULL;
+}
+
+RES ResourceFormatLoaderDLScript::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");
+}
+bool ResourceFormatLoaderDLScript::handles_type(const String &p_type) const {
+ return (p_type == "Script" || p_type == "DLScript");
+}
+String ResourceFormatLoaderDLScript::get_resource_type(const String &p_path) const {
+ String el = p_path.get_extension().to_lower();
+ if (el == "dl")
+ return "DLScript";
+ return "";
+}
+
+Error ResourceFormatSaverDLScript::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;
+}
+
+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");
+ }
+}
diff --git a/modules/dlscript/dl_script.h b/modules/dlscript/dl_script.h
new file mode 100644
index 0000000000..497208c832
--- /dev/null
+++ b/modules/dlscript/dl_script.h
@@ -0,0 +1,404 @@
+/*************************************************************************/
+/* dl_script.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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 DL_SCRIPT_H
+#define DL_SCRIPT_H
+
+#include "io/resource_loader.h"
+#include "io/resource_saver.h"
+#include "os/thread_safe.h"
+#include "resource.h"
+#include "script_language.h"
+#include "self_list.h"
+
+#include "godot.h"
+
+#ifdef TOOLS_ENABLED
+// #define DLSCRIPT_EDITOR_FEATURES
+#endif
+
+struct DLScriptData {
+ /* 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);
+ typedef void (MethodDataFreeFunc)(void *method_data);
+ typedef void (SetterFunc)(godot_object* instance,void* userdata,godot_variant value);
+ typedef godot_variant (GetterFunc)(godot_object* instance,void* userdata);*/
+
+ struct Method {
+ godot_instance_method method;
+ MethodInfo info;
+ int rpc_mode;
+
+ Method() {
+ }
+ Method(godot_instance_method p_method, MethodInfo p_info, int p_rpc_mode) {
+ method = p_method;
+ info = p_info;
+ rpc_mode = p_rpc_mode;
+ }
+ };
+ struct Property {
+ godot_property_set_func setter;
+ godot_property_get_func getter;
+ PropertyInfo info;
+ Variant default_value;
+ int rset_mode;
+
+ Property() {
+ }
+ Property(godot_property_set_func p_setter, godot_property_get_func p_getter) {
+ setter = p_setter;
+ getter = p_getter;
+ }
+ Property(godot_property_set_func p_setter, godot_property_get_func p_getter, PropertyInfo p_info, Variant p_default_value, int p_rset_mode) {
+ setter = p_setter;
+ getter = p_getter;
+ info = p_info;
+ default_value = p_default_value;
+ rset_mode = p_rset_mode;
+ }
+ };
+
+ struct Signal {
+ MethodInfo signal;
+ };
+
+ Map<StringName, Method> methods;
+ Map<StringName, Property> properties;
+ Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
+ StringName base;
+ StringName base_native_type;
+ DLScriptData *base_data;
+ godot_instance_create_func create_func;
+ godot_instance_destroy_func destroy_func;
+
+ bool is_tool;
+
+ DLScriptData() {
+ base = StringName();
+ base_data = NULL;
+ is_tool = false;
+ }
+ DLScriptData(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;
+ destroy_func = p_free;
+ is_tool = false;
+ }
+};
+
+class DLLibrary;
+
+class DLScript : public Script {
+
+ GDCLASS(DLScript, Script);
+
+ Ref<DLLibrary> library;
+ StringName script_name;
+ StringName base_native_type;
+ Set<Object *> instances;
+ DLScriptData *script_data;
+
+#ifdef TOOLS_ENABLED
+ Set<PlaceHolderScriptInstance *> placeholders;
+// void _update_placeholder(PlaceHolderScriptInstance *p_placeholder);
+// virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
+#endif
+
+ friend class DLInstance;
+ friend class DLScriptLanguage;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual bool can_instance() const;
+
+ virtual Ref<Script> get_base_script() const; //for script inheritance
+
+ virtual StringName get_instance_base_type() const; // this may not work in all scripts, will return empty if so
+ virtual ScriptInstance *instance_create(Object *p_this);
+ virtual bool instance_has(const Object *p_this) const;
+
+ virtual bool has_source_code() const;
+ virtual String get_source_code() const;
+ virtual void set_source_code(const String &p_code) {}
+ virtual Error reload(bool p_keep_state = false);
+
+ virtual bool has_method(const StringName &p_method) const;
+ virtual MethodInfo get_method_info(const StringName &p_method) const;
+
+ virtual bool is_tool() const;
+
+ virtual String get_node_type() const;
+
+ virtual ScriptLanguage *get_language() const;
+
+ virtual bool has_script_signal(const StringName &p_signal) const;
+ virtual void get_script_signal_list(List<MethodInfo> *r_signals) const;
+
+ virtual bool get_property_default_value(const StringName &p_property, Variant &r_value) const;
+
+ virtual void update_exports() {} //editor tool
+ 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);
+
+ StringName get_script_name() const;
+ void set_script_name(StringName p_script_name);
+
+ DLScript();
+ ~DLScript();
+};
+
+class DLLibrary : public Resource {
+ _THREAD_SAFE_CLASS_
+
+ GDCLASS(DLLibrary, Resource);
+ OBJ_SAVE_TYPE(DLLibrary);
+
+ Map<StringName, String> platform_files;
+ void *library_handle;
+ String library_path;
+ static DLLibrary *currently_initialized_library;
+ Map<StringName, DLScriptData *> scripts;
+
+protected:
+ friend class DLScript;
+ _FORCE_INLINE_ void _update_library(const DLLibrary &p_other) {
+ platform_files = p_other.platform_files;
+ library_handle = p_other.library_handle;
+ library_path = p_other.library_path;
+ scripts = p_other.scripts;
+ }
+
+ Error _initialize_handle(bool p_in_editor = false);
+
+ Error _free_handle(bool p_in_editor = false);
+
+ DLScriptData *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;
+ void _get_property_list(List<PropertyInfo> *p_list) const;
+ void _notification(int p_what);
+ static void _bind_methods();
+
+public:
+ static DLLibrary *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);
+ void _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 _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 _register_script_signal(const StringName p_name, const godot_signal *p_signal);
+
+ void set_platform_file(StringName p_platform, String p_file);
+ String get_platform_file(StringName p_platform) const;
+
+ DLLibrary();
+ ~DLLibrary();
+};
+
+class DLInstance : public ScriptInstance {
+ friend class DLScript;
+
+ Object *owner;
+ Ref<DLScript> script;
+ void *userdata;
+
+ void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
+
+public:
+ _FORCE_INLINE_ Object *get_owner() { return owner; }
+
+ _FORCE_INLINE_ void *get_userdata() { return userdata; }
+
+ virtual bool set(const StringName &p_name, const Variant &p_value);
+ virtual bool get(const StringName &p_name, Variant &r_ret) const;
+ virtual void get_property_list(List<PropertyInfo> *p_properties) const;
+ virtual Variant::Type get_property_type(const StringName &p_name, bool *r_is_valid = NULL) const;
+
+ virtual void get_method_list(List<MethodInfo> *p_list) const;
+ virtual bool has_method(const StringName &p_method) const;
+ virtual Variant call(const StringName &p_method, const Variant **p_args, int p_argcount, Variant::CallError &r_error);
+ virtual void call_multilevel(const StringName &p_method, const Variant **p_args, int p_argcount);
+ virtual void call_multilevel_reversed(const StringName &p_method, const Variant **p_args, int p_argcount);
+
+ Variant debug_get_member_by_index(int p_idx) const { return Variant(); }
+
+ virtual void notification(int p_notification);
+
+ virtual Ref<Script> get_script() const;
+
+ virtual ScriptLanguage *get_language();
+
+ void set_path(const String &p_path);
+
+ void reload_members();
+
+ virtual RPCMode get_rpc_mode(const StringName &p_method) const;
+ virtual RPCMode get_rset_mode(const StringName &p_variable) const;
+
+ DLInstance();
+ ~DLInstance();
+};
+
+class DLScriptLanguage : public ScriptLanguage {
+ friend class DLScript;
+ friend class DLInstance;
+
+ static DLScriptLanguage *singleton;
+
+ Variant *_global_array; // @Unused necessary?
+ Vector<Variant> global_array; // @Unused necessary?
+ Map<StringName, int> globals; // @Unused necessary?
+
+ // @Unused necessary?
+ void _add_global(const StringName &p_name, const Variant &p_value);
+
+ Mutex *lock;
+
+ SelfList<DLScript>::List script_list;
+
+ Map<String, DLLibrary *> initialized_libraries;
+
+ bool profiling;
+ uint64_t script_frame_time;
+
+ struct {
+
+ StringName _notification;
+
+ } strings;
+
+public:
+ _FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; }
+
+ virtual String get_name() const;
+
+ bool is_library_initialized(const String &p_path);
+ void set_library_initialized(const String &p_path, DLLibrary *p_dllibrary);
+ DLLibrary *get_library_dllibrary(const String &p_path);
+ void set_library_uninitialized(const String &p_path);
+
+ /* LANGUAGE FUNCTIONS */
+ virtual void init();
+ virtual String get_type() const;
+ virtual String get_extension() const;
+ virtual Error execute_file(const String &p_path);
+ virtual void finish();
+
+ /* EDITOR FUNCTIONS */
+
+ virtual void get_reserved_words(List<String> *p_words) const {};
+ virtual void get_comment_delimiters(List<String> *p_delimiters) const {};
+ virtual void get_string_delimiters(List<String> *p_delimiters) const {};
+ virtual Ref<Script> get_template(const String &p_class_name, const String &p_base_class_name) const;
+ virtual bool 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 = NULL) const;
+ virtual Script *create_script() const;
+ virtual bool has_named_classes() const;
+ virtual int find_function(const String &p_function, const String &p_code) const;
+ virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
+
+ virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, String &r_call_hint) { return ERR_UNAVAILABLE; }
+
+ virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result) { return ERR_UNAVAILABLE; }
+
+ 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);
+
+ /* MULTITHREAD FUNCTIONS */
+
+ //some VMs need to be notified of thread creation/exiting to allocate a stack
+ virtual void thread_enter() {}
+ virtual void thread_exit() {}
+
+ /* DEBUGGER FUNCTIONS */
+
+ virtual String debug_get_error() const;
+ virtual int debug_get_stack_level_count() const;
+ virtual int debug_get_stack_level_line(int p_level) const;
+ virtual String debug_get_stack_level_function(int p_level) const;
+ virtual String debug_get_stack_level_source(int p_level) const;
+ virtual void debug_get_stack_level_locals(int p_level, List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1){};
+ virtual void debug_get_stack_level_members(int p_level, List<String> *p_members, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+ virtual void debug_get_globals(List<String> *p_locals, List<Variant> *p_values, int p_max_subitems = -1, int p_max_depth = -1);
+ virtual String debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems = -1, int p_max_depth = -1);
+
+ virtual Vector<StackInfo> debug_get_current_stack_info() { return Vector<StackInfo>(); }
+
+ virtual void reload_all_scripts();
+ virtual void reload_tool_script(const Ref<Script> &p_script, bool p_soft_reload);
+ /* LOADER FUNCTIONS */
+
+ virtual void get_recognized_extensions(List<String> *p_extensions) const;
+ virtual void get_public_functions(List<MethodInfo> *p_functions) const;
+ virtual void get_public_constants(List<Pair<String, Variant> > *p_constants) const;
+
+ /* PROFILLER FUNCTIONS */
+
+ virtual void profiling_start();
+ virtual void profiling_stop();
+
+ virtual int profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max);
+ virtual int profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max);
+
+ virtual void frame();
+
+ static String get_init_symbol_name();
+ static String get_terminate_symbol_name();
+
+ /* HACKER FUNCTIONS */
+ void _compile_dummy_for_the_api();
+
+ DLScriptLanguage();
+ ~DLScriptLanguage();
+};
+
+class ResourceFormatLoaderDLScript : 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;
+ virtual bool handles_type(const String &p_type) const;
+ virtual String get_resource_type(const String &p_path) const;
+};
+
+class ResourceFormatSaverDLScript : 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
diff --git a/modules/dlscript/godot.cpp b/modules/dlscript/godot.cpp
new file mode 100644
index 0000000000..0e09a82de6
--- /dev/null
+++ b/modules/dlscript/godot.cpp
@@ -0,0 +1,202 @@
+/*************************************************************************/
+/* godot_c.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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.h"
+
+#include <cstdlib>
+
+#include "class_db.h"
+#include "dl_script.h"
+#include "global_config.h"
+#include "variant.h"
+
+#include <memory.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern "C" void _string_api_anchor();
+extern "C" void _vector2_api_anchor();
+extern "C" void _rect2_api_anchor();
+extern "C" void _vector3_api_anchor();
+extern "C" void _transform2d_api_anchor();
+extern "C" void _plane_api_anchor();
+extern "C" void _quat_api_anchor();
+extern "C" void _basis_api_anchor();
+extern "C" void _rect3_api_anchor();
+extern "C" void _transform_api_anchor();
+extern "C" void _color_api_anchor();
+extern "C" void _image_api_anchor();
+extern "C" void _node_path_api_anchor();
+extern "C" void _rid_api_anchor();
+extern "C" void _input_event_api_anchor();
+extern "C" void _dictionary_api_anchor();
+extern "C" void _array_api_anchor();
+extern "C" void _pool_arrays_api_anchor();
+extern "C" void _variant_api_anchor();
+
+void _api_anchor() {
+
+ _string_api_anchor();
+ _vector2_api_anchor();
+ _rect2_api_anchor();
+ _vector3_api_anchor();
+ _transform2d_api_anchor();
+ _plane_api_anchor();
+ _quat_api_anchor();
+ _rect3_api_anchor();
+ _basis_api_anchor();
+ _transform_api_anchor();
+ _color_api_anchor();
+ _image_api_anchor();
+ _node_path_api_anchor();
+ _rid_api_anchor();
+ _input_event_api_anchor();
+ _dictionary_api_anchor();
+ _array_api_anchor();
+ _pool_arrays_api_anchor();
+ _variant_api_anchor();
+}
+
+extern "C++" {
+template <class a, class b>
+_FORCE_INLINE_ a memcast(b v) {
+ return *((a *)&v);
+}
+}
+
+void GDAPI godot_object_destroy(godot_object *p_o) {
+ memdelete((Object *)p_o);
+}
+
+// Singleton API
+
+godot_object GDAPI *godot_global_get_singleton(char *p_name) {
+ return (godot_object *)GlobalConfig::get_singleton()->get_singleton_object(String(p_name));
+} // result shouldn't be freed
+
+// MethodBind API
+
+godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname) {
+
+ MethodBind *mb = ClassDB::get_method(StringName(p_classname), StringName(p_methodname));
+ // MethodBind *mb = ClassDB::get_method("Node", "get_name");
+ return (godot_method_bind *)mb;
+}
+
+void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret) {
+
+ MethodBind *mb = (MethodBind *)p_method_bind;
+ Object *o = (Object *)p_instance;
+ mb->ptrcall(o, p_args, p_ret);
+}
+
+// @Todo
+/*
+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();
+ if (!library) {
+ ERR_EXPLAIN("Attempt to register script after initializing library!");
+ ERR_FAIL();
+ }
+ library->_register_script(p_name, p_base, p_create_func, p_destroy_func);
+}
+
+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();
+ if (!library) {
+ ERR_EXPLAIN("Attempt to register script after initializing library!");
+ ERR_FAIL();
+ }
+ library->_register_tool_script(p_name, p_base, p_create_func, p_destroy_func);
+}
+
+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();
+ if (!library) {
+ ERR_EXPLAIN("Attempt to register script after initializing library!");
+ ERR_FAIL();
+ }
+ library->_register_script_method(p_name, p_function_name, p_attr, p_method, MethodInfo());
+}
+
+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();
+ if (!library) {
+ ERR_EXPLAIN("Attempt to register script after initializing library!");
+ ERR_FAIL();
+ }
+
+ library->_register_script_property(p_name, p_path, p_attr, p_set_func, p_get_func);
+}
+
+void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) {
+ DLLibrary *library = DLLibrary::get_currently_initialized_library();
+ if (!library) {
+ ERR_EXPLAIN("Attempt to register script after initializing library!");
+ ERR_FAIL();
+ }
+
+ library->_register_script_signal(p_name, p_signal);
+}
+
+void GDAPI *godot_dlinstance_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();
+ }
+ return NULL;
+}
+
+// System functions
+void GDAPI *godot_alloc(int p_bytes) {
+ return memalloc(p_bytes);
+}
+
+void GDAPI *godot_realloc(void *p_ptr, int p_bytes) {
+ return memrealloc(p_ptr, p_bytes);
+}
+
+void GDAPI godot_free(void *p_ptr) {
+ memfree(p_ptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot.h b/modules/dlscript/godot.h
new file mode 100644
index 0000000000..75f1f47ed1
--- /dev/null
+++ b/modules/dlscript/godot.h
@@ -0,0 +1,389 @@
+/*************************************************************************/
+/* godot_c.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* http://www.godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* */
+/* 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_C_H
+#define GODOT_C_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef GDAPI_BUILT_IN
+#define GDAPI_EXPORT
+#endif
+
+#if !defined(_WIN32) && !defined(_MSC_VER)
+#define GDAPI
+#elif defined(GDAPI_EXPORT)
+#define GDAPI __declspec(dllexport)
+#else
+#define GDAPI __declspec(dllimport)
+#endif
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#define GODOT_API_VERSION 1
+
+////// Error
+
+typedef enum godot_error {
+ GODOT_OK,
+ GODOT_FAILED, ///< Generic fail error
+ GODOT_ERR_UNAVAILABLE, ///< What is requested is unsupported/unavailable
+ GODOT_ERR_UNCONFIGURED, ///< The object being used hasnt been properly set up yet
+ GODOT_ERR_UNAUTHORIZED, ///< Missing credentials for requested resource
+ GODOT_ERR_PARAMETER_RANGE_ERROR, ///< Parameter given out of range (5)
+ GODOT_ERR_OUT_OF_MEMORY, ///< Out of memory
+ GODOT_ERR_FILE_NOT_FOUND,
+ GODOT_ERR_FILE_BAD_DRIVE,
+ GODOT_ERR_FILE_BAD_PATH,
+ GODOT_ERR_FILE_NO_PERMISSION, // (10)
+ GODOT_ERR_FILE_ALREADY_IN_USE,
+ GODOT_ERR_FILE_CANT_OPEN,
+ GODOT_ERR_FILE_CANT_WRITE,
+ GODOT_ERR_FILE_CANT_READ,
+ GODOT_ERR_FILE_UNRECOGNIZED, // (15)
+ GODOT_ERR_FILE_CORRUPT,
+ GODOT_ERR_FILE_MISSING_DEPENDENCIES,
+ GODOT_ERR_FILE_EOF,
+ GODOT_ERR_CANT_OPEN, ///< Can't open a resource/socket/file
+ GODOT_ERR_CANT_CREATE, // (20)
+ GODOT_ERR_QUERY_FAILED,
+ GODOT_ERR_ALREADY_IN_USE,
+ GODOT_ERR_LOCKED, ///< resource is locked
+ GODOT_ERR_TIMEOUT,
+ GODOT_ERR_CANT_CONNECT, // (25)
+ GODOT_ERR_CANT_RESOLVE,
+ GODOT_ERR_CONNECTION_ERROR,
+ GODOT_ERR_CANT_AQUIRE_RESOURCE,
+ GODOT_ERR_CANT_FORK,
+ GODOT_ERR_INVALID_DATA, ///< Data passed is invalid (30)
+ GODOT_ERR_INVALID_PARAMETER, ///< Parameter passed is invalid
+ GODOT_ERR_ALREADY_EXISTS, ///< When adding, item already exists
+ GODOT_ERR_DOES_NOT_EXIST, ///< When retrieving/erasing, it item does not exist
+ GODOT_ERR_DATABASE_CANT_READ, ///< database is full
+ GODOT_ERR_DATABASE_CANT_WRITE, ///< database is full (35)
+ GODOT_ERR_COMPILATION_FAILED,
+ GODOT_ERR_METHOD_NOT_FOUND,
+ GODOT_ERR_LINK_FAILED,
+ GODOT_ERR_SCRIPT_FAILED,
+ GODOT_ERR_CYCLIC_LINK, // (40)
+ GODOT_ERR_INVALID_DECLARATION,
+ GODOT_ERR_DUPLICATE_SYMBOL,
+ GODOT_ERR_PARSE_ERROR,
+ GODOT_ERR_BUSY,
+ GODOT_ERR_SKIP, // (45)
+ GODOT_ERR_HELP, ///< user requested help!!
+ GODOT_ERR_BUG, ///< a bug in the software certainly happened, due to a double check failing or unexpected behavior.
+ GODOT_ERR_PRINTER_ON_FIRE, /// the parallel port printer is engulfed in flames
+ GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD, ///< shit happens, has never been used, though
+ GODOT_ERR_WTF = GODOT_ERR_OMFG_THIS_IS_VERY_VERY_BAD ///< short version of the above
+} godot_error;
+
+////// bool
+
+typedef bool godot_bool;
+
+#define GODOT_TRUE 1
+#define GODOT_FALSE 0
+
+/////// int
+
+typedef int godot_int;
+
+/////// real
+
+typedef float godot_real;
+
+/////// Object (forward declared)
+typedef void godot_object;
+
+/////// String
+
+#include "godot/godot_string.h"
+
+////// Vector2
+
+#include "godot/godot_vector2.h"
+
+////// Rect2
+
+#include "godot/godot_rect2.h"
+
+////// Vector3
+
+#include "godot/godot_vector3.h"
+
+////// Transform2D
+
+#include "godot/godot_transform2d.h"
+
+/////// Plane
+
+#include "godot/godot_plane.h"
+
+/////// Quat
+
+#include "godot/godot_quat.h"
+
+/////// Rect3
+
+#include "godot/godot_rect3.h"
+
+/////// Basis
+
+#include "godot/godot_basis.h"
+
+/////// Transform
+
+#include "godot/godot_transform.h"
+
+/////// Color
+
+#include "godot/godot_color.h"
+
+/////// Image
+
+#include "godot/godot_image.h"
+
+/////// NodePath
+
+#include "godot/godot_node_path.h"
+
+/////// RID
+
+#include "godot/godot_rid.h"
+
+/////// InputEvent
+
+#include "godot/godot_input_event.h"
+
+/////// Dictionary
+
+#include "godot/godot_dictionary.h"
+
+/////// Array
+
+#include "godot/godot_array.h"
+
+// single API file for Pool*Array
+#include "godot/godot_pool_arrays.h"
+
+void GDAPI godot_object_destroy(godot_object *p_o);
+
+////// Variant
+
+#include "godot/godot_variant.h"
+
+////// Singleton API
+
+godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed
+
+////// MethodBind API
+
+typedef struct godot_method_bind {
+ uint8_t _dont_touch_that[1]; // TODO
+} godot_method_bind;
+
+godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname);
+void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret);
+
+////// Script API
+
+typedef struct godot_dlscript_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;
+
+typedef struct godot_dlscript_terminate_options {
+ godot_bool in_editor;
+} godot_dlscript_terminate_options;
+
+typedef enum godot_method_rpc_mode {
+ GODOT_METHOD_RPC_MODE_DISABLED,
+ GODOT_METHOD_RPC_MODE_REMOTE,
+ GODOT_METHOD_RPC_MODE_SYNC,
+ GODOT_METHOD_RPC_MODE_MASTER,
+ GODOT_METHOD_RPC_MODE_SLAVE,
+} godot_method_rpc_mode;
+
+typedef struct godot_method_attributes {
+ godot_method_rpc_mode rpc_type;
+} godot_method_attributes;
+
+typedef enum godot_property_hint {
+ GODOT_PROPERTY_HINT_NONE, ///< no hint provided.
+ GODOT_PROPERTY_HINT_RANGE, ///< hint_text = "min,max,step,slider; //slider is optional"
+ GODOT_PROPERTY_HINT_EXP_RANGE, ///< hint_text = "min,max,step", exponential edit
+ GODOT_PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
+ GODOT_PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
+ GODOT_PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
+ GODOT_PROPERTY_HINT_SPRITE_FRAME,
+ GODOT_PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
+ GODOT_PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
+ GODOT_PROPERTY_HINT_LAYERS_2D_RENDER,
+ GODOT_PROPERTY_HINT_LAYERS_2D_PHYSICS,
+ GODOT_PROPERTY_HINT_LAYERS_3D_RENDER,
+ GODOT_PROPERTY_HINT_LAYERS_3D_PHYSICS,
+ GODOT_PROPERTY_HINT_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
+ GODOT_PROPERTY_HINT_DIR, ///< a directort path must be passed
+ GODOT_PROPERTY_HINT_GLOBAL_FILE, ///< a file path must be passed, hint_text (optionally) is a filter "*.png,*.wav,*.doc,"
+ GODOT_PROPERTY_HINT_GLOBAL_DIR, ///< a directort path must be passed
+ GODOT_PROPERTY_HINT_RESOURCE_TYPE, ///< a resource object type
+ GODOT_PROPERTY_HINT_MULTILINE_TEXT, ///< used for string properties that can contain multiple lines
+ GODOT_PROPERTY_HINT_COLOR_NO_ALPHA, ///< used for ignoring alpha component when editing a color
+ GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSY,
+ GODOT_PROPERTY_HINT_IMAGE_COMPRESS_LOSSLESS,
+ GODOT_PROPERTY_HINT_OBJECT_ID,
+ GODOT_PROPERTY_HINT_TYPE_STRING, ///< a type string, the hint is the base type to choose
+ GODOT_PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE, ///< so something else can provide this (used in scripts)
+ GODOT_PROPERTY_HINT_METHOD_OF_VARIANT_TYPE, ///< a method of a type
+ GODOT_PROPERTY_HINT_METHOD_OF_BASE_TYPE, ///< a method of a base type
+ GODOT_PROPERTY_HINT_METHOD_OF_INSTANCE, ///< a method of an instance
+ GODOT_PROPERTY_HINT_METHOD_OF_SCRIPT, ///< a method of a script & base
+ GODOT_PROPERTY_HINT_PROPERTY_OF_VARIANT_TYPE, ///< a property of a type
+ GODOT_PROPERTY_HINT_PROPERTY_OF_BASE_TYPE, ///< a property of a base type
+ GODOT_PROPERTY_HINT_PROPERTY_OF_INSTANCE, ///< a property of an instance
+ GODOT_PROPERTY_HINT_PROPERTY_OF_SCRIPT, ///< a property of a script & base
+ GODOT_PROPERTY_HINT_MAX,
+} godot_property_hint;
+
+typedef enum godot_property_usage_flags {
+
+ GODOT_PROPERTY_USAGE_STORAGE = 1,
+ GODOT_PROPERTY_USAGE_EDITOR = 2,
+ GODOT_PROPERTY_USAGE_NETWORK = 4,
+ GODOT_PROPERTY_USAGE_EDITOR_HELPER = 8,
+ GODOT_PROPERTY_USAGE_CHECKABLE = 16, //used for editing global variables
+ GODOT_PROPERTY_USAGE_CHECKED = 32, //used for editing global variables
+ GODOT_PROPERTY_USAGE_INTERNATIONALIZED = 64, //hint for internationalized strings
+ GODOT_PROPERTY_USAGE_GROUP = 128, //used for grouping props in the editor
+ GODOT_PROPERTY_USAGE_CATEGORY = 256,
+ GODOT_PROPERTY_USAGE_STORE_IF_NONZERO = 512, //only store if nonzero
+ GODOT_PROPERTY_USAGE_STORE_IF_NONONE = 1024, //only store if false
+ GODOT_PROPERTY_USAGE_NO_INSTANCE_STATE = 2048,
+ GODOT_PROPERTY_USAGE_RESTART_IF_CHANGED = 4096,
+ GODOT_PROPERTY_USAGE_SCRIPT_VARIABLE = 8192,
+ GODOT_PROPERTY_USAGE_STORE_IF_NULL = 16384,
+ GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER = 32768,
+ GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED = 65536,
+
+ GODOT_PROPERTY_USAGE_DEFAULT = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK,
+ GODOT_PROPERTY_USAGE_DEFAULT_INTL = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_EDITOR | GODOT_PROPERTY_USAGE_NETWORK | GODOT_PROPERTY_USAGE_INTERNATIONALIZED,
+ GODOT_PROPERTY_USAGE_NOEDITOR = GODOT_PROPERTY_USAGE_STORAGE | GODOT_PROPERTY_USAGE_NETWORK,
+} godot_property_usage_flags;
+
+typedef struct godot_property_attributes {
+ godot_method_rpc_mode rset_type;
+
+ godot_int type;
+ godot_property_hint hint;
+ godot_string hint_string;
+ godot_property_usage_flags usage;
+ godot_variant default_value;
+} godot_property_attributes;
+
+typedef struct godot_instance_create_func {
+ // instance pointer, method_data - return user data
+ void *(*create_func)(godot_object *, void *);
+ void *method_data;
+ void (*free_func)(void *);
+} godot_script_instance_func;
+
+typedef struct godot_instance_destroy_func {
+ // instance pointer, method data, user data
+ void (*destroy_func)(godot_object *, void *, void *);
+ void *method_data;
+ 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);
+
+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);
+
+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 **);
+ void *method_data;
+ 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);
+ void *method_data;
+ 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 *);
+ void *method_data;
+ 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);
+
+typedef struct godot_signal_argument {
+ godot_string name;
+ godot_int type;
+ godot_property_hint hint;
+ godot_string hint_string;
+ godot_property_usage_flags usage;
+ godot_variant default_value;
+} godot_signal_argument;
+
+typedef struct godot_signal {
+ godot_string name;
+ int num_args;
+ godot_signal_argument *args;
+ int num_default_args;
+ godot_variant *default_args;
+} 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);
+
+////// System Functions
+
+//using these will help Godot track how much memory is in use in debug mode
+void GDAPI *godot_alloc(int p_bytes);
+void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
+void GDAPI godot_free(void *p_ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_C_H
diff --git a/modules/dlscript/godot/godot_array.cpp b/modules/dlscript/godot/godot_array.cpp
new file mode 100644
index 0000000000..21ad97ca78
--- /dev/null
+++ b/modules/dlscript/godot/godot_array.cpp
@@ -0,0 +1,271 @@
+#include "godot_array.h"
+
+#include "core/array.h"
+#include "core/os/memory.h"
+
+#include "core/color.h"
+#include "core/dvector.h"
+
+#include "core/variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _array_api_anchor() {
+}
+
+void GDAPI godot_array_new(godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ memnew_placement(a, Array);
+}
+
+void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca) {
+ Array *a = (Array *)p_arr;
+ PoolVector<Color> *pca = (PoolVector<Color> *)p_pca;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a) {
+ Array *a = (Array *)p_arr;
+ PoolVector<Vector3> *pca = (PoolVector<Vector3> *)p_pv3a;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a) {
+ Array *a = (Array *)p_arr;
+ PoolVector<Vector2> *pca = (PoolVector<Vector2> *)p_pv2a;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa) {
+ Array *a = (Array *)p_arr;
+ PoolVector<String> *pca = (PoolVector<String> *)p_psa;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra) {
+ Array *a = (Array *)p_arr;
+ PoolVector<godot_real> *pca = (PoolVector<godot_real> *)p_pra;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia) {
+ Array *a = (Array *)p_arr;
+ PoolVector<godot_int> *pca = (PoolVector<godot_int> *)p_pia;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba) {
+ Array *a = (Array *)p_arr;
+ PoolVector<uint8_t> *pca = (PoolVector<uint8_t> *)p_pba;
+ memnew_placement(a, Array);
+ a->resize(pca->size());
+
+ for (size_t i = 0; i < a->size(); i++) {
+ Variant v = pca->operator[](i);
+ a->operator[](i) = v;
+ }
+}
+
+void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ a->operator[](p_idx) = *val;
+}
+
+godot_variant GDAPI *godot_array_get(godot_array *p_arr, const godot_int p_idx) {
+ Array *a = (Array *)p_arr;
+ return (godot_variant *)&a->operator[](p_idx);
+}
+
+void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ a->append(*val);
+}
+
+void GDAPI godot_array_clear(godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ a->clear();
+}
+
+godot_int GDAPI godot_array_count(godot_array *p_arr, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ return a->count(*val);
+}
+
+godot_bool GDAPI godot_array_empty(const godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ return a->empty();
+}
+
+void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ a->erase(*val);
+}
+
+godot_variant GDAPI godot_array_front(const godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ godot_variant v;
+ Variant *val = (Variant *)&v;
+ memnew_placement(val, Variant);
+ *val = a->front();
+ return v;
+}
+
+godot_variant GDAPI godot_array_back(const godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ godot_variant v;
+ Variant *val = (Variant *)&v;
+ memnew_placement(val, Variant);
+ *val = a->back();
+ return v;
+}
+
+godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_what;
+ return a->find(*val, p_from);
+}
+
+godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_what;
+ return a->find_last(*val);
+}
+
+godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ return a->has(*val);
+}
+
+uint32_t GDAPI godot_array_hash(const godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ return a->hash();
+}
+
+void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ a->insert(p_pos, *val);
+}
+
+void GDAPI godot_array_invert(godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ a->invert();
+}
+
+godot_bool GDAPI godot_array_is_shared(const godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ return false; // @Todo how do I do it?
+}
+
+godot_variant GDAPI godot_array_pop_back(godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ godot_variant v;
+ Variant *val = (Variant *)&v;
+ memnew_placement(val, Variant);
+ *val = a->pop_back();
+ return v;
+}
+
+godot_variant GDAPI godot_array_pop_front(godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ godot_variant v;
+ Variant *val = (Variant *)&v;
+ memnew_placement(val, Variant);
+ *val = a->pop_front();
+ return v;
+}
+
+void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ a->push_back(*val);
+}
+
+void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_value;
+ a->push_front(*val);
+}
+
+void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx) {
+ Array *a = (Array *)p_arr;
+ a->remove(p_idx);
+}
+
+void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size) {
+ Array *a = (Array *)p_arr;
+ a->resize(p_size);
+}
+
+godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from) {
+ Array *a = (Array *)p_arr;
+ Variant *val = (Variant *)p_what;
+ return a->rfind(*val, p_from);
+}
+
+godot_int GDAPI godot_array_size(const godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ return a->size();
+}
+
+void GDAPI godot_array_sort(godot_array *p_arr) {
+ Array *a = (Array *)p_arr;
+ a->sort();
+}
+
+void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func) {
+ Array *a = (Array *)p_arr;
+ String *func = (String *)p_func;
+ a->sort_custom((Object *)p_obj, *func);
+}
+
+void GDAPI godot_array_destroy(godot_array *p_arr) {
+ ((Array *)p_arr)->~Array();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_array.h b/modules/dlscript/godot/godot_array.h
new file mode 100644
index 0000000000..544e95a2ed
--- /dev/null
+++ b/modules/dlscript/godot/godot_array.h
@@ -0,0 +1,88 @@
+#ifndef GODOT_DLSCRIPT_ARRAY_H
+#define GODOT_DLSCRIPT_ARRAY_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED
+typedef struct godot_array {
+ uint8_t _dont_touch_that[8];
+} godot_array;
+#endif
+
+#include "../godot.h"
+
+#include "godot_pool_arrays.h"
+#include "godot_variant.h"
+
+void GDAPI godot_array_new(godot_array *p_arr);
+void GDAPI godot_array_new_pool_color_array(godot_array *p_arr, const godot_pool_color_array *p_pca);
+void GDAPI godot_array_new_pool_vector3_array(godot_array *p_arr, const godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_array_new_pool_vector2_array(godot_array *p_arr, const godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_array_new_pool_string_array(godot_array *p_arr, const godot_pool_string_array *p_psa);
+void GDAPI godot_array_new_pool_real_array(godot_array *p_arr, const godot_pool_real_array *p_pra);
+void GDAPI godot_array_new_pool_int_array(godot_array *p_arr, const godot_pool_int_array *p_pia);
+void GDAPI godot_array_new_pool_byte_array(godot_array *p_arr, const godot_pool_byte_array *p_pba);
+
+void GDAPI godot_array_set(godot_array *p_arr, const godot_int p_idx, const godot_variant *p_value);
+
+godot_variant GDAPI *godot_array_get(godot_array *p_arr, const godot_int p_idx);
+
+void GDAPI godot_array_append(godot_array *p_arr, const godot_variant *p_value);
+
+void GDAPI godot_array_clear(godot_array *p_arr);
+
+godot_int GDAPI godot_array_count(godot_array *p_arr, const godot_variant *p_value);
+
+godot_bool GDAPI godot_array_empty(const godot_array *p_arr);
+
+void GDAPI godot_array_erase(godot_array *p_arr, const godot_variant *p_value);
+
+godot_variant GDAPI godot_array_front(const godot_array *p_arr);
+
+godot_variant GDAPI godot_array_back(const godot_array *p_arr);
+
+godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from);
+
+godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what);
+
+godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value);
+
+uint32_t GDAPI godot_array_hash(const godot_array *p_arr);
+
+void GDAPI godot_array_insert(godot_array *p_arr, const godot_int p_pos, const godot_variant *p_value);
+
+void GDAPI godot_array_invert(godot_array *p_arr);
+
+godot_bool GDAPI godot_array_is_shared(const godot_array *p_arr);
+
+godot_variant GDAPI godot_array_pop_back(godot_array *p_arr);
+
+godot_variant GDAPI godot_array_pop_front(godot_array *p_arr);
+
+void GDAPI godot_array_push_back(godot_array *p_arr, const godot_variant *p_value);
+
+void GDAPI godot_array_push_front(godot_array *p_arr, const godot_variant *p_value);
+
+void GDAPI godot_array_remove(godot_array *p_arr, const godot_int p_idx);
+
+void GDAPI godot_array_resize(godot_array *p_arr, const godot_int p_size);
+
+godot_int GDAPI godot_array_rfind(const godot_array *p_arr, const godot_variant *p_what, const godot_int p_from);
+
+godot_int GDAPI godot_array_size(const godot_array *p_arr);
+
+void GDAPI godot_array_sort(godot_array *p_arr);
+
+void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, const godot_string *p_func);
+
+void GDAPI godot_array_destroy(godot_array *p_arr);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_ARRAY_H
diff --git a/modules/dlscript/godot/godot_basis.cpp b/modules/dlscript/godot/godot_basis.cpp
new file mode 100644
index 0000000000..813a531de5
--- /dev/null
+++ b/modules/dlscript/godot/godot_basis.cpp
@@ -0,0 +1,58 @@
+#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
new file mode 100644
index 0000000000..43efd65ea2
--- /dev/null
+++ b/modules/dlscript/godot/godot_basis.h
@@ -0,0 +1,34 @@
+#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
new file mode 100644
index 0000000000..7e49565d40
--- /dev/null
+++ b/modules/dlscript/godot/godot_color.cpp
@@ -0,0 +1,34 @@
+#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
new file mode 100644
index 0000000000..72e16a2c5a
--- /dev/null
+++ b/modules/dlscript/godot/godot_color.h
@@ -0,0 +1,29 @@
+#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.cpp b/modules/dlscript/godot/godot_dictionary.cpp
new file mode 100644
index 0000000000..9147b17307
--- /dev/null
+++ b/modules/dlscript/godot/godot_dictionary.cpp
@@ -0,0 +1,109 @@
+#include "godot_dictionary.h"
+
+#include "core/dictionary.h"
+
+#include "core/os/memory.h"
+
+#include "core/io/json.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _dictionary_api_anchor() {
+}
+
+void GDAPI godot_dictionary_new(godot_dictionary *p_dict) {
+ Dictionary *dict = (Dictionary *)p_dict;
+ memnew_placement(dict, Dictionary);
+}
+
+void GDAPI godot_dictionary_clear(godot_dictionary *p_dict) {
+ Dictionary *dict = (Dictionary *)p_dict;
+ dict->clear();
+}
+
+godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict) {
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ return dict->empty();
+}
+
+void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key) {
+ Dictionary *dict = (Dictionary *)p_dict;
+ Variant *key = (Variant *)p_key;
+ dict->erase(*key);
+}
+
+godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key) {
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ const Variant *key = (const Variant *)p_key;
+ return dict->has(*key);
+}
+
+godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys) {
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ const Array *keys = (const Array *)p_keys;
+ return dict->has_all(*keys);
+}
+
+uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict) {
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ return dict->hash();
+}
+
+godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict) {
+ godot_array a;
+ godot_array_new(&a);
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ Array *array = (Array *)&a;
+ *array = dict->keys();
+ return a;
+}
+
+godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json) {
+ Dictionary *dict = (Dictionary *)p_dict;
+ const String *json = (const String *)p_json;
+ Variant ret;
+ int err_line;
+ String err_str;
+ int err = (int)JSON::parse(*json, ret, err_str, err_line);
+ *dict = ret;
+ return err;
+}
+
+godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key) {
+ Dictionary *dict = (Dictionary *)p_dict;
+ Variant *key = (Variant *)p_key;
+ return (godot_variant *)&dict->operator[](*key);
+}
+
+godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict) {
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ return dict->size();
+}
+
+godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict) {
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ godot_string str;
+ godot_string_new(&str);
+ String *s = (String *)&str;
+ *s = JSON::print(Variant(*dict));
+ return str;
+}
+
+godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict) {
+ godot_array a;
+ godot_array_new(&a);
+ const Dictionary *dict = (const Dictionary *)p_dict;
+ Array *array = (Array *)&a;
+ *array = dict->values();
+ return a;
+}
+
+void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict) {
+ ((Dictionary *)p_dict)->~Dictionary();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_dictionary.h b/modules/dlscript/godot/godot_dictionary.h
new file mode 100644
index 0000000000..5f86cbca5a
--- /dev/null
+++ b/modules/dlscript/godot/godot_dictionary.h
@@ -0,0 +1,51 @@
+#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_image.cpp b/modules/dlscript/godot/godot_image.cpp
new file mode 100644
index 0000000000..362d1aa3e6
--- /dev/null
+++ b/modules/dlscript/godot/godot_image.cpp
@@ -0,0 +1,85 @@
+#include "godot_image.h"
+
+#include "image.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _image_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+void GDAPI godot_image_new(godot_image *p_img) {
+ Image *img = (Image *)p_img;
+ memnew_placement_custom(img, Image, Image());
+}
+
+void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len) {
+ Image *img = (Image *)p_img;
+ memnew_placement_custom(img, Image, Image(p_mem_png_jpg, p_len));
+}
+
+void GDAPI godot_image_new_with_xpm(godot_image *p_img, const char **p_xpm) {
+ Image *img = (Image *)p_img;
+ memnew_placement_custom(img, Image, Image(p_xpm));
+}
+
+void GDAPI godot_image_new_with_size_format(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format) {
+ Image *img = (Image *)p_img;
+ memnew_placement_custom(img, Image, Image(p_width, p_height, p_use_mipmaps, (Image::Format)p_format));
+}
+
+void GDAPI godot_image_new_with_size_format_data(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format, godot_pool_byte_array *p_data) {
+ Image *img = (Image *)p_img;
+ PoolVector<uint8_t> *data = (PoolVector<uint8_t> *)p_data;
+ memnew_placement_custom(img, Image, Image(p_width, p_height, p_use_mipmaps, (Image::Format)p_format, *data));
+}
+
+godot_pool_byte_array GDAPI godot_image_get_data(godot_image *p_img) {
+ Image *img = (Image *)p_img;
+ PoolVector<uint8_t> cpp_data = img->get_data();
+ godot_pool_byte_array *data = (godot_pool_byte_array *)&cpp_data;
+ return *data;
+}
+
+godot_error GDAPI godot_image_load(godot_image *p_img, const godot_string *p_path) {
+ Image *img = (Image *)p_img;
+ String *path = (String *)p_path;
+ return (godot_error)img->load(*path);
+}
+
+godot_error GDAPI godot_image_save_png(godot_image *p_img, const godot_string *p_path) {
+ Image *img = (Image *)p_img;
+ String *path = (String *)p_path;
+ return (godot_error)img->save_png(*path);
+}
+
+int GDAPI godot_image_get_width(const godot_image *p_img) {
+ Image *img = (Image *)p_img;
+ return img->get_width();
+}
+
+int GDAPI godot_image_get_height(const godot_image *p_img) {
+ Image *img = (Image *)p_img;
+ return img->get_height();
+}
+
+godot_bool GDAPI godot_image_has_mipmaps(const godot_image *p_img) {
+ Image *img = (Image *)p_img;
+ return img->has_mipmaps();
+}
+
+int GDAPI godot_image_get_mipmap_count(const godot_image *p_img) {
+ Image *img = (Image *)p_img;
+ return img->get_mipmap_count();
+}
+
+void GDAPI godot_image_destroy(godot_image *p_img) {
+ ((Image *)p_img)->~Image();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_image.h b/modules/dlscript/godot/godot_image.h
new file mode 100644
index 0000000000..78593f21a7
--- /dev/null
+++ b/modules/dlscript/godot/godot_image.h
@@ -0,0 +1,95 @@
+#ifndef GODOT_DLSCRIPT_IMAGE_H
+#define GODOT_DLSCRIPT_IMAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_IMAGE_TYPE_DEFINED
+typedef struct godot_image {
+ uint8_t _dont_touch_that[32];
+} godot_image;
+#endif
+
+#include "godot_pool_arrays.h"
+
+#include "../godot.h"
+
+// This is a copypasta of the C++ enum inside the Image class
+// There's no neat way of automatically updating the C enum / using the C++ enum directly
+// if somebody knows a way feel free to open a PR or open an issue (or ask for Karroffel or bojidar-bg on IRC)
+
+enum godot_image_format {
+
+ GODOT_IMAGE_FORMAT_L8, //luminance
+ GODOT_IMAGE_FORMAT_LA8, //luminance-alpha
+ GODOT_IMAGE_FORMAT_R8,
+ GODOT_IMAGE_FORMAT_RG8,
+ GODOT_IMAGE_FORMAT_RGB8,
+ GODOT_IMAGE_FORMAT_RGBA8,
+ GODOT_IMAGE_FORMAT_RGB565, //16 bit
+ GODOT_IMAGE_FORMAT_RGBA4444,
+ GODOT_IMAGE_FORMAT_RGBA5551,
+ GODOT_IMAGE_FORMAT_RF, //float
+ GODOT_IMAGE_FORMAT_RGF,
+ GODOT_IMAGE_FORMAT_RGBF,
+ GODOT_IMAGE_FORMAT_RGBAF,
+ GODOT_IMAGE_FORMAT_RH, //half float
+ GODOT_IMAGE_FORMAT_RGH,
+ GODOT_IMAGE_FORMAT_RGBH,
+ GODOT_IMAGE_FORMAT_RGBAH,
+ GODOT_IMAGE_FORMAT_DXT1, //s3tc bc1
+ GODOT_IMAGE_FORMAT_DXT3, //bc2
+ GODOT_IMAGE_FORMAT_DXT5, //bc3
+ GODOT_IMAGE_FORMAT_ATI1, //bc4
+ GODOT_IMAGE_FORMAT_ATI2, //bc5
+ GODOT_IMAGE_FORMAT_BPTC_RGBA, //btpc bc6h
+ GODOT_IMAGE_FORMAT_BPTC_RGBF, //float /
+ GODOT_IMAGE_FORMAT_BPTC_RGBFU, //unsigned float
+ GODOT_IMAGE_FORMAT_PVRTC2, //pvrtc
+ GODOT_IMAGE_FORMAT_PVRTC2A,
+ GODOT_IMAGE_FORMAT_PVRTC4,
+ GODOT_IMAGE_FORMAT_PVRTC4A,
+ GODOT_IMAGE_FORMAT_ETC, //etc1
+ GODOT_IMAGE_FORMAT_ETC2_R11, //etc2
+ GODOT_IMAGE_FORMAT_ETC2_R11S, //signed, NOT srgb.
+ GODOT_IMAGE_FORMAT_ETC2_RG11,
+ GODOT_IMAGE_FORMAT_ETC2_RG11S,
+ GODOT_IMAGE_FORMAT_ETC2_RGB8,
+ GODOT_IMAGE_FORMAT_ETC2_RGBA8,
+ GODOT_IMAGE_FORMAT_ETC2_RGB8A1,
+ GODOT_IMAGE_FORMAT_MAX
+};
+typedef enum godot_image_format godot_image_format;
+
+void GDAPI godot_image_new(godot_image *p_img);
+// p_len can be -1
+void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len);
+void GDAPI godot_image_new_with_xpm(godot_image *p_img, const char **p_xpm);
+
+void GDAPI godot_image_new_with_size_format(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format);
+void GDAPI godot_image_new_with_size_format_data(godot_image *p_img, int p_width, int p_height, bool p_use_mipmaps, godot_image_format p_format, godot_pool_byte_array *p_data);
+
+godot_pool_byte_array GDAPI godot_image_get_data(godot_image *p_img);
+
+godot_error GDAPI godot_image_load(godot_image *p_img, const godot_string *p_path);
+godot_error GDAPI godot_image_save_png(godot_image *p_img, const godot_string *p_path);
+
+int GDAPI godot_image_get_width(const godot_image *p_img);
+int GDAPI godot_image_get_height(const godot_image *p_img);
+godot_bool GDAPI godot_image_has_mipmaps(const godot_image *p_img);
+int GDAPI godot_image_get_mipmap_count(const godot_image *p_img);
+
+// @Incomplete
+// I think it's too complex for the binding authors to implement the image class anew, so we should definitely
+// export all methods here. That takes a while so it's on my @Todo list
+
+void GDAPI godot_image_destroy(godot_image *p_img);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_IMAGE_H
diff --git a/modules/dlscript/godot/godot_input_event.cpp b/modules/dlscript/godot/godot_input_event.cpp
new file mode 100644
index 0000000000..b50ed8a22d
--- /dev/null
+++ b/modules/dlscript/godot/godot_input_event.cpp
@@ -0,0 +1,280 @@
+#include "godot_input_event.h"
+
+#include "os/input_event.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _input_event_api_anchor() {
+}
+
+void GDAPI godot_input_event_new(godot_input_event *p_ie) {
+ InputEvent *ie = (InputEvent *)p_ie;
+ *ie = InputEvent();
+}
+
+godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie) {
+ const InputEvent *ie = (const InputEvent *)p_ie;
+ return ie->is_pressed();
+}
+
+godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action) {
+ const InputEvent *ie = (const InputEvent *)p_ie;
+ const String *action = (const String *)p_action;
+ return ie->is_action(*action);
+}
+
+godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action) {
+ const InputEvent *ie = (const InputEvent *)p_ie;
+ const String *action = (const String *)p_action;
+ return ie->is_action_pressed(*action);
+}
+
+godot_bool GDAPI godot_input_event_is_action_released(const godot_input_event *p_ie, const godot_string *p_action) {
+ const InputEvent *ie = (const InputEvent *)p_ie;
+ const String *action = (const String *)p_action;
+ return ie->is_action_released(*action);
+}
+
+godot_bool GDAPI godot_input_event_is_echo(const godot_input_event *p_ie) {
+ const InputEvent *ie = (const InputEvent *)p_ie;
+ return ie->is_echo();
+}
+
+void GDAPI godot_input_event_set_as_action(godot_input_event *p_ie, const godot_string *p_action, const godot_bool p_pressed) {
+ InputEvent *ie = (InputEvent *)p_ie;
+ const String *action = (const String *)p_action;
+ return ie->set_as_action(*action, p_pressed);
+}
+
+godot_string GDAPI godot_input_event_as_string(const godot_input_event *p_ie) {
+ const InputEvent *ie = (const InputEvent *)p_ie;
+ godot_string str;
+ String *s = (String *)&str;
+ memnew_placement(s, String);
+ *s = (String)*ie;
+ return str;
+}
+
+uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie) {
+ InputEvent *ie = (InputEvent *)p_ie;
+ return &ie->ID;
+}
+
+godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie) {
+ InputEvent *ie = (InputEvent *)p_ie;
+ return (godot_input_event_type *)&ie->type;
+}
+
+godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie) {
+ InputEvent *ie = (InputEvent *)p_ie;
+ return &ie->device;
+}
+
+static InputModifierState *_get_mod_for_type(InputEvent *ie) {
+ switch (ie->type) {
+ case InputEvent::MOUSE_BUTTON:
+ return &ie->mouse_button.mod;
+ case InputEvent::MOUSE_MOTION:
+ return &ie->mouse_motion.mod;
+ case InputEvent::KEY:
+ return &ie->key.mod;
+ default:
+ return 0;
+ }
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ InputModifierState *mod = _get_mod_for_type(ie);
+ return &mod->alt;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ InputModifierState *mod = _get_mod_for_type(ie);
+ return &mod->control;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ InputModifierState *mod = _get_mod_for_type(ie);
+ return &mod->command;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_shift(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ InputModifierState *mod = _get_mod_for_type(ie);
+ return &mod->shift;
+}
+
+godot_bool GDAPI *godot_input_event_mod_get_meta(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ InputModifierState *mod = _get_mod_for_type(ie);
+ return &mod->meta;
+}
+
+uint32_t GDAPI *godot_input_event_key_get_scancode(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->key.scancode;
+}
+
+uint32_t GDAPI *godot_input_event_key_get_unicode(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->key.unicode;
+}
+
+godot_bool GDAPI *godot_input_event_key_get_pressed(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->key.pressed;
+}
+
+godot_bool GDAPI *godot_input_event_key_get_echo(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->key.echo;
+}
+
+float GDAPI *godot_input_event_mouse_get_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.x;
+}
+
+float GDAPI *godot_input_event_mouse_get_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.y;
+}
+
+float GDAPI *godot_input_event_mouse_get_global_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.global_x;
+}
+
+float GDAPI *godot_input_event_mouse_get_global_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.global_y;
+}
+
+godot_int GDAPI *godot_input_event_mouse_get_button_mask(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.button_mask;
+}
+
+godot_int GDAPI *godot_input_event_mouse_button_get_button_index(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.button_index;
+}
+
+godot_bool GDAPI *godot_input_event_mouse_button_get_pressed(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.pressed;
+}
+
+godot_bool GDAPI *godot_input_event_mouse_button_get_doubleclick(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_button.doubleclick;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_relative_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_motion.relative_x;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_relative_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_motion.relative_y;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_speed_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_motion.speed_x;
+}
+
+float GDAPI *godot_input_event_mouse_motion_get_speed_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->mouse_motion.speed_y;
+}
+
+godot_int GDAPI *godot_input_event_joypad_motion_get_axis(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->joy_motion.axis;
+}
+
+float GDAPI *godot_input_event_joypad_motion_get_axis_value(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->joy_motion.axis_value;
+}
+
+godot_int GDAPI *godot_input_event_joypad_button_get_button_index(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->joy_button.button_index;
+}
+
+godot_bool GDAPI *godot_input_event_joypad_button_get_pressed(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->joy_button.pressed;
+}
+
+float GDAPI *godot_input_event_joypad_button_get_pressure(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->joy_button.pressure;
+}
+
+godot_int GDAPI *godot_input_event_screen_touch_get_index(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_touch.index;
+}
+
+float GDAPI *godot_input_event_screen_touch_get_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_touch.x;
+}
+
+float GDAPI *godot_input_event_screen_touch_get_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_touch.y;
+}
+
+godot_bool GDAPI *godot_input_event_screen_touch_get_pressed(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_touch.pressed;
+}
+
+godot_int GDAPI *godot_input_event_screen_drag_get_index(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.index;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.x;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.y;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_relative_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.relative_x;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.relative_y;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.speed_x;
+}
+
+float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event) {
+ InputEvent *ie = (InputEvent *)p_event;
+ return &ie->screen_drag.speed_y;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_input_event.h b/modules/dlscript/godot/godot_input_event.h
new file mode 100644
index 0000000000..bfda18bf7c
--- /dev/null
+++ b/modules/dlscript/godot/godot_input_event.h
@@ -0,0 +1,206 @@
+#ifndef GODOT_DLSCRIPT_INPUT_EVENT_H
+#define GODOT_DLSCRIPT_INPUT_EVENT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_INPUT_EVENT_TYPE_DEFINED
+typedef struct godot_input_event {
+ uint8_t _dont_touch_that[56];
+} godot_input_event;
+#endif
+
+enum godot_input_event_type {
+ GODOT_INPUT_EVENT_TYPE_NONE,
+ GODOT_INPUT_EVENT_TYPE_KEY,
+ GODOT_INPUT_EVENT_TYPE_MOUSE_MOTION,
+ GODOT_INPUT_EVENT_TYPE_MOUSE_BUTTON,
+ GODOT_INPUT_EVENT_TYPE_JOYPAD_MOTION,
+ GODOT_INPUT_EVENT_TYPE_JOYPAD_BUTTON,
+ GODOT_INPUT_EVENT_TYPE_SCREEN_TOUCH,
+ GODOT_INPUT_EVENT_TYPE_SCREEN_DRAG,
+ GODOT_INPUT_EVENT_TYPE_ACTION,
+ GODOT_INPUT_EVENT_TYPE_TYPE_MAX
+};
+typedef enum godot_input_event_type godot_input_event_type;
+
+enum {
+ GODOT_BUTTON_LEFT = 1,
+ GODOT_BUTTON_RIGHT = 2,
+ GODOT_BUTTON_MIDDLE = 3,
+ GODOT_BUTTON_WHEEL_UP = 4,
+ GODOT_BUTTON_WHEEL_DOWN = 5,
+ GODOT_BUTTON_WHEEL_LEFT = 6,
+ GODOT_BUTTON_WHEEL_RIGHT = 7,
+ GODOT_BUTTON_MASK_LEFT = (1 << (GODOT_BUTTON_LEFT - 1)),
+ GODOT_BUTTON_MASK_RIGHT = (1 << (GODOT_BUTTON_RIGHT - 1)),
+ GODOT_BUTTON_MASK_MIDDLE = (1 << (GODOT_BUTTON_MIDDLE - 1)),
+
+};
+
+enum {
+
+ GODOT_JOY_BUTTON_0 = 0,
+ GODOT_JOY_BUTTON_1 = 1,
+ GODOT_JOY_BUTTON_2 = 2,
+ GODOT_JOY_BUTTON_3 = 3,
+ GODOT_JOY_BUTTON_4 = 4,
+ GODOT_JOY_BUTTON_5 = 5,
+ GODOT_JOY_BUTTON_6 = 6,
+ GODOT_JOY_BUTTON_7 = 7,
+ GODOT_JOY_BUTTON_8 = 8,
+ GODOT_JOY_BUTTON_9 = 9,
+ GODOT_JOY_BUTTON_10 = 10,
+ GODOT_JOY_BUTTON_11 = 11,
+ GODOT_JOY_BUTTON_12 = 12,
+ GODOT_JOY_BUTTON_13 = 13,
+ GODOT_JOY_BUTTON_14 = 14,
+ GODOT_JOY_BUTTON_15 = 15,
+ GODOT_JOY_BUTTON_MAX = 16,
+
+ GODOT_JOY_L = GODOT_JOY_BUTTON_4,
+ GODOT_JOY_R = GODOT_JOY_BUTTON_5,
+ GODOT_JOY_L2 = GODOT_JOY_BUTTON_6,
+ GODOT_JOY_R2 = GODOT_JOY_BUTTON_7,
+ GODOT_JOY_L3 = GODOT_JOY_BUTTON_8,
+ GODOT_JOY_R3 = GODOT_JOY_BUTTON_9,
+ GODOT_JOY_SELECT = GODOT_JOY_BUTTON_10,
+ GODOT_JOY_START = GODOT_JOY_BUTTON_11,
+ GODOT_JOY_DPAD_UP = GODOT_JOY_BUTTON_12,
+ GODOT_JOY_DPAD_DOWN = GODOT_JOY_BUTTON_13,
+ GODOT_JOY_DPAD_LEFT = GODOT_JOY_BUTTON_14,
+ GODOT_JOY_DPAD_RIGHT = GODOT_JOY_BUTTON_15,
+
+ // a little history about game controllers (who copied who)
+
+ GODOT_JOY_SNES_B = GODOT_JOY_BUTTON_0,
+ GODOT_JOY_SNES_A = GODOT_JOY_BUTTON_1,
+ GODOT_JOY_SNES_Y = GODOT_JOY_BUTTON_2,
+ GODOT_JOY_SNES_X = GODOT_JOY_BUTTON_3,
+
+ GODOT_JOY_SONY_CIRCLE = GODOT_JOY_SNES_A,
+ GODOT_JOY_SONY_X = GODOT_JOY_SNES_B,
+ GODOT_JOY_SONY_SQUARE = GODOT_JOY_SNES_Y,
+ GODOT_JOY_SONY_TRIANGLE = GODOT_JOY_SNES_X,
+
+ GODOT_JOY_SEGA_B = GODOT_JOY_SNES_A,
+ GODOT_JOY_SEGA_A = GODOT_JOY_SNES_B,
+ GODOT_JOY_SEGA_X = GODOT_JOY_SNES_Y,
+ GODOT_JOY_SEGA_Y = GODOT_JOY_SNES_X,
+
+ GODOT_JOY_XBOX_B = GODOT_JOY_SEGA_B,
+ GODOT_JOY_XBOX_A = GODOT_JOY_SEGA_A,
+ GODOT_JOY_XBOX_X = GODOT_JOY_SEGA_X,
+ GODOT_JOY_XBOX_Y = GODOT_JOY_SEGA_Y,
+
+ GODOT_JOY_DS_A = GODOT_JOY_SNES_A,
+ GODOT_JOY_DS_B = GODOT_JOY_SNES_B,
+ GODOT_JOY_DS_X = GODOT_JOY_SNES_X,
+ GODOT_JOY_DS_Y = GODOT_JOY_SNES_Y,
+
+ GODOT_JOY_WII_C = GODOT_JOY_BUTTON_5,
+ GODOT_JOY_WII_Z = GODOT_JOY_BUTTON_6,
+
+ GODOT_JOY_WII_MINUS = GODOT_JOY_BUTTON_9,
+ GODOT_JOY_WII_PLUS = GODOT_JOY_BUTTON_10,
+
+ // end of history
+
+ GODOT_JOY_AXIS_0 = 0,
+ GODOT_JOY_AXIS_1 = 1,
+ GODOT_JOY_AXIS_2 = 2,
+ GODOT_JOY_AXIS_3 = 3,
+ GODOT_JOY_AXIS_4 = 4,
+ GODOT_JOY_AXIS_5 = 5,
+ GODOT_JOY_AXIS_6 = 6,
+ GODOT_JOY_AXIS_7 = 7,
+ GODOT_JOY_AXIS_MAX = 8,
+
+ GODOT_JOY_ANALOG_0_X = GODOT_JOY_AXIS_0,
+ GODOT_JOY_ANALOG_0_Y = GODOT_JOY_AXIS_1,
+
+ GODOT_JOY_ANALOG_1_X = GODOT_JOY_AXIS_2,
+ GODOT_JOY_ANALOG_1_Y = GODOT_JOY_AXIS_3,
+
+ GODOT_JOY_ANALOG_2_X = GODOT_JOY_AXIS_4,
+ GODOT_JOY_ANALOG_2_Y = GODOT_JOY_AXIS_5,
+
+ GODOT_JOY_ANALOG_L2 = GODOT_JOY_AXIS_6,
+ GODOT_JOY_ANALOG_R2 = GODOT_JOY_AXIS_7,
+};
+
+#include "../godot.h"
+
+void GDAPI godot_input_event_new(godot_input_event *p_ie);
+
+godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie);
+godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action);
+godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action);
+godot_bool GDAPI godot_input_event_is_action_released(const godot_input_event *p_ie, const godot_string *p_action);
+godot_bool GDAPI godot_input_event_is_echo(const godot_input_event *p_ie);
+void GDAPI godot_input_event_set_as_action(godot_input_event *p_ie, const godot_string *p_action, const godot_bool p_pressed);
+
+godot_string GDAPI godot_input_event_as_string(const godot_input_event *p_ie);
+
+// Note:
+// We're returning pointers to the fields in the unions.
+// This is because I'm too lazy to write setter functions
+
+uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie);
+godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie);
+godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie);
+
+godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_shift(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mod_get_meta(godot_input_event *p_event);
+
+uint32_t GDAPI *godot_input_event_key_get_scancode(godot_input_event *p_event);
+uint32_t GDAPI *godot_input_event_key_get_unicode(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_key_get_pressed(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_key_get_echo(godot_input_event *p_event);
+
+float GDAPI *godot_input_event_mouse_get_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_get_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_get_global_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_get_global_y(godot_input_event *p_event);
+godot_int GDAPI *godot_input_event_mouse_get_button_mask(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_mouse_button_get_button_index(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mouse_button_get_pressed(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_mouse_button_get_doubleclick(godot_input_event *p_event);
+
+float GDAPI *godot_input_event_mouse_motion_get_relative_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_motion_get_relative_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_motion_get_speed_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_mouse_motion_get_speed_y(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_joypad_motion_get_axis(godot_input_event *p_event);
+float GDAPI *godot_input_event_joypad_motion_get_axis_value(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_joypad_button_get_button_index(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_joypad_button_get_pressed(godot_input_event *p_event);
+float GDAPI *godot_input_event_joypad_button_get_pressure(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_screen_touch_get_index(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_touch_get_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_touch_get_y(godot_input_event *p_event);
+godot_bool GDAPI *godot_input_event_screen_touch_get_pressed(godot_input_event *p_event);
+
+godot_int GDAPI *godot_input_event_screen_drag_get_index(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_relative_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event);
+float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_INPUT_EVENT_H
diff --git a/modules/dlscript/godot/godot_node_path.cpp b/modules/dlscript/godot/godot_node_path.cpp
new file mode 100644
index 0000000000..cc0652c75b
--- /dev/null
+++ b/modules/dlscript/godot/godot_node_path.cpp
@@ -0,0 +1,87 @@
+#include "godot_node_path.h"
+
+#include "path_db.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _node_path_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+// @Bug ?
+// Do I need to memnew_placement when returning strings?
+
+void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from) {
+ NodePath *np = (NodePath *)p_np;
+ String *from = (String *)p_from;
+ memnew_placement_custom(np, NodePath, NodePath(*from));
+}
+
+godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx) {
+ const NodePath *np = (const NodePath *)p_np;
+ godot_string str;
+ String *s = (String *)&str;
+ memnew_placement(s, String);
+ *s = np->get_name(p_idx);
+ return str;
+}
+
+godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np) {
+ const NodePath *np = (const NodePath *)p_np;
+ return np->get_name_count();
+}
+
+godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np) {
+ const NodePath *np = (const NodePath *)p_np;
+ godot_string str;
+ String *s = (String *)&str;
+ memnew_placement(s, String);
+ *s = np->get_property();
+ return str;
+}
+
+godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx) {
+ const NodePath *np = (const NodePath *)p_np;
+ godot_string str;
+ String *s = (String *)&str;
+ memnew_placement(s, String);
+ *s = np->get_subname(p_idx);
+ return str;
+}
+
+godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np) {
+ const NodePath *np = (const NodePath *)p_np;
+ return np->get_subname_count();
+}
+
+godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np) {
+ const NodePath *np = (const NodePath *)p_np;
+ return np->is_absolute();
+}
+
+godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np) {
+ const NodePath *np = (const NodePath *)p_np;
+ return np->is_empty();
+}
+
+godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np) {
+ const NodePath *np = (const NodePath *)p_np;
+ godot_string str;
+ String *s = (String *)&str;
+ memnew_placement(s, String);
+ *s = *np;
+ return str;
+}
+
+void GDAPI godot_node_path_destroy(godot_node_path *p_np) {
+ ((NodePath *)p_np)->~NodePath();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_node_path.h b/modules/dlscript/godot/godot_node_path.h
new file mode 100644
index 0000000000..b322e55d83
--- /dev/null
+++ b/modules/dlscript/godot/godot_node_path.h
@@ -0,0 +1,38 @@
+#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);
+
+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
new file mode 100644
index 0000000000..883aeb6282
--- /dev/null
+++ b/modules/dlscript/godot/godot_plane.cpp
@@ -0,0 +1,48 @@
+#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
new file mode 100644
index 0000000000..1323ef4075
--- /dev/null
+++ b/modules/dlscript/godot/godot_plane.h
@@ -0,0 +1,37 @@
+#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_pool_arrays.cpp b/modules/dlscript/godot/godot_pool_arrays.cpp
new file mode 100644
index 0000000000..3fb030f835
--- /dev/null
+++ b/modules/dlscript/godot/godot_pool_arrays.cpp
@@ -0,0 +1,558 @@
+#include "godot_pool_arrays.h"
+
+#include "array.h"
+#include "dvector.h"
+#include "variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _pool_arrays_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+// byte
+
+void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ memnew_placement(pba, PoolVector<uint8_t>);
+}
+
+void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<uint8_t>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ pba->append(p_data);
+}
+
+void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ PoolVector<uint8_t> *array = (PoolVector<uint8_t> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ return pba->insert(p_idx, p_data);
+}
+
+void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ pba->push_back(p_data);
+}
+
+void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ pba->set(p_idx, p_data);
+}
+
+uint8_t GDAPI godot_pool_byte_array_get(godot_pool_byte_array *p_pba, const godot_int p_idx) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ return pba->get(p_idx);
+}
+
+godot_int GDAPI godot_pool_byte_array_size(godot_pool_byte_array *p_pba) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba) {
+ ((PoolVector<uint8_t> *)p_pba)->~PoolVector();
+}
+
+// int
+
+void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pba) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ memnew_placement(pba, PoolVector<uint8_t>);
+}
+
+void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pba, const godot_array *p_a) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<uint8_t>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pba, const godot_int p_data) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->append(p_data);
+}
+
+void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pba, const godot_pool_int_array *p_array) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ PoolVector<godot_int> *array = (PoolVector<godot_int> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ return pba->insert(p_idx, p_data);
+}
+
+void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pba) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pba, const godot_int p_data) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->push_back(p_data);
+}
+
+void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pba, const godot_int p_idx) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pba, const godot_int p_size) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pba, const godot_int p_idx, const godot_int p_data) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->set(p_idx, p_data);
+}
+
+godot_int GDAPI godot_pool_int_array_get(godot_pool_int_array *p_pba, const godot_int p_idx) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ return pba->get(p_idx);
+}
+
+godot_int GDAPI godot_pool_int_array_size(godot_pool_int_array *p_pba) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pba) {
+ ((PoolVector<godot_int> *)p_pba)->~PoolVector();
+}
+
+// real
+
+void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pba) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ memnew_placement(pba, PoolVector<uint8_t>);
+}
+
+void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pba, const godot_array *p_a) {
+ PoolVector<uint8_t> *pba = (PoolVector<uint8_t> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<uint8_t>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pba, const godot_real p_data) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ pba->append(p_data);
+}
+
+void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pba, const godot_pool_real_array *p_array) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ PoolVector<godot_real> *array = (PoolVector<godot_real> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ return pba->insert(p_idx, p_data);
+}
+
+void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pba) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pba, const godot_real p_data) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ pba->push_back(p_data);
+}
+
+void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pba, const godot_int p_idx) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pba, const godot_int p_size) {
+ PoolVector<godot_int> *pba = (PoolVector<godot_int> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pba, const godot_int p_idx, const godot_real p_data) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ pba->set(p_idx, p_data);
+}
+
+godot_real GDAPI godot_pool_real_array_get(godot_pool_real_array *p_pba, const godot_int p_idx) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ return pba->get(p_idx);
+}
+
+godot_int GDAPI godot_pool_real_array_size(godot_pool_real_array *p_pba) {
+ PoolVector<godot_real> *pba = (PoolVector<godot_real> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pba) {
+ ((PoolVector<godot_real> *)p_pba)->~PoolVector();
+}
+
+// string
+
+void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_pba) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ memnew_placement(pba, PoolVector<String>);
+}
+
+void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_pba, const godot_array *p_a) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<String>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_pba, const godot_string *p_data) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ String &s = *(String *)p_data;
+ pba->append(s);
+}
+
+void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_pba, const godot_pool_string_array *p_array) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ PoolVector<String> *array = (PoolVector<String> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ String &s = *(String *)p_data;
+ return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_pba) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_pba, const godot_string *p_data) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ String &s = *(String *)p_data;
+ pba->push_back(s);
+}
+
+void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_pba, const godot_int p_idx) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_pba, const godot_int p_size) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_pba, const godot_int p_idx, const godot_string *p_data) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ String &s = *(String *)p_data;
+ pba->set(p_idx, s);
+}
+
+godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_pba, const godot_int p_idx) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ godot_string str;
+ String *s = (String *)&str;
+ memnew_placement(s, String);
+ *s = pba->get(p_idx);
+ return str;
+}
+
+godot_int GDAPI godot_pool_string_array_size(godot_pool_string_array *p_pba) {
+ PoolVector<String> *pba = (PoolVector<String> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_pba) {
+ ((PoolVector<String> *)p_pba)->~PoolVector();
+}
+
+// vector2
+
+void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pba) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ memnew_placement(pba, PoolVector<Vector2>);
+}
+
+void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pba, const godot_array *p_a) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<Vector2>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ Vector2 &s = *(Vector2 *)p_data;
+ pba->append(s);
+}
+
+void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pba, const godot_pool_vector2_array *p_array) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ PoolVector<Vector2> *array = (PoolVector<Vector2> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ Vector2 &s = *(Vector2 *)p_data;
+ return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pba) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pba, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ Vector2 &s = *(Vector2 *)p_data;
+ pba->push_back(s);
+}
+
+void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pba, const godot_int p_idx) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pba, const godot_int p_size) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pba, const godot_int p_idx, const godot_vector2 *p_data) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ Vector2 &s = *(Vector2 *)p_data;
+ pba->set(p_idx, s);
+}
+
+godot_vector2 GDAPI godot_pool_vector2_array_get(godot_pool_vector2_array *p_pba, const godot_int p_idx) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ godot_vector2 v;
+ Vector2 *s = (Vector2 *)&v;
+ *s = pba->get(p_idx);
+ return v;
+}
+
+godot_int GDAPI godot_pool_vector2_array_size(godot_pool_vector2_array *p_pba) {
+ PoolVector<Vector2> *pba = (PoolVector<Vector2> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pba) {
+ ((PoolVector<Vector2> *)p_pba)->~PoolVector();
+}
+
+// vector3
+
+void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pba) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ memnew_placement(pba, PoolVector<Vector3>);
+}
+
+void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pba, const godot_array *p_a) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<Vector3>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ Vector3 &s = *(Vector3 *)p_data;
+ pba->append(s);
+}
+
+void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pba, const godot_pool_vector3_array *p_array) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ PoolVector<Vector3> *array = (PoolVector<Vector3> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ Vector3 &s = *(Vector3 *)p_data;
+ return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pba) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pba, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ Vector3 &s = *(Vector3 *)p_data;
+ pba->push_back(s);
+}
+
+void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pba, const godot_int p_idx) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pba, const godot_int p_size) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pba, const godot_int p_idx, const godot_vector3 *p_data) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ Vector3 &s = *(Vector3 *)p_data;
+ pba->set(p_idx, s);
+}
+
+godot_vector3 GDAPI godot_pool_vector3_array_get(godot_pool_vector3_array *p_pba, const godot_int p_idx) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ godot_vector3 v;
+ Vector3 *s = (Vector3 *)&v;
+ *s = pba->get(p_idx);
+ return v;
+}
+
+godot_int GDAPI godot_pool_vector3_array_size(godot_pool_vector3_array *p_pba) {
+ PoolVector<Vector3> *pba = (PoolVector<Vector3> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pba) {
+ ((PoolVector<Vector3> *)p_pba)->~PoolVector();
+}
+
+// color
+
+void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pba) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ memnew_placement(pba, PoolVector<Color>);
+}
+
+void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pba, const godot_array *p_a) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ Array *a = (Array *)p_a;
+ memnew_placement(pba, PoolVector<Color>);
+
+ pba->resize(a->size());
+ for (size_t i = 0; i < a->size(); i++) {
+ pba->set(i, (*a)[i]);
+ }
+}
+
+void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pba, const godot_color *p_data) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ Color &s = *(Color *)p_data;
+ pba->append(s);
+}
+
+void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pba, const godot_pool_color_array *p_array) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ PoolVector<Color> *array = (PoolVector<Color> *)p_array;
+ pba->append_array(*array);
+}
+
+int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ Color &s = *(Color *)p_data;
+ return pba->insert(p_idx, s);
+}
+
+void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pba) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ pba->invert();
+}
+
+void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pba, const godot_color *p_data) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ Color &s = *(Color *)p_data;
+ pba->push_back(s);
+}
+
+void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pba, const godot_int p_idx) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ pba->remove(p_idx);
+}
+
+void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pba, const godot_int p_size) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ pba->resize(p_size);
+}
+
+void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pba, const godot_int p_idx, const godot_color *p_data) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ Color &s = *(Color *)p_data;
+ pba->set(p_idx, s);
+}
+
+godot_color GDAPI godot_pool_color_array_get(godot_pool_color_array *p_pba, const godot_int p_idx) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ godot_color v;
+ Color *s = (Color *)&v;
+ *s = pba->get(p_idx);
+ return v;
+}
+
+godot_int GDAPI godot_pool_color_array_size(godot_pool_color_array *p_pba) {
+ PoolVector<Color> *pba = (PoolVector<Color> *)p_pba;
+ return pba->size();
+}
+
+void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pba) {
+ ((PoolVector<Color> *)p_pba)->~PoolVector();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_pool_arrays.h b/modules/dlscript/godot/godot_pool_arrays.h
new file mode 100644
index 0000000000..77b6c3dde0
--- /dev/null
+++ b/modules/dlscript/godot/godot_pool_arrays.h
@@ -0,0 +1,256 @@
+#ifndef GODOT_DLSCRIPT_POOL_ARRAYS_H
+#define GODOT_DLSCRIPT_POOL_ARRAYS_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+/////// PoolByteArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_byte_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_byte_array;
+#endif
+
+/////// PoolIntArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_int_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_int_array;
+#endif
+
+/////// PoolRealArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_real_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_real_array;
+#endif
+
+/////// PoolStringArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_string_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_string_array;
+#endif
+
+/////// PoolVector2Array
+
+#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_vector2_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_vector2_array;
+#endif
+
+/////// PoolVector3Array
+
+#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_vector3_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_vector3_array;
+#endif
+
+/////// PoolColorArray
+
+#ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED
+typedef struct godot_pool_color_array {
+ uint8_t _dont_touch_that[8];
+} godot_pool_color_array;
+#endif
+
+#include "../godot.h"
+
+#include "godot_array.h"
+
+// byte
+
+void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *p_pba);
+void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *p_pba, const godot_array *p_a);
+
+void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_pba, const uint8_t p_data);
+
+void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_pba, const godot_pool_byte_array *p_array);
+
+int GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
+
+void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_pba);
+
+void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_pba, const uint8_t p_data);
+
+void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_pba, const godot_int p_idx);
+
+void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_pba, const godot_int p_size);
+
+void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_pba, const godot_int p_idx, const uint8_t p_data);
+uint8_t GDAPI godot_pool_byte_array_get(godot_pool_byte_array *p_pba, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_byte_array_size(godot_pool_byte_array *p_pba);
+
+void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_pba);
+
+// int
+
+void GDAPI godot_pool_int_array_new(godot_pool_int_array *p_pia);
+void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *p_pia, const godot_array *p_a);
+
+void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_pia, const godot_int p_data);
+
+void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_pia, const godot_pool_int_array *p_array);
+
+int GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
+
+void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_pia);
+
+void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_pia, const godot_int p_data);
+
+void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_pia, const godot_int p_idx);
+
+void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_pia, const godot_int p_size);
+
+void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_pia, const godot_int p_idx, const godot_int p_data);
+godot_int GDAPI godot_pool_int_array_get(godot_pool_int_array *p_pia, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_int_array_size(godot_pool_int_array *p_pia);
+
+void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_pia);
+
+// real
+
+void GDAPI godot_pool_real_array_new(godot_pool_real_array *p_pra);
+void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *p_pra, const godot_array *p_a);
+
+void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_pra, const godot_real p_data);
+
+void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_pra, const godot_pool_real_array *p_array);
+
+int GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
+
+void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_pra);
+
+void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_pra, const godot_real p_data);
+
+void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_pra, const godot_int p_idx);
+
+void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_pra, const godot_int p_size);
+
+void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_pra, const godot_int p_idx, const godot_real p_data);
+godot_real GDAPI godot_pool_real_array_get(godot_pool_real_array *p_pra, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_real_array_size(godot_pool_real_array *p_pra);
+
+void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_pra);
+
+// string
+
+void GDAPI godot_pool_string_array_new(godot_pool_string_array *p_psa);
+void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *p_psa, const godot_array *p_a);
+
+void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_psa, const godot_string *p_data);
+
+void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_psa, const godot_pool_string_array *p_array);
+
+int GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
+
+void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_psa);
+
+void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_psa, const godot_string *p_data);
+
+void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_psa, const godot_int p_idx);
+
+void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_psa, const godot_int p_size);
+
+void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_psa, const godot_int p_idx, const godot_string *p_data);
+godot_string GDAPI godot_pool_string_array_get(godot_pool_string_array *p_psa, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_string_array_size(godot_pool_string_array *p_psa);
+
+void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_psa);
+
+// vector2
+
+void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *p_pv2a, const godot_array *p_a);
+
+void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data);
+
+void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_pv2a, const godot_pool_vector2_array *p_array);
+
+int GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
+
+void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_pv2a);
+
+void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_pv2a, const godot_vector2 *p_data);
+
+void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
+
+void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_pv2a, const godot_int p_size);
+
+void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_pv2a, const godot_int p_idx, const godot_vector2 *p_data);
+godot_vector2 GDAPI godot_pool_vector2_array_get(godot_pool_vector2_array *p_pv2a, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_vector2_array_size(godot_pool_vector2_array *p_pv2a);
+
+void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_pv2a);
+
+// vector3
+
+void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *p_pv3a, const godot_array *p_a);
+
+void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data);
+
+void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_pv3a, const godot_pool_vector3_array *p_array);
+
+int GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
+
+void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_pv3a);
+
+void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_pv3a, const godot_vector3 *p_data);
+
+void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
+
+void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_pv3a, const godot_int p_size);
+
+void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_pv3a, const godot_int p_idx, const godot_vector3 *p_data);
+godot_vector3 GDAPI godot_pool_vector3_array_get(godot_pool_vector3_array *p_pv3a, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_vector3_array_size(godot_pool_vector3_array *p_pv3a);
+
+void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_pv3a);
+
+// color
+
+void GDAPI godot_pool_color_array_new(godot_pool_color_array *p_pca);
+void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *p_pca, const godot_array *p_a);
+
+void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_pca, const godot_color *p_data);
+
+void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_pca, const godot_pool_color_array *p_array);
+
+int GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
+
+void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_pca);
+
+void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_pca, const godot_color *p_data);
+
+void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_pca, const godot_int p_idx);
+
+void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_pca, const godot_int p_size);
+
+void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_pca, const godot_int p_idx, const godot_color *p_data);
+godot_color GDAPI godot_pool_color_array_get(godot_pool_color_array *p_pca, const godot_int p_idx);
+
+godot_int GDAPI godot_pool_color_array_size(godot_pool_color_array *p_pca);
+
+void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_DLSCRIPT_POOL_ARRAYS_H
diff --git a/modules/dlscript/godot/godot_quat.cpp b/modules/dlscript/godot/godot_quat.cpp
new file mode 100644
index 0000000000..5571614e07
--- /dev/null
+++ b/modules/dlscript/godot/godot_quat.cpp
@@ -0,0 +1,79 @@
+#include "godot_quat.h"
+
+#include "math/quat.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#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
new file mode 100644
index 0000000000..4e3253c4e5
--- /dev/null
+++ b/modules/dlscript/godot/godot_quat.h
@@ -0,0 +1,33 @@
+#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
new file mode 100644
index 0000000000..8e60811114
--- /dev/null
+++ b/modules/dlscript/godot/godot_rect2.cpp
@@ -0,0 +1,48 @@
+#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
new file mode 100644
index 0000000000..a3b19bdb7e
--- /dev/null
+++ b/modules/dlscript/godot/godot_rect2.h
@@ -0,0 +1,31 @@
+#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
new file mode 100644
index 0000000000..3c442a278b
--- /dev/null
+++ b/modules/dlscript/godot/godot_rect3.cpp
@@ -0,0 +1,48 @@
+#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
new file mode 100644
index 0000000000..b9279616d1
--- /dev/null
+++ b/modules/dlscript/godot/godot_rect3.h
@@ -0,0 +1,31 @@
+#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
new file mode 100644
index 0000000000..a36a2e64a3
--- /dev/null
+++ b/modules/dlscript/godot/godot_rid.cpp
@@ -0,0 +1,36 @@
+#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
new file mode 100644
index 0000000000..f20c0d4dae
--- /dev/null
+++ b/modules/dlscript/godot/godot_rid.h
@@ -0,0 +1,28 @@
+#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
new file mode 100644
index 0000000000..1501743e02
--- /dev/null
+++ b/modules/dlscript/godot/godot_string.cpp
@@ -0,0 +1,83 @@
+#include "godot_string.h"
+
+#include "string_db.h"
+#include "ustring.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#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
new file mode 100644
index 0000000000..73b366d9cd
--- /dev/null
+++ b/modules/dlscript/godot/godot_string.h
@@ -0,0 +1,42 @@
+#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
new file mode 100644
index 0000000000..18d218e6c4
--- /dev/null
+++ b/modules/dlscript/godot/godot_transform.cpp
@@ -0,0 +1,44 @@
+#include "godot_transform.h"
+
+#include "math/transform.h"
+
+#include <memory.h> // why is there no <cmemory> btw?
+
+#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
new file mode 100644
index 0000000000..54af78d5b9
--- /dev/null
+++ b/modules/dlscript/godot/godot_transform.h
@@ -0,0 +1,29 @@
+#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
new file mode 100644
index 0000000000..39fa0e7363
--- /dev/null
+++ b/modules/dlscript/godot/godot_transform2d.cpp
@@ -0,0 +1,59 @@
+#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
new file mode 100644
index 0000000000..7403954527
--- /dev/null
+++ b/modules/dlscript/godot/godot_transform2d.h
@@ -0,0 +1,48 @@
+#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/dlscript/godot/godot_variant.cpp
new file mode 100644
index 0000000000..3681f89753
--- /dev/null
+++ b/modules/dlscript/godot/godot_variant.cpp
@@ -0,0 +1,476 @@
+#include "godot_variant.h"
+
+#include "../godot.h"
+
+#include "variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void _variant_api_anchor() {
+}
+
+#define memnew_placement_custom(m_placement, m_class, m_constr) _post_initialize(new (m_placement, sizeof(m_class), "") m_constr)
+
+godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ return (godot_variant_type)v->get_type();
+}
+
+void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src) {
+ Variant *dest = (Variant *)p_dest;
+ Variant *src = (Variant *)p_src;
+ *dest = *src;
+}
+
+void GDAPI godot_variant_new_nil(godot_variant *p_v) {
+ Variant *v = (Variant *)p_v;
+ memnew_placement(v, Variant);
+}
+
+void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b) {
+ Variant *v = (Variant *)p_v;
+ memnew_placement_custom(v, Variant, Variant(p_b));
+}
+
+void GDAPI godot_variant_new_uint(godot_variant *p_v, const uint64_t p_i) {
+ Variant *v = (Variant *)p_v;
+ memnew_placement_custom(v, Variant, Variant(p_i));
+}
+
+void GDAPI godot_variant_new_int(godot_variant *p_v, const int64_t p_i) {
+ Variant *v = (Variant *)p_v;
+ memnew_placement_custom(v, Variant, Variant(p_i));
+}
+
+void GDAPI godot_variant_new_real(godot_variant *p_v, const double p_r) {
+ Variant *v = (Variant *)p_v;
+ memnew_placement_custom(v, Variant, Variant(p_r));
+}
+
+void GDAPI godot_variant_new_string(godot_variant *p_v, const godot_string *p_s) {
+ Variant *v = (Variant *)p_v;
+ String *s = (String *)p_s;
+ memnew_placement_custom(v, Variant, Variant(*s));
+}
+
+void GDAPI godot_variant_new_vector2(godot_variant *p_v, const godot_vector2 *p_v2) {
+ Variant *v = (Variant *)p_v;
+ Vector2 *v2 = (Vector2 *)p_v2;
+ memnew_placement_custom(v, Variant, Variant(*v2));
+}
+
+void GDAPI godot_variant_new_rect2(godot_variant *p_v, const godot_rect2 *p_rect2) {
+ Variant *v = (Variant *)p_v;
+ Rect2 *rect2 = (Rect2 *)p_rect2;
+ memnew_placement_custom(v, Variant, Variant(*rect2));
+}
+
+void GDAPI godot_variant_new_vector3(godot_variant *p_v, const godot_vector3 *p_v3) {
+ Variant *v = (Variant *)p_v;
+ Vector3 *v3 = (Vector3 *)p_v3;
+ memnew_placement_custom(v, Variant, Variant(*v3));
+}
+
+void GDAPI godot_variant_new_transform2d(godot_variant *p_v, const godot_transform2d *p_t2d) {
+ Variant *v = (Variant *)p_v;
+ Transform2D *t2d = (Transform2D *)p_t2d;
+ memnew_placement_custom(v, Variant, Variant(*t2d));
+}
+
+void GDAPI godot_variant_new_plane(godot_variant *p_v, const godot_plane *p_plane) {
+ Variant *v = (Variant *)p_v;
+ Plane *plane = (Plane *)p_plane;
+ memnew_placement_custom(v, Variant, Variant(*plane));
+}
+
+void GDAPI godot_variant_new_quat(godot_variant *p_v, const godot_quat *p_quat) {
+ Variant *v = (Variant *)p_v;
+ Quat *quat = (Quat *)p_quat;
+ memnew_placement_custom(v, Variant, Variant(*quat));
+}
+
+void GDAPI godot_variant_new_rect3(godot_variant *p_v, const godot_rect3 *p_rect3) {
+ Variant *v = (Variant *)p_v;
+ Rect3 *rect3 = (Rect3 *)p_rect3;
+ memnew_placement_custom(v, Variant, Variant(*rect3));
+}
+
+void GDAPI godot_variant_new_basis(godot_variant *p_v, const godot_basis *p_basis) {
+ Variant *v = (Variant *)p_v;
+ Basis *basis = (Basis *)p_basis;
+ memnew_placement_custom(v, Variant, Variant(*basis));
+}
+
+void GDAPI godot_variant_new_transform(godot_variant *p_v, const godot_transform *p_trans) {
+ Variant *v = (Variant *)p_v;
+ Transform *trans = (Transform *)p_trans;
+ memnew_placement_custom(v, Variant, Variant(*trans));
+}
+
+void GDAPI godot_variant_new_color(godot_variant *p_v, const godot_color *p_color) {
+ Variant *v = (Variant *)p_v;
+ Color *color = (Color *)p_color;
+ memnew_placement_custom(v, Variant, Variant(*color));
+}
+
+void GDAPI godot_variant_new_image(godot_variant *p_v, const godot_image *p_img) {
+ Variant *v = (Variant *)p_v;
+ Image *img = (Image *)p_img;
+ memnew_placement_custom(v, Variant, Variant(*img));
+}
+
+void GDAPI godot_variant_new_node_path(godot_variant *p_v, const godot_node_path *p_np) {
+ Variant *v = (Variant *)p_v;
+ NodePath *np = (NodePath *)p_np;
+ memnew_placement_custom(v, Variant, Variant(*np));
+}
+
+void GDAPI godot_variant_new_rid(godot_variant *p_v, const godot_rid *p_rid) {
+ Variant *v = (Variant *)p_v;
+ RID *rid = (RID *)p_rid;
+ memnew_placement_custom(v, Variant, Variant(*rid));
+}
+
+void GDAPI godot_variant_new_object(godot_variant *p_v, const godot_object *p_obj) {
+ Variant *v = (Variant *)p_v;
+ Object *obj = (Object *)p_obj;
+ memnew_placement_custom(v, Variant, Variant(obj));
+}
+
+void GDAPI godot_variant_new_input_event(godot_variant *p_v, const godot_input_event *p_event) {
+ Variant *v = (Variant *)p_v;
+ InputEvent *event = (InputEvent *)p_event;
+ memnew_placement_custom(v, Variant, Variant(*event));
+}
+
+void GDAPI godot_variant_new_dictionary(godot_variant *p_v, const godot_dictionary *p_dict) {
+ Variant *v = (Variant *)p_v;
+ Dictionary *dict = (Dictionary *)p_dict;
+ memnew_placement_custom(v, Variant, Variant(*dict));
+}
+
+void GDAPI godot_variant_new_array(godot_variant *p_v, const godot_array *p_arr) {
+ Variant *v = (Variant *)p_v;
+ Array *arr = (Array *)p_arr;
+ memnew_placement_custom(v, Variant, Variant(*arr));
+}
+
+void GDAPI godot_variant_new_pool_byte_array(godot_variant *p_v, const godot_pool_byte_array *p_pba) {
+ Variant *v = (Variant *)p_v;
+ PoolByteArray *pba = (PoolByteArray *)p_pba;
+ memnew_placement_custom(v, Variant, Variant(*pba));
+}
+
+void GDAPI godot_variant_new_pool_int_array(godot_variant *p_v, const godot_pool_int_array *p_pia) {
+ Variant *v = (Variant *)p_v;
+ PoolIntArray *pia = (PoolIntArray *)p_pia;
+ memnew_placement_custom(v, Variant, Variant(*pia));
+}
+
+void GDAPI godot_variant_new_pool_real_array(godot_variant *p_v, const godot_pool_real_array *p_pra) {
+ Variant *v = (Variant *)p_v;
+ PoolRealArray *pra = (PoolRealArray *)p_pra;
+ memnew_placement_custom(v, Variant, Variant(*pra));
+}
+
+void GDAPI godot_variant_new_pool_string_array(godot_variant *p_v, const godot_pool_string_array *p_psa) {
+ Variant *v = (Variant *)p_v;
+ PoolStringArray *psa = (PoolStringArray *)p_psa;
+ memnew_placement_custom(v, Variant, Variant(*psa));
+}
+
+void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_pool_vector2_array *p_pv2a) {
+ Variant *v = (Variant *)p_v;
+ PoolVector2Array *pv2a = (PoolVector2Array *)p_pv2a;
+ memnew_placement_custom(v, Variant, Variant(*pv2a));
+}
+
+void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a) {
+ Variant *v = (Variant *)p_v;
+ PoolVector3Array *pv3a = (PoolVector3Array *)p_pv3a;
+ memnew_placement_custom(v, Variant, Variant(*pv3a));
+}
+
+void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca) {
+ Variant *v = (Variant *)p_v;
+ PoolColorArray *pca = (PoolColorArray *)p_pca;
+ memnew_placement_custom(v, Variant, Variant(*pca));
+}
+
+godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ return v->operator bool();
+}
+
+uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ return v->operator uint64_t();
+}
+
+int64_t GDAPI godot_variant_as_int(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ return v->operator int64_t();
+}
+
+double GDAPI godot_variant_as_real(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ return v->operator double();
+}
+
+godot_string GDAPI godot_variant_as_string(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_string s;
+ godot_string_new(&s);
+ String *str = (String *)&s;
+ *str = v->operator String();
+ return s;
+}
+
+godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_vector2 v2;
+ Vector2 *vec2 = (Vector2 *)&v2;
+ *vec2 = *v;
+ return v2;
+}
+
+godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_rect2 r2;
+ Rect2 *rect2 = (Rect2 *)&r2;
+ *rect2 = *v;
+ return r2;
+}
+
+godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_vector3 v3;
+ Vector3 *vec3 = (Vector3 *)&v3;
+ *vec3 = *v;
+ return v3;
+}
+
+godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_transform2d t2;
+ Transform2D *t = (Transform2D *)&t2;
+ *t = *v;
+ return t2;
+}
+
+godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_plane p;
+ Plane *pl = (Plane *)&p;
+ *pl = *v;
+ return p;
+}
+
+godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_quat q;
+ Quat *qt = (Quat *)&q;
+ *qt = *v;
+ return q;
+}
+
+godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_rect3 r;
+ Rect3 *r3 = (Rect3 *)&r;
+ *r3 = *v;
+ return r;
+}
+
+godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_basis b;
+ Basis *bs = (Basis *)&b;
+ *bs = *v;
+ return b;
+}
+
+godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_transform t;
+ Transform *tr = (Transform *)&t;
+ *tr = *v;
+ return t;
+}
+
+godot_color GDAPI godot_variant_as_color(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_color c;
+ Color *col = (Color *)&c;
+ *col = *v;
+ return c;
+}
+
+godot_image GDAPI godot_variant_as_image(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_image img;
+ godot_image_new(&img);
+ Image *i = (Image *)&img;
+ *i = *v;
+ return img;
+}
+
+godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_node_path np;
+ memnew_placement_custom((NodePath *)&np, NodePath, NodePath((String)*v));
+ return np;
+}
+
+godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_rid rid;
+ memnew_placement_custom((RID *)&rid, RID, RID(*v));
+ return rid;
+}
+
+godot_object GDAPI *godot_variant_as_object(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_object *p = NULL;
+ Object **op = (Object **)&p;
+ *op = *v;
+ return p;
+}
+
+godot_input_event GDAPI godot_variant_as_input_event(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_input_event ev;
+ InputEvent *event = (InputEvent *)&ev;
+ *event = *v;
+ return ev;
+}
+
+godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_dictionary dict;
+ godot_dictionary_new(&dict);
+ Dictionary *d = (Dictionary *)&dict;
+ *d = *v;
+ return dict;
+}
+
+godot_array GDAPI godot_variant_as_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_array array;
+ godot_array_new(&array);
+ Array *a = (Array *)&array;
+ *a = *v;
+ return array;
+}
+
+godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_byte_array pba;
+ godot_pool_byte_array_new(&pba);
+ PoolByteArray *p = (PoolByteArray *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_int_array pba;
+ godot_pool_int_array_new(&pba);
+ PoolIntArray *p = (PoolIntArray *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_real_array pba;
+ godot_pool_real_array_new(&pba);
+ PoolRealArray *p = (PoolRealArray *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_string_array pba;
+ godot_pool_string_array_new(&pba);
+ PoolStringArray *p = (PoolStringArray *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_vector2_array pba;
+ godot_pool_vector2_array_new(&pba);
+ PoolVector2Array *p = (PoolVector2Array *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_vector3_array pba;
+ godot_pool_vector3_array_new(&pba);
+ PoolVector3Array *p = (PoolVector3Array *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v) {
+ const Variant *v = (const Variant *)p_v;
+ godot_pool_color_array pba;
+ godot_pool_color_array_new(&pba);
+ PoolColorArray *p = (PoolColorArray *)&pba;
+ *p = *v;
+ return pba;
+}
+
+godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount /*, godot_variant_call_error *r_error */) {
+ Variant *v = (Variant *)p_v;
+ String *method = (String *)p_method;
+ Variant **args = (Variant **)p_args;
+ godot_variant res;
+ memnew_placement_custom((Variant *)&res, Variant, Variant(v->call(*method, args, p_argcount)));
+ return res;
+}
+
+godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method) {
+ Variant *v = (Variant *)p_v;
+ String *method = (String *)p_method;
+ return v->has_method(*method);
+}
+
+godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b) {
+ const Variant *a = (const Variant *)p_a;
+ const Variant *b = (const Variant *)p_b;
+ return a->operator==(*b);
+}
+
+godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b) {
+ const Variant *a = (const Variant *)p_a;
+ const Variant *b = (const Variant *)p_b;
+ return a->operator<(*b);
+}
+
+godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_a, const godot_variant *p_b) {
+ const Variant *a = (const Variant *)p_a;
+ const Variant *b = (const Variant *)p_b;
+ return a->hash_compare(*b);
+}
+
+godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *p_valid) {
+ const Variant *v = (const Variant *)p_v;
+ bool &valid = *p_valid;
+ return v->booleanize(valid);
+}
+
+void GDAPI godot_variant_destroy(godot_variant *p_v) {
+ ((Variant *)p_v)->~Variant();
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/dlscript/godot/godot_variant.h b/modules/dlscript/godot/godot_variant.h
new file mode 100644
index 0000000000..1ff5ba4a57
--- /dev/null
+++ b/modules/dlscript/godot/godot_variant.h
@@ -0,0 +1,150 @@
+#ifndef GODOT_VARIANT_H
+#define GODOT_VARIANT_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
+typedef struct godot_variant {
+ uint8_t _dont_touch_that[24];
+} godot_variant;
+#endif
+
+struct godot_transform2d;
+typedef struct godot_transform2d godot_transform2d;
+
+#include "godot_array.h"
+#include "godot_dictionary.h"
+#include "godot_input_event.h"
+#include "godot_node_path.h"
+#include "godot_rid.h"
+#include "godot_transform2d.h"
+
+typedef enum godot_variant_type {
+ GODOT_VARIANT_TYPE_NIL,
+
+ // atomic types
+ GODOT_VARIANT_TYPE_BOOL,
+ GODOT_VARIANT_TYPE_INT,
+ GODOT_VARIANT_TYPE_REAL,
+ GODOT_VARIANT_TYPE_STRING,
+
+ // math types
+
+ GODOT_VARIANT_TYPE_VECTOR2, // 5
+ GODOT_VARIANT_TYPE_RECT2,
+ GODOT_VARIANT_TYPE_VECTOR3,
+ GODOT_VARIANT_TYPE_TRANSFORM2D,
+ GODOT_VARIANT_TYPE_PLANE,
+ GODOT_VARIANT_TYPE_QUAT, // 10
+ GODOT_VARIANT_TYPE_RECT3, //sorry naming convention fail :( not like it's used often
+ GODOT_VARIANT_TYPE_BASIS,
+ GODOT_VARIANT_TYPE_TRANSFORM,
+
+ // misc types
+ GODOT_VARIANT_TYPE_COLOR,
+ GODOT_VARIANT_TYPE_IMAGE, // 15
+ GODOT_VARIANT_TYPE_NODE_PATH,
+ GODOT_VARIANT_TYPE_RID,
+ GODOT_VARIANT_TYPE_OBJECT,
+ GODOT_VARIANT_TYPE_INPUT_EVENT,
+ GODOT_VARIANT_TYPE_DICTIONARY, // 20
+ GODOT_VARIANT_TYPE_ARRAY,
+
+ // arrays
+ GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY,
+ GODOT_VARIANT_TYPE_POOL_INT_ARRAY,
+ GODOT_VARIANT_TYPE_POOL_REAL_ARRAY,
+ GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, // 25
+ GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY,
+ GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
+ GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
+} godot_variant_type;
+
+godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
+
+void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src);
+
+void GDAPI godot_variant_new_nil(godot_variant *p_v);
+
+void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b);
+void GDAPI godot_variant_new_uint(godot_variant *p_v, const uint64_t p_i);
+void GDAPI godot_variant_new_int(godot_variant *p_v, const int64_t p_i);
+void GDAPI godot_variant_new_real(godot_variant *p_v, const double p_r);
+void GDAPI godot_variant_new_string(godot_variant *p_v, const godot_string *p_s);
+void GDAPI godot_variant_new_vector2(godot_variant *p_v, const godot_vector2 *p_v2);
+void GDAPI godot_variant_new_rect2(godot_variant *p_v, const godot_rect2 *p_rect2);
+void GDAPI godot_variant_new_vector3(godot_variant *p_v, const godot_vector3 *p_v3);
+void GDAPI godot_variant_new_transform2d(godot_variant *p_v, const godot_transform2d *p_t2d);
+void GDAPI godot_variant_new_plane(godot_variant *p_v, const godot_plane *p_plane);
+void GDAPI godot_variant_new_quat(godot_variant *p_v, const godot_quat *p_quat);
+void GDAPI godot_variant_new_rect3(godot_variant *p_v, const godot_rect3 *p_rect3);
+void GDAPI godot_variant_new_basis(godot_variant *p_v, const godot_basis *p_basis);
+void GDAPI godot_variant_new_transform(godot_variant *p_v, const godot_transform *p_trans);
+void GDAPI godot_variant_new_color(godot_variant *p_v, const godot_color *p_color);
+void GDAPI godot_variant_new_image(godot_variant *p_v, const godot_image *p_img);
+void GDAPI godot_variant_new_node_path(godot_variant *p_v, const godot_node_path *p_np);
+void GDAPI godot_variant_new_rid(godot_variant *p_v, const godot_rid *p_rid);
+void GDAPI godot_variant_new_object(godot_variant *p_v, const godot_object *p_obj);
+void GDAPI godot_variant_new_input_event(godot_variant *p_v, const godot_input_event *p_event);
+void GDAPI godot_variant_new_dictionary(godot_variant *p_v, const godot_dictionary *p_dict);
+void GDAPI godot_variant_new_array(godot_variant *p_v, const godot_array *p_arr);
+void GDAPI godot_variant_new_pool_byte_array(godot_variant *p_v, const godot_pool_byte_array *p_pba);
+void GDAPI godot_variant_new_pool_int_array(godot_variant *p_v, const godot_pool_int_array *p_pia);
+void GDAPI godot_variant_new_pool_real_array(godot_variant *p_v, const godot_pool_real_array *p_pra);
+void GDAPI godot_variant_new_pool_string_array(godot_variant *p_v, const godot_pool_string_array *p_psa);
+void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_pool_vector2_array *p_pv2a);
+void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a);
+void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca);
+
+godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v);
+uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_v);
+int64_t GDAPI godot_variant_as_int(const godot_variant *p_v);
+double GDAPI godot_variant_as_real(const godot_variant *p_v);
+godot_string GDAPI godot_variant_as_string(const godot_variant *p_v);
+godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_v);
+godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_v);
+godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_v);
+godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_v);
+godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_v);
+godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_v);
+godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_v);
+godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_v);
+godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_v);
+godot_color GDAPI godot_variant_as_color(const godot_variant *p_v);
+godot_image GDAPI godot_variant_as_image(const godot_variant *p_v);
+godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_v);
+godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_v);
+godot_object GDAPI *godot_variant_as_object(const godot_variant *p_v);
+godot_input_event GDAPI godot_variant_as_input_event(const godot_variant *p_v);
+godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_v);
+godot_array GDAPI godot_variant_as_array(const godot_variant *p_v);
+godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_v);
+godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_v);
+godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_v);
+godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_v);
+godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_v);
+godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v);
+godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v);
+
+godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount /*, godot_variant_call_error *r_error */);
+
+godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method);
+
+godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b);
+godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b);
+
+godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_a, const godot_variant *p_b);
+
+godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *p_valid);
+
+void GDAPI godot_variant_destroy(godot_variant *p_v);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/modules/dlscript/godot/godot_vector2.cpp b/modules/dlscript/godot/godot_vector2.cpp
new file mode 100644
index 0000000000..0664da186e
--- /dev/null
+++ b/modules/dlscript/godot/godot_vector2.cpp
@@ -0,0 +1,124 @@
+#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
new file mode 100644
index 0000000000..63da367e4f
--- /dev/null
+++ b/modules/dlscript/godot/godot_vector2.h
@@ -0,0 +1,78 @@
+#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
new file mode 100644
index 0000000000..34005cbcb8
--- /dev/null
+++ b/modules/dlscript/godot/godot_vector3.cpp
@@ -0,0 +1,150 @@
+#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
new file mode 100644
index 0000000000..7fe93e3fd5
--- /dev/null
+++ b/modules/dlscript/godot/godot_vector3.h
@@ -0,0 +1,82 @@
+#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/cscript/register_types.cpp b/modules/dlscript/register_types.cpp
index 2477bc51e2..1da00701a0 100644
--- a/modules/cscript/register_types.cpp
+++ b/modules/dlscript/register_types.cpp
@@ -27,8 +27,43 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
+#include "dl_script.h"
-void register_cscript_types() {
+#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;
+//ResourceFormatLoaderDLLibrary *resource_loader_dllib=NULL;
+
+void register_dlscript_types() {
+
+ ClassDB::register_class<DLLibrary>();
+ ClassDB::register_class<DLScript>();
+
+ 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);
}
-void unregister_cscript_types() {
+
+void unregister_dlscript_types() {
+
+ ScriptServer::unregister_language(script_language_dl);
+
+ if (script_language_dl)
+ memdelete(script_language_dl);
+
+ if (resource_loader_dl)
+ memdelete(resource_loader_dl);
+
+ if (resource_saver_dl)
+ memdelete(resource_saver_dl);
}
diff --git a/modules/cscript/register_types.h b/modules/dlscript/register_types.h
index 6614ee3a19..90aa1d87fc 100644
--- a/modules/cscript/register_types.h
+++ b/modules/dlscript/register_types.h
@@ -26,5 +26,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_cscript_types();
-void unregister_cscript_types();
+void register_dlscript_types();
+void unregister_dlscript_types();
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp
index 981924191f..dca34f923e 100644
--- a/modules/gdscript/gd_tokenizer.cpp
+++ b/modules/gdscript/gd_tokenizer.cpp
@@ -117,6 +117,7 @@ const char *GDTokenizer::token_names[TK_MAX] = {
"'.'",
"'?'",
"':'",
+ "'$'",
"'\\n'",
"PI",
"_",
diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp
index bb51474a8c..df1605ae9e 100644
--- a/platform/windows/export/export.cpp
+++ b/platform/windows/export/export.cpp
@@ -26,28 +26,25 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "export.h"
#include "editor/editor_export.h"
#include "platform/windows/logo.h"
void register_windows_exporter() {
-#if 0
+ Ref<EditorExportPlatformPC> platform;
+ platform.instance();
+
Image img(_windows_logo);
- Ref<ImageTexture> logo = memnew( ImageTexture );
+ Ref<ImageTexture> logo;
+ logo.instance();
logo->create_from_image(img);
+ platform->set_logo(logo);
+ platform->set_name("Windows Desktop");
+ platform->set_extension("exe");
+ platform->set_release_32("windows_32_release.exe");
+ platform->set_debug_32("windows_32_debug.exe");
+ platform->set_release_64("windows_64_release.exe");
+ platform->set_debug_64("windows_64_debug.exe");
- {
- Ref<EditorExportPlatformPC> exporter = Ref<EditorExportPlatformPC>( memnew(EditorExportPlatformPC) );
- exporter->set_binary_extension("exe");
- exporter->set_release_binary32("windows_32_release.exe");
- exporter->set_debug_binary32("windows_32_debug.exe");
- exporter->set_release_binary64("windows_64_release.exe");
- exporter->set_debug_binary64("windows_64_debug.exe");
- exporter->set_name("Windows Desktop");
- exporter->set_logo(logo);
- EditorImportExport::get_singleton()->add_export_platform(exporter);
- }
-
-#endif
+ EditorExport::get_singleton()->add_export_platform(platform);
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 83a6aa6079..992e50a2e6 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1582,6 +1582,32 @@ bool OS_Windows::get_borderless_window() {
return video_mode.borderless_window;
}
+Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle) {
+ p_library_handle = (void *)LoadLibrary(p_path.utf8().get_data());
+ if (!p_library_handle) {
+ ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + String::num(GetLastError()));
+ ERR_FAIL_V(ERR_CANT_OPEN);
+ }
+ return OK;
+}
+
+Error OS_Windows::close_dynamic_library(void *p_library_handle) {
+ if (!FreeLibrary((HMODULE)p_library_handle)) {
+ return FAILED;
+ }
+ return OK;
+}
+
+Error OS_Windows::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle) {
+ char *error;
+ p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
+ if (!p_symbol_handle) {
+ ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + String::num(GetLastError()));
+ ERR_FAIL_V(ERR_CANT_RESOLVE);
+ }
+ return OK;
+}
+
void OS_Windows::request_attention() {
FLASHWINFO info;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 25c3102ee6..050067ad7d 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -222,6 +222,10 @@ public:
virtual void set_borderless_window(int p_borderless);
virtual bool get_borderless_window();
+ virtual Error open_dynamic_library(const String p_path, void *&p_library_handle);
+ virtual Error close_dynamic_library(void *p_library_handle);
+ virtual Error get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle);
+
virtual MainLoop *get_main_loop() const;
virtual String get_name();
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index b52dd8d660..3e5bb7f572 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -206,7 +206,7 @@ void CanvasItem::show() {
return;
_propagate_visibility_changed(true);
- _change_notify("visibility/visible");
+ _change_notify("visible");
}
void CanvasItem::hide() {
@@ -221,7 +221,7 @@ void CanvasItem::hide() {
return;
_propagate_visibility_changed(false);
- _change_notify("visibility/visible");
+ _change_notify("visible");
}
Variant CanvasItem::edit_get_state() const {
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 1ba6ec46cf..16b6342299 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -63,9 +63,10 @@ void Node2D::edit_set_state(const Variant &p_state) {
angle = state[1];
_scale = state[2];
_update_transform();
- _change_notify("transform/rot");
- _change_notify("transform/scale");
- _change_notify("transform/pos");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
+ _change_notify("scale");
+ _change_notify("position");
}
void Node2D::edit_set_rect(const Rect2 &p_edit_rect) {
@@ -95,15 +96,16 @@ void Node2D::edit_set_rect(const Rect2 &p_edit_rect) {
_scale *= new_scale;
_update_transform();
- _change_notify("transform/scale");
- _change_notify("transform/pos");
+ _change_notify("scale");
+ _change_notify("position");
}
void Node2D::edit_rotate(float p_rot) {
angle += p_rot;
_update_transform();
- _change_notify("transform/rot");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
}
void Node2D::_update_xform_values() {
@@ -134,7 +136,7 @@ void Node2D::set_position(const Point2 &p_pos) {
((Node2D *)this)->_update_xform_values();
pos = p_pos;
_update_transform();
- _change_notify("transform/pos");
+ _change_notify("position");
}
void Node2D::set_rotation(float p_radians) {
@@ -143,7 +145,8 @@ void Node2D::set_rotation(float p_radians) {
((Node2D *)this)->_update_xform_values();
angle = p_radians;
_update_transform();
- _change_notify("transform/rot");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
}
void Node2D::set_rotation_in_degrees(float p_degrees) {
@@ -169,7 +172,7 @@ void Node2D::set_scale(const Size2 &p_scale) {
if (_scale.y == 0)
_scale.y = CMP_EPSILON;
_update_transform();
- _change_notify("transform/scale");
+ _change_notify("scale");
}
Point2 Node2D::get_position() const {
@@ -349,6 +352,7 @@ void Node2D::set_z(int p_z) {
ERR_FAIL_COND(p_z > VS::CANVAS_ITEM_Z_MAX);
z = p_z;
VS::get_singleton()->canvas_item_set_z(get_canvas_item(), z);
+ _change_notify("z");
}
void Node2D::set_z_as_relative(bool p_enabled) {
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 88845a7290..00187f28bc 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1168,7 +1168,7 @@ Vector2 KinematicBody2D::move(const Vector2 &p_motion) {
#endif
}
-Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_bounces) {
+Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction, float p_slope_stop_min_velocity, int p_max_bounces, float p_floor_max_angle) {
Vector2 motion = (move_and_slide_floor_velocity + p_linear_velocity) * get_fixed_process_delta_time();
Vector2 lv = p_linear_velocity;
@@ -1189,7 +1189,7 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
//all is a wall
move_and_slide_on_wall = true;
} else {
- if (get_collision_normal().dot(p_floor_direction) > Math::cos(Math::deg2rad((float)45))) { //floor
+ if (get_collision_normal().dot(p_floor_direction) >= Math::cos(p_floor_max_angle)) { //floor
move_and_slide_on_floor = true;
move_and_slide_floor_velocity = get_collider_velocity();
@@ -1198,15 +1198,16 @@ Vector2 KinematicBody2D::move_and_slide(const Vector2 &p_linear_velocity, const
revert_motion();
return Vector2();
}
- } else if (get_collision_normal().dot(p_floor_direction) < Math::cos(Math::deg2rad((float)45))) { //ceiling
+ } else if (get_collision_normal().dot(-p_floor_direction) <= Math::cos(p_floor_max_angle)) { //ceiling
move_and_slide_on_ceiling = true;
} else {
move_and_slide_on_wall = true;
}
}
- motion = get_collision_normal().slide(motion);
- lv = get_collision_normal().slide(lv);
+ Vector2 n = get_collision_normal();
+ motion = motion.slide(n);
+ lv = lv.slide(n);
Variant collider = _get_collider();
if (collider.get_type() != Variant::NIL) {
move_and_slide_colliders.push_back(collider);
@@ -1307,7 +1308,7 @@ void KinematicBody2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("move", "rel_vec"), &KinematicBody2D::move);
ClassDB::bind_method(D_METHOD("move_to", "position"), &KinematicBody2D::move_to);
- ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "slope_stop_min_velocity", "max_bounces"), &KinematicBody2D::move_and_slide, DEFVAL(Vector2(0, 0)), DEFVAL(5), DEFVAL(4));
+ ClassDB::bind_method(D_METHOD("move_and_slide", "linear_velocity", "floor_normal", "slope_stop_min_velocity", "max_bounces", "floor_max_angle"), &KinematicBody2D::move_and_slide, DEFVAL(Vector2(0, 0)), DEFVAL(5), DEFVAL(4), DEFVAL(Math::deg2rad((float)45)));
ClassDB::bind_method(D_METHOD("test_move", "from", "rel_vec"), &KinematicBody2D::test_move);
ClassDB::bind_method(D_METHOD("get_travel"), &KinematicBody2D::get_travel);
diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h
index e51b512302..6ce6f14d36 100644
--- a/scene/2d/physics_body_2d.h
+++ b/scene/2d/physics_body_2d.h
@@ -314,7 +314,7 @@ public:
void set_collision_margin(float p_margin);
float get_collision_margin() const;
- Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), float p_slope_stop_min_velocity = 5, int p_max_bounces = 4);
+ Vector2 move_and_slide(const Vector2 &p_linear_velocity, const Vector2 &p_floor_direction = Vector2(0, 0), float p_slope_stop_min_velocity = 5, int p_max_bounces = 4, float p_floor_max_angle = Math::deg2rad((float)45));
bool is_move_and_slide_on_floor() const;
bool is_move_and_slide_on_wall() const;
bool is_move_and_slide_on_ceiling() const;
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp
index db822ed306..804af7d9c6 100644
--- a/scene/2d/screen_button.cpp
+++ b/scene/2d/screen_button.cpp
@@ -65,12 +65,14 @@ Ref<BitMap> TouchScreenButton::get_bitmask() const {
void TouchScreenButton::set_shape(const Ref<Shape2D> &p_shape) {
+ if (shape.is_valid())
+ shape->disconnect("changed", this, "update");
+
shape = p_shape;
- if (!is_inside_tree())
- return;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
- return;
+ if (shape.is_valid())
+ shape->connect("changed", this, "update");
+
update();
}
@@ -82,11 +84,17 @@ Ref<Shape2D> TouchScreenButton::get_shape() const {
void TouchScreenButton::set_shape_centered(bool p_shape_centered) {
shape_centered = p_shape_centered;
+ update();
+}
- if (!is_inside_tree())
- return;
- if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
- return;
+bool TouchScreenButton::is_shape_visible() const {
+
+ return shape_visible;
+}
+
+void TouchScreenButton::set_shape_visible(bool p_shape_visible) {
+
+ shape_visible = p_shape_visible;
update();
}
@@ -118,6 +126,8 @@ void TouchScreenButton::_notification(int p_what) {
draw_texture(texture, Point2());
}
+ if (!shape_visible)
+ return;
if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
return;
if (shape.is_valid()) {
@@ -375,6 +385,9 @@ void TouchScreenButton::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shape_centered", "bool"), &TouchScreenButton::set_shape_centered);
ClassDB::bind_method(D_METHOD("is_shape_centered"), &TouchScreenButton::is_shape_centered);
+ ClassDB::bind_method(D_METHOD("set_shape_visible", "bool"), &TouchScreenButton::set_shape_visible);
+ ClassDB::bind_method(D_METHOD("is_shape_visible"), &TouchScreenButton::is_shape_visible);
+
ClassDB::bind_method(D_METHOD("set_action", "action"), &TouchScreenButton::set_action);
ClassDB::bind_method(D_METHOD("get_action"), &TouchScreenButton::get_action);
@@ -393,6 +406,7 @@ void TouchScreenButton::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "bitmask", PROPERTY_HINT_RESOURCE_TYPE, "BitMap"), "set_bitmask", "get_bitmask");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "shape", PROPERTY_HINT_RESOURCE_TYPE, "Shape2D"), "set_shape", "get_shape");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shape_centered"), "set_shape_centered", "is_shape_centered");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shape_visible"), "set_shape_visible", "is_shape_visible");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "passby_press"), "set_passby_press", "is_passby_press_enabled");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "action"), "set_action", "get_action");
ADD_PROPERTY(PropertyInfo(Variant::INT, "visibility_mode", PROPERTY_HINT_ENUM, "Always,TouchScreen Only"), "set_visibility_mode", "get_visibility_mode");
@@ -408,6 +422,7 @@ TouchScreenButton::TouchScreenButton() {
passby_press = false;
visibility = VISIBILITY_ALWAYS;
shape_centered = true;
+ shape_visible = true;
unit_rect = Ref<RectangleShape2D>(memnew(RectangleShape2D));
unit_rect->set_extents(Vector2(0.5, 0.5));
}
diff --git a/scene/2d/screen_button.h b/scene/2d/screen_button.h
index 201d908bf6..2262723ed3 100644
--- a/scene/2d/screen_button.h
+++ b/scene/2d/screen_button.h
@@ -50,6 +50,7 @@ private:
Ref<BitMap> bitmask;
Ref<Shape2D> shape;
bool shape_centered;
+ bool shape_visible;
Ref<RectangleShape2D> unit_rect;
@@ -85,6 +86,9 @@ public:
void set_shape_centered(bool p_shape_centered);
bool is_shape_centered() const;
+ void set_shape_visible(bool p_shape_visible);
+ bool is_shape_visible() const;
+
void set_action(const String &p_action);
String get_action() const;
diff --git a/scene/3d/spatial.cpp b/scene/3d/spatial.cpp
index 1125a7a4d2..1698c0ffd0 100644
--- a/scene/3d/spatial.cpp
+++ b/scene/3d/spatial.cpp
@@ -220,9 +220,10 @@ void Spatial::set_transform(const Transform &p_transform) {
data.local_transform = p_transform;
data.dirty |= DIRTY_VECTORS;
- _change_notify("transform/translation");
- _change_notify("transform/rotation");
- _change_notify("transform/scale");
+ _change_notify("translation");
+ _change_notify("rotation");
+ _change_notify("rotation_deg");
+ _change_notify("scale");
_propagate_transform_changed(this);
if (data.notify_local_transform) {
notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
@@ -525,7 +526,7 @@ void Spatial::_propagate_visibility_changed() {
notification(NOTIFICATION_VISIBILITY_CHANGED);
emit_signal(SceneStringNames::get_singleton()->visibility_changed);
- _change_notify("visibility/visible");
+ _change_notify("visible");
#ifdef TOOLS_ENABLED
if (data.gizmo.is_valid())
_update_gizmo();
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index d2f3eea721..c249d3dd64 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1347,12 +1347,12 @@ Control::AnchorType Control::get_anchor(Margin p_margin) const {
void Control::_change_notify_margins() {
// this avoids sending the whole object data again on a change
- _change_notify("margin/left");
- _change_notify("margin/top");
- _change_notify("margin/right");
- _change_notify("margin/bottom");
- _change_notify("rect/pos");
- _change_notify("rect/size");
+ _change_notify("margin_left");
+ _change_notify("margin_top");
+ _change_notify("margin_right");
+ _change_notify("margin_bottom");
+ _change_notify("rect_pos");
+ _change_notify("rect_size");
}
void Control::set_margin(Margin p_margin, float p_value) {
@@ -2158,7 +2158,7 @@ void Control::set_rotation(float p_radians) {
data.rotation = p_radians;
update();
_notify_transform();
- _change_notify("rect/rotation");
+ _change_notify("rect_rotation");
}
float Control::get_rotation() const {
diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp
index 35d54d9843..df8bfcf691 100644
--- a/scene/gui/dialogs.cpp
+++ b/scene/gui/dialogs.cpp
@@ -177,7 +177,18 @@ void WindowDialog::_notification(int p_what) {
Size2 size = get_size();
Ref<StyleBox> panel = get_stylebox("panel", "WindowDialog");
- panel->draw(canvas, Rect2(Point2(), size));
+ 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);
int title_height = get_constant("title_height", "WindowDialog");
Color title_color = get_color("title_color", "WindowDialog");
diff --git a/scene/gui/patch_9_rect.cpp b/scene/gui/patch_9_rect.cpp
index d0bd45e435..e1ac2be7e6 100644
--- a/scene/gui/patch_9_rect.cpp
+++ b/scene/gui/patch_9_rect.cpp
@@ -37,27 +37,13 @@ void NinePatchRect::_notification(int p_what) {
if (texture.is_null())
return;
- Size2 s = get_size();
+ Rect2 rect = Rect2(Point2(), get_size());
+ Rect2 src_rect = region_rect;
+
+ texture->get_rect_region(rect, src_rect, rect, src_rect);
+
RID ci = get_canvas_item();
- VS::get_singleton()->canvas_item_add_nine_patch(ci, Rect2(Point2(), s), region_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);
- //draw_texture_rect(texture,Rect2(Point2(),s),false,modulate);
-
- /*
- Vector<Point2> points;
- points.resize(4);
- points[0]=Point2(0,0);
- points[1]=Point2(s.x,0);
- points[2]=Point2(s.x,s.y);
- points[3]=Point2(0,s.y);
- Vector<Point2> uvs;
- uvs.resize(4);
- uvs[0]=Point2(0,0);
- uvs[1]=Point2(1,0);
- uvs[2]=Point2(1,1);
- uvs[3]=Point2(0,1);
-
- VisualServer::get_singleton()->canvas_item_add_primitive(ci,points,Vector<Color>(),uvs,texture->get_rid());
-*/
+ VS::get_singleton()->canvas_item_add_nine_patch(ci, 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);
}
}
@@ -116,16 +102,16 @@ void NinePatchRect::set_patch_margin(Margin p_margin, int p_size) {
minimum_size_changed();
switch (p_margin) {
case MARGIN_LEFT:
- _change_notify("patch_margin/left");
+ _change_notify("patch_margin_left");
break;
case MARGIN_TOP:
- _change_notify("patch_margin/top");
+ _change_notify("patch_margin_top");
break;
case MARGIN_RIGHT:
- _change_notify("patch_margin/right");
+ _change_notify("patch_margin_right");
break;
case MARGIN_BOTTOM:
- _change_notify("patch_margin/bottom");
+ _change_notify("patch_margin_bottom");
break;
}
}
diff --git a/scene/gui/range.cpp b/scene/gui/range.cpp
index f15f3a6078..626d1d9663 100644
--- a/scene/gui/range.cpp
+++ b/scene/gui/range.cpp
@@ -33,7 +33,7 @@ void Range::_value_changed_notify() {
_value_changed(shared->val);
emit_signal("value_changed", shared->val);
update();
- _change_notify("range/value");
+ _change_notify("value");
}
void Range::Shared::emit_value_changed() {
@@ -87,26 +87,26 @@ void Range::set_min(double p_min) {
shared->min = p_min;
set_value(shared->val);
- shared->emit_changed("range/min");
+ shared->emit_changed("min");
}
void Range::set_max(double p_max) {
shared->max = p_max;
set_value(shared->val);
- shared->emit_changed("range/max");
+ shared->emit_changed("max");
}
void Range::set_step(double p_step) {
shared->step = p_step;
- shared->emit_changed("range/step");
+ shared->emit_changed("step");
}
void Range::set_page(double p_page) {
shared->page = p_page;
set_value(shared->val);
- shared->emit_changed("range/page");
+ shared->emit_changed("page");
}
double Range::get_value() const {
diff --git a/scene/gui/split_container.cpp b/scene/gui/split_container.cpp
index 5b6f17e0f7..11d068b048 100644
--- a/scene/gui/split_container.cpp
+++ b/scene/gui/split_container.cpp
@@ -185,7 +185,7 @@ void SplitContainer::_resort() {
}
update();
- _change_notify("split/offset");
+ _change_notify("split_offset");
}
Size2 SplitContainer::get_minimum_size() const {
diff --git a/scene/main/scene_main_loop.cpp b/scene/main/scene_main_loop.cpp
index 79ee4a6f75..8eb09908ad 100644
--- a/scene/main/scene_main_loop.cpp
+++ b/scene/main/scene_main_loop.cpp
@@ -374,6 +374,10 @@ void SceneTree::input_text(const String &p_text) {
root_lock--;
}
+bool SceneTree::is_input_handled() {
+ return input_handled;
+}
+
void SceneTree::input_event(const InputEvent &p_event) {
if (is_editor_hint() && (p_event.type == InputEvent::JOYPAD_MOTION || p_event.type == InputEvent::JOYPAD_BUTTON))
@@ -2153,6 +2157,7 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_pause", "enable"), &SceneTree::set_pause);
ClassDB::bind_method(D_METHOD("is_paused"), &SceneTree::is_paused);
ClassDB::bind_method(D_METHOD("set_input_as_handled"), &SceneTree::set_input_as_handled);
+ ClassDB::bind_method(D_METHOD("is_input_handled"), &SceneTree::is_input_handled);
ClassDB::bind_method(D_METHOD("create_timer:SceneTreeTimer", "time_sec", "pause_mode_process"), &SceneTree::create_timer, DEFVAL(true));
diff --git a/scene/main/scene_main_loop.h b/scene/main/scene_main_loop.h
index fadf77e30f..47220b9b63 100644
--- a/scene/main/scene_main_loop.h
+++ b/scene/main/scene_main_loop.h
@@ -350,6 +350,7 @@ public:
void quit();
void set_input_as_handled();
+ bool is_input_handled();
_FORCE_INLINE_ float get_fixed_process_time() const { return fixed_process_time; }
_FORCE_INLINE_ float get_idle_process_time() const { return idle_process_time; }
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 2263e82312..aeb72a6d1e 100755
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -50,8 +50,7 @@ void Timer::_notification(int p_what) {
if (time_left < 0) {
if (!one_shot)
- //time_left=wait_time+time_left;
- time_left = wait_time;
+ time_left += wait_time;
else
stop();
@@ -66,8 +65,7 @@ void Timer::_notification(int p_what) {
if (time_left < 0) {
if (!one_shot)
- //time_left = wait_time + time_left;
- time_left = wait_time;
+ time_left += wait_time;
else
stop();
emit_signal("timeout");
diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp
index 60490d70ca..3f19c2eafc 100644
--- a/scene/resources/default_theme/default_theme.cpp
+++ b/scene/resources/default_theme/default_theme.cpp
@@ -544,7 +544,7 @@ void fill_default_theme(Ref<Theme> &t, const Ref<Font> &default_font, const Ref<
t->set_font("title_font", "WindowDialog", large_font);
t->set_color("title_color", "WindowDialog", Color(0, 0, 0));
- t->set_constant("title_height", "WindowDialog", 18 * scale);
+ t->set_constant("title_height", "WindowDialog", 20 * scale);
t->set_icon("close", "WindowDialog", make_icon(close_png));
t->set_icon("close_hilite", "WindowDialog", make_icon(close_hl_png));
diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp
index 7a503207bc..a3bb52d0f1 100644
--- a/scene/resources/style_box.cpp
+++ b/scene/resources/style_box.cpp
@@ -103,9 +103,11 @@ void StyleBoxTexture::set_texture(RES p_texture) {
if (texture == p_texture)
return;
texture = p_texture;
+ region_rect = Rect2(Point2(), texture->get_size());
emit_signal("texture_changed");
emit_changed();
}
+
RES StyleBoxTexture::get_texture() const {
return texture;
@@ -130,12 +132,12 @@ void StyleBoxTexture::draw(RID p_canvas_item, const Rect2 &p_rect) const {
if (texture.is_null())
return;
- Rect2 r = p_rect;
- r.pos.x -= expand_margin[MARGIN_LEFT];
- r.pos.y -= expand_margin[MARGIN_TOP];
- r.size.x += expand_margin[MARGIN_LEFT] + expand_margin[MARGIN_RIGHT];
- r.size.y += expand_margin[MARGIN_TOP] + expand_margin[MARGIN_BOTTOM];
- VisualServer::get_singleton()->canvas_item_add_nine_patch(p_canvas_item, r, region_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);
+ Rect2 rect = p_rect;
+ Rect2 src_rect = region_rect;
+
+ texture->get_rect_region(rect, src_rect, rect, src_rect);
+
+ 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);
}
void StyleBoxTexture::set_draw_center(bool p_draw) {
diff --git a/scene/scene_string_names.cpp b/scene/scene_string_names.cpp
index f0a33e0d3b..d4a5429c02 100644
--- a/scene/scene_string_names.cpp
+++ b/scene/scene_string_names.cpp
@@ -32,6 +32,9 @@ SceneStringNames *SceneStringNames::singleton = NULL;
SceneStringNames::SceneStringNames() {
+ _estimate_cost = StaticCString::create("_estimate_cost");
+ _compute_cost = StaticCString::create("_compute_cost");
+
resized = StaticCString::create("resized");
dot = StaticCString::create(".");
doubledot = StaticCString::create("..");
diff --git a/scene/scene_string_names.h b/scene/scene_string_names.h
index 8900bbe1d9..3ca006daba 100644
--- a/scene/scene_string_names.h
+++ b/scene/scene_string_names.h
@@ -49,6 +49,9 @@ class SceneStringNames {
public:
_FORCE_INLINE_ static SceneStringNames *get_singleton() { return singleton; }
+ StringName _estimate_cost;
+ StringName _compute_cost;
+
StringName resized;
StringName dot;
StringName doubledot;