diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-05-18 16:39:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-18 16:39:40 +0200 |
commit | 38250ef54e439d69240f4b514f3bacb05b5d8c12 (patch) | |
tree | d2c756a93b723f424622f83fbb1b6368ff6d01aa /modules/gdnative/include | |
parent | 5ee340ab4c6e8e644e90e6cf1c54d592574a44b7 (diff) | |
parent | 74eecd1d6bd00a239b54bfc47d6ea5cb3de0fa63 (diff) |
Merge pull request #38826 from bruvzg/gdnative_core_types
Add new (and rename changed) core types to GDNative API.
Diffstat (limited to 'modules/gdnative/include')
-rw-r--r-- | modules/gdnative/include/gdnative/array.h | 8 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/callable.h | 126 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/gdnative.h | 18 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/packed_arrays.h (renamed from modules/gdnative/include/gdnative/pool_arrays.h) | 170 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/rect2.h | 54 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/variant.h | 38 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/vector2.h | 55 | ||||
-rw-r--r-- | modules/gdnative/include/gdnative/vector3.h | 53 | ||||
-rw-r--r-- | modules/gdnative/include/nativescript/godot_nativescript.h | 8 |
9 files changed, 465 insertions, 65 deletions
diff --git a/modules/gdnative/include/gdnative/array.h b/modules/gdnative/include/gdnative/array.h index e3114e9348..4db685873f 100644 --- a/modules/gdnative/include/gdnative/array.h +++ b/modules/gdnative/include/gdnative/array.h @@ -51,7 +51,7 @@ typedef struct { } #endif -#include <gdnative/pool_arrays.h> +#include <gdnative/packed_arrays.h> #include <gdnative/variant.h> #include <gdnative/gdnative.h> @@ -66,8 +66,10 @@ void GDAPI godot_array_new_packed_color_array(godot_array *r_dest, const godot_p void GDAPI godot_array_new_packed_vector3_array(godot_array *r_dest, const godot_packed_vector3_array *p_pv3a); void GDAPI godot_array_new_packed_vector2_array(godot_array *r_dest, const godot_packed_vector2_array *p_pv2a); void GDAPI godot_array_new_packed_string_array(godot_array *r_dest, const godot_packed_string_array *p_psa); -void GDAPI godot_array_new_packed_real_array(godot_array *r_dest, const godot_packed_real_array *p_pra); -void GDAPI godot_array_new_packed_int_array(godot_array *r_dest, const godot_packed_int_array *p_pia); +void GDAPI godot_array_new_packed_float32_array(godot_array *r_dest, const godot_packed_float32_array *p_pra); +void GDAPI godot_array_new_packed_float64_array(godot_array *r_dest, const godot_packed_float64_array *p_pra); +void GDAPI godot_array_new_packed_int32_array(godot_array *r_dest, const godot_packed_int32_array *p_pia); +void GDAPI godot_array_new_packed_int64_array(godot_array *r_dest, const godot_packed_int64_array *p_pia); void GDAPI godot_array_new_packed_byte_array(godot_array *r_dest, const godot_packed_byte_array *p_pba); void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value); diff --git a/modules/gdnative/include/gdnative/callable.h b/modules/gdnative/include/gdnative/callable.h new file mode 100644 index 0000000000..dbb5d02590 --- /dev/null +++ b/modules/gdnative/include/gdnative/callable.h @@ -0,0 +1,126 @@ +/*************************************************************************/ +/* callable.h */ +/*************************************************************************/ +/* This file is part of: */ +/* GODOT ENGINE */ +/* https://godotengine.org */ +/*************************************************************************/ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 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_CALLABLE_H +#define GODOT_CALLABLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +#define GODOT_CALLABLE_SIZE (16) + +#ifndef GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_CALLABLE_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_CALLABLE_SIZE]; +} godot_callable; +#endif + +#define GODOT_SIGNAL_SIZE (16) + +#ifndef GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_SIGNAL_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_SIGNAL_SIZE]; +} godot_signal; +#endif + +#ifdef __cplusplus +} +#endif + +#include <gdnative/gdnative.h> +#include <gdnative/string_name.h> + +#ifdef __cplusplus +extern "C" { +#endif + +// Callable + +void GDAPI godot_callable_new_with_object(godot_callable *r_dest, const godot_object *p_object, const godot_string_name *p_method); +void GDAPI godot_callable_new_with_object_id(godot_callable *r_dest, uint64_t p_objectid, const godot_string_name *p_method); +void GDAPI godot_callable_new_copy(godot_callable *r_dest, const godot_callable *p_src); + +void GDAPI godot_callable_destroy(godot_callable *p_self); + +godot_int GDAPI godot_callable_call(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount, godot_variant *r_return_value); +void GDAPI godot_callable_call_deferred(const godot_callable *p_self, const godot_variant **p_arguments, godot_int p_argcount); + +godot_bool GDAPI godot_callable_is_null(const godot_callable *p_self); +godot_bool GDAPI godot_callable_is_custom(const godot_callable *p_self); +godot_bool GDAPI godot_callable_is_standard(const godot_callable *p_self); + +godot_object GDAPI *godot_callable_get_object(const godot_callable *p_self); +uint64_t GDAPI godot_callable_get_object_id(const godot_callable *p_self); +godot_string_name GDAPI godot_callable_get_method(const godot_callable *p_self); + +uint32_t GDAPI godot_callable_hash(const godot_callable *p_self); + +godot_string GDAPI godot_callable_as_string(const godot_callable *p_self); + +godot_bool GDAPI godot_callable_operator_equal(const godot_callable *p_self, const godot_callable *p_other); +godot_bool GDAPI godot_callable_operator_less(const godot_callable *p_self, const godot_callable *p_other); + +// Signal + +void GDAPI godot_signal_new_with_object(godot_signal *r_dest, const godot_object *p_object, const godot_string_name *p_name); +void GDAPI godot_signal_new_with_object_id(godot_signal *r_dest, uint64_t p_objectid, const godot_string_name *p_name); +void GDAPI godot_signal_new_copy(godot_signal *r_dest, const godot_signal *p_src); + +void GDAPI godot_signal_destroy(godot_signal *p_self); + +godot_int GDAPI godot_signal_emit(const godot_signal *p_self, const godot_variant **p_arguments, godot_int p_argcount); + +godot_int GDAPI godot_signal_connect(godot_signal *p_self, const godot_callable *p_callable, const godot_array *p_binds, uint32_t p_flags); +void GDAPI godot_signal_disconnect(godot_signal *p_self, const godot_callable *p_callable); + +godot_bool GDAPI godot_signal_is_null(const godot_signal *p_self); +godot_bool GDAPI godot_signal_is_connected(const godot_signal *p_self, const godot_callable *p_callable); + +godot_array GDAPI godot_signal_get_connections(const godot_signal *p_self); + +godot_object GDAPI *godot_signal_get_object(const godot_signal *p_self); +uint64_t GDAPI godot_signal_get_object_id(const godot_signal *p_self); +godot_string_name GDAPI godot_signal_get_name(const godot_signal *p_self); + +godot_string GDAPI godot_signal_as_string(const godot_signal *p_self); + +godot_bool GDAPI godot_signal_operator_equal(const godot_signal *p_self, const godot_signal *p_other); +godot_bool GDAPI godot_signal_operator_less(const godot_signal *p_self, const godot_signal *p_other); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h index 6fdca30122..6a0a375da8 100644 --- a/modules/gdnative/include/gdnative/gdnative.h +++ b/modules/gdnative/include/gdnative/gdnative.h @@ -144,15 +144,15 @@ typedef void godot_object; #include <gdnative/string_name.h> -////// Vector2 +////// Vector2 & Vector2i #include <gdnative/vector2.h> -////// Rect2 +////// Rect2 & Rect2i #include <gdnative/rect2.h> -////// Vector3 +////// Vector3 & Vector3i #include <gdnative/vector3.h> @@ -192,6 +192,10 @@ typedef void godot_object; #include <gdnative/rid.h> +/////// Callable & Signal + +#include <gdnative/callable.h> + /////// Dictionary #include <gdnative/dictionary.h> @@ -200,8 +204,8 @@ typedef void godot_object; #include <gdnative/array.h> -// single API file for Pool*Array -#include <gdnative/pool_arrays.h> +// single API file for Packed*Array +#include <gdnative/packed_arrays.h> void GDAPI godot_object_destroy(godot_object *p_o); @@ -289,7 +293,9 @@ void GDAPI *godot_get_class_tag(const godot_string_name *p_class); godot_object GDAPI *godot_object_cast_to(const godot_object *p_object, void *p_class_tag); // equivalent of GDScript's instance_from_id -godot_object GDAPI *godot_instance_from_id(godot_int p_instance_id); +godot_object GDAPI *godot_instance_from_id(uint64_t p_instance_id); + +uint64_t GDAPI godot_object_get_instance_id(const godot_object *p_object); #ifdef __cplusplus } diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/packed_arrays.h index 652bd6ae1c..d5bad70bdc 100644 --- a/modules/gdnative/include/gdnative/pool_arrays.h +++ b/modules/gdnative/include/gdnative/packed_arrays.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* pool_arrays.h */ +/* packed_arrays.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -28,8 +28,8 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef GODOT_POOL_ARRAYS_H -#define GODOT_POOL_ARRAYS_H +#ifndef GODOT_PACKED_ARRAYS_H +#define GODOT_PACKED_ARRAYS_H #ifdef __cplusplus extern "C" { @@ -50,24 +50,46 @@ typedef struct { /////// PackedInt32Array -#define GODOT_PACKED_INT_ARRAY_SIZE (2 * sizeof(void *)) +#define GODOT_PACKED_INT32_ARRAY_SIZE (2 * sizeof(void *)) -#ifndef GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_INT_ARRAY_TYPE_DEFINED +#ifndef GODOT_CORE_API_GODOT_PACKED_INT32_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_INT32_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_INT_ARRAY_SIZE]; -} godot_packed_int_array; + uint8_t _dont_touch_that[GODOT_PACKED_INT32_ARRAY_SIZE]; +} godot_packed_int32_array; +#endif + +/////// PackedInt64Array + +#define GODOT_PACKED_INT64_ARRAY_SIZE (2 * sizeof(void *)) + +#ifndef GODOT_CORE_API_GODOT_PACKED_INT64_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_INT64_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_PACKED_INT64_ARRAY_SIZE]; +} godot_packed_int64_array; #endif /////// PackedFloat32Array -#define GODOT_PACKED_REAL_ARRAY_SIZE (2 * sizeof(void *)) +#define GODOT_PACKED_FLOAT32_ARRAY_SIZE (2 * sizeof(void *)) + +#ifndef GODOT_CORE_API_GODOT_PACKED_FLOAT32_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_FLOAT32_ARRAY_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_PACKED_FLOAT32_ARRAY_SIZE]; +} godot_packed_float32_array; +#endif + +/////// PackedFloat64Array -#ifndef GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED -#define GODOT_CORE_API_GODOT_PACKED_REAL_ARRAY_TYPE_DEFINED +#define GODOT_PACKED_FLOAT64_ARRAY_SIZE (2 * sizeof(void *)) + +#ifndef GODOT_CORE_API_GODOT_PACKED_FLOAT64_ARRAY_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_PACKED_FLOAT64_ARRAY_TYPE_DEFINED typedef struct { - uint8_t _dont_touch_that[GODOT_PACKED_REAL_ARRAY_SIZE]; -} godot_packed_real_array; + uint8_t _dont_touch_that[GODOT_PACKED_FLOAT64_ARRAY_SIZE]; +} godot_packed_float64_array; #endif /////// PackedStringArray @@ -159,63 +181,121 @@ godot_bool GDAPI godot_packed_byte_array_empty(const godot_packed_byte_array *p_ void GDAPI godot_packed_byte_array_destroy(godot_packed_byte_array *p_self); -// int +// int32 + +void GDAPI godot_packed_int32_array_new(godot_packed_int32_array *r_dest); +void GDAPI godot_packed_int32_array_new_copy(godot_packed_int32_array *r_dest, const godot_packed_int32_array *p_src); +void GDAPI godot_packed_int32_array_new_with_array(godot_packed_int32_array *r_dest, const godot_array *p_a); + +void GDAPI godot_packed_int32_array_append(godot_packed_int32_array *p_self, const int32_t p_data); + +void GDAPI godot_packed_int32_array_append_array(godot_packed_int32_array *p_self, const godot_packed_int32_array *p_array); + +godot_error GDAPI godot_packed_int32_array_insert(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data); + +void GDAPI godot_packed_int32_array_invert(godot_packed_int32_array *p_self); + +void GDAPI godot_packed_int32_array_push_back(godot_packed_int32_array *p_self, const int32_t p_data); + +void GDAPI godot_packed_int32_array_remove(godot_packed_int32_array *p_self, const godot_int p_idx); + +void GDAPI godot_packed_int32_array_resize(godot_packed_int32_array *p_self, const godot_int p_size); + +void GDAPI godot_packed_int32_array_set(godot_packed_int32_array *p_self, const godot_int p_idx, const int32_t p_data); +int32_t GDAPI godot_packed_int32_array_get(const godot_packed_int32_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_packed_int32_array_size(const godot_packed_int32_array *p_self); + +godot_bool GDAPI godot_packed_int32_array_empty(const godot_packed_int32_array *p_self); + +void GDAPI godot_packed_int32_array_destroy(godot_packed_int32_array *p_self); + +// int64 + +void GDAPI godot_packed_int64_array_new(godot_packed_int64_array *r_dest); +void GDAPI godot_packed_int64_array_new_copy(godot_packed_int64_array *r_dest, const godot_packed_int64_array *p_src); +void GDAPI godot_packed_int64_array_new_with_array(godot_packed_int64_array *r_dest, const godot_array *p_a); + +void GDAPI godot_packed_int64_array_append(godot_packed_int64_array *p_self, const int64_t p_data); + +void GDAPI godot_packed_int64_array_append_array(godot_packed_int64_array *p_self, const godot_packed_int64_array *p_array); + +godot_error GDAPI godot_packed_int64_array_insert(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data); + +void GDAPI godot_packed_int64_array_invert(godot_packed_int64_array *p_self); + +void GDAPI godot_packed_int64_array_push_back(godot_packed_int64_array *p_self, const int64_t p_data); + +void GDAPI godot_packed_int64_array_remove(godot_packed_int64_array *p_self, const godot_int p_idx); + +void GDAPI godot_packed_int64_array_resize(godot_packed_int64_array *p_self, const godot_int p_size); + +void GDAPI godot_packed_int64_array_set(godot_packed_int64_array *p_self, const godot_int p_idx, const int64_t p_data); +int64_t GDAPI godot_packed_int64_array_get(const godot_packed_int64_array *p_self, const godot_int p_idx); + +godot_int GDAPI godot_packed_int64_array_size(const godot_packed_int64_array *p_self); + +godot_bool GDAPI godot_packed_int64_array_empty(const godot_packed_int64_array *p_self); + +void GDAPI godot_packed_int64_array_destroy(godot_packed_int64_array *p_self); + +// float32 -void GDAPI godot_packed_int_array_new(godot_packed_int_array *r_dest); -void GDAPI godot_packed_int_array_new_copy(godot_packed_int_array *r_dest, const godot_packed_int_array *p_src); -void GDAPI godot_packed_int_array_new_with_array(godot_packed_int_array *r_dest, const godot_array *p_a); +void GDAPI godot_packed_float32_array_new(godot_packed_float32_array *r_dest); +void GDAPI godot_packed_float32_array_new_copy(godot_packed_float32_array *r_dest, const godot_packed_float32_array *p_src); +void GDAPI godot_packed_float32_array_new_with_array(godot_packed_float32_array *r_dest, const godot_array *p_a); -void GDAPI godot_packed_int_array_append(godot_packed_int_array *p_self, const godot_int p_data); +void GDAPI godot_packed_float32_array_append(godot_packed_float32_array *p_self, const float p_data); -void GDAPI godot_packed_int_array_append_array(godot_packed_int_array *p_self, const godot_packed_int_array *p_array); +void GDAPI godot_packed_float32_array_append_array(godot_packed_float32_array *p_self, const godot_packed_float32_array *p_array); -godot_error GDAPI godot_packed_int_array_insert(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data); +godot_error GDAPI godot_packed_float32_array_insert(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data); -void GDAPI godot_packed_int_array_invert(godot_packed_int_array *p_self); +void GDAPI godot_packed_float32_array_invert(godot_packed_float32_array *p_self); -void GDAPI godot_packed_int_array_push_back(godot_packed_int_array *p_self, const godot_int p_data); +void GDAPI godot_packed_float32_array_push_back(godot_packed_float32_array *p_self, const float p_data); -void GDAPI godot_packed_int_array_remove(godot_packed_int_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_float32_array_remove(godot_packed_float32_array *p_self, const godot_int p_idx); -void GDAPI godot_packed_int_array_resize(godot_packed_int_array *p_self, const godot_int p_size); +void GDAPI godot_packed_float32_array_resize(godot_packed_float32_array *p_self, const godot_int p_size); -void GDAPI godot_packed_int_array_set(godot_packed_int_array *p_self, const godot_int p_idx, const godot_int p_data); -godot_int GDAPI godot_packed_int_array_get(const godot_packed_int_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_float32_array_set(godot_packed_float32_array *p_self, const godot_int p_idx, const float p_data); +float GDAPI godot_packed_float32_array_get(const godot_packed_float32_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_packed_int_array_size(const godot_packed_int_array *p_self); +godot_int GDAPI godot_packed_float32_array_size(const godot_packed_float32_array *p_self); -godot_bool GDAPI godot_packed_int_array_empty(const godot_packed_int_array *p_self); +godot_bool GDAPI godot_packed_float32_array_empty(const godot_packed_float32_array *p_self); -void GDAPI godot_packed_int_array_destroy(godot_packed_int_array *p_self); +void GDAPI godot_packed_float32_array_destroy(godot_packed_float32_array *p_self); -// real +// float64 -void GDAPI godot_packed_real_array_new(godot_packed_real_array *r_dest); -void GDAPI godot_packed_real_array_new_copy(godot_packed_real_array *r_dest, const godot_packed_real_array *p_src); -void GDAPI godot_packed_real_array_new_with_array(godot_packed_real_array *r_dest, const godot_array *p_a); +void GDAPI godot_packed_float64_array_new(godot_packed_float64_array *r_dest); +void GDAPI godot_packed_float64_array_new_copy(godot_packed_float64_array *r_dest, const godot_packed_float64_array *p_src); +void GDAPI godot_packed_float64_array_new_with_array(godot_packed_float64_array *r_dest, const godot_array *p_a); -void GDAPI godot_packed_real_array_append(godot_packed_real_array *p_self, const godot_real p_data); +void GDAPI godot_packed_float64_array_append(godot_packed_float64_array *p_self, const double p_data); -void GDAPI godot_packed_real_array_append_array(godot_packed_real_array *p_self, const godot_packed_real_array *p_array); +void GDAPI godot_packed_float64_array_append_array(godot_packed_float64_array *p_self, const godot_packed_float64_array *p_array); -godot_error GDAPI godot_packed_real_array_insert(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data); +godot_error GDAPI godot_packed_float64_array_insert(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data); -void GDAPI godot_packed_real_array_invert(godot_packed_real_array *p_self); +void GDAPI godot_packed_float64_array_invert(godot_packed_float64_array *p_self); -void GDAPI godot_packed_real_array_push_back(godot_packed_real_array *p_self, const godot_real p_data); +void GDAPI godot_packed_float64_array_push_back(godot_packed_float64_array *p_self, const double p_data); -void GDAPI godot_packed_real_array_remove(godot_packed_real_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_float64_array_remove(godot_packed_float64_array *p_self, const godot_int p_idx); -void GDAPI godot_packed_real_array_resize(godot_packed_real_array *p_self, const godot_int p_size); +void GDAPI godot_packed_float64_array_resize(godot_packed_float64_array *p_self, const godot_int p_size); -void GDAPI godot_packed_real_array_set(godot_packed_real_array *p_self, const godot_int p_idx, const godot_real p_data); -godot_real GDAPI godot_packed_real_array_get(const godot_packed_real_array *p_self, const godot_int p_idx); +void GDAPI godot_packed_float64_array_set(godot_packed_float64_array *p_self, const godot_int p_idx, const double p_data); +double GDAPI godot_packed_float64_array_get(const godot_packed_float64_array *p_self, const godot_int p_idx); -godot_int GDAPI godot_packed_real_array_size(const godot_packed_real_array *p_self); +godot_int GDAPI godot_packed_float64_array_size(const godot_packed_float64_array *p_self); -godot_bool GDAPI godot_packed_real_array_empty(const godot_packed_real_array *p_self); +godot_bool GDAPI godot_packed_float64_array_empty(const godot_packed_float64_array *p_self); -void GDAPI godot_packed_real_array_destroy(godot_packed_real_array *p_self); +void GDAPI godot_packed_float64_array_destroy(godot_packed_float64_array *p_self); // string diff --git a/modules/gdnative/include/gdnative/rect2.h b/modules/gdnative/include/gdnative/rect2.h index 0ecf072471..f317afc9da 100644 --- a/modules/gdnative/include/gdnative/rect2.h +++ b/modules/gdnative/include/gdnative/rect2.h @@ -44,6 +44,13 @@ typedef struct godot_rect2 { } godot_rect2; #endif +#ifndef GODOT_CORE_API_GODOT_RECT2I_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_RECT2I_TYPE_DEFINED +typedef struct godot_rect2i { + uint8_t _dont_touch_that[16]; +} godot_rect2i; +#endif + // reduce extern "C" nesting for VS2013 #ifdef __cplusplus } @@ -56,11 +63,15 @@ typedef struct godot_rect2 { extern "C" { #endif +// Rect2 + 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_rect2i GDAPI godot_rect2_as_rect2i(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); @@ -95,6 +106,49 @@ void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_ void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size); +// Rect2I + +void GDAPI godot_rect2i_new_with_position_and_size(godot_rect2i *r_dest, const godot_vector2i *p_pos, const godot_vector2i *p_size); +void GDAPI godot_rect2i_new(godot_rect2i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_width, const godot_int p_height); + +godot_string GDAPI godot_rect2i_as_string(const godot_rect2i *p_self); + +godot_rect2 GDAPI godot_rect2i_as_rect2(const godot_rect2i *p_self); + +godot_int GDAPI godot_rect2i_get_area(const godot_rect2i *p_self); + +godot_bool GDAPI godot_rect2i_intersects(const godot_rect2i *p_self, const godot_rect2i *p_b); + +godot_bool GDAPI godot_rect2i_encloses(const godot_rect2i *p_self, const godot_rect2i *p_b); + +godot_bool GDAPI godot_rect2i_has_no_area(const godot_rect2i *p_self); + +godot_rect2i GDAPI godot_rect2i_clip(const godot_rect2i *p_self, const godot_rect2i *p_b); + +godot_rect2i GDAPI godot_rect2i_merge(const godot_rect2i *p_self, const godot_rect2i *p_b); + +godot_bool GDAPI godot_rect2i_has_point(const godot_rect2i *p_self, const godot_vector2i *p_point); + +godot_rect2i GDAPI godot_rect2i_grow(const godot_rect2i *p_self, const godot_int p_by); + +godot_rect2i GDAPI godot_rect2i_grow_individual(const godot_rect2i *p_self, const godot_int p_left, const godot_int p_top, const godot_int p_right, const godot_int p_bottom); + +godot_rect2i GDAPI godot_rect2i_grow_margin(const godot_rect2i *p_self, const godot_int p_margin, const godot_int p_by); + +godot_rect2i GDAPI godot_rect2i_abs(const godot_rect2i *p_self); + +godot_rect2i GDAPI godot_rect2i_expand(const godot_rect2i *p_self, const godot_vector2i *p_to); + +godot_bool GDAPI godot_rect2i_operator_equal(const godot_rect2i *p_self, const godot_rect2i *p_b); + +godot_vector2i GDAPI godot_rect2i_get_position(const godot_rect2i *p_self); + +godot_vector2i GDAPI godot_rect2i_get_size(const godot_rect2i *p_self); + +void GDAPI godot_rect2i_set_position(godot_rect2i *p_self, const godot_vector2i *p_pos); + +void GDAPI godot_rect2i_set_size(godot_rect2i *p_self, const godot_vector2i *p_size); + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h index 682c3e3ba8..0a611b76e9 100644 --- a/modules/gdnative/include/gdnative/variant.h +++ b/modules/gdnative/include/gdnative/variant.h @@ -71,16 +71,21 @@ typedef enum godot_variant_type { // misc types GODOT_VARIANT_TYPE_COLOR, + GODOT_VARIANT_TYPE_STRING_NAME, GODOT_VARIANT_TYPE_NODE_PATH, GODOT_VARIANT_TYPE_RID, GODOT_VARIANT_TYPE_OBJECT, + GODOT_VARIANT_TYPE_CALLABLE, + GODOT_VARIANT_TYPE_SIGNAL, GODOT_VARIANT_TYPE_DICTIONARY, GODOT_VARIANT_TYPE_ARRAY, // arrays GODOT_VARIANT_TYPE_PACKED_BYTE_ARRAY, - GODOT_VARIANT_TYPE_PACKED_INT_ARRAY, - GODOT_VARIANT_TYPE_PACKED_REAL_ARRAY, + GODOT_VARIANT_TYPE_PACKED_INT32_ARRAY, + GODOT_VARIANT_TYPE_PACKED_INT64_ARRAY, + GODOT_VARIANT_TYPE_PACKED_FLOAT32_ARRAY, + GODOT_VARIANT_TYPE_PACKED_FLOAT64_ARRAY, GODOT_VARIANT_TYPE_PACKED_STRING_ARRAY, GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, GODOT_VARIANT_TYPE_PACKED_VECTOR3_ARRAY, @@ -149,15 +154,17 @@ typedef enum godot_variant_operator { #include <gdnative/aabb.h> #include <gdnative/array.h> #include <gdnative/basis.h> +#include <gdnative/callable.h> #include <gdnative/color.h> #include <gdnative/dictionary.h> #include <gdnative/node_path.h> +#include <gdnative/packed_arrays.h> #include <gdnative/plane.h> -#include <gdnative/pool_arrays.h> #include <gdnative/quat.h> #include <gdnative/rect2.h> #include <gdnative/rid.h> #include <gdnative/string.h> +#include <gdnative/string_name.h> #include <gdnative/transform.h> #include <gdnative/transform2d.h> #include <gdnative/variant.h> @@ -181,9 +188,13 @@ 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_string_name(godot_variant *r_dest, const godot_string_name *p_s); void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2); +void GDAPI godot_variant_new_vector2i(godot_variant *r_dest, const godot_vector2i *p_v2); void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2); +void GDAPI godot_variant_new_rect2i(godot_variant *r_dest, const godot_rect2i *p_rect2); void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3); +void GDAPI godot_variant_new_vector3i(godot_variant *r_dest, const godot_vector3i *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); @@ -193,12 +204,16 @@ void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transf 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_callable(godot_variant *r_dest, const godot_callable *p_callable); +void GDAPI godot_variant_new_signal(godot_variant *r_dest, const godot_signal *p_signal); 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_packed_byte_array(godot_variant *r_dest, const godot_packed_byte_array *p_pba); -void GDAPI godot_variant_new_packed_int_array(godot_variant *r_dest, const godot_packed_int_array *p_pia); -void GDAPI godot_variant_new_packed_real_array(godot_variant *r_dest, const godot_packed_real_array *p_pra); +void GDAPI godot_variant_new_packed_int32_array(godot_variant *r_dest, const godot_packed_int32_array *p_pia); +void GDAPI godot_variant_new_packed_int64_array(godot_variant *r_dest, const godot_packed_int64_array *p_pia); +void GDAPI godot_variant_new_packed_float32_array(godot_variant *r_dest, const godot_packed_float32_array *p_pra); +void GDAPI godot_variant_new_packed_float64_array(godot_variant *r_dest, const godot_packed_float64_array *p_pra); void GDAPI godot_variant_new_packed_string_array(godot_variant *r_dest, const godot_packed_string_array *p_psa); void GDAPI godot_variant_new_packed_vector2_array(godot_variant *r_dest, const godot_packed_vector2_array *p_pv2a); void GDAPI godot_variant_new_packed_vector3_array(godot_variant *r_dest, const godot_packed_vector3_array *p_pv3a); @@ -209,9 +224,13 @@ 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_string_name GDAPI godot_variant_as_string_name(const godot_variant *p_self); godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self); +godot_vector2i GDAPI godot_variant_as_vector2i(const godot_variant *p_self); godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self); +godot_rect2i GDAPI godot_variant_as_rect2i(const godot_variant *p_self); godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self); +godot_vector3i GDAPI godot_variant_as_vector3i(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); @@ -221,12 +240,16 @@ 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_callable GDAPI godot_variant_as_callable(const godot_variant *p_self); +godot_signal GDAPI godot_variant_as_signal(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_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_variant *p_self); -godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_variant *p_self); -godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_variant *p_self); +godot_packed_int32_array GDAPI godot_variant_as_packed_int32_array(const godot_variant *p_self); +godot_packed_int64_array GDAPI godot_variant_as_packed_int64_array(const godot_variant *p_self); +godot_packed_float32_array GDAPI godot_variant_as_packed_float32_array(const godot_variant *p_self); +godot_packed_float64_array GDAPI godot_variant_as_packed_float64_array(const godot_variant *p_self); godot_packed_string_array GDAPI godot_variant_as_packed_string_array(const godot_variant *p_self); godot_packed_vector2_array GDAPI godot_variant_as_packed_vector2_array(const godot_variant *p_self); godot_packed_vector3_array GDAPI godot_variant_as_packed_vector3_array(const godot_variant *p_self); @@ -239,6 +262,7 @@ godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const god 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); +uint32_t GDAPI godot_variant_hash(const godot_variant *p_self); 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); diff --git a/modules/gdnative/include/gdnative/vector2.h b/modules/gdnative/include/gdnative/vector2.h index c11e23a586..35b02c5a75 100644 --- a/modules/gdnative/include/gdnative/vector2.h +++ b/modules/gdnative/include/gdnative/vector2.h @@ -46,6 +46,15 @@ typedef struct { } godot_vector2; #endif +#define GODOT_VECTOR2I_SIZE 8 + +#ifndef GODOT_CORE_API_GODOT_VECTOR2I_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VECTOR2I_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_VECTOR2I_SIZE]; +} godot_vector2i; +#endif + // reduce extern "C" nesting for VS2013 #ifdef __cplusplus } @@ -57,10 +66,14 @@ typedef struct { extern "C" { #endif +// Vector2 + 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_vector2i GDAPI godot_vector2_as_vector2i(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); @@ -93,6 +106,8 @@ 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_sign(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); @@ -135,6 +150,46 @@ godot_real GDAPI godot_vector2_get_x(const godot_vector2 *p_self); godot_real GDAPI godot_vector2_get_y(const godot_vector2 *p_self); +// Vector2i + +void GDAPI godot_vector2i_new(godot_vector2i *r_dest, const godot_int p_x, const godot_int p_y); + +godot_string GDAPI godot_vector2i_as_string(const godot_vector2i *p_self); + +godot_vector2 GDAPI godot_vector2i_as_vector2(const godot_vector2i *p_self); + +godot_real GDAPI godot_vector2i_aspect(const godot_vector2i *p_self); + +godot_vector2i GDAPI godot_vector2i_abs(const godot_vector2i *p_self); + +godot_vector2i GDAPI godot_vector2i_sign(const godot_vector2i *p_self); + +godot_vector2i GDAPI godot_vector2i_operator_add(const godot_vector2i *p_self, const godot_vector2i *p_b); + +godot_vector2i GDAPI godot_vector2i_operator_subtract(const godot_vector2i *p_self, const godot_vector2i *p_b); + +godot_vector2i GDAPI godot_vector2i_operator_multiply_vector(const godot_vector2i *p_self, const godot_vector2i *p_b); + +godot_vector2i GDAPI godot_vector2i_operator_multiply_scalar(const godot_vector2i *p_self, const godot_int p_b); + +godot_vector2i GDAPI godot_vector2i_operator_divide_vector(const godot_vector2i *p_self, const godot_vector2i *p_b); + +godot_vector2i GDAPI godot_vector2i_operator_divide_scalar(const godot_vector2i *p_self, const godot_int p_b); + +godot_bool GDAPI godot_vector2i_operator_equal(const godot_vector2i *p_self, const godot_vector2i *p_b); + +godot_bool GDAPI godot_vector2i_operator_less(const godot_vector2i *p_self, const godot_vector2i *p_b); + +godot_vector2i GDAPI godot_vector2i_operator_neg(const godot_vector2i *p_self); + +void GDAPI godot_vector2i_set_x(godot_vector2i *p_self, const godot_int p_x); + +void GDAPI godot_vector2i_set_y(godot_vector2i *p_self, const godot_int p_y); + +godot_int GDAPI godot_vector2i_get_x(const godot_vector2i *p_self); + +godot_int GDAPI godot_vector2i_get_y(const godot_vector2i *p_self); + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/gdnative/vector3.h b/modules/gdnative/include/gdnative/vector3.h index 8ebf15b724..5127b8789b 100644 --- a/modules/gdnative/include/gdnative/vector3.h +++ b/modules/gdnative/include/gdnative/vector3.h @@ -46,6 +46,15 @@ typedef struct { } godot_vector3; #endif +#define GODOT_VECTOR3I_SIZE 12 + +#ifndef GODOT_CORE_API_GODOT_VECTOR3I_TYPE_DEFINED +#define GODOT_CORE_API_GODOT_VECTOR3I_TYPE_DEFINED +typedef struct { + uint8_t _dont_touch_that[GODOT_VECTOR3I_SIZE]; +} godot_vector3i; +#endif + // reduce extern "C" nesting for VS2013 #ifdef __cplusplus } @@ -64,10 +73,14 @@ typedef enum { GODOT_VECTOR3_AXIS_Z, } godot_vector3_axis; +// Vector3 + 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_vector3i GDAPI godot_vector3_as_vector3i(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); @@ -102,6 +115,8 @@ 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_sign(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); @@ -142,6 +157,44 @@ void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axi godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis); +// Vector3i + +void GDAPI godot_vector3i_new(godot_vector3i *r_dest, const godot_int p_x, const godot_int p_y, const godot_int p_z); + +godot_string GDAPI godot_vector3i_as_string(const godot_vector3i *p_self); + +godot_vector3 GDAPI godot_vector3i_as_vector3(const godot_vector3i *p_self); + +godot_int GDAPI godot_vector3i_min_axis(const godot_vector3i *p_self); + +godot_int GDAPI godot_vector3i_max_axis(const godot_vector3i *p_self); + +godot_vector3i GDAPI godot_vector3i_abs(const godot_vector3i *p_self); + +godot_vector3i GDAPI godot_vector3i_sign(const godot_vector3i *p_self); + +godot_vector3i GDAPI godot_vector3i_operator_add(const godot_vector3i *p_self, const godot_vector3i *p_b); + +godot_vector3i GDAPI godot_vector3i_operator_subtract(const godot_vector3i *p_self, const godot_vector3i *p_b); + +godot_vector3i GDAPI godot_vector3i_operator_multiply_vector(const godot_vector3i *p_self, const godot_vector3i *p_b); + +godot_vector3i GDAPI godot_vector3i_operator_multiply_scalar(const godot_vector3i *p_self, const godot_int p_b); + +godot_vector3i GDAPI godot_vector3i_operator_divide_vector(const godot_vector3i *p_self, const godot_vector3i *p_b); + +godot_vector3i GDAPI godot_vector3i_operator_divide_scalar(const godot_vector3i *p_self, const godot_int p_b); + +godot_bool GDAPI godot_vector3i_operator_equal(const godot_vector3i *p_self, const godot_vector3i *p_b); + +godot_bool GDAPI godot_vector3i_operator_less(const godot_vector3i *p_self, const godot_vector3i *p_b); + +godot_vector3i GDAPI godot_vector3i_operator_neg(const godot_vector3i *p_self); + +void GDAPI godot_vector3i_set_axis(godot_vector3i *p_self, const godot_vector3_axis p_axis, const godot_int p_val); + +godot_int GDAPI godot_vector3i_get_axis(const godot_vector3i *p_self, const godot_vector3_axis p_axis); + #ifdef __cplusplus } #endif diff --git a/modules/gdnative/include/nativescript/godot_nativescript.h b/modules/gdnative/include/nativescript/godot_nativescript.h index 0fb5180103..d65b3f91f4 100644 --- a/modules/gdnative/include/nativescript/godot_nativescript.h +++ b/modules/gdnative/include/nativescript/godot_nativescript.h @@ -172,17 +172,17 @@ typedef struct { godot_string hint_string; godot_property_usage_flags usage; godot_variant default_value; -} godot_signal_argument; +} godot_nativescript_signal_argument; typedef struct { godot_string name; int num_args; - godot_signal_argument *args; + godot_nativescript_signal_argument *args; int num_default_args; godot_variant *default_args; -} godot_signal; +} godot_nativescript_signal; -void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_signal *p_signal); +void GDAPI godot_nativescript_register_signal(void *p_gdnative_handle, const char *p_name, const godot_nativescript_signal *p_signal); void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance); |