From 2fd1efcc4e5b2dd3b7eb210e306886c5feed3e35 Mon Sep 17 00:00:00 2001 From: Ruslan Mustakov Date: Thu, 27 Jul 2017 18:44:23 +0700 Subject: [PATCH] Remove dependency on headers --- examples/simple/godot_headers/godot/array.h | 122 ---- examples/simple/godot_headers/godot/basis.h | 121 ---- examples/simple/godot_headers/godot/color.h | 96 ---- .../simple/godot_headers/godot/dictionary.h | 89 --- .../simple/godot_headers/godot/gdnative.h | 302 ---------- .../simple/godot_headers/godot/node_path.h | 77 --- examples/simple/godot_headers/godot/plane.h | 93 --- .../simple/godot_headers/godot/pool_arrays.h | 316 ---------- examples/simple/godot_headers/godot/quat.h | 104 ---- examples/simple/godot_headers/godot/rect2.h | 86 --- examples/simple/godot_headers/godot/rect3.h | 108 ---- examples/simple/godot_headers/godot/rid.h | 64 --- examples/simple/godot_headers/godot/string.h | 76 --- .../simple/godot_headers/godot/transform.h | 100 ---- .../simple/godot_headers/godot/transform2d.h | 99 ---- examples/simple/godot_headers/godot/variant.h | 201 ------- examples/simple/godot_headers/godot/vector2.h | 128 ----- examples/simple/godot_headers/godot/vector3.h | 135 ----- .../simple/godot_headers/godot_nativescript.h | 228 -------- examples/simple/src/nim.cfg | 1 - examples/simple/src/simple.nimble | 4 +- godot.nimble | 2 +- godot/core/arrays.nim | 78 ++- godot/core/basis.nim | 540 ++++++++++++++---- godot/core/color.nim | 101 ++-- godot/core/dictionary.nim | 49 +- godot/core/godotbase.nim | 75 ++- godot/core/godotcore.nim | 190 +++--- godot/core/nodepath.nim | 32 +- godot/core/plane.nim | 54 +- godot/core/poolarray.nim | 270 ++++----- godot/core/quat.nim | 64 +-- godot/core/rect2.nim | 49 +- godot/core/rect3.nim | 72 +-- godot/core/rid.nim | 14 +- godot/core/strings.nim | 38 +- godot/core/transform.nim | 74 +-- godot/core/transform2d.nim | 70 +-- godot/core/variant.nim | 154 +++-- godot/core/vector2.nim | 91 ++- godot/core/vector3.nim | 325 +++++++---- godot/nim/godotnim.nim | 2 +- 42 files changed, 1280 insertions(+), 3614 deletions(-) delete mode 100644 examples/simple/godot_headers/godot/array.h delete mode 100644 examples/simple/godot_headers/godot/basis.h delete mode 100644 examples/simple/godot_headers/godot/color.h delete mode 100644 examples/simple/godot_headers/godot/dictionary.h delete mode 100644 examples/simple/godot_headers/godot/gdnative.h delete mode 100644 examples/simple/godot_headers/godot/node_path.h delete mode 100644 examples/simple/godot_headers/godot/plane.h delete mode 100644 examples/simple/godot_headers/godot/pool_arrays.h delete mode 100644 examples/simple/godot_headers/godot/quat.h delete mode 100644 examples/simple/godot_headers/godot/rect2.h delete mode 100644 examples/simple/godot_headers/godot/rect3.h delete mode 100644 examples/simple/godot_headers/godot/rid.h delete mode 100644 examples/simple/godot_headers/godot/string.h delete mode 100644 examples/simple/godot_headers/godot/transform.h delete mode 100644 examples/simple/godot_headers/godot/transform2d.h delete mode 100644 examples/simple/godot_headers/godot/variant.h delete mode 100644 examples/simple/godot_headers/godot/vector2.h delete mode 100644 examples/simple/godot_headers/godot/vector3.h delete mode 100644 examples/simple/godot_headers/godot_nativescript.h diff --git a/examples/simple/godot_headers/godot/array.h b/examples/simple/godot_headers/godot/array.h deleted file mode 100644 index cbdbfbd..0000000 --- a/examples/simple/godot_headers/godot/array.h +++ /dev/null @@ -1,122 +0,0 @@ -/*************************************************************************/ -/* array.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ - -#ifndef GODOT_ARRAY_H -#define GODOT_ARRAY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_ARRAY_SIZE]; -} godot_array; -#endif - -#include "pool_arrays.h" -#include "variant.h" - -#include "gdnative.h" - -void GDAPI godot_array_new(godot_array *r_dest); -void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src); -void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca); -void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a); -void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a); -void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa); -void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra); -void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia); -void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba); - -void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); - -godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx); - -godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx); - -void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value); - -void GDAPI godot_array_clear(godot_array *p_self); - -godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value); - -godot_bool GDAPI godot_array_empty(const godot_array *p_self); - -void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value); - -godot_variant GDAPI godot_array_front(const godot_array *p_self); - -godot_variant GDAPI godot_array_back(const godot_array *p_self); - -godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); - -godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what); - -godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value); - -godot_int GDAPI godot_array_hash(const godot_array *p_self); - -void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value); - -void GDAPI godot_array_invert(godot_array *p_self); - -godot_variant GDAPI godot_array_pop_back(godot_array *p_self); - -godot_variant GDAPI godot_array_pop_front(godot_array *p_self); - -void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value); - -void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value); - -void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx); - -void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size); - -godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from); - -godot_int GDAPI godot_array_size(const godot_array *p_self); - -void GDAPI godot_array_sort(godot_array *p_self); - -void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func); - -void GDAPI godot_array_destroy(godot_array *p_self); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_ARRAY_H diff --git a/examples/simple/godot_headers/godot/basis.h b/examples/simple/godot_headers/godot/basis.h deleted file mode 100644 index 79b2b45..0000000 --- a/examples/simple/godot_headers/godot/basis.h +++ /dev/null @@ -1,121 +0,0 @@ -/*************************************************************************/ -/* basis.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_BASIS_H -#define GODOT_BASIS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_BASIS_SIZE 36 - -#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_BASIS_SIZE]; -} godot_basis; -#endif - -#include "gdnative.h" -#include "quat.h" -#include "vector3.h" - -void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis); -void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi); -void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler); - -godot_string GDAPI godot_basis_as_string(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self); - -godot_real GDAPI godot_basis_determinant(const godot_basis *p_self); - -godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - -godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale); - -void GDAPI godot_basis_set_scale(godot_basis *p_self, const godot_vector3 *p_scale); - -void GDAPI godot_basis_set_rotation_euler(godot_basis *p_self, const godot_vector3 *p_euler); - -void GDAPI godot_basis_set_rotation_axis_angle(godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_angle); - -godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self); - -godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self); - -godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with); - -godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with); - -godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with); - -godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v); - -godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self); - -void GDAPI godot_basis_new(godot_basis *r_dest); - -void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler); - -// p_elements is a pointer to an array of 3 (!!) vector3 -void GDAPI godot_basis_get_elements(godot_basis *p_self, godot_vector3 *p_elements); - -godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis); - -void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value); - -godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row); - -void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value); - -godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b); - -godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_BASIS_H diff --git a/examples/simple/godot_headers/godot/color.h b/examples/simple/godot_headers/godot/color.h deleted file mode 100644 index 77e709f..0000000 --- a/examples/simple/godot_headers/godot/color.h +++ /dev/null @@ -1,96 +0,0 @@ -/*************************************************************************/ -/* color.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_COLOR_H -#define GODOT_COLOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_COLOR_SIZE 16 - -#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_COLOR_SIZE]; -} godot_color; -#endif - -#include "gdnative.h" -#include "string.h" - -void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a); -void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b); - -godot_real godot_color_get_r(const godot_color *p_self); -void godot_color_set_r(godot_color *p_self, const godot_real r); - -godot_real godot_color_get_g(const godot_color *p_self); -void godot_color_set_g(godot_color *p_self, const godot_real g); - -godot_real godot_color_get_b(const godot_color *p_self); -void godot_color_set_b(godot_color *p_self, const godot_real b); - -godot_real godot_color_get_a(const godot_color *p_self); -void godot_color_set_a(godot_color *p_self, const godot_real a); - -godot_real godot_color_get_h(const godot_color *p_self); -godot_real godot_color_get_s(const godot_color *p_self); -godot_real godot_color_get_v(const godot_color *p_self); - -godot_string GDAPI godot_color_as_string(const godot_color *p_self); - -godot_int GDAPI godot_color_to_32(const godot_color *p_self); - -godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self); - -godot_real GDAPI godot_color_gray(const godot_color *p_self); - -godot_color GDAPI godot_color_inverted(const godot_color *p_self); - -godot_color GDAPI godot_color_contrasted(const godot_color *p_self); - -godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t); - -godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over); - -godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha); - -godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b); - -godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_COLOR_H diff --git a/examples/simple/godot_headers/godot/dictionary.h b/examples/simple/godot_headers/godot/dictionary.h deleted file mode 100644 index a08deb2..0000000 --- a/examples/simple/godot_headers/godot/dictionary.h +++ /dev/null @@ -1,89 +0,0 @@ -/*************************************************************************/ -/* dictionary.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_DICTIONARY_H -#define GODOT_DICTIONARY_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_DICTIONARY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_DICTIONARY_SIZE]; -} godot_dictionary; -#endif - -#include "array.h" -#include "gdnative.h" -#include "variant.h" - -void GDAPI godot_dictionary_new(godot_dictionary *r_dest); -void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src); -void GDAPI godot_dictionary_destroy(godot_dictionary *p_self); - -godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self); - -godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self); - -void GDAPI godot_dictionary_clear(godot_dictionary *p_self); - -godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys); - -void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key); - -godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self); - -godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self); - -godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self); - -godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key); -void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value); - -godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key); - -godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key); - -godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b); - -godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_DICTIONARY_H diff --git a/examples/simple/godot_headers/godot/gdnative.h b/examples/simple/godot_headers/godot/gdnative.h deleted file mode 100644 index 510bf36..0000000 --- a/examples/simple/godot_headers/godot/gdnative.h +++ /dev/null @@ -1,302 +0,0 @@ -/*************************************************************************/ -/* gdnative.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_GDNATIVE_H -#define GODOT_GDNATIVE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef GDAPI_BUILT_IN -#define GDAPI_EXPORT -#endif - -#ifdef _WIN32 -#if defined(GDAPI_EXPORT) -#define GDCALLINGCONV -#define GDAPI __declspec(dllexport) GDCALLINGCONV -#else -#define GDCALLINGCONV -#define GDAPI __declspec(dllimport) GDCALLINGCONV -#endif -#elif defined(__APPLE__) -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -#define GDCALLINGCONV -#define GDAPI -#elif TARGET_OS_MAC -#define GDCALLINGCONV __attribute__((sysv_abi)) -#define GDAPI GDCALLINGCONV -#endif -#else -#define GDCALLINGCONV __attribute__((sysv_abi)) -#define GDAPI GDCALLINGCONV -#endif - -// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! -#ifdef _WIN32 -#define GDN_EXPORT __declspec(dllexport) -#else -#define GDN_EXPORT -#endif - -#include -#include - -#define GODOT_API_VERSION 1 - -////// Error - -typedef enum { - 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; - -/////// Brute force forward declarations for the rest -/* -typedef struct godot_variant godot_variant; -typedef struct godot_string godot_string; -typedef struct godot_vector2 godot_vector2; -typedef struct godot_rect2 godot_rect2; -typedef struct godot_vector3 godot_vector3; -typedef struct godot_transform2d godot_transform2d; -typedef struct godot_plane godot_plane; -typedef struct godot_quat godot_quat; -typedef struct godot_rect3 godot_rect3; -typedef struct godot_basis godot_basis; -typedef struct godot_transform godot_transform; -typedef struct godot_color godot_color; -typedef struct godot_node_path godot_node_path; -typedef struct godot_rid godot_rid; -typedef struct godot_dictionary godot_dictionary; -typedef struct godot_array godot_array; -typedef struct godot_pool_byte_array godot_pool_byte_array; -typedef struct godot_pool_int_array godot_pool_int_array; -typedef struct godot_pool_real_array godot_pool_real_array; -typedef struct godot_pool_string_array godot_pool_string_array; -typedef struct godot_pool_vector2_array godot_pool_vector2_array; -typedef struct godot_pool_vector3_array godot_pool_vector3_array; -typedef struct godot_pool_color_array godot_pool_color_array; -*/ -/////// String - -#include "string.h" - -////// Vector2 - -#include "vector2.h" - -////// Rect2 - -#include "rect2.h" - -////// Vector3 - -#include "vector3.h" - -////// Transform2D - -#include "transform2d.h" - -/////// Plane - -#include "plane.h" - -/////// Quat - -#include "quat.h" - -/////// Rect3 - -#include "rect3.h" - -/////// Basis - -#include "basis.h" - -/////// Transform - -#include "transform.h" - -/////// Color - -#include "color.h" - -/////// NodePath - -#include "node_path.h" - -/////// RID - -#include "rid.h" - -/////// Dictionary - -#include "dictionary.h" - -/////// Array - -#include "array.h" - -// single API file for Pool*Array -#include "pool_arrays.h" - -void GDAPI godot_object_destroy(godot_object *p_o); - -////// Variant - -#include "variant.h" - -////// Singleton API - -godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed - -////// OS API - -void GDAPI *godot_get_stack_bottom(); // returns stack bottom of the main thread - -////// MethodBind API - -typedef struct { - 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); -godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error); -////// Script API - -typedef struct { - godot_bool in_editor; - uint64_t core_api_hash; - uint64_t editor_api_hash; - uint64_t no_api_hash; -} godot_gdnative_init_options; - -typedef struct { - godot_bool in_editor; -} godot_gdnative_terminate_options; - -// Calling convention? -typedef godot_object *(*godot_class_constructor)(); - -godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname); - -godot_dictionary GDAPI godot_get_global_constants(); - -////// GDNative procedure types -typedef void (*godot_gdnative_init_fn)(godot_gdnative_init_options *); -typedef void (*godot_gdnative_terminate_fn)(godot_gdnative_terminate_options *); -typedef godot_variant (*godot_gdnative_procedure_fn)(void *, godot_array *); - -////// 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); - -//print using Godot's error handler list -void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line); -void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line); -void GDAPI godot_print(const godot_string *p_message); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_C_H diff --git a/examples/simple/godot_headers/godot/node_path.h b/examples/simple/godot_headers/godot/node_path.h deleted file mode 100644 index 06955a0..0000000 --- a/examples/simple/godot_headers/godot/node_path.h +++ /dev/null @@ -1,77 +0,0 @@ -/*************************************************************************/ -/* node_path.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_NODE_PATH_H -#define GODOT_NODE_PATH_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_NODE_PATH_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_NODE_PATH_SIZE]; -} godot_node_path; -#endif - -#include "gdnative.h" -#include "string.h" - -void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from); -void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src); -void GDAPI godot_node_path_destroy(godot_node_path *p_self); - -godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self); - -godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self); - -godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self); - -godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx); - -godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self); - -godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx); - -godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_self); - -godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self); - -godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_NODE_PATH_H diff --git a/examples/simple/godot_headers/godot/plane.h b/examples/simple/godot_headers/godot/plane.h deleted file mode 100644 index e9e3b71..0000000 --- a/examples/simple/godot_headers/godot/plane.h +++ /dev/null @@ -1,93 +0,0 @@ -/*************************************************************************/ -/* plane.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_PLANE_H -#define GODOT_PLANE_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_PLANE_SIZE 16 - -#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_PLANE_SIZE]; -} godot_plane; -#endif - -#include "gdnative.h" -#include "vector3.h" - -void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d); -void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3); -void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d); - -godot_string GDAPI godot_plane_as_string(const godot_plane *p_self); - -godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self); - -godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self); - -godot_vector3 GDAPI godot_plane_get_any_point(const godot_plane *p_self); - -godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point); - -godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point); - -godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon); - -godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point); - -godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c); - -godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir); - -godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end); - -godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self); - -godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b); - -void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal); - -godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self); - -godot_real GDAPI godot_plane_get_d(const godot_plane *p_self); - -void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_PLANE_H diff --git a/examples/simple/godot_headers/godot/pool_arrays.h b/examples/simple/godot_headers/godot/pool_arrays.h deleted file mode 100644 index 1e2916c..0000000 --- a/examples/simple/godot_headers/godot/pool_arrays.h +++ /dev/null @@ -1,316 +0,0 @@ -/*************************************************************************/ -/* pool_arrays.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_POOL_ARRAYS_H -#define GODOT_POOL_ARRAYS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/////// PoolByteArray - -#define GODOT_POOL_BYTE_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_BYTE_ARRAY_SIZE]; -} godot_pool_byte_array; -#endif - -/////// PoolIntArray - -#define GODOT_POOL_INT_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_INT_ARRAY_SIZE]; -} godot_pool_int_array; -#endif - -/////// PoolRealArray - -#define GODOT_POOL_REAL_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_REAL_ARRAY_SIZE]; -} godot_pool_real_array; -#endif - -/////// PoolStringArray - -#define GODOT_POOL_STRING_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_STRING_ARRAY_SIZE]; -} godot_pool_string_array; -#endif - -/////// PoolVector2Array - -#define GODOT_POOL_VECTOR2_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_VECTOR2_ARRAY_SIZE]; -} godot_pool_vector2_array; -#endif - -/////// PoolVector3Array - -#define GODOT_POOL_VECTOR3_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_VECTOR3_ARRAY_SIZE]; -} godot_pool_vector3_array; -#endif - -/////// PoolColorArray - -#define GODOT_POOL_COLOR_ARRAY_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_POOL_COLOR_ARRAY_SIZE]; -} godot_pool_color_array; -#endif - -#include "array.h" -#include "color.h" -#include "vector2.h" -#include "vector3.h" - -#include "gdnative.h" - -// byte - -void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest); -void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src); -void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data); - -void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array); - -godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); - -void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self); - -void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data); - -void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data); -uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self); - -void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self); - -// int - -void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest); -void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src); -void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data); - -void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array); - -godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); - -void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self); - -void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data); - -void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data); -godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self); - -void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self); - -// real - -void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest); -void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src); -void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data); - -void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array); - -godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); - -void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self); - -void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data); - -void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data); -godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self); - -void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self); - -// string - -void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest); -void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src); -void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data); - -void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array); - -godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); - -void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self); - -void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data); - -void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data); -godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self); - -void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self); - -// vector2 - -void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest); -void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src); -void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); - -void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array); - -godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); - -void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self); - -void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data); - -void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data); -godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self); - -void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self); - -// vector3 - -void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest); -void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src); -void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); - -void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array); - -godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); - -void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self); - -void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data); - -void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data); -godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self); - -void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self); - -// color - -void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest); -void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src); -void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a); - -void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data); - -void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array); - -godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); - -void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self); - -void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data); - -void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx); - -void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size); - -void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data); -godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx); - -godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self); - -void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_POOL_ARRAYS_H diff --git a/examples/simple/godot_headers/godot/quat.h b/examples/simple/godot_headers/godot/quat.h deleted file mode 100644 index b86cbac..0000000 --- a/examples/simple/godot_headers/godot/quat.h +++ /dev/null @@ -1,104 +0,0 @@ -/*************************************************************************/ -/* quat.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_QUAT_H -#define GODOT_QUAT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_QUAT_SIZE 16 - -#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_QUAT_SIZE]; -} godot_quat; -#endif - -#include "gdnative.h" -#include "vector3.h" - -void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w); -void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle); - -godot_real GDAPI godot_quat_get_x(const godot_quat *p_self); -void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val); - -godot_real GDAPI godot_quat_get_y(const godot_quat *p_self); -void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val); - -godot_real GDAPI godot_quat_get_z(const godot_quat *p_self); -void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val); - -godot_real GDAPI godot_quat_get_w(const godot_quat *p_self); -void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val); - -godot_string GDAPI godot_quat_as_string(const godot_quat *p_self); - -godot_real GDAPI godot_quat_length(const godot_quat *p_self); - -godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self); - -godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self); - -godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self); - -godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self); - -godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b); - -godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v); - -godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); - -godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t); - -godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t); - -godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b); - -godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b); - -godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b); - -godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b); - -godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b); - -godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_QUAT_H diff --git a/examples/simple/godot_headers/godot/rect2.h b/examples/simple/godot_headers/godot/rect2.h deleted file mode 100644 index 7b6613d..0000000 --- a/examples/simple/godot_headers/godot/rect2.h +++ /dev/null @@ -1,86 +0,0 @@ -/*************************************************************************/ -/* rect2.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_RECT2_H -#define GODOT_RECT2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED -typedef struct godot_rect2 { - uint8_t _dont_touch_that[16]; -} godot_rect2; -#endif - -#include "gdnative.h" -#include "vector2.h" - -void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size); -void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height); - -godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self); - -godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self); - -godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self); - -godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point); - -godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by); - -godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to); - -godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b); - -godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self); - -godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self); - -void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos); - -void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_RECT2_H diff --git a/examples/simple/godot_headers/godot/rect3.h b/examples/simple/godot_headers/godot/rect3.h deleted file mode 100644 index 638d89f..0000000 --- a/examples/simple/godot_headers/godot/rect3.h +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************/ -/* rect3.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_RECT3_H -#define GODOT_RECT3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_RECT3_SIZE 24 - -#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_RECT3_SIZE]; -} godot_rect3; -#endif - -#include "gdnative.h" -#include "plane.h" -#include "vector3.h" - -void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size); - -godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self); -void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self); -void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v); - -godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self); - -godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self); - -godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self); - -godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self); - -godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with); - -godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane); - -godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to); - -godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point); - -godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir); - -godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self); - -godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self); - -godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self); - -godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self); - -godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self); - -godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self); - -godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point); - -godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by); - -godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx); - -godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_RECT3_H diff --git a/examples/simple/godot_headers/godot/rid.h b/examples/simple/godot_headers/godot/rid.h deleted file mode 100644 index 92e101f..0000000 --- a/examples/simple/godot_headers/godot/rid.h +++ /dev/null @@ -1,64 +0,0 @@ -/*************************************************************************/ -/* rid.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_RID_H -#define GODOT_RID_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_RID_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_RID_SIZE]; -} godot_rid; -#endif - -#include "gdnative.h" - -void GDAPI godot_rid_new(godot_rid *r_dest); - -godot_int GDAPI godot_rid_get_id(const godot_rid *p_self); - -void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from); - -godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b); - -godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_RID_H diff --git a/examples/simple/godot_headers/godot/string.h b/examples/simple/godot_headers/godot/string.h deleted file mode 100644 index d4d6d6c..0000000 --- a/examples/simple/godot_headers/godot/string.h +++ /dev/null @@ -1,76 +0,0 @@ -/*************************************************************************/ -/* string.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_STRING_H -#define GODOT_STRING_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#define GODOT_STRING_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_STRING_SIZE]; -} godot_string; -#endif - -#include "gdnative.h" - -void GDAPI godot_string_new(godot_string *r_dest); -void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src); -void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size); -void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size); - -void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size); - -wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx); -const char GDAPI *godot_string_c_str(const godot_string *p_self); -const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self); - -godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b); -godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b); -godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, 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_self); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_STRING_H diff --git a/examples/simple/godot_headers/godot/transform.h b/examples/simple/godot_headers/godot/transform.h deleted file mode 100644 index d14190e..0000000 --- a/examples/simple/godot_headers/godot/transform.h +++ /dev/null @@ -1,100 +0,0 @@ -/*************************************************************************/ -/* transform.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_TRANSFORM_H -#define GODOT_TRANSFORM_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_TRANSFORM_SIZE 48 - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_TRANSFORM_SIZE]; -} godot_transform; -#endif - -#include "basis.h" -#include "gdnative.h" -#include "variant.h" -#include "vector3.h" - -void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin); -void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin); - -godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self); -void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v); - -godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self); -void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v); - -godot_string GDAPI godot_transform_as_string(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self); - -godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - -godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale); - -godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs); - -godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up); - -godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v); - -godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v); - -void GDAPI godot_transform_new_identity(godot_transform *r_dest); - -godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b); - -godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b); - -godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v); - -godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v); - -godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v); - -godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_TRANSFORM_H diff --git a/examples/simple/godot_headers/godot/transform2d.h b/examples/simple/godot_headers/godot/transform2d.h deleted file mode 100644 index 7171e52..0000000 --- a/examples/simple/godot_headers/godot/transform2d.h +++ /dev/null @@ -1,99 +0,0 @@ -/*************************************************************************/ -/* transform2d.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_TRANSFORM2D_H -#define GODOT_TRANSFORM2D_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_TRANSFORM2D_SIZE 24 - -#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_TRANSFORM2D_SIZE]; -} godot_transform2d; -#endif - -#include "gdnative.h" -#include "variant.h" -#include "vector2.h" - -void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos); -void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin); - -godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self); - -godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self); - -godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self); - -godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self); - -godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi); - -godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale); - -godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset); - -godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v); - -godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c); - -godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b); - -godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b); - -void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest); - -godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v); - -godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_TRANSFORM2D_H diff --git a/examples/simple/godot_headers/godot/variant.h b/examples/simple/godot_headers/godot/variant.h deleted file mode 100644 index b56d582..0000000 --- a/examples/simple/godot_headers/godot/variant.h +++ /dev/null @@ -1,201 +0,0 @@ -/*************************************************************************/ -/* variant.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_VARIANT_H -#define GODOT_VARIANT_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_VARIANT_SIZE 24 - -#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_VARIANT_SIZE]; -} godot_variant; -#endif - -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, - GODOT_VARIANT_TYPE_BASIS, - GODOT_VARIANT_TYPE_TRANSFORM, - - // misc types - GODOT_VARIANT_TYPE_COLOR, - GODOT_VARIANT_TYPE_NODE_PATH, // 15 - GODOT_VARIANT_TYPE_RID, - GODOT_VARIANT_TYPE_OBJECT, - GODOT_VARIANT_TYPE_DICTIONARY, - GODOT_VARIANT_TYPE_ARRAY, // 20 - - // 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, - GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25 - GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY, - GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY, -} godot_variant_type; - -typedef enum godot_variant_call_error_error { - GODOT_CALL_ERROR_CALL_OK, - GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD, - GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT, - GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS, - GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS, - GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL, -} godot_variant_call_error_error; - -typedef struct godot_variant_call_error { - godot_variant_call_error_error error; - int argument; - godot_variant_type expected; -} godot_variant_call_error; - -#include "array.h" -#include "basis.h" -#include "color.h" -#include "dictionary.h" -#include "node_path.h" -#include "plane.h" -#include "pool_arrays.h" -#include "quat.h" -#include "rect2.h" -#include "rect3.h" -#include "rid.h" -#include "string.h" -#include "transform.h" -#include "transform2d.h" -#include "variant.h" -#include "vector2.h" -#include "vector3.h" - -#include "gdnative.h" - -godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v); - -void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src); - -void GDAPI godot_variant_new_nil(godot_variant *r_dest); - -void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b); -void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i); -void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i); -void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r); -void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s); -void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2); -void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2); -void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3); -void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d); -void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane); -void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat); -void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3); -void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis); -void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans); -void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color); -void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np); -void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid); -void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj); -void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict); -void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr); -void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba); -void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia); -void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra); -void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa); -void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a); -void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a); -void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca); - -godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self); -uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self); -int64_t GDAPI godot_variant_as_int(const godot_variant *p_self); -double GDAPI godot_variant_as_real(const godot_variant *p_self); -godot_string GDAPI godot_variant_as_string(const godot_variant *p_self); -godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self); -godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self); -godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self); -godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self); -godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self); -godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self); -godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self); -godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self); -godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self); -godot_color GDAPI godot_variant_as_color(const godot_variant *p_self); -godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self); -godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self); -godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self); -godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self); -godot_array GDAPI godot_variant_as_array(const godot_variant *p_self); -godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self); -godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self); -godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self); -godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self); -godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self); -godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self); -godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self); - -godot_variant GDAPI godot_variant_call(godot_variant *p_self, 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(const godot_variant *p_self, const godot_string *p_method); - -godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other); -godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other); - -godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other); - -godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self, godot_bool *r_valid); - -void GDAPI godot_variant_destroy(godot_variant *p_self); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/examples/simple/godot_headers/godot/vector2.h b/examples/simple/godot_headers/godot/vector2.h deleted file mode 100644 index 9934dda..0000000 --- a/examples/simple/godot_headers/godot/vector2.h +++ /dev/null @@ -1,128 +0,0 @@ -/*************************************************************************/ -/* vector2.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_VECTOR2_H -#define GODOT_VECTOR2_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_VECTOR2_SIZE 8 - -#ifndef GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VECTOR2_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_VECTOR2_SIZE]; -} godot_vector2; -#endif - -#include "gdnative.h" - -void GDAPI godot_vector2_new(godot_vector2 *r_dest, const godot_real p_x, const godot_real p_y); - -godot_string GDAPI godot_vector2_as_string(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_normalized(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_length(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_angle(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_self); - -godot_bool GDAPI godot_vector2_is_normalized(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_real GDAPI godot_vector2_angle_to(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_real GDAPI godot_vector2_angle_to_point(const godot_vector2 *p_self, const godot_vector2 *p_to); - -godot_vector2 GDAPI godot_vector2_linear_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_real p_t); - -godot_vector2 GDAPI godot_vector2_cubic_interpolate(const godot_vector2 *p_self, const godot_vector2 *p_b, const godot_vector2 *p_pre_a, const godot_vector2 *p_post_b, const godot_real p_t); - -godot_vector2 GDAPI godot_vector2_rotated(const godot_vector2 *p_self, const godot_real p_phi); - -godot_vector2 GDAPI godot_vector2_tangent(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_floor(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_snapped(const godot_vector2 *p_self, const godot_vector2 *p_by); - -godot_real GDAPI godot_vector2_aspect(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_dot(const godot_vector2 *p_self, const godot_vector2 *p_with); - -godot_vector2 GDAPI godot_vector2_slide(const godot_vector2 *p_self, const godot_vector2 *p_n); - -godot_vector2 GDAPI godot_vector2_bounce(const godot_vector2 *p_self, const godot_vector2 *p_n); - -godot_vector2 GDAPI godot_vector2_reflect(const godot_vector2 *p_self, const godot_vector2 *p_n); - -godot_vector2 GDAPI godot_vector2_abs(const godot_vector2 *p_self); - -godot_vector2 GDAPI godot_vector2_clamped(const godot_vector2 *p_self, const godot_real p_length); - -godot_vector2 GDAPI godot_vector2_operator_add(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_substract(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_multiply_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_multiply_scalar(const godot_vector2 *p_self, const godot_real p_b); - -godot_vector2 GDAPI godot_vector2_operator_divide_vector(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_divide_scalar(const godot_vector2 *p_self, const godot_real p_b); - -godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_self, const godot_vector2 *p_b); - -godot_vector2 GDAPI godot_vector2_operator_neg(const godot_vector2 *p_self); - -void GDAPI godot_vector2_set_x(godot_vector2 *p_self, const godot_real p_x); - -void GDAPI godot_vector2_set_y(godot_vector2 *p_self, const godot_real p_y); - -godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self); - -godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_VECTOR2_H diff --git a/examples/simple/godot_headers/godot/vector3.h b/examples/simple/godot_headers/godot/vector3.h deleted file mode 100644 index b5f8d0f..0000000 --- a/examples/simple/godot_headers/godot/vector3.h +++ /dev/null @@ -1,135 +0,0 @@ -/*************************************************************************/ -/* vector3.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_VECTOR3_H -#define GODOT_VECTOR3_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#define GODOT_VECTOR3_SIZE 12 - -#ifndef GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_VECTOR3_TYPE_DEFINED -typedef struct { - uint8_t _dont_touch_that[GODOT_VECTOR3_SIZE]; -} godot_vector3; -#endif - -#include "basis.h" -#include "gdnative.h" - -typedef enum { - GODOT_VECTOR3_AXIS_X, - GODOT_VECTOR3_AXIS_Y, - GODOT_VECTOR3_AXIS_Z, -} godot_vector3_axis; - -void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z); - -godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self); - -godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self); - -godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self); - -godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self); - -godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self); - -godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_vector3 *p_by); - -godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi); - -godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t); - -godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t); - -godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self); - -godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self); - -godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to); - -godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n); - -godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n); - -godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n); - -godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b); - -godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b); - -godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b); - -godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self); - -void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val); - -godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis); - -#ifdef __cplusplus -} -#endif - -#endif // GODOT_VECTOR3_H diff --git a/examples/simple/godot_headers/godot_nativescript.h b/examples/simple/godot_headers/godot_nativescript.h deleted file mode 100644 index 9a84899..0000000 --- a/examples/simple/godot_headers/godot_nativescript.h +++ /dev/null @@ -1,228 +0,0 @@ -/*************************************************************************/ -/* godot.h */ -/*************************************************************************/ -/* This file is part of: */ -/* GODOT ENGINE */ -/* http://www.godotengine.org */ -/*************************************************************************/ -/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ -/* */ -/* Permission is hereby granted, free of charge, to any person obtaining */ -/* a copy of this software and associated documentation files (the */ -/* "Software"), to deal in the Software without restriction, including */ -/* without limitation the rights to use, copy, modify, merge, publish, */ -/* distribute, sublicense, and/or sell copies of the Software, and to */ -/* permit persons to whom the Software is furnished to do so, subject to */ -/* the following conditions: */ -/* */ -/* The above copyright notice and this permission notice shall be */ -/* included in all copies or substantial portions of the Software. */ -/* */ -/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ -/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ -/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ -/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ -/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ -/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ -/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/*************************************************************************/ -#ifndef GODOT_NATIVESCRIPT_H -#define GODOT_NATIVESCRIPT_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef GDAPI_BUILT_IN -#define GDAPI_EXPORT -#endif - -#ifdef _WIN32 -#if defined(GDAPI_EXPORT) -#define GDCALLINGCONV -#define GDAPI __declspec(dllexport) GDCALLINGCONV -#else -#define GDCALLINGCONV -#define GDAPI __declspec(dllimport) GDCALLINGCONV -#endif -#elif defined(__APPLE__) -#include "TargetConditionals.h" -#if TARGET_OS_IPHONE -#define GDCALLINGCONV -#define GDAPI -#elif TARGET_OS_MAC -#define GDCALLINGCONV __attribute__((sysv_abi)) -#define GDAPI GDCALLINGCONV -#endif -#else -#define GDCALLINGCONV __attribute__((sysv_abi)) -#define GDAPI GDCALLINGCONV -#endif - -// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!! -#ifdef _WIN32 -#define GDN_EXPORT __declspec(dllexport) -#else -#define GDN_EXPORT -#endif - -#include -#include - -typedef enum { - 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 enum { - 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_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_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 { - // instance pointer, method_data - return user data - GDCALLINGCONV void *(*create_func)(godot_object *, void *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_instance_create_func; - -typedef struct { - // instance pointer, method data, user data - GDCALLINGCONV void (*destroy_func)(godot_object *, void *, void *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_instance_destroy_func; - -void GDAPI godot_nativescript_register_class(void *p_gdnative_handle, 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_nativescript_register_tool_class(void *p_gdnative_handle, 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_method_rpc_mode rpc_type; -} godot_method_attributes; - -typedef struct { - // instance pointer, method data, user data, num args, args - return result as varaint - GDCALLINGCONV godot_variant (*method)(godot_object *, void *, void *, int, godot_variant **); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_instance_method; - -void GDAPI godot_nativescript_register_method(void *p_gdnative_handle, const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method); - -typedef struct { - // instance pointer, method data, user data, value - GDCALLINGCONV void (*set_func)(godot_object *, void *, void *, godot_variant *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_property_set_func; - -typedef struct { - // instance pointer, method data, user data, value - GDCALLINGCONV godot_variant (*get_func)(godot_object *, void *, void *); - void *method_data; - GDCALLINGCONV void (*free_func)(void *); -} godot_property_get_func; - -void GDAPI godot_nativescript_register_property(void *p_gdnative_handle, 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_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_string name; - int num_args; - godot_signal_argument *args; - int num_default_args; - godot_variant *default_args; -} godot_signal; - -void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_signal *p_signal); -godot_object GDAPI *godot_nativescript_new(const char *p_classname); - -void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/examples/simple/src/nim.cfg b/examples/simple/src/nim.cfg index 7e8f842..a64088d 100644 --- a/examples/simple/src/nim.cfg +++ b/examples/simple/src/nim.cfg @@ -1,6 +1,5 @@ --path:"$projectdir" --path:"$projectdir/../godotapi" ---cincludes:"$projectdir/../godot_headers/" --experimental --app:lib --stackTrace:on diff --git a/examples/simple/src/simple.nimble b/examples/simple/src/simple.nimble index f33fa69..22c3f19 100644 --- a/examples/simple/src/simple.nimble +++ b/examples/simple/src/simple.nimble @@ -1,10 +1,10 @@ version = "0.1.0" author = "Xored Software, Inc." -description = "FPS Counter Sample" +description = "Simple Sample" license = "MIT" bin = @["simple"] -requires "https://github.com/pragmagic/godot-nim.git >= 0.2.3 & < 0.3.0" +requires "https://github.com/pragmagic/godot-nim.git >= 0.3.0 & < 0.4.0" task make, "build": const archPostfix = when sizeof(int) == 8: "_64" else: "_32" diff --git a/godot.nimble b/godot.nimble index 371275f..1788bf7 100644 --- a/godot.nimble +++ b/godot.nimble @@ -1,4 +1,4 @@ -version = "0.2.4" +version = "0.3.0" author = "Xored Software, Inc." description = "Godot Engine bindings" license = "MIT" diff --git a/godot/core/arrays.nim b/godot/core/arrays.nim index 8d1f054..fcc065b 100644 --- a/godot/core/arrays.nim +++ b/godot/core/arrays.nim @@ -4,28 +4,21 @@ import hashes import godotbase, poolarray, variant, strings proc initArray(dest: var Array) {. - importc: "godot_array_new", header: "godot/array.h".} + importc: "godot_array_new".} proc initArray(dest: var Array; pca: PoolColorArray) {. - importc: "godot_array_new_pool_coloarray", - header: "godot/array.h".} + importc: "godot_array_new_pool_coloarray".} proc initArray(dest: var Array; pv3a: PoolVector3Array) {. - importc: "godot_array_new_pool_vector3_array", - header: "godot/array.h".} + importc: "godot_array_new_pool_vector3_array".} proc initArray(dest: var Array; pv2a: PoolVector2Array) {. - importc: "godot_array_new_pool_vector2_array", - header: "godot/array.h".} + importc: "godot_array_new_pool_vector2_array".} proc initArray(dest: var Array; psa: PoolStringArray) {. - importc: "godot_array_new_pool_string_array", - header: "godot/array.h".} + importc: "godot_array_new_pool_string_array".} proc initArray(dest: var Array; pra: PoolRealArray) {. - importc: "godot_array_new_pool_real_array", - header: "godot/array.h".} + importc: "godot_array_new_pool_real_array".} proc initArray(dest: var Array; pia: PoolIntArray) {. - importc: "godot_array_new_pool_int_array", - header: "godot/array.h".} + importc: "godot_array_new_pool_int_array".} proc initArray(dest: var Array; pba: PoolByteArray) {. - importc: "godot_array_new_pool_byte_array", - header: "godot/array.h".} + importc: "godot_array_new_pool_byte_array".} proc initArray*(): Array {.inline.} = initArray(result) @@ -54,79 +47,76 @@ proc initArray*(pba: PoolByteArray): Array {.inline.} = proc `[]=`*(self: var Array; idx: cint; value: Variant) {. noSideEffect, - importc: "godot_array_set", header: "godot/array.h".} + importc: "godot_array_set".} proc `[]`*(self: Array; idx: cint): Variant {. noSideEffect, - importc: "godot_array_get", header: "godot/array.h".} + importc: "godot_array_get".} proc mget*(self: var Array; idx: cint): ptr Variant {. - importc: "godot_array_operator_index", header: "godot/array.h".} + importc: "godot_array_operator_index".} proc add*(self: var Array; value: Variant) {. noSideEffect, - importc: "godot_array_append", header: "godot/array.h".} -proc clear*(self: var Array) {.importc: "godot_array_clear", - header: "godot/array.h".} + importc: "godot_array_append".} +proc clear*(self: var Array) {.importc: "godot_array_clear".} proc count*(self: Array; value: Variant): cint {. noSideEffect, - importc: "godot_array_count", header: "godot/array.h".} + importc: "godot_array_count".} proc isEmpty*(self: Array): bool {. noSideEffect, - importc: "godot_array_empty", header: "godot/array.h".} + importc: "godot_array_empty".} proc erase*(self: var Array; value: Variant) {. - importc: "godot_array_erase", header: "godot/array.h".} + importc: "godot_array_erase".} proc first*(self: Array): Variant {. noSideEffect, - importc: "godot_array_front", header: "godot/array.h".} + importc: "godot_array_front".} proc last*(self: Array): Variant {. noSideEffect, - importc: "godot_array_back", header: "godot/array.h".} + importc: "godot_array_back".} proc find*(self: Array; what: Variant; f: cint): cint {. noSideEffect, - importc: "godot_array_find", header: "godot/array.h".} + importc: "godot_array_find".} proc findLast*(self: Array; what: Variant): cint {. noSideEffect, - importc: "godot_array_find_last", header: "godot/array.h".} + importc: "godot_array_find_last".} proc contains*(self: Array; value: Variant): bool {. noSideEffect, - importc: "godot_array_has", header: "godot/array.h".} + importc: "godot_array_has".} proc godotHash*(self: Array): cint {. noSideEffect, - importc: "godot_array_hash", header: "godot/array.h".} + importc: "godot_array_hash".} proc hash*(self: Array): Hash {.inline.} = hash(godotHash(self)) proc insert*(self: var Array; pos: cint; value: Variant) {. - importc: "godot_array_insert", header: "godot/array.h".} -proc reverse*(self: var Array) {.importc: "godot_array_invert", - header: "godot/array.h".} + importc: "godot_array_insert".} +proc reverse*(self: var Array) {.importc: "godot_array_invert".} proc popLast*(self: var Array): Variant {. - importc: "godot_array_pop_back", header: "godot/array.h".} + importc: "godot_array_pop_back".} proc popFirst*(self: var Array): Variant {. - importc: "godot_array_pop_front", header: "godot/array.h".} + importc: "godot_array_pop_front".} proc addLast*(self: var Array; value: Variant) {. - importc: "godot_array_push_back", header: "godot/array.h".} + importc: "godot_array_push_back".} proc addFirst*(self: var Array; value: Variant) {. - importc: "godot_array_push_front", header: "godot/array.h".} + importc: "godot_array_push_front".} proc delete*(self: var Array; idx: cint) {. - importc: "godot_array_remove", header: "godot/array.h".} + importc: "godot_array_remove".} proc setLen*(self: var Array; size: cint) {. - importc: "godot_array_resize", header: "godot/array.h".} + importc: "godot_array_resize".} proc rfind*(self: Array; what: Variant; f: cint): cint {. noSideEffect, - importc: "godot_array_rfind", header: "godot/array.h".} + importc: "godot_array_rfind".} proc len*(self: Array): cint {. noSideEffect, - importc: "godot_array_size", header: "godot/array.h".} -proc sort*(self: var Array) {.importc: "godot_array_sort", - header: "godot/array.h".} + importc: "godot_array_size".} +proc sort*(self: var Array) {.importc: "godot_array_sort".} proc sortCustom*(self: var Array; obj: var GodotObject; funcName: GodotString) {. - importc: "godot_array_sort_custom", header: "godot/array.h".} + importc: "godot_array_sort_custom".} iterator items*(arr: Array): Variant = for i in 0.. -PI * 0.5: + result.x = arctan2(-self.elements[1].z, self.elements[2].z) + result.z = arctan2(-self.elements[0].y, self.elements[0].x) + else: + let r = arctan2(self.elements[1].x, self.elements[1].y) + result.x = -r + else: + let r = arctan2(self.elements[0].y, self.elements[1].y) + result.x = r proc initBasis*(euler: Vector3): Basis {.inline.} = - initBasis(result, euler) + result.setEuler(euler) -proc toGodotString*(self: Basis): GodotString {. - noSideEffect, - importc: "godot_basis_as_string", header: "godot/basis.h".} +proc outer*(self, other: Vector3): Basis {.inline.} = + let row0 = vec3(self.x * other.x, self.x * other.y, self.x * other.z) + let row1 = vec3(self.y * other.x, self.y * other.y, self.y * other.z) + let row2 = vec3(self.z * other.x, self.z * other.y, self.z * other.z) + initBasis(row0, row1, row2) + +proc toDiagonalMatrix*(self: Vector3): Basis {.inline.} = + initBasis( + self.x, 0, 0, + 0, self.y, 0, + 0, 0, self.z + ) proc `$`*(self: Basis): string {.inline.} = - $self.toGodotString() + result = newStringOfCap(128) + for i in 0..2: + for j in 0..2: + if i != 0 or j != 0: + result.add(", ") + result.add($self[i][j]) -proc inverse*(self: Basis): Basis {. - noSideEffect, - importc: "godot_basis_inverse", header: "godot/basis.h".} -proc transposed*(self: Basis): Basis {. - noSideEffect, - importc: "godot_basis_transposed", header: "godot/basis.h".} -proc orthonormalized*(self: Basis): Basis {. - noSideEffect, - importc: "godot_basis_orthonormalized", header: "godot/basis.h".} -proc determinant*(self: Basis): float32 {. - noSideEffect, - importc: "godot_basis_determinant", header: "godot/basis.h".} -proc rotated*(self: Basis; axis: Vector3; - phi: float32): Basis {. - noSideEffect, - importc: "godot_basis_rotated", header: "godot/basis.h".} -proc scaled*(self: Basis; scale: Vector3): Basis {. - noSideEffect, - importc: "godot_basis_scaled", header: "godot/basis.h".} +template cofac(row1, col1, row2, col2: int): float32 = + self.elements[row1][col1] * self.elements[row2][col2] - + self.elements[row1][col2] * self.elements[row2][col1] -proc setScale*(self: var Basis; scale: Vector3) {. - noSideEffect, - importc: "godot_basis_set_scale", header: "godot/basis.h".} -proc setRotationEuler*(self: var Basis; - euler: Vector3) {. - noSideEffect, - importc: "godot_basis_set_rotation_euler", header: "godot/basis.h".} -proc setRotationAxisAngle*(self: var Basis; axis: Vector3; angle: float32) {. - noSideEffect, - importc: "godot_basis_set_rotation_axis_angle", header: "godot/basis.h".} +proc determinant(self: Basis): float32 {.inline.} = + self[0][0] * cofac(1, 1, 2, 2) - + self[1][0] * cofac(0, 1, 2, 2) + + self[2][0] * cofac(0, 1, 1, 2) -proc scale*(self: Basis): Vector3 {. - noSideEffect, - importc: "godot_basis_get_scale", header: "godot/basis.h".} -proc euler*(self: Basis): Vector3 {. - noSideEffect, - importc: "godot_basis_get_euler", header: "godot/basis.h".} +proc invert*(self: var Basis) = + let co = [cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)] + let det = self.elements[0][0] * co[0] + + self.elements[0][1] * co[1] + + self.elements[0][2] * co[2] + assert(det != 0) + let s = 1.0'f32 / det + self.setCells( + co[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s, + co[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s, + co[2] * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s + ) -proc tdotx*(self: Basis; x: Vector3): float32 {. - noSideEffect, - importc: "godot_basis_tdotx", header: "godot/basis.h".} -proc tdoty*(self: Basis; y: Vector3): float32 {. - noSideEffect, - importc: "godot_basis_tdoty", header: "godot/basis.h".} -proc tdotz*(self: Basis; z: Vector3): float32 {. - noSideEffect, - importc: "godot_basis_tdotz", header: "godot/basis.h".} +proc inverse*(self: Basis): Basis {.inline.} = + result = self + result.invert() -proc xform*(self: Basis; v: Vector3): Vector3 {. - noSideEffect, - importc: "godot_basis_xform", header: "godot/basis.h".} -proc xformInv*(self: Basis; v: Vector3): Vector3 {. - noSideEffect, - importc: "godot_basis_xform_inv", header: "godot/basis.h".} +proc axis*(self: Basis; idx: range[0..2]): Vector3 {.inline.} = + vec3(self[0][idx], self[1][idx], self[2][idx]) -proc orthogonalIndex*(self: Basis): cint {. - noSideEffect, - importc: "godot_basis_get_orthogonal_index", header: "godot/basis.h".} +proc setAxis*(self: var Basis; idx: range[0..2]; value: Vector3) {.inline.} = + self.elements[0][idx] = value.x + self.elements[1][idx] = value.y + self.elements[2][idx] = value.z -proc godot_basis_get_elements(self: Basis; - elements: var array[3, Vector3]) {. - noSideEffect, - importc: "godot_basis_get_elements", header: "godot/basis.h".} +proc row*(self: Basis; row: range[0..2]): Vector3 {.inline.} = + self.elements[row] -proc elements*(self: Basis): array[3, Vector3] {.inline.} = - godot_basis_get_elements(self, result) +proc setRow*(self: var Basis; row: range[0..2]; value: Vector3) {.inline.} = + self.elements[row] = value -proc `[]`*(self: Basis; axis: range[0..2]): Vector3 {. - noSideEffect, - importc: "godot_basis_get_axis", header: "godot/basis.h".} -proc `[]=`*(self: var Basis; axis: range[0..2]; - value: Vector3) {. - noSideEffect, - importc: "godot_basis_set_axis", header: "godot/basis.h".} -proc row*(self: Basis; row: cint): Vector3 {. - noSideEffect, - importc: "godot_basis_get_row", header: "godot/basis.h".} -proc setRow*(self: var Basis; row: cint; - value: Vector3) {. - noSideEffect, - importc: "godot_basis_set_row", header: "godot/basis.h".} -proc `==`*(self: Basis; b: Basis): bool {. - noSideEffect, - importc: "godot_basis_operator_equal", header: "godot/basis.h".} -proc `+`*(self: Basis; b: Basis): Basis {. - noSideEffect, - importc: "godot_basis_operator_add", header: "godot/basis.h".} -proc `-`*(self: Basis; b: Basis): Basis {. - noSideEffect, - importc: "godot_basis_operator_substract", header: "godot/basis.h".} -proc `*`*(self: Basis; b: Basis): Basis {. - noSideEffect, - importc: "godot_basis_operator_multiply_vector", header: "godot/basis.h".} -proc `*`*(self: Basis; b: float32): Basis {. - noSideEffect, - importc: "godot_basis_operator_multiply_scalar", header: "godot/basis.h".} +proc getMainDiagonal*(self: Basis): Vector3 {.inline.} = + vec3(self.elements[0][0], self.elements[1][1], self.elements[2][2]) + +proc zero*(self: var Basis) {.inline.} = + self.elements[0].zero() + self.elements[1].zero() + self.elements[2].zero() + +proc orthonormalize(self: var Basis) = + var x = self.axis(0) + var y = self.axis(1) + var z = self.axis(2) + + x.normalize() + y = y - x * x.dot(y) + y.normalize() + z = z - x * x.dot(z) - y * y.dot(z) + z.normalize() + + self.setAxis(0, x) + self.setAxis(1, y) + self.setAxis(2, z) + +proc orthonormalized*(self: Basis): Basis {.inline.} = + result = self + result.orthonormalize() + +proc transpose*(self: var Basis) {.inline.} = + swap(self.elements[0].x, self.elements[1].x) + swap(self.elements[0].z, self.elements[2].x) + swap(self.elements[1].z, self.elements[2].y) + +proc transposed*(self: Basis): Basis {.inline.} = + result = self + result.transpose() + +proc isOrthogonal*(self: Basis): bool {.inline.} = + let id = initBasis() + let m = self * self.transposed() + result = id.isEqualApprox(m) + +proc isRotation*(self: Basis): bool {.inline.} = + self.determinant().isEqualApprox(1.0) and self.isOrthogonal() + +proc isSymmetric*(self: Basis): bool {.inline.} = + if not self.elements[0][1].isEqualApprox(self.elements[1][0]): + return false + if not self.elements[0][2].isEqualApprox(self.elements[2][0]): + return false + if not self.elements[1][2].isEqualApprox(self.elements[2][1]): + return false + result = true + +proc scale*(self: var Basis, scale: Vector3) = + self[0].x *= scale.x + self[0].y *= scale.x + self[0].z *= scale.x + self[1].x *= scale.y + self[1].y *= scale.y + self[1].z *= scale.y + self[2].x *= scale.z + self[2].y *= scale.z + self[2].z *= scale.z + +proc scaled*(self: Basis, scale: Vector3): Basis = + result = self + result.scale(scale) + +proc rotated*(self: Basis; axis: Vector3; phi: float32): Basis {.inline.} = + initBasis(axis, phi) * self + +proc rotate*(self: var Basis; axis: Vector3; phi: float32) {.inline.} = + self = self.rotated(axis, phi) + +proc rotated*(self: Basis; euler: Vector3): Basis {.inline.} = + initBasis(euler) * self + +proc rotate*(self: var Basis; euler: Vector3) {.inline.} = + self = self.rotated(euler) + +proc getScale*(self: Basis): Vector3 = + let detSign = if self.determinant() > 0: 1'f32 else: -1'f32 + result = detSign * vec3( + vec3(self.elements[0].x, self.elements[1].x, self.elements[2].x).length(), + vec3(self.elements[0].y, self.elements[1].y, self.elements[2].y).length(), + vec3(self.elements[0].z, self.elements[1].z, self.elements[2].z).length(), + ) + +proc getRotation*(self: Basis): Vector3 {.inline.} = + var m = self.orthonormalized() + let det = m.determinant() + if det < 0: + m.scale(vec3(-1, -1, -1)) + result = m.getEuler() + +proc setScale*(self: var Basis; scale: Vector3) = + let e = self.getEuler() + self = initBasis() # reset to identity + self.scale(scale) + self.rotate(e) + +proc setRotationEuler*(self: var Basis; euler: Vector3) = + let s = self.getScale() + self = initBasis() + self.scale(s) + self.rotate(euler) + +proc setRotationAxisAngle*(self: var Basis; axis: Vector3; angle: float32) = + let s = self.getScale() + self = initBasis() + self.scale(s) + self.rotate(axis, angle) + +proc asQuat*(self: Basis): Quat = + let trace = self.elements[0].x + self.elements[1].y + self.elements[2].z + var temp: array[4, float32] + if trace > 0'f32: + var s = sqrt(trace + 1.0) + temp[3] = s * 0.5 + s = 0.5 / s + + temp[0] = (self.elements[2].y - self.elements[1].z) * s + temp[1] = (self.elements[0].z - self.elements[2].x) * s + temp[2] = (self.elements[1].x - self.elements[0].y) * s + else: + let i = if self.elements[0].x < self.elements[1].y: + if self.elements[1].y < self.elements[2].z: 2 else: 1 + else: + if self.elements[0].x < self.elements[2].z: 2 else: 0 + let j = (i + 1) mod 3 + let k = (i + 2) mod 3 + + var s = sqrt(self.elements[i][i] - self.elements[j][j] - + self.elements[k][k] + 1.0) + temp[i] = s * 0.5 + s = 0.5 / s + + temp[3] = (self.elements[k][j] - self.elements[j][k]) * s + temp[j] = (self.elements[j][i] + self.elements[i][j]) * s + temp[k] = (self.elements[k][i] + self.elements[i][k]) * s + + result = initQuat(temp[0], temp[1], temp[2], temp[3]) + +proc xform*(self: Basis; v: Vector3): Vector3 {.inline.} = + vec3( + self.elements[0].dot(v), + self.elements[1].dot(v), + self.elements[2].dot(v) + ) + +proc xformInv*(self: Basis; v: Vector3): Vector3 {.inline.} = + vec3( + self.elements[0].x * v.x + self.elements[1].x * v.y + self.elements[2].x * v.z, + self.elements[0].y * v.x + self.elements[1].y * v.y + self.elements[2].y * v.z, + self.elements[0].z * v.x + self.elements[1].z * v.y + self.elements[2].z * v.z, + ) + +const orthoBases = [ + initBasis(1, 0, 0, 0, 1, 0, 0, 0, 1), + initBasis(0, -1, 0, 1, 0, 0, 0, 0, 1), + initBasis(-1, 0, 0, 0, -1, 0, 0, 0, 1), + initBasis(0, 1, 0, -1, 0, 0, 0, 0, 1), + initBasis(1, 0, 0, 0, 0, -1, 0, 1, 0), + initBasis(0, 0, 1, 1, 0, 0, 0, 1, 0), + initBasis(-1, 0, 0, 0, 0, 1, 0, 1, 0), + initBasis(0, 0, -1, -1, 0, 0, 0, 1, 0), + initBasis(1, 0, 0, 0, -1, 0, 0, 0, -1), + initBasis(0, 1, 0, 1, 0, 0, 0, 0, -1), + initBasis(-1, 0, 0, 0, 1, 0, 0, 0, -1), + initBasis(0, -1, 0, -1, 0, 0, 0, 0, -1), + initBasis(1, 0, 0, 0, 0, 1, 0, -1, 0), + initBasis(0, 0, -1, 1, 0, 0, 0, -1, 0), + initBasis(-1, 0, 0, 0, 0, -1, 0, -1, 0), + initBasis(0, 0, 1, -1, 0, 0, 0, -1, 0), + initBasis(0, 0, 1, 0, 1, 0, -1, 0, 0), + initBasis(0, -1, 0, 0, 0, 1, -1, 0, 0), + initBasis(0, 0, -1, 0, -1, 0, -1, 0, 0), + initBasis(0, 1, 0, 0, 0, -1, -1, 0, 0), + initBasis(0, 0, 1, 0, -1, 0, 1, 0, 0), + initBasis(0, 1, 0, 0, 0, 1, 1, 0, 0), + initBasis(0, 0, -1, 0, 1, 0, 1, 0, 0), + initBasis(0, -1, 0, 0, 0, -1, 1, 0, 0) +] + +proc orthogonalIndex*(self: Basis): int = + var orth = self + for i in 0..2: + for j in 0..2: + var v = orth[i][j] + if v > 0.5: + v = 1.0'f32 + elif v < -0.5: + v = -1.0'f32 + else: + v = 0'f32 + orth[i][j] = v + + for idx, base in orthoBases: + if base == orth: + return idx + +proc setOrthogonalIndex*(self: var Basis, idx: range[0..23]) = + self = orthoBases[idx] + +proc rotate*(self: var Vector3; axis: Vector3; phi: float32) = + self = initBasis(axis, phi).xform(self) + +proc rotated*(self: Vector3; axis: Vector3; phi: float32): Vector3 = + result = self + result.rotate(axis, phi) diff --git a/godot/core/color.nim b/godot/core/color.nim index f1b0d94..bb7f00b 100644 --- a/godot/core/color.nim +++ b/godot/core/color.nim @@ -3,74 +3,69 @@ import godotbase, strings type - Color* {.importc: "godot_color", header: "godot/color.h", byref.} = object + Color* {.byref.} = object + r: float32 + g: float32 + b: float32 + a: float32 -proc initColor(dest: var Color; r, g, b, a: float32) {. - importc: "godot_color_new_rgba", header: "godot/color.h".} -proc initColor(dest: var Color; r, g, b: float32) {. - importc: "godot_color_new_rgb", - header: "godot/color.h".} +proc initColor*(r, g, b: float32; a: float32 = 1.0'f32): Color {.inline.} = + Color( + r: r, + g: g, + b: b, + a: a + ) -proc initColor*(r, g, b, a: float32): Color {.inline.} = - initColor(result, r, g, b, a) - -proc initColor*(r, g, b: float32): Color {.inline.} = - initColor(result, r, g, b) - -proc r*(self: Color): float32 {. - importc: "godot_color_get_r", header: "godot/color.h".} -proc `r=`*(self: var Color; r: float32) {. - importc: "godot_color_set_r", header: "godot/color.h".} -proc g*(self: Color): float32 {. - importc: "godot_color_get_g", header: "godot/color.h".} -proc `g=`*(self: var Color; g: float32) {. - importc: "godot_color_set_g", header: "godot/color.h".} -proc b*(self: Color): float32 {. - importc: "godot_color_get_b", header: "godot/color.h".} -proc `b=`*(self: var Color; b: float32) {. - importc: "godot_color_set_b", header: "godot/color.h".} -proc a*(self: Color): float32 {. - importc: "godot_color_get_a", header: "godot/color.h".} -proc `a=`*(self: var Color; a: float32) {. - importc: "godot_color_set_a", header: "godot/color.h".} +proc initColor*(): Color {.inline.} = + ## Initializes black color with 1.0 alpha + initColor(0, 0, 0) proc h*(self: Color): float32 {. - importc: "godot_color_get_h", header: "godot/color.h".} + importc: "godot_color_get_h".} proc s*(self: Color): float32 {. - importc: "godot_color_get_s", header: "godot/color.h".} + importc: "godot_color_get_s".} proc v*(self: Color): float32 {. - importc: "godot_color_get_v", header: "godot/color.h".} + importc: "godot_color_get_v".} -proc toGodotString*(self: Color): GodotString {. - importc: "godot_color_as_string", header: "godot/color.h".} proc `$`*(self: Color): string {.inline.} = - $self.toGodotString() + result = newStringOfCap(50) + result.add($self.r) + result.add(", ") + result.add($self.g) + result.add(", ") + result.add($self.b) + result.add(", ") + result.add($self.a) proc toHtml*(self: Color; with_alpha: bool): GodotString {. - importc: "godot_color_to_html", header: "godot/color.h".} + importc: "godot_color_to_html".} -proc to32CInt(self: Color): cint {. - importc: "godot_color_to_32", header: "godot/color.h".} -proc toARGB32CInt(self: Color): cint {. - importc: "godot_color_to_ARGB32", header: "godot/color.h".} - -proc to32*(self: Color): uint32 {.inline.}= - cast[uint32](to32CInt(self)) -proc toARGB32*(self: Color): uint32 {.inline.} = - cast[uint32](toARGB32CInt(self)) +proc toARGB32*(self: Color): uint32 = + result = uint8(self.a * 255) + result = (result shl 8) or uint8(self.r * 255) + result = (result shl 8) or uint8(self.g * 255) + result = (result shl 8) or uint8(self.b * 255) proc gray*(self: Color): float32 {. - importc: "godot_color_gray", header: "godot/color.h".} + importc: "godot_color_gray".} proc inverted*(self: Color): Color {. - importc: "godot_color_inverted", header: "godot/color.h".} + importc: "godot_color_inverted".} proc contrasted*(self: Color): Color {. - importc: "godot_color_contrasted", header: "godot/color.h".} + importc: "godot_color_contrasted".} proc lerp*(self: Color; b: Color; t: float32): Color {. - importc: "godot_color_linear_interpolate", header: "godot/color.h".} + importc: "godot_color_linear_interpolate".} proc blend*(self: Color; over: Color): Color {. - importc: "godot_color_blend", header: "godot/color.h".} + importc: "godot_color_blend".} -proc `==`*(self, b: Color): bool {. - importc: "godot_color_operator_equal", header: "godot/color.h".} -proc `<`*(self, b: Color): bool {. - importc: "godot_color_operator_less", header: "godot/color.h".} +proc `==`*(a, b: Color): bool = + a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a + +proc `<`*(a, b: Color): bool = + if a.r == b.r: + if a.g == b.g: + if a.b == b.b: + return a.a < b.a + return a.b < b.b + return a.g < b.g + return a.r < b.r diff --git a/godot/core/dictionary.nim b/godot/core/dictionary.nim index 5c937b6..e21f15a 100644 --- a/godot/core/dictionary.nim +++ b/godot/core/dictionary.nim @@ -4,26 +4,24 @@ import hashes import godotbase, arrays, variant, strings type - Dictionary* {.importc: "godot_dictionary", - header: "godot/dictionary.h", byref.} = object + Dictionary* {.byref.} = object + p: pointer proc initVariant(dest: var Variant; dict: Dictionary) {. - importc: "godot_variant_new_dictionary", - header: "godot/variant.h".} + importc: "godot_variant_new_dictionary".} proc variant*(dict: Dictionary): Variant {.inline.} = initVariant(result, dict) proc asDictionary*(self: Variant): Dictionary {. - importc: "godot_variant_as_dictionary", header: "godot/variant.h".} + importc: "godot_variant_as_dictionary".} proc initDictionary(dest: var Dictionary; src: Dictionary) {. - importc: "godot_dictionary_new_copy", - header: "godot/dictionary.h".} + importc: "godot_dictionary_new_copy".} proc deinit(self: var Dictionary) {. - importc: "godot_dictionary_destroy", header: "godot/dictionary.h".} + importc: "godot_dictionary_destroy".} proc `=`(self: var Dictionary, other: Dictionary) {.inline.} = initDictionary(self, other) @@ -32,54 +30,49 @@ proc `=destroy`(self: Dictionary) {.inline.} = unsafeAddr(self)[].deinit() proc initDictionary(dest: var Dictionary) {. - importc: "godot_dictionary_new", header: "godot/dictionary.h".} + importc: "godot_dictionary_new".} proc initDictionary*(): Dictionary {.inline.} = initDictionary(result) proc len*(self: Dictionary): cint {. - importc: "godot_dictionary_size", header: "godot/dictionary.h".} + importc: "godot_dictionary_size".} proc isEmpty*(self: Dictionary): bool {. - importc: "godot_dictionary_empty", header: "godot/dictionary.h".} + importc: "godot_dictionary_empty".} proc clear*(self: var Dictionary) {. - importc: "godot_dictionary_clear", header: "godot/dictionary.h".} + importc: "godot_dictionary_clear".} proc contains*(self: Dictionary; key: Variant): bool {. - importc: "godot_dictionary_has", - header: "godot/dictionary.h".} + importc: "godot_dictionary_has".} proc contains*(self: Dictionary; keys: Array): bool {. - importc: "godot_dictionary_has_all", - header: "godot/dictionary.h".} + importc: "godot_dictionary_has_all".} proc del*(self: var Dictionary; key: Variant) {. - importc: "godot_dictionary_erase", header: "godot/dictionary.h".} + importc: "godot_dictionary_erase".} proc godotHash*(self: Dictionary): cint {. - importc: "godot_dictionary_hash", header: "godot/dictionary.h".} + importc: "godot_dictionary_hash".} proc hash*(self: Dictionary): Hash {.inline.} = hash(godotHash(self)) proc keys*(self: Dictionary): Array {. - importc: "godot_dictionary_keys", header: "godot/dictionary.h".} + importc: "godot_dictionary_keys".} proc values*(self: Dictionary): Array {. - importc: "godot_dictionary_values", header: "godot/dictionary.h".} + importc: "godot_dictionary_values".} proc `[]`*(self: Dictionary; key: Variant): Variant {. - importc: "godot_dictionary_get", header: "godot/dictionary.h".} + importc: "godot_dictionary_get".} proc `[]`*(self: Dictionary; keyStr: string): Variant = let key = variant(keyStr) result = self[key] proc `[]=`*(self: var Dictionary; key, value: Variant) {. - importc: "godot_dictionary_set", - header: "godot/dictionary.h".} + importc: "godot_dictionary_set".} proc mget*(self: var Dictionary; key: Variant): ptr Variant {. - importc: "godot_dictionary_operator_index", - header: "godot/dictionary.h".} + importc: "godot_dictionary_operator_index".} proc `==`*(self, other: Dictionary): bool {. - importc: "godot_dictionary_operator_equal", - header: "godot/dictionary.h".} + importc: "godot_dictionary_operator_equal".} proc toJson*(self: Dictionary): GodotString {. - importc: "godot_dictionary_to_json", header: "godot/dictionary.h".} + importc: "godot_dictionary_to_json".} iterator keys*(dict: Dictionary): Variant = let keyArr = dict.keys() diff --git a/godot/core/godotbase.nim b/godot/core/godotbase.nim index 22fe3b6..3f469a0 100644 --- a/godot/core/godotbase.nim +++ b/godot/core/godotbase.nim @@ -1,8 +1,9 @@ # Copyright (c) 2017 Xored Software, Inc. +import math + type - Error* {.importc: "godot_error", header: "godot/gdnative.h", - size: sizeof(cint), pure.} = enum + Error* {.size: sizeof(cint), pure.} = enum OK, Failed, ## Generic fail error Unavailable, ## What is requested is unsupported/unavailable @@ -59,17 +60,16 @@ type const MAX_ARG_COUNT* = 128 type - GodotObject* {.importc: "godot_object", header: "godot/gdnative.h".} = object - Array* {.importc: "godot_array", header: "godot/array.h", byref.} = object - Variant* {.importc: "godot_variant", - header: "godot/variant.h", byref.} = object + GodotObject* = object + Array* {.byref.} = object + p: pointer + Variant* {.byref.} = object + data: array[24, byte] proc initArray(dest: var Array, src: Array) {. - importc: "godot_array_new_copy", - header: "godot/array.h".} + importc: "godot_array_new_copy".} -proc deinit(self: var Array) {.importc: "godot_array_destroy", - header: "godot/array.h".} +proc deinit(self: var Array) {.importc: "godot_array_destroy".} proc `=`(self: var Array, other: Array) {.inline.} = initArray(self, other) @@ -78,10 +78,10 @@ proc `=destroy`(self: Array) {.inline.} = unsafeAddr(self).deinit() proc initVariant(dest: var Variant; src: Variant) {. - importc: "godot_variant_new_copy", header: "godot/variant.h".} + importc: "godot_variant_new_copy".} proc deinit*(self: var Variant) {. - importc: "godot_variant_destroy", header: "godot/variant.h".} + importc: "godot_variant_destroy".} proc `=`(self: var Variant, other: Variant) {.inline.} = initVariant(self, other) @@ -92,16 +92,61 @@ proc `=destroy`(self: Variant) {.inline.} = # System Functions proc godotAlloc*(bytes: cint): pointer {. - importc: "godot_alloc", header: "godot/gdnative.h".} + importc: "godot_alloc".} ## Allocates the specified number of bytes. ## Using this instead of stdlib proc will help Godot track how much memory ## is in use in debug mode. proc godotRealloc*(p: pointer; bytes: cint): pointer {. - importc: "godot_realloc", header: "godot/gdnative.h".} + importc: "godot_realloc".} ## Reallocates the pointer for the specified number of bytes. ## Using this instead of stdlib proc will help Godot track how much memory ## is in use in debug mode. -proc godotFree*(p: pointer) {.importc: "godot_free", header: "godot/gdnative.h".} +proc godotFree*(p: pointer) {.importc: "godot_free".} ## Frees the memory pointed to by the pointer. ## Using this instead of stdlib proc will help Godot track how much memory ## is in use in debug mode. + +# print using Godot's error handler list + +proc godotPrintError(description: cstring; function: cstring; file: cstring; + line: cint) {. + importc: "godot_print_error".} + +proc godotPrintWarning(description: cstring; function: cstring; + file: cstring; line: cint) {. + importc: "godot_print_warning".} + +template printWarning*(warn: typed) = + let (filename, line) = instantiationInfo() + godotPrintWarning(cstring($warn), nil, cstring(filename), line.cint) + +template printError*(err: typed) = + let (filename, line) = instantiationInfo() + godotPrintError(cstring($err), nil, cstring(filename), line.cint) + +# math helpers + +const EPSILON = 0.00001'f32 +proc isEqualApprox*(a, b: float32): bool {.inline.} = + abs(a - b) < EPSILON + +proc isEqualApprox*(a, b: float64): bool {.inline.} = + abs(a - b) < EPSILON + +proc sign*(a: float32): float32 {.inline.} = + if a < 0: -1.0'f32 else: 1.0'f32 + +proc sign*(a: float64): float64 {.inline.} = + if a < 0: -1.0'f64 else: 1.0'f64 + +proc stepify*(value, step: float64): float64 = + if step != 0'f64: + floor(value / step + 0.5'f64) * step + else: + value + +proc stepify*(value, step: float32): float32 = + if step != 0'f32: + floor(value / step + 0.5'f32) * step + else: + value diff --git a/godot/core/godotcore.nim b/godot/core/godotcore.nim index f0b51ff..00521d4 100644 --- a/godot/core/godotcore.nim +++ b/godot/core/godotcore.nim @@ -11,53 +11,44 @@ export godotbase, strings, vector2, rect2, vector3, transform2d, plane, quat, # MethodBind API -type - GodotMethodBind* {.importc: "godot_method_bind", - header: "godot/gdnative.h".} = object +type GodotMethodBind* = object proc getMethod*(className: cstring; methodName: cstring): ptr GodotMethodBind {. - importc: "godot_method_bind_get_method", header: "godot/gdnative.h".} + importc: "godot_method_bind_get_method".} proc ptrCall*(methodBind: ptr GodotMethodBind; instance: ptr GodotObject; args: ptr array[MAX_ARG_COUNT, pointer]; ret: pointer) {. - importc: "godot_method_bind_ptrcall", header: "godot/gdnative.h".} + importc: "godot_method_bind_ptrcall".} proc call*(methodBind: ptr GodotMethodBind; instance: ptr GodotObject; args: var ptr array[MAX_ARG_COUNT, Variant]; argCount: cint; callError: var VariantCallError): Variant {. - importc: "godot_method_bind_call", header: "godot/gdnative.h".} + importc: "godot_method_bind_call".} # Script API type - GodotNativeInitOptions* {.importc: "godot_gdnative_init_options", - header: "godot/gdnative.h".} = object - inEditor* {.importc: "in_editor".}: bool - coreApiHash* {.importc: "core_api_hash".}: uint64 - editorApiHash* {.importc: "editor_api_hash".}: uint64 - noApiHash* {.importc: "no_api_hash".}: uint64 + GodotNativeInitOptions* = object + inEditor*: bool + coreApiHash*: uint64 + editorApiHash*: uint64 + noApiHash*: uint64 - GodotNativeTerminateOptions* {.importc: "godot_gdnative_terminate_options", - header: "godot/gdnative.h".} = object - inEditor* {.importc: "in_editor".}: bool + GodotNativeTerminateOptions* = object + inEditor*: bool - GodotMethodRPCMode* {.importc: "godot_method_rpc_mode", - header: "godot_nativescript.h", - size: sizeof(cint), pure.} = enum + GodotMethodRPCMode* {.size: sizeof(cint), pure.} = enum Disabled, Remote, Sync, Master, Slave - GodotMethodAttributes* {.importc: "godot_method_attributes", - header: "godot_nativescript.h".} = object - rpcMode* {.importc: "rpc_type".}: GodotMethodRPCMode + GodotMethodAttributes* = object + rpcMode*: GodotMethodRPCMode - GodotPropertyHint* {.importc: "godot_property_hint", - header: "godot_nativescript.h", - size: sizeof(cint), pure.} = enum + GodotPropertyHint* {.size: sizeof(cint), pure.} = enum None, ## no hint provided. Range, ## hint_text = "min,max,step,slider; // slider is optional" ExpRange, ## hint_text = "min,max,step", exponential edit @@ -126,9 +117,7 @@ const GODOT_PROPERTY_USAGE_STORAGE_VALUE or GODOT_PROPERTY_USAGE_NETWORK_VALUE type - GodotPropertyUsageFlags* {.importc: "godot_property_usage_flags", - header: "godot_nativescript.h", size: sizeof(cint), - pure.} = enum + GodotPropertyUsageFlags* {.size: sizeof(cint), pure.} = enum Storage = GODOT_PROPERTY_USAGE_STORAGE_VALUE Editor = GODOT_PROPERTY_USAGE_EDITOR_VALUE Network = GODOT_PROPERTY_USAGE_NETWORK_VALUE @@ -156,143 +145,98 @@ type AnimateAsTrigger = GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER_VALUE UpdateAllIfModified = GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED_VALUE - GodotPropertyAttributes* {.importc: "godot_property_attributes", - header: "godot_nativescript.h", bycopy.} = object - rsetType* {.importc: "rset_type".}: GodotMethodRPCMode - typ* {.importc: "type".}: cint - hint* {.importc: "hint".}: GodotPropertyHint - hintString* {.importc: "hint_string".}: GodotString - usage* {.importc: "usage".}: GodotPropertyUsageFlags - defaultValue* {.importc: "default_value".}: Variant + GodotPropertyAttributes* {.bycopy.} = object + rsetType*: GodotMethodRPCMode + typ*: cint + hint*: GodotPropertyHint + hintString*: GodotString + usage*: GodotPropertyUsageFlags + defaultValue*: Variant - GodotInstanceCreateFunc* {.importc: "godot_instance_create_func", - header: "godot_nativescript.h", bycopy.} = object - createFunc* {.importc: "create_func".}: + GodotInstanceCreateFunc* {.bycopy.} = object + createFunc*: proc (obj: ptr GodotObject; methodData: pointer): pointer {.noconv.} ## returns user data - methodData* {.importc: "method_data".}: pointer - freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.} + methodData*: pointer + freeFunc*: proc (a2: pointer) {.noconv.} - GodotInstanceDestroyFunc* {.importc: "godot_instance_destroy_func", - header: "godot_nativescript.h", bycopy.} = object - destroyFunc* {.importc: "destroy_func".}: + GodotInstanceDestroyFunc* {.bycopy.} = object + destroyFunc*: proc (obj: ptr GodotObject; methodData: pointer; userData: pointer) {.noconv.} - methodData* {.importc: "method_data".}: pointer - freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.} + methodData*: pointer + freeFunc*: proc (a2: pointer) {.noconv.} proc godotScriptRegisterClass*(libHandle: pointer; name, base: cstring; create_func: GodotInstanceCreateFunc; destroy_func: GodotInstanceDestroyFunc) {. - importc: "godot_nativescript_register_class", - header: "godot_nativescript.h".} + importc: "godot_nativescript_register_class".} proc godotScriptRegisterToolClass*(libHandle: pointer; name, base: cstring; createFunc: GodotInstanceCreateFunc; destroyFunc: GodotInstanceDestroyFunc) {. - importc: "godot_nativescript_register_tool_class", - header: "godot_nativescript.h".} + importc: "godot_nativescript_register_tool_class".} type - GodotInstanceMethod* {.importc: "godot_instance_method", - header: "godot_nativescript.h", bycopy.} = object - meth* {.importc: "method".}: + GodotInstanceMethod* {.bycopy.} = object + meth*: proc (obj: ptr GodotObject; methodData: pointer; userData: pointer; numArgs: cint; args: var ptr array[MAX_ARG_COUNT, Variant]): Variant {.noconv.} - methodData* {.importc: "method_data".}: pointer - freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.} + methodData*: pointer + freeFunc*: proc (a2: pointer) {.noconv.} proc godotScriptRegisterMethod*(libHandle: pointer; name: cstring; function_name: cstring; attr: GodotMethodAttributes; meth: GodotInstanceMethod) {. - importc: "godot_nativescript_register_method", - header: "godot_nativescript.h".} + importc: "godot_nativescript_register_method".} type - GodotPropertySetFunc* {.importc: "godot_property_set_func", - header: "godot_nativescript.h", bycopy.} = object - setFunc* {.importc: "set_func".}: proc (obj: ptr GodotObject; - methodData: pointer; - userData: pointer; - value: Variant) {.noconv.} - methodData* {.importc: "method_data".}: pointer - freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.} + GodotPropertySetFunc* {.bycopy.} = object + setFunc*: proc (obj: ptr GodotObject; methodData: pointer; + userData: pointer; value: Variant) {.noconv.} + methodData*: pointer + freeFunc*: proc (a2: pointer) {.noconv.} - GodotPropertyGetFunc* {.importc: "godot_property_get_func", - header: "godot_nativescript.h", bycopy.} = object - getFunc* {.importc: "get_func".}: - proc (obj: ptr GodotObject; methodData: pointer; - userData: pointer): Variant {.noconv.} - methodData* {.importc: "method_data".}: pointer - freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.} + GodotPropertyGetFunc* {.bycopy.} = object + getFunc*: proc (obj: ptr GodotObject; methodData: pointer; + userData: pointer): Variant {.noconv.} + methodData*: pointer + freeFunc*: proc (a2: pointer) {.noconv.} proc godotScriptRegisterProperty*(libHandle: pointer; name: cstring; path: cstring; attr: var GodotPropertyAttributes; setFunc: GodotPropertySetFunc; getFunc: GodotPropertyGetFunc) {. - importc: "godot_nativescript_register_property", - header: "godot_nativescript.h".} + importc: "godot_nativescript_register_property".} type - GodotSignalArgument* {.importc: "godot_signal_argument", - header: "godot_nativescript.h", bycopy.} = object - name* {.importc: "name".}: GodotString - typ* {.importc: "type".}: cint - hint* {.importc: "hint".}: GodotPropertyHint - hintString* {.importc: "hint_string".}: GodotString - usage* {.importc: "usage".}: GodotPropertyUsageFlags - defaultValue* {.importc: "default_value".}: Variant + GodotSignalArgument* {.bycopy.} = object + name*: GodotString + typ*: cint + hint*: GodotPropertyHint + hintString*: GodotString + usage*: GodotPropertyUsageFlags + defaultValue*: Variant - GodotSignal* {.importc: "godot_signal", - header: "godot_nativescript.h".} = object - name* {.importc: "name".}: GodotString - numArgs* {.importc: "num_args".}: cint - args* {.importc: "args".}: ptr GodotSignalArgument - numDefaultArgs* {.importc: "num_default_args".}: cint - defaultArgs* {.importc: "default_args".}: ptr Variant + GodotSignal* = object + name*: GodotString + numArgs*: cint + args*: ptr GodotSignalArgument + numDefaultArgs*: cint + defaultArgs*: ptr Variant proc godotScriptRegisterSignal*(libHandle: pointer; name: cstring; signal: GodotSignal) {. - importc: "godot_nativescript_register_signal", - header: "godot_nativescript.h".} + importc: "godot_nativescript_register_signal".} proc getUserdata*(instance: ptr GodotObject): pointer {. - importc: "godot_nativescript_get_userdata", header: "godot_nativescript.h".} + importc: "godot_nativescript_get_userdata".} proc godotNew*(p_classname: cstring): ptr GodotObject {. - importc: "godot_nativescript_new", header: "godot_nativescript.h".} + importc: "godot_nativescript_new".} proc godotStackBottom*(): pointer {. - importc: "godot_get_stack_bottom", header: "godot/gdnative.h".} + importc: "godot_get_stack_bottom".} proc deinit*(o: ptr GodotObject) {. - importc: "godot_object_destroy", header: "godot/gdnative.h".} - -# print using Godot's error handler list - -proc godotPrintError(description: cstring; function: cstring; file: cstring; - line: cint) {. - importc: "godot_print_error", header: "godot/gdnative.h".} - -proc godotPrintWarning(description: cstring; function: cstring; - file: cstring; line: cint) {. - importc: "godot_print_warning", header: "godot/gdnative.h".} - -proc godotPrint(message: GodotString) {. - importc: "godot_print", header: "godot/gdnative.h".} - -proc print*(message: string) {.inline.} = - let s = message.toGodotString() - godotPrint(s) - -proc print*(message: cstring) {.inline.} = - let s = message.toGodotString() - godotPrint(s) - -template printWarning*(warn: typed) = - let (filename, line) = instantiationInfo() - godotPrintWarning(cstring($warn), nil, cstring(filename), line.cint) - -template printError*(err: typed) = - let (filename, line) = instantiationInfo() - godotPrintError(cstring($err), nil, cstring(filename), line.cint) + importc: "godot_object_destroy".} diff --git a/godot/core/nodepath.nim b/godot/core/nodepath.nim index 1c2112f..2a2300b 100644 --- a/godot/core/nodepath.nim +++ b/godot/core/nodepath.nim @@ -3,16 +3,16 @@ import godotbase, strings type - NodePath* {.importc: "godot_node_path", - header: "godot/node_path.h", byref.} = object + NodePath* {.byref.} = object + p: pointer proc initNodePath(dest: var NodePath; s: GodotString) {. - importc: "godot_node_path_new", header: "godot/node_path.h".} + importc: "godot_node_path_new".} proc initNodePath(dest: var NodePath; src: NodePath) {. - importc: "godot_node_path_new_copy", header: "godot/node_path.h".} + importc: "godot_node_path_new_copy".} proc deinit(self: var NodePath) {. - importc: "godot_node_path_destroy", header: "godot/node_path.h".} + importc: "godot_node_path_destroy".} proc initNodePath*(s: string): NodePath {.inline.} = initNodePath(result, s.toGodotString()) @@ -24,32 +24,28 @@ proc `=`(self: var NodePath, other: NodePath) {.inline.} = initNodePath(self, other) proc toGodotString*(self: NodePath): GodotString {. - importc: "godot_node_path_as_string", header: "godot/node_path.h".} + importc: "godot_node_path_as_string".} proc `$`*(self: NodePath): string {.inline.} = let s = self.toGodotString() result = $s proc isAbsolute*(self: NodePath): bool {. - importc: "godot_node_path_is_absolute", header: "godot/node_path.h".} + importc: "godot_node_path_is_absolute".} proc nameCount*(self: NodePath): cint {. - importc: "godot_node_path_get_name_count", - header: "godot/node_path.h".} + importc: "godot_node_path_get_name_count".} proc getName*(self: NodePath; idx: cint): GodotString {. - importc: "godot_node_path_get_name", header: "godot/node_path.h".} + importc: "godot_node_path_get_name".} proc subnameCount*(self: NodePath): cint {. - importc: "godot_node_path_get_subname_count", - header: "godot/node_path.h".} + importc: "godot_node_path_get_subname_count".} proc getSubname*(self: NodePath; idx: cint): GodotString {. - importc: "godot_node_path_get_subname", - header: "godot/node_path.h".} + importc: "godot_node_path_get_subname".} proc property*(self: NodePath): GodotString {. - importc: "godot_node_path_get_property", header: "godot/node_path.h".} + importc: "godot_node_path_get_property".} proc isEmpty*(self: NodePath): bool {. - importc: "godot_node_path_is_empty", header: "godot/node_path.h".} + importc: "godot_node_path_is_empty".} proc `==`*(a, b: NodePath): bool {. - importc: "godot_node_path_operator_equal", - header: "godot/node_path.h".} + importc: "godot_node_path_operator_equal".} converter fromString*(s: string): NodePath = initNodePath(result, s.toGodotString()) diff --git a/godot/core/plane.nim b/godot/core/plane.nim index f2378cb..b425fea 100644 --- a/godot/core/plane.nim +++ b/godot/core/plane.nim @@ -3,16 +3,16 @@ import godotbase, vector3, strings type - Plane* {.importc: "godot_plane", header: "godot/plane.h", byref.} = object + Plane* {.byref.} = object + normal*: Vector3 + d*: float32 proc initPlane(dest: var Plane; a, b, c, d: float32) {. - importc: "godot_plane_new_with_reals", header: "godot/plane.h".} + importc: "godot_plane_new_with_reals".} proc initPlane(dest: var Plane; v1, v2, v3: Vector3) {. - importc: "godot_plane_new_with_vectors", - header: "godot/plane.h".} + importc: "godot_plane_new_with_vectors".} proc initPlane(dest: var Plane; normal: Vector3; d: float32) {. - importc: "godot_plane_new_with_normal", - header: "godot/plane.h".} + importc: "godot_plane_new_with_normal".} proc initPlane*(a, b, c, d: float32): Plane = initPlane(result, a, b, c, d) @@ -23,62 +23,48 @@ proc initPlane*(v1, v2, v3: Vector3): Plane = proc initPlane*(normal: Vector3; d: float32): Plane = initPlane(result, normal, d) -proc toGodotString*(self: Plane): GodotString {. +proc toGodotString(self: Plane): GodotString {. noSideEffect, - importc: "godot_plane_as_string", header: "godot/plane.h".} + importc: "godot_plane_as_string".} proc `$`*(self: Plane): string {.inline.} = $self.toGodotString() proc normalized*(self: Plane): Plane {. noSideEffect, - importc: "godot_plane_normalized", header: "godot/plane.h".} + importc: "godot_plane_normalized".} proc center*(self: Plane): Vector3 {. noSideEffect, - importc: "godot_plane_center", header: "godot/plane.h".} + importc: "godot_plane_center".} proc getAnyPoint*(self: Plane): Vector3 {. noSideEffect, - importc: "godot_plane_get_any_point", header: "godot/plane.h".} + importc: "godot_plane_get_any_point".} proc isPointOver*(self: Plane; point: Vector3): bool {. noSideEffect, - importc: "godot_plane_is_point_over", - header: "godot/plane.h".} + importc: "godot_plane_is_point_over".} proc distanceTo*(self: Plane; point: Vector3): float32 {. noSideEffect, - importc: "godot_plane_distance_to", header: "godot/plane.h".} + importc: "godot_plane_distance_to".} proc contains*(self: Plane; point: Vector3; epsilon: float32): bool {. noSideEffect, - importc: "godot_plane_has_point", header: "godot/plane.h".} + importc: "godot_plane_has_point".} proc project*(self: Plane; point: Vector3): Vector3 {. noSideEffect, - importc: "godot_plane_project", header: "godot/plane.h".} + importc: "godot_plane_project".} proc intersect3*(self: Plane; dest: var Vector3; b, c: Plane): bool {. noSideEffect, - importc: "godot_plane_intersect_3", - header: "godot/plane.h".} + importc: "godot_plane_intersect_3".} proc intersectsRay*(self: Plane; dest: var Vector3; v, dir: Vector3): bool {. noSideEffect, - importc: "godot_plane_intersects_ray", - header: "godot/plane.h".} + importc: "godot_plane_intersects_ray".} proc intersectsSegment*(self: Plane; dest: var Vector3; segmentBegin, segmentEnd: Vector3): bool {. - noSideEffect, importc: "godot_plane_intersects_segment", - header: "godot/plane.h".} + noSideEffect, importc: "godot_plane_intersects_segment".} proc `-`*(self: Plane): Plane {. noSideEffect, - importc: "godot_plane_operator_neg", header: "godot/plane.h".} + importc: "godot_plane_operator_neg".} proc `==`*(a, b: Plane): bool {. noSideEffect, - importc: "godot_plane_operator_equal", header: "godot/plane.h".} -proc normal*(self: Plane): Vector3 {. - noSideEffect, - importc: "godot_plane_get_normal", header: "godot/plane.h".} -proc `normal=`*(self: var Plane; normal: Vector3) {. - importc: "godot_plane_set_normal", header: "godot/plane.h".} -proc d*(self: Plane): float32 {. - noSideEffect, - importc: "godot_plane_get_d", header: "godot/plane.h".} -proc `d=`*(self: var Plane; d: float32) {. - importc: "godot_plane_set_d", header: "godot/plane.h".} \ No newline at end of file + importc: "godot_plane_operator_equal".} diff --git a/godot/core/poolarray.nim b/godot/core/poolarray.nim index da5bf2f..4fdf22c 100644 --- a/godot/core/poolarray.nim +++ b/godot/core/poolarray.nim @@ -3,35 +3,33 @@ import godotbase, color, vector2, vector3, strings type - PoolByteArray* {.importc: "godot_pool_byte_array", - header: "godot/pool_arrays.h", byref.} = object - PoolIntArray* {.importc: "godot_pool_int_array", - header: "godot/pool_arrays.h", byref.} = object - PoolRealArray* {.importc: "godot_pool_real_array", - header: "godot/pool_arrays.h", byref.} = object - PoolStringArray* {.importc: "godot_pool_string_array", - header: "godot/pool_arrays.h", byref.} = object - PoolVector2Array* {.importc: "godot_pool_vector2_array", - header: "godot/pool_arrays.h", byref.} = object - PoolVector3Array* {.importc: "godot_pool_vector3_array", - header: "godot/pool_arrays.h", byref.} = object - PoolColorArray* {.importc: "godot_pool_color_array", - header: "godot/pool_arrays.h", byref.} = object + PoolByteArray* {.byref.} = object + p: pointer + PoolIntArray* {.byref.} = object + p: pointer + PoolRealArray* {.byref.} = object + p: pointer + PoolStringArray* {.byref.} = object + p: pointer + PoolVector2Array* {.byref.} = object + p: pointer + PoolVector3Array* {.byref.} = object + p: pointer + PoolColorArray* {.byref.} = object + p: pointer # byte proc initPoolByteArray(dest: var PoolByteArray) {. - importc: "godot_pool_byte_array_new", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_new".} proc initPoolByteArray(dest: var PoolByteArray; src: PoolByteArray) {. - importc: "godot_pool_byte_array_new_copy", - header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_new_copy".} proc initPoolByteArray(dest: var PoolByteArray; arr: Array) {. - importc: "godot_pool_byte_array_new_with_array", - header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_new_with_array".} proc deinit(self: var PoolByteArray) {. - importc: "godot_pool_byte_array_destroy", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_destroy".} proc initPoolByteArray*(): PoolByteArray {.inline.} = initPoolByteArray(result) @@ -47,33 +45,31 @@ proc `=destroy`(self: PoolByteArray) {.inline.} = proc add*(self: var PoolByteArray; data: uint8) {. - importc: "godot_pool_byte_array_append", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_append".} proc addFirst*(self: var PoolByteArray, data: uint8) {. - importc: "godot_pool_byte_array_push_back", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_push_back".} proc add*(self: var PoolByteArray; arr: PoolByteArray) {. - importc: "godot_pool_byte_array_append_array", - header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_append_array".} proc insert*(self: var PoolByteArray; idx: cint; data: uint8): Error {. - importc: "godot_pool_byte_array_insert", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_insert".} proc delete*(self: var PoolByteArray; idx: cint) {. - importc: "godot_pool_byte_array_remove", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_remove".} proc reverse*(self: var PoolByteArray) {. - importc: "godot_pool_byte_array_invert", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_invert".} proc setLen*(self: var PoolByteArray; size: cint) {. - importc: "godot_pool_byte_array_resize", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_resize".} proc `[]=`*(self: var PoolByteArray; idx: cint; data: uint8) {. - importc: "godot_pool_byte_array_set", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_set".} proc `[]`*(self: PoolByteArray; idx: cint): uint8 {. noSideEffect, - importc: "godot_pool_byte_array_get", - header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_get".} proc len*(self: PoolByteArray): cint {. noSideEffect, - importc: "godot_pool_byte_array_size", header: "godot/pool_arrays.h".} + importc: "godot_pool_byte_array_size".} iterator items*(arr: PoolByteArray): byte = for i in 0..