diff options
Diffstat (limited to 'modules/gdnative/include')
19 files changed, 2665 insertions, 0 deletions
diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h new file mode 100644 index 0000000000..edab028cba --- /dev/null +++ b/modules/gdnative/include/gdnative/array.h @@ -0,0 +1,122 @@ +/*************************************************************************/ +/* array.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://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 <stdint.h> + +#define GODOT_ARRAY_SIZE sizeof(void *) + +#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 <gdnative/pool_arrays.h> +#include <gdnative/variant.h> + +#include <gdnative/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/modules/gdnative/include/gdnative/basis.h b/modules/gdnative/include/gdnative/basis.h new file mode 100644 index 0000000000..8ff6a6f541 --- /dev/null +++ b/modules/gdnative/include/gdnative/basis.h @@ -0,0 +1,115 @@ +/*************************************************************************/ +/* basis.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_BASIS_H +#define GODOT_BASIS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/gdnative.h> +#include <gdnative/quat.h> +#include <gdnative/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); + +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/modules/gdnative/include/gdnative/color.h b/modules/gdnative/include/gdnative/color.h new file mode 100644 index 0000000000..90dccf75aa --- /dev/null +++ b/modules/gdnative/include/gdnative/color.h @@ -0,0 +1,96 @@ +/*************************************************************************/ +/* color.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_COLOR_H +#define GODOT_COLOR_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/gdnative.h> +#include <gdnative/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/modules/gdnative/include/gdnative/dictionary.h b/modules/gdnative/include/gdnative/dictionary.h new file mode 100644 index 0000000000..c85c3f3830 --- /dev/null +++ b/modules/gdnative/include/gdnative/dictionary.h @@ -0,0 +1,89 @@ +/*************************************************************************/ +/* dictionary.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_DICTIONARY_H +#define GODOT_DICTIONARY_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define GODOT_DICTIONARY_SIZE sizeof(void *) + +#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 <gdnative/array.h> +#include <gdnative/gdnative.h> +#include <gdnative/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/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h new file mode 100644 index 0000000000..c574c56d5a --- /dev/null +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -0,0 +1,277 @@ +/*************************************************************************/ +/* gdnative.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://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, visibility("default"))) +#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 <stdbool.h> +#include <stdint.h> + +#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; + +/////// String + +#include <gdnative/string.h> + +////// Vector2 + +#include <gdnative/vector2.h> + +////// Rect2 + +#include <gdnative/rect2.h> + +////// Vector3 + +#include <gdnative/vector3.h> + +////// Transform2D + +#include <gdnative/transform2d.h> + +/////// Plane + +#include <gdnative/plane.h> + +/////// Quat + +#include <gdnative/quat.h> + +/////// Rect3 + +#include <gdnative/rect3.h> + +/////// Basis + +#include <gdnative/basis.h> + +/////// Transform + +#include <gdnative/transform.h> + +/////// Color + +#include <gdnative/color.h> + +/////// NodePath + +#include <gdnative/node_path.h> + +/////// RID + +#include <gdnative/rid.h> + +/////// Dictionary + +#include <gdnative/dictionary.h> + +/////// Array + +#include <gdnative/array.h> + +// single API file for Pool*Array +#include <gdnative/pool_arrays.h> + +void GDAPI godot_object_destroy(godot_object *p_o); + +////// Variant + +#include <gdnative/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_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized +} 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/modules/gdnative/include/gdnative/node_path.h b/modules/gdnative/include/gdnative/node_path.h new file mode 100644 index 0000000000..0cfdbc1127 --- /dev/null +++ b/modules/gdnative/include/gdnative/node_path.h @@ -0,0 +1,77 @@ +/*************************************************************************/ +/* node_path.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_NODE_PATH_H +#define GODOT_NODE_PATH_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define GODOT_NODE_PATH_SIZE sizeof(void *) + +#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/gdnative.h> +#include <gdnative/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/modules/gdnative/include/gdnative/plane.h b/modules/gdnative/include/gdnative/plane.h new file mode 100644 index 0000000000..6a8915e08b --- /dev/null +++ b/modules/gdnative/include/gdnative/plane.h @@ -0,0 +1,93 @@ +/*************************************************************************/ +/* plane.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_PLANE_H +#define GODOT_PLANE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/gdnative.h> +#include <gdnative/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/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h new file mode 100644 index 0000000000..cb1095ee8c --- /dev/null +++ b/modules/gdnative/include/gdnative/pool_arrays.h @@ -0,0 +1,316 @@ +/*************************************************************************/ +/* pool_arrays.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://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 <stdint.h> + +/////// PoolByteArray + +#define GODOT_POOL_BYTE_ARRAY_SIZE sizeof(void *) + +#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 sizeof(void *) + +#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 sizeof(void *) + +#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 sizeof(void *) + +#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 sizeof(void *) + +#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 sizeof(void *) + +#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 sizeof(void *) + +#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 <gdnative/array.h> +#include <gdnative/color.h> +#include <gdnative/vector2.h> +#include <gdnative/vector3.h> + +#include <gdnative/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/modules/gdnative/include/gdnative/quat.h b/modules/gdnative/include/gdnative/quat.h new file mode 100644 index 0000000000..4ffb96eb26 --- /dev/null +++ b/modules/gdnative/include/gdnative/quat.h @@ -0,0 +1,104 @@ +/*************************************************************************/ +/* quat.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_QUAT_H +#define GODOT_QUAT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/gdnative.h> +#include <gdnative/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/modules/gdnative/include/gdnative/rect2.h b/modules/gdnative/include/gdnative/rect2.h new file mode 100644 index 0000000000..9e6cf60342 --- /dev/null +++ b/modules/gdnative/include/gdnative/rect2.h @@ -0,0 +1,86 @@ +/*************************************************************************/ +/* rect2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RECT2_H +#define GODOT_RECT2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED +typedef struct godot_rect2 { + uint8_t _dont_touch_that[16]; +} godot_rect2; +#endif + +#include <gdnative/gdnative.h> +#include <gdnative/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/modules/gdnative/include/gdnative/rect3.h b/modules/gdnative/include/gdnative/rect3.h new file mode 100644 index 0000000000..f94b6fea25 --- /dev/null +++ b/modules/gdnative/include/gdnative/rect3.h @@ -0,0 +1,108 @@ +/*************************************************************************/ +/* rect3.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RECT3_H +#define GODOT_RECT3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/gdnative.h> +#include <gdnative/plane.h> +#include <gdnative/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/modules/gdnative/include/gdnative/rid.h b/modules/gdnative/include/gdnative/rid.h new file mode 100644 index 0000000000..d9b5336fc9 --- /dev/null +++ b/modules/gdnative/include/gdnative/rid.h @@ -0,0 +1,64 @@ +/*************************************************************************/ +/* rid.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_RID_H +#define GODOT_RID_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define GODOT_RID_SIZE sizeof(void *) + +#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/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/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h new file mode 100644 index 0000000000..aca23a81d8 --- /dev/null +++ b/modules/gdnative/include/gdnative/string.h @@ -0,0 +1,228 @@ +/*************************************************************************/ +/* string.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_STRING_H +#define GODOT_STRING_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> +#include <wchar.h> + +#define GODOT_STRING_SIZE sizeof(void *) + +#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/gdnative.h> +#include <gdnative/variant.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); + +/* Standard size stuff */ + +godot_int GDAPI godot_string_length(const godot_string *p_self); + +/* Helpers */ + +godot_bool GDAPI godot_string_begins_with(const godot_string *p_self, const godot_string *p_string); +godot_bool GDAPI godot_string_begins_with_char_array(const godot_string *p_self, const char *p_char_array); +godot_array GDAPI godot_string_bigrams(const godot_string *p_self); +godot_string GDAPI godot_string_chr(wchar_t p_character); +godot_bool GDAPI godot_string_ends_with(const godot_string *p_self, const godot_string *p_string); +godot_int GDAPI godot_string_find(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_find_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_findmk(const godot_string *p_self, const godot_array *p_keys); +godot_int GDAPI godot_string_findmk_from(const godot_string *p_self, const godot_array *p_keys, godot_int p_from); +godot_int GDAPI godot_string_findmk_from_in_place(const godot_string *p_self, const godot_array *p_keys, godot_int p_from, godot_int *r_key); +godot_int GDAPI godot_string_findn(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_findn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_find_last(const godot_string *p_self, godot_string p_what); +godot_string GDAPI godot_string_format(const godot_string *p_self, const godot_variant *p_values); +godot_string GDAPI godot_string_format_with_custom_placeholder(const godot_string *p_self, const godot_variant *p_values, const char *p_placeholder); +godot_string GDAPI godot_string_hex_encode_buffer(const uint8_t *p_buffer, godot_int p_len); +godot_int GDAPI godot_string_hex_to_int(const godot_string *p_self); +godot_int GDAPI godot_string_hex_to_int_without_prefix(const godot_string *p_self); +godot_string GDAPI godot_string_insert(const godot_string *p_self, godot_int p_at_pos, godot_string p_string); +godot_bool GDAPI godot_string_is_numeric(const godot_string *p_self); +godot_bool GDAPI godot_string_is_subsequence_of(const godot_string *p_self, const godot_string *p_string); +godot_bool GDAPI godot_string_is_subsequence_ofi(const godot_string *p_self, const godot_string *p_string); +godot_string GDAPI godot_string_lpad(const godot_string *p_self, godot_int p_min_length); +godot_string GDAPI godot_string_lpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); +godot_bool GDAPI godot_string_match(const godot_string *p_self, const godot_string *p_wildcard); +godot_bool GDAPI godot_string_matchn(const godot_string *p_self, const godot_string *p_wildcard); +godot_string GDAPI godot_string_md5(const uint8_t *p_md5); +godot_string GDAPI godot_string_num(double p_num); +godot_string GDAPI godot_string_num_int64(int64_t p_num, godot_int p_base); +godot_string GDAPI godot_string_num_int64_capitalized(int64_t p_num, godot_int p_base, godot_bool p_capitalize_hex); +godot_string GDAPI godot_string_num_real(double p_num); +godot_string GDAPI godot_string_num_scientific(double p_num); +godot_string GDAPI godot_string_num_with_decimals(double p_num, godot_int p_decimals); +godot_string GDAPI godot_string_pad_decimals(const godot_string *p_self, godot_int p_digits); +godot_string GDAPI godot_string_pad_zeros(const godot_string *p_self, godot_int p_digits); +godot_string GDAPI godot_string_replace_first(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_string GDAPI godot_string_replace(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_string GDAPI godot_string_replacen(const godot_string *p_self, godot_string p_key, godot_string p_with); +godot_int GDAPI godot_string_rfind(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_rfindn(const godot_string *p_self, godot_string p_what); +godot_int GDAPI godot_string_rfind_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_int GDAPI godot_string_rfindn_from(const godot_string *p_self, godot_string p_what, godot_int p_from); +godot_string GDAPI godot_string_rpad(const godot_string *p_self, godot_int p_min_length); +godot_string GDAPI godot_string_rpad_with_custom_character(const godot_string *p_self, godot_int p_min_length, const godot_string *p_character); +godot_real GDAPI godot_string_similarity(const godot_string *p_self, const godot_string *p_string); +godot_string GDAPI godot_string_sprintf(const godot_string *p_self, const godot_array *p_values, godot_bool *p_error); +godot_string GDAPI godot_string_substr(const godot_string *p_self, godot_int p_from, godot_int p_chars); +double GDAPI godot_string_to_double(const godot_string *p_self); +godot_real GDAPI godot_string_to_float(const godot_string *p_self); +godot_int GDAPI godot_string_to_int(const godot_string *p_self); + +godot_string GDAPI godot_string_camelcase_to_underscore(const godot_string *p_self); +godot_string GDAPI godot_string_camelcase_to_underscore_lowercased(const godot_string *p_self); +godot_string GDAPI godot_string_capitalize(const godot_string *p_self); +double GDAPI godot_string_char_to_double(const char *p_what); +godot_int GDAPI godot_string_char_to_int(const char *p_what); +int64_t GDAPI godot_string_wchar_to_int(const wchar_t *p_str); +godot_int GDAPI godot_string_char_to_int_with_len(const char *p_what, godot_int p_len); +int64_t GDAPI godot_string_char_to_int64_with_len(const wchar_t *p_str, int p_len); +int64_t GDAPI godot_string_hex_to_int64(const godot_string *p_self); +int64_t GDAPI godot_string_hex_to_int64_with_prefix(const godot_string *p_self); +int64_t GDAPI godot_string_to_int64(const godot_string *p_self); +double GDAPI godot_string_unicode_char_to_double(const wchar_t *p_str, const wchar_t **r_end); + +godot_int GDAPI godot_string_get_slice_count(const godot_string *p_self, godot_string p_splitter); +godot_string GDAPI godot_string_get_slice(const godot_string *p_self, godot_string p_splitter, godot_int p_slice); +godot_string GDAPI godot_string_get_slicec(const godot_string *p_self, wchar_t p_splitter, godot_int p_slice); + +godot_array GDAPI godot_string_split(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_allow_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats_allows_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_floats_mk(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_floats_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_ints(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_ints_allows_empty(const godot_string *p_self, const godot_string *p_splitter); +godot_array GDAPI godot_string_split_ints_mk(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_ints_mk_allows_empty(const godot_string *p_self, const godot_array *p_splitters); +godot_array GDAPI godot_string_split_spaces(const godot_string *p_self); + +wchar_t GDAPI godot_string_char_lowercase(wchar_t p_char); +wchar_t GDAPI godot_string_char_uppercase(wchar_t p_char); +godot_string GDAPI godot_string_to_lower(const godot_string *p_self); +godot_string GDAPI godot_string_to_upper(const godot_string *p_self); + +godot_string GDAPI godot_string_get_basename(const godot_string *p_self); +godot_string GDAPI godot_string_get_extension(const godot_string *p_self); +godot_string GDAPI godot_string_left(const godot_string *p_self, godot_int p_pos); +wchar_t GDAPI godot_string_ord_at(const godot_string *p_self, godot_int p_idx); +godot_string GDAPI godot_string_plus_file(const godot_string *p_self, const godot_string *p_file); +godot_string GDAPI godot_string_right(const godot_string *p_self, godot_int p_pos); +godot_string GDAPI godot_string_strip_edges(const godot_string *p_self, godot_bool p_left, godot_bool p_right); +godot_string GDAPI godot_string_strip_escapes(const godot_string *p_self); + +void GDAPI godot_string_erase(godot_string *p_self, godot_int p_pos, godot_int p_chars); + +void GDAPI godot_string_ascii(godot_string *p_self, char *result); +void GDAPI godot_string_ascii_extended(godot_string *p_self, char *result); +void GDAPI godot_string_utf8(godot_string *p_self, char *result); +godot_bool GDAPI godot_string_parse_utf8(godot_string *p_self, const char *p_utf8); +godot_bool GDAPI godot_string_parse_utf8_with_len(godot_string *p_self, const char *p_utf8, godot_int p_len); +godot_string GDAPI godot_string_chars_to_utf8(const char *p_utf8); +godot_string GDAPI godot_string_chars_to_utf8_with_len(const char *p_utf8, godot_int p_len); + +uint32_t GDAPI godot_string_hash(const godot_string *p_self); +uint64_t GDAPI godot_string_hash64(const godot_string *p_self); +uint32_t GDAPI godot_string_hash_chars(const char *p_cstr); +uint32_t GDAPI godot_string_hash_chars_with_len(const char *p_cstr, godot_int p_len); +uint32_t GDAPI godot_string_hash_utf8_chars(const wchar_t *p_str); +uint32_t GDAPI godot_string_hash_utf8_chars_with_len(const wchar_t *p_str, godot_int p_len); +godot_pool_byte_array GDAPI godot_string_md5_buffer(const godot_string *p_self); +godot_string GDAPI godot_string_md5_text(const godot_string *p_self); +godot_pool_byte_array GDAPI godot_string_sha256_buffer(const godot_string *p_self); +godot_string GDAPI godot_string_sha256_text(const godot_string *p_self); + +godot_bool godot_string_empty(const godot_string *p_self); + +// path functions +godot_string GDAPI godot_string_get_base_dir(const godot_string *p_self); +godot_string GDAPI godot_string_get_file(const godot_string *p_self); +godot_string GDAPI godot_string_humanize_size(size_t p_size); +godot_bool GDAPI godot_string_is_abs_path(const godot_string *p_self); +godot_bool GDAPI godot_string_is_rel_path(const godot_string *p_self); +godot_bool GDAPI godot_string_is_resource_file(const godot_string *p_self); +godot_string GDAPI godot_string_path_to(const godot_string *p_self, const godot_string *p_path); +godot_string GDAPI godot_string_path_to_file(const godot_string *p_self, const godot_string *p_path); +godot_string GDAPI godot_string_simplify_path(const godot_string *p_self); + +godot_string GDAPI godot_string_c_escape(const godot_string *p_self); +godot_string GDAPI godot_string_c_escape_multiline(const godot_string *p_self); +godot_string GDAPI godot_string_c_unescape(const godot_string *p_self); +godot_string GDAPI godot_string_http_escape(const godot_string *p_self); +godot_string GDAPI godot_string_http_unescape(const godot_string *p_self); +godot_string GDAPI godot_string_json_escape(const godot_string *p_self); +godot_string GDAPI godot_string_word_wrap(const godot_string *p_self, godot_int p_chars_per_line); +godot_string GDAPI godot_string_xml_escape(const godot_string *p_self); +godot_string GDAPI godot_string_xml_escape_with_quotes(const godot_string *p_self); +godot_string GDAPI godot_string_xml_unescape(const godot_string *p_self); + +godot_string GDAPI godot_string_percent_decode(const godot_string *p_self); +godot_string GDAPI godot_string_percent_encode(const godot_string *p_self); + +godot_bool GDAPI godot_string_is_valid_float(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_hex_number(const godot_string *p_self, godot_bool p_with_prefix); +godot_bool GDAPI godot_string_is_valid_html_color(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_identifier(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_integer(const godot_string *p_self); +godot_bool GDAPI godot_string_is_valid_ip_address(const godot_string *p_self); + +void GDAPI godot_string_destroy(godot_string *p_self); + +#ifdef __cplusplus +} +#endif + +#endif // GODOT_STRING_H diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h new file mode 100644 index 0000000000..656afae129 --- /dev/null +++ b/modules/gdnative/include/gdnative/transform.h @@ -0,0 +1,100 @@ +/*************************************************************************/ +/* transform.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_TRANSFORM_H +#define GODOT_TRANSFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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 <gdnative/basis.h> +#include <gdnative/gdnative.h> +#include <gdnative/variant.h> +#include <gdnative/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/modules/gdnative/include/gdnative/transform2d.h b/modules/gdnative/include/gdnative/transform2d.h new file mode 100644 index 0000000000..a945868b17 --- /dev/null +++ b/modules/gdnative/include/gdnative/transform2d.h @@ -0,0 +1,99 @@ +/*************************************************************************/ +/* transform2d.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_TRANSFORM2D_H +#define GODOT_TRANSFORM2D_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/gdnative.h> +#include <gdnative/variant.h> +#include <gdnative/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/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h new file mode 100644 index 0000000000..969506585d --- /dev/null +++ b/modules/gdnative/include/gdnative/variant.h @@ -0,0 +1,201 @@ +/*************************************************************************/ +/* variant.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://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 <stdint.h> + +#define GODOT_VARIANT_SIZE (16 + sizeof(void *)) + +#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 <gdnative/array.h> +#include <gdnative/basis.h> +#include <gdnative/color.h> +#include <gdnative/dictionary.h> +#include <gdnative/node_path.h> +#include <gdnative/plane.h> +#include <gdnative/pool_arrays.h> +#include <gdnative/quat.h> +#include <gdnative/rect2.h> +#include <gdnative/rect3.h> +#include <gdnative/rid.h> +#include <gdnative/string.h> +#include <gdnative/transform.h> +#include <gdnative/transform2d.h> +#include <gdnative/variant.h> +#include <gdnative/vector2.h> +#include <gdnative/vector3.h> + +#include <gdnative/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/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h new file mode 100644 index 0000000000..0af4abae27 --- /dev/null +++ b/modules/gdnative/include/gdnative/vector2.h @@ -0,0 +1,128 @@ +/*************************************************************************/ +/* vector2.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_VECTOR2_H +#define GODOT_VECTOR2_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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/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/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h new file mode 100644 index 0000000000..a27d516ec5 --- /dev/null +++ b/modules/gdnative/include/gdnative/vector3.h @@ -0,0 +1,135 @@ +/*************************************************************************/ +/* vector3.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ +#ifndef GODOT_VECTOR3_H +#define GODOT_VECTOR3_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#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 <gdnative/basis.h> +#include <gdnative/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/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h new file mode 100644 index 0000000000..96f213ead7 --- /dev/null +++ b/modules/gdnative/include/nativescript/godot_nativescript.h @@ -0,0 +1,227 @@ +/*************************************************************************/ +/* godot_nativescript.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://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 <gdnative/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, visibility("default"))) +#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 <stdbool.h> +#include <stdint.h> + +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); + +void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance); + +#ifdef __cplusplus +} +#endif + +#endif |