Remove dependency on headers
This commit is contained in:
parent
69cb828750
commit
2fd1efcc4e
42 changed files with 1280 additions and 3614 deletions
|
|
@ -1,122 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* array.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
#ifndef GODOT_ARRAY_H
|
|
||||||
#define GODOT_ARRAY_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define GODOT_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_ARRAY_SIZE];
|
|
||||||
} godot_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "pool_arrays.h"
|
|
||||||
#include "variant.h"
|
|
||||||
|
|
||||||
#include "gdnative.h"
|
|
||||||
|
|
||||||
void GDAPI godot_array_new(godot_array *r_dest);
|
|
||||||
void GDAPI godot_array_new_copy(godot_array *r_dest, const godot_array *p_src);
|
|
||||||
void GDAPI godot_array_new_pool_color_array(godot_array *r_dest, const godot_pool_color_array *p_pca);
|
|
||||||
void GDAPI godot_array_new_pool_vector3_array(godot_array *r_dest, const godot_pool_vector3_array *p_pv3a);
|
|
||||||
void GDAPI godot_array_new_pool_vector2_array(godot_array *r_dest, const godot_pool_vector2_array *p_pv2a);
|
|
||||||
void GDAPI godot_array_new_pool_string_array(godot_array *r_dest, const godot_pool_string_array *p_psa);
|
|
||||||
void GDAPI godot_array_new_pool_real_array(godot_array *r_dest, const godot_pool_real_array *p_pra);
|
|
||||||
void GDAPI godot_array_new_pool_int_array(godot_array *r_dest, const godot_pool_int_array *p_pia);
|
|
||||||
void GDAPI godot_array_new_pool_byte_array(godot_array *r_dest, const godot_pool_byte_array *p_pba);
|
|
||||||
|
|
||||||
void GDAPI godot_array_set(godot_array *p_self, const godot_int p_idx, const godot_variant *p_value);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_array_get(const godot_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_variant GDAPI *godot_array_operator_index(godot_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_array_append(godot_array *p_self, const godot_variant *p_value);
|
|
||||||
|
|
||||||
void GDAPI godot_array_clear(godot_array *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_array_count(const godot_array *p_self, const godot_variant *p_value);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_array_empty(const godot_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_array_erase(godot_array *p_self, const godot_variant *p_value);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_array_front(const godot_array *p_self);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_array_back(const godot_array *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_array_find(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_array_find_last(const godot_array *p_self, const godot_variant *p_what);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_array_has(const godot_array *p_self, const godot_variant *p_value);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_array_hash(const godot_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_array_insert(godot_array *p_self, const godot_int p_pos, const godot_variant *p_value);
|
|
||||||
|
|
||||||
void GDAPI godot_array_invert(godot_array *p_self);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_array_pop_back(godot_array *p_self);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_array_pop_front(godot_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_array_push_back(godot_array *p_self, const godot_variant *p_value);
|
|
||||||
|
|
||||||
void GDAPI godot_array_push_front(godot_array *p_self, const godot_variant *p_value);
|
|
||||||
|
|
||||||
void GDAPI godot_array_remove(godot_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_array_resize(godot_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_array_rfind(const godot_array *p_self, const godot_variant *p_what, const godot_int p_from);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_array_size(const godot_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_array_sort(godot_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_array_sort_custom(godot_array *p_self, godot_object *p_obj, const godot_string *p_func);
|
|
||||||
|
|
||||||
void GDAPI godot_array_destroy(godot_array *p_self);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_ARRAY_H
|
|
||||||
|
|
@ -1,121 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* basis.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_BASIS_H
|
|
||||||
#define GODOT_BASIS_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "quat.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
void GDAPI godot_basis_new_with_rows(godot_basis *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis);
|
|
||||||
void GDAPI godot_basis_new_with_axis_and_angle(godot_basis *r_dest, const godot_vector3 *p_axis, const godot_real p_phi);
|
|
||||||
void GDAPI godot_basis_new_with_euler(godot_basis *r_dest, const godot_vector3 *p_euler);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_basis_as_string(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_inverse(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_transposed(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_orthonormalized(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_basis_determinant(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_rotated(const godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_phi);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_scaled(const godot_basis *p_self, const godot_vector3 *p_scale);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_set_scale(godot_basis *p_self, const godot_vector3 *p_scale);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_set_rotation_euler(godot_basis *p_self, const godot_vector3 *p_euler);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_set_rotation_axis_angle(godot_basis *p_self, const godot_vector3 *p_axis, const godot_real p_angle);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_basis_get_scale(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_basis_tdotx(const godot_basis *p_self, const godot_vector3 *p_with);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_basis_tdoty(const godot_basis *p_self, const godot_vector3 *p_with);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_basis_tdotz(const godot_basis *p_self, const godot_vector3 *p_with);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_basis_xform(const godot_basis *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_basis_xform_inv(const godot_basis *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_basis_get_orthogonal_index(const godot_basis *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_new(godot_basis *r_dest);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_new_with_euler_quat(godot_basis *r_dest, const godot_quat *p_euler);
|
|
||||||
|
|
||||||
// p_elements is a pointer to an array of 3 (!!) vector3
|
|
||||||
void GDAPI godot_basis_get_elements(godot_basis *p_self, godot_vector3 *p_elements);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_basis_get_axis(const godot_basis *p_self, const godot_int p_axis);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_set_axis(godot_basis *p_self, const godot_int p_axis, const godot_vector3 *p_value);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_basis_get_row(const godot_basis *p_self, const godot_int p_row);
|
|
||||||
|
|
||||||
void GDAPI godot_basis_set_row(godot_basis *p_self, const godot_int p_row, const godot_vector3 *p_value);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_basis_operator_equal(const godot_basis *p_self, const godot_basis *p_b);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_operator_add(const godot_basis *p_self, const godot_basis *p_b);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_operator_substract(const godot_basis *p_self, const godot_basis *p_b);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_operator_multiply_vector(const godot_basis *p_self, const godot_basis *p_b);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_basis_operator_multiply_scalar(const godot_basis *p_self, const godot_real p_b);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_BASIS_H
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* color.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_COLOR_H
|
|
||||||
#define GODOT_COLOR_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
void GDAPI godot_color_new_rgba(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b, const godot_real p_a);
|
|
||||||
void GDAPI godot_color_new_rgb(godot_color *r_dest, const godot_real p_r, const godot_real p_g, const godot_real p_b);
|
|
||||||
|
|
||||||
godot_real godot_color_get_r(const godot_color *p_self);
|
|
||||||
void godot_color_set_r(godot_color *p_self, const godot_real r);
|
|
||||||
|
|
||||||
godot_real godot_color_get_g(const godot_color *p_self);
|
|
||||||
void godot_color_set_g(godot_color *p_self, const godot_real g);
|
|
||||||
|
|
||||||
godot_real godot_color_get_b(const godot_color *p_self);
|
|
||||||
void godot_color_set_b(godot_color *p_self, const godot_real b);
|
|
||||||
|
|
||||||
godot_real godot_color_get_a(const godot_color *p_self);
|
|
||||||
void godot_color_set_a(godot_color *p_self, const godot_real a);
|
|
||||||
|
|
||||||
godot_real godot_color_get_h(const godot_color *p_self);
|
|
||||||
godot_real godot_color_get_s(const godot_color *p_self);
|
|
||||||
godot_real godot_color_get_v(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_color_as_string(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_color_to_32(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_color_to_ARGB32(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_color_gray(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_color GDAPI godot_color_inverted(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_color GDAPI godot_color_contrasted(const godot_color *p_self);
|
|
||||||
|
|
||||||
godot_color GDAPI godot_color_linear_interpolate(const godot_color *p_self, const godot_color *p_b, const godot_real p_t);
|
|
||||||
|
|
||||||
godot_color GDAPI godot_color_blend(const godot_color *p_self, const godot_color *p_over);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_color_to_html(const godot_color *p_self, const godot_bool p_with_alpha);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_color_operator_equal(const godot_color *p_self, const godot_color *p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_color_operator_less(const godot_color *p_self, const godot_color *p_b);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_COLOR_H
|
|
||||||
|
|
@ -1,89 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* dictionary.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_DICTIONARY_H
|
|
||||||
#define GODOT_DICTIONARY_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define GODOT_DICTIONARY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_DICTIONARY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_DICTIONARY_SIZE];
|
|
||||||
} godot_dictionary;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "array.h"
|
|
||||||
#include "gdnative.h"
|
|
||||||
#include "variant.h"
|
|
||||||
|
|
||||||
void GDAPI godot_dictionary_new(godot_dictionary *r_dest);
|
|
||||||
void GDAPI godot_dictionary_new_copy(godot_dictionary *r_dest, const godot_dictionary *p_src);
|
|
||||||
void GDAPI godot_dictionary_destroy(godot_dictionary *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_dictionary_clear(godot_dictionary *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_self, const godot_variant *p_key);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_self, const godot_array *p_keys);
|
|
||||||
|
|
||||||
void GDAPI godot_dictionary_erase(godot_dictionary *p_self, const godot_variant *p_key);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_dictionary_hash(const godot_dictionary *p_self);
|
|
||||||
|
|
||||||
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_self);
|
|
||||||
|
|
||||||
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_self);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_dictionary_get(const godot_dictionary *p_self, const godot_variant *p_key);
|
|
||||||
void GDAPI godot_dictionary_set(godot_dictionary *p_self, const godot_variant *p_key, const godot_variant *p_value);
|
|
||||||
|
|
||||||
godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_self, const godot_variant *p_key);
|
|
||||||
|
|
||||||
godot_variant GDAPI *godot_dictionary_next(const godot_dictionary *p_self, const godot_variant *p_key);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_dictionary_operator_equal(const godot_dictionary *p_self, const godot_dictionary *p_b);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_self);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_DICTIONARY_H
|
|
||||||
|
|
@ -1,302 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* gdnative.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_GDNATIVE_H
|
|
||||||
#define GODOT_GDNATIVE_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GDAPI_BUILT_IN
|
|
||||||
#define GDAPI_EXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#if defined(GDAPI_EXPORT)
|
|
||||||
#define GDCALLINGCONV
|
|
||||||
#define GDAPI __declspec(dllexport) GDCALLINGCONV
|
|
||||||
#else
|
|
||||||
#define GDCALLINGCONV
|
|
||||||
#define GDAPI __declspec(dllimport) GDCALLINGCONV
|
|
||||||
#endif
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#include "TargetConditionals.h"
|
|
||||||
#if TARGET_OS_IPHONE
|
|
||||||
#define GDCALLINGCONV
|
|
||||||
#define GDAPI
|
|
||||||
#elif TARGET_OS_MAC
|
|
||||||
#define GDCALLINGCONV __attribute__((sysv_abi))
|
|
||||||
#define GDAPI GDCALLINGCONV
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define GDCALLINGCONV __attribute__((sysv_abi))
|
|
||||||
#define GDAPI GDCALLINGCONV
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define GDN_EXPORT __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define GDN_EXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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;
|
|
||||||
|
|
||||||
/////// Brute force forward declarations for the rest
|
|
||||||
/*
|
|
||||||
typedef struct godot_variant godot_variant;
|
|
||||||
typedef struct godot_string godot_string;
|
|
||||||
typedef struct godot_vector2 godot_vector2;
|
|
||||||
typedef struct godot_rect2 godot_rect2;
|
|
||||||
typedef struct godot_vector3 godot_vector3;
|
|
||||||
typedef struct godot_transform2d godot_transform2d;
|
|
||||||
typedef struct godot_plane godot_plane;
|
|
||||||
typedef struct godot_quat godot_quat;
|
|
||||||
typedef struct godot_rect3 godot_rect3;
|
|
||||||
typedef struct godot_basis godot_basis;
|
|
||||||
typedef struct godot_transform godot_transform;
|
|
||||||
typedef struct godot_color godot_color;
|
|
||||||
typedef struct godot_node_path godot_node_path;
|
|
||||||
typedef struct godot_rid godot_rid;
|
|
||||||
typedef struct godot_dictionary godot_dictionary;
|
|
||||||
typedef struct godot_array godot_array;
|
|
||||||
typedef struct godot_pool_byte_array godot_pool_byte_array;
|
|
||||||
typedef struct godot_pool_int_array godot_pool_int_array;
|
|
||||||
typedef struct godot_pool_real_array godot_pool_real_array;
|
|
||||||
typedef struct godot_pool_string_array godot_pool_string_array;
|
|
||||||
typedef struct godot_pool_vector2_array godot_pool_vector2_array;
|
|
||||||
typedef struct godot_pool_vector3_array godot_pool_vector3_array;
|
|
||||||
typedef struct godot_pool_color_array godot_pool_color_array;
|
|
||||||
*/
|
|
||||||
/////// String
|
|
||||||
|
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
////// Vector2
|
|
||||||
|
|
||||||
#include "vector2.h"
|
|
||||||
|
|
||||||
////// Rect2
|
|
||||||
|
|
||||||
#include "rect2.h"
|
|
||||||
|
|
||||||
////// Vector3
|
|
||||||
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
////// Transform2D
|
|
||||||
|
|
||||||
#include "transform2d.h"
|
|
||||||
|
|
||||||
/////// Plane
|
|
||||||
|
|
||||||
#include "plane.h"
|
|
||||||
|
|
||||||
/////// Quat
|
|
||||||
|
|
||||||
#include "quat.h"
|
|
||||||
|
|
||||||
/////// Rect3
|
|
||||||
|
|
||||||
#include "rect3.h"
|
|
||||||
|
|
||||||
/////// Basis
|
|
||||||
|
|
||||||
#include "basis.h"
|
|
||||||
|
|
||||||
/////// Transform
|
|
||||||
|
|
||||||
#include "transform.h"
|
|
||||||
|
|
||||||
/////// Color
|
|
||||||
|
|
||||||
#include "color.h"
|
|
||||||
|
|
||||||
/////// NodePath
|
|
||||||
|
|
||||||
#include "node_path.h"
|
|
||||||
|
|
||||||
/////// RID
|
|
||||||
|
|
||||||
#include "rid.h"
|
|
||||||
|
|
||||||
/////// Dictionary
|
|
||||||
|
|
||||||
#include "dictionary.h"
|
|
||||||
|
|
||||||
/////// Array
|
|
||||||
|
|
||||||
#include "array.h"
|
|
||||||
|
|
||||||
// single API file for Pool*Array
|
|
||||||
#include "pool_arrays.h"
|
|
||||||
|
|
||||||
void GDAPI godot_object_destroy(godot_object *p_o);
|
|
||||||
|
|
||||||
////// Variant
|
|
||||||
|
|
||||||
#include "variant.h"
|
|
||||||
|
|
||||||
////// Singleton API
|
|
||||||
|
|
||||||
godot_object GDAPI *godot_global_get_singleton(char *p_name); // result shouldn't be freed
|
|
||||||
|
|
||||||
////// OS API
|
|
||||||
|
|
||||||
void GDAPI *godot_get_stack_bottom(); // returns stack bottom of the main thread
|
|
||||||
|
|
||||||
////// MethodBind API
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[1]; // TODO
|
|
||||||
} godot_method_bind;
|
|
||||||
|
|
||||||
godot_method_bind GDAPI *godot_method_bind_get_method(const char *p_classname, const char *p_methodname);
|
|
||||||
void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_object *p_instance, const void **p_args, void *p_ret);
|
|
||||||
godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error);
|
|
||||||
////// Script API
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
godot_bool in_editor;
|
|
||||||
uint64_t core_api_hash;
|
|
||||||
uint64_t editor_api_hash;
|
|
||||||
uint64_t no_api_hash;
|
|
||||||
} godot_gdnative_init_options;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
godot_bool in_editor;
|
|
||||||
} godot_gdnative_terminate_options;
|
|
||||||
|
|
||||||
// Calling convention?
|
|
||||||
typedef godot_object *(*godot_class_constructor)();
|
|
||||||
|
|
||||||
godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname);
|
|
||||||
|
|
||||||
godot_dictionary GDAPI godot_get_global_constants();
|
|
||||||
|
|
||||||
////// GDNative procedure types
|
|
||||||
typedef void (*godot_gdnative_init_fn)(godot_gdnative_init_options *);
|
|
||||||
typedef void (*godot_gdnative_terminate_fn)(godot_gdnative_terminate_options *);
|
|
||||||
typedef godot_variant (*godot_gdnative_procedure_fn)(void *, godot_array *);
|
|
||||||
|
|
||||||
////// System Functions
|
|
||||||
|
|
||||||
//using these will help Godot track how much memory is in use in debug mode
|
|
||||||
void GDAPI *godot_alloc(int p_bytes);
|
|
||||||
void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
|
|
||||||
void GDAPI godot_free(void *p_ptr);
|
|
||||||
|
|
||||||
//print using Godot's error handler list
|
|
||||||
void GDAPI godot_print_error(const char *p_description, const char *p_function, const char *p_file, int p_line);
|
|
||||||
void GDAPI godot_print_warning(const char *p_description, const char *p_function, const char *p_file, int p_line);
|
|
||||||
void GDAPI godot_print(const godot_string *p_message);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_C_H
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* node_path.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_NODE_PATH_H
|
|
||||||
#define GODOT_NODE_PATH_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define GODOT_NODE_PATH_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_NODE_PATH_SIZE];
|
|
||||||
} godot_node_path;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gdnative.h"
|
|
||||||
#include "string.h"
|
|
||||||
|
|
||||||
void GDAPI godot_node_path_new(godot_node_path *r_dest, const godot_string *p_from);
|
|
||||||
void GDAPI godot_node_path_new_copy(godot_node_path *r_dest, const godot_node_path *p_src);
|
|
||||||
void GDAPI godot_node_path_destroy(godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_node_path_operator_equal(const godot_node_path *p_self, const godot_node_path *p_b);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_NODE_PATH_H
|
|
||||||
|
|
@ -1,93 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* plane.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_PLANE_H
|
|
||||||
#define GODOT_PLANE_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
void GDAPI godot_plane_new_with_reals(godot_plane *r_dest, const godot_real p_a, const godot_real p_b, const godot_real p_c, const godot_real p_d);
|
|
||||||
void GDAPI godot_plane_new_with_vectors(godot_plane *r_dest, const godot_vector3 *p_v1, const godot_vector3 *p_v2, const godot_vector3 *p_v3);
|
|
||||||
void GDAPI godot_plane_new_with_normal(godot_plane *r_dest, const godot_vector3 *p_normal, const godot_real p_d);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_plane_as_string(const godot_plane *p_self);
|
|
||||||
|
|
||||||
godot_plane GDAPI godot_plane_normalized(const godot_plane *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_plane_center(const godot_plane *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_plane_get_any_point(const godot_plane *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_plane_is_point_over(const godot_plane *p_self, const godot_vector3 *p_point);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_plane_distance_to(const godot_plane *p_self, const godot_vector3 *p_point);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_plane_has_point(const godot_plane *p_self, const godot_vector3 *p_point, const godot_real p_epsilon);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_plane_project(const godot_plane *p_self, const godot_vector3 *p_point);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_plane_intersect_3(const godot_plane *p_self, godot_vector3 *r_dest, const godot_plane *p_b, const godot_plane *p_c);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_plane_intersects_ray(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_from, const godot_vector3 *p_dir);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_plane_intersects_segment(const godot_plane *p_self, godot_vector3 *r_dest, const godot_vector3 *p_begin, const godot_vector3 *p_end);
|
|
||||||
|
|
||||||
godot_plane GDAPI godot_plane_operator_neg(const godot_plane *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_plane_operator_equal(const godot_plane *p_self, const godot_plane *p_b);
|
|
||||||
|
|
||||||
void GDAPI godot_plane_set_normal(godot_plane *p_self, const godot_vector3 *p_normal);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_plane_get_d(const godot_plane *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_plane_set_d(godot_plane *p_self, const godot_real p_d);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_PLANE_H
|
|
||||||
|
|
@ -1,316 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* pool_arrays.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_POOL_ARRAYS_H
|
|
||||||
#define GODOT_POOL_ARRAYS_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/////// PoolByteArray
|
|
||||||
|
|
||||||
#define GODOT_POOL_BYTE_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_BYTE_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_BYTE_ARRAY_SIZE];
|
|
||||||
} godot_pool_byte_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////// PoolIntArray
|
|
||||||
|
|
||||||
#define GODOT_POOL_INT_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_INT_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_INT_ARRAY_SIZE];
|
|
||||||
} godot_pool_int_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////// PoolRealArray
|
|
||||||
|
|
||||||
#define GODOT_POOL_REAL_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_REAL_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_REAL_ARRAY_SIZE];
|
|
||||||
} godot_pool_real_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////// PoolStringArray
|
|
||||||
|
|
||||||
#define GODOT_POOL_STRING_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_STRING_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_STRING_ARRAY_SIZE];
|
|
||||||
} godot_pool_string_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////// PoolVector2Array
|
|
||||||
|
|
||||||
#define GODOT_POOL_VECTOR2_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_VECTOR2_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_VECTOR2_ARRAY_SIZE];
|
|
||||||
} godot_pool_vector2_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////// PoolVector3Array
|
|
||||||
|
|
||||||
#define GODOT_POOL_VECTOR3_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_VECTOR3_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_VECTOR3_ARRAY_SIZE];
|
|
||||||
} godot_pool_vector3_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/////// PoolColorArray
|
|
||||||
|
|
||||||
#define GODOT_POOL_COLOR_ARRAY_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_POOL_COLOR_ARRAY_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_POOL_COLOR_ARRAY_SIZE];
|
|
||||||
} godot_pool_color_array;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "array.h"
|
|
||||||
#include "color.h"
|
|
||||||
#include "vector2.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
#include "gdnative.h"
|
|
||||||
|
|
||||||
// byte
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_new(godot_pool_byte_array *r_dest);
|
|
||||||
void GDAPI godot_pool_byte_array_new_copy(godot_pool_byte_array *r_dest, const godot_pool_byte_array *p_src);
|
|
||||||
void GDAPI godot_pool_byte_array_new_with_array(godot_pool_byte_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_append(godot_pool_byte_array *p_self, const uint8_t p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_append_array(godot_pool_byte_array *p_self, const godot_pool_byte_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_byte_array_insert(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_invert(godot_pool_byte_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_push_back(godot_pool_byte_array *p_self, const uint8_t p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_remove(godot_pool_byte_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_resize(godot_pool_byte_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_set(godot_pool_byte_array *p_self, const godot_int p_idx, const uint8_t p_data);
|
|
||||||
uint8_t GDAPI godot_pool_byte_array_get(const godot_pool_byte_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_byte_array_size(const godot_pool_byte_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_byte_array_destroy(godot_pool_byte_array *p_self);
|
|
||||||
|
|
||||||
// int
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_new(godot_pool_int_array *r_dest);
|
|
||||||
void GDAPI godot_pool_int_array_new_copy(godot_pool_int_array *r_dest, const godot_pool_int_array *p_src);
|
|
||||||
void GDAPI godot_pool_int_array_new_with_array(godot_pool_int_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_append(godot_pool_int_array *p_self, const godot_int p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_append_array(godot_pool_int_array *p_self, const godot_pool_int_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_int_array_insert(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_invert(godot_pool_int_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_push_back(godot_pool_int_array *p_self, const godot_int p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_remove(godot_pool_int_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_resize(godot_pool_int_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_set(godot_pool_int_array *p_self, const godot_int p_idx, const godot_int p_data);
|
|
||||||
godot_int GDAPI godot_pool_int_array_get(const godot_pool_int_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_int_array_size(const godot_pool_int_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_int_array_destroy(godot_pool_int_array *p_self);
|
|
||||||
|
|
||||||
// real
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_new(godot_pool_real_array *r_dest);
|
|
||||||
void GDAPI godot_pool_real_array_new_copy(godot_pool_real_array *r_dest, const godot_pool_real_array *p_src);
|
|
||||||
void GDAPI godot_pool_real_array_new_with_array(godot_pool_real_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_append(godot_pool_real_array *p_self, const godot_real p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_append_array(godot_pool_real_array *p_self, const godot_pool_real_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_real_array_insert(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_invert(godot_pool_real_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_push_back(godot_pool_real_array *p_self, const godot_real p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_remove(godot_pool_real_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_resize(godot_pool_real_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_set(godot_pool_real_array *p_self, const godot_int p_idx, const godot_real p_data);
|
|
||||||
godot_real GDAPI godot_pool_real_array_get(const godot_pool_real_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_real_array_size(const godot_pool_real_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_real_array_destroy(godot_pool_real_array *p_self);
|
|
||||||
|
|
||||||
// string
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_new(godot_pool_string_array *r_dest);
|
|
||||||
void GDAPI godot_pool_string_array_new_copy(godot_pool_string_array *r_dest, const godot_pool_string_array *p_src);
|
|
||||||
void GDAPI godot_pool_string_array_new_with_array(godot_pool_string_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_append(godot_pool_string_array *p_self, const godot_string *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_append_array(godot_pool_string_array *p_self, const godot_pool_string_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_string_array_insert(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_invert(godot_pool_string_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_push_back(godot_pool_string_array *p_self, const godot_string *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_remove(godot_pool_string_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_resize(godot_pool_string_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_set(godot_pool_string_array *p_self, const godot_int p_idx, const godot_string *p_data);
|
|
||||||
godot_string GDAPI godot_pool_string_array_get(const godot_pool_string_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_string_array_size(const godot_pool_string_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_string_array_destroy(godot_pool_string_array *p_self);
|
|
||||||
|
|
||||||
// vector2
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_new(godot_pool_vector2_array *r_dest);
|
|
||||||
void GDAPI godot_pool_vector2_array_new_copy(godot_pool_vector2_array *r_dest, const godot_pool_vector2_array *p_src);
|
|
||||||
void GDAPI godot_pool_vector2_array_new_with_array(godot_pool_vector2_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_append(godot_pool_vector2_array *p_self, const godot_vector2 *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_append_array(godot_pool_vector2_array *p_self, const godot_pool_vector2_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_vector2_array_insert(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_invert(godot_pool_vector2_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_push_back(godot_pool_vector2_array *p_self, const godot_vector2 *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_remove(godot_pool_vector2_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_resize(godot_pool_vector2_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_set(godot_pool_vector2_array *p_self, const godot_int p_idx, const godot_vector2 *p_data);
|
|
||||||
godot_vector2 GDAPI godot_pool_vector2_array_get(const godot_pool_vector2_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_vector2_array_size(const godot_pool_vector2_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector2_array_destroy(godot_pool_vector2_array *p_self);
|
|
||||||
|
|
||||||
// vector3
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_new(godot_pool_vector3_array *r_dest);
|
|
||||||
void GDAPI godot_pool_vector3_array_new_copy(godot_pool_vector3_array *r_dest, const godot_pool_vector3_array *p_src);
|
|
||||||
void GDAPI godot_pool_vector3_array_new_with_array(godot_pool_vector3_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_append(godot_pool_vector3_array *p_self, const godot_vector3 *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_append_array(godot_pool_vector3_array *p_self, const godot_pool_vector3_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_vector3_array_insert(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_invert(godot_pool_vector3_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_push_back(godot_pool_vector3_array *p_self, const godot_vector3 *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_remove(godot_pool_vector3_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_resize(godot_pool_vector3_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_set(godot_pool_vector3_array *p_self, const godot_int p_idx, const godot_vector3 *p_data);
|
|
||||||
godot_vector3 GDAPI godot_pool_vector3_array_get(const godot_pool_vector3_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_vector3_array_size(const godot_pool_vector3_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_vector3_array_destroy(godot_pool_vector3_array *p_self);
|
|
||||||
|
|
||||||
// color
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_new(godot_pool_color_array *r_dest);
|
|
||||||
void GDAPI godot_pool_color_array_new_copy(godot_pool_color_array *r_dest, const godot_pool_color_array *p_src);
|
|
||||||
void GDAPI godot_pool_color_array_new_with_array(godot_pool_color_array *r_dest, const godot_array *p_a);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_append(godot_pool_color_array *p_self, const godot_color *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_append_array(godot_pool_color_array *p_self, const godot_pool_color_array *p_array);
|
|
||||||
|
|
||||||
godot_error GDAPI godot_pool_color_array_insert(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_invert(godot_pool_color_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_push_back(godot_pool_color_array *p_self, const godot_color *p_data);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_remove(godot_pool_color_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_resize(godot_pool_color_array *p_self, const godot_int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_set(godot_pool_color_array *p_self, const godot_int p_idx, const godot_color *p_data);
|
|
||||||
godot_color GDAPI godot_pool_color_array_get(const godot_pool_color_array *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_pool_color_array_size(const godot_pool_color_array *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_self);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_POOL_ARRAYS_H
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* quat.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_QUAT_H
|
|
||||||
#define GODOT_QUAT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
void GDAPI godot_quat_new(godot_quat *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z, const godot_real p_w);
|
|
||||||
void GDAPI godot_quat_new_with_axis_angle(godot_quat *r_dest, const godot_vector3 *p_axis, const godot_real p_angle);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_get_x(const godot_quat *p_self);
|
|
||||||
void GDAPI godot_quat_set_x(godot_quat *p_self, const godot_real val);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_get_y(const godot_quat *p_self);
|
|
||||||
void GDAPI godot_quat_set_y(godot_quat *p_self, const godot_real val);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_get_z(const godot_quat *p_self);
|
|
||||||
void GDAPI godot_quat_set_z(godot_quat *p_self, const godot_real val);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_get_w(const godot_quat *p_self);
|
|
||||||
void GDAPI godot_quat_set_w(godot_quat *p_self, const godot_real val);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_quat_as_string(const godot_quat *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_length(const godot_quat *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_length_squared(const godot_quat *p_self);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_normalized(const godot_quat *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_quat_is_normalized(const godot_quat *p_self);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_inverse(const godot_quat *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_quat_dot(const godot_quat *p_self, const godot_quat *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_quat_xform(const godot_quat *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_slerpni(const godot_quat *p_self, const godot_quat *p_b, const godot_real p_t);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_cubic_slerp(const godot_quat *p_self, const godot_quat *p_b, const godot_quat *p_pre_a, const godot_quat *p_post_b, const godot_real p_t);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_operator_multiply(const godot_quat *p_self, const godot_real p_b);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_operator_add(const godot_quat *p_self, const godot_quat *p_b);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_operator_substract(const godot_quat *p_self, const godot_quat *p_b);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_operator_divide(const godot_quat *p_self, const godot_real p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_quat_operator_equal(const godot_quat *p_self, const godot_quat *p_b);
|
|
||||||
|
|
||||||
godot_quat GDAPI godot_quat_operator_neg(const godot_quat *p_self);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_QUAT_H
|
|
||||||
|
|
@ -1,86 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* rect2.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_RECT2_H
|
|
||||||
#define GODOT_RECT2_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "vector2.h"
|
|
||||||
|
|
||||||
void GDAPI godot_rect2_new_with_position_and_size(godot_rect2 *r_dest, const godot_vector2 *p_pos, const godot_vector2 *p_size);
|
|
||||||
void GDAPI godot_rect2_new(godot_rect2 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_width, const godot_real p_height);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_rect2_as_string(const godot_rect2 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_rect2_get_area(const godot_rect2 *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect2_intersects(const godot_rect2 *p_self, const godot_rect2 *p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect2_encloses(const godot_rect2 *p_self, const godot_rect2 *p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect2_has_no_area(const godot_rect2 *p_self);
|
|
||||||
|
|
||||||
godot_rect2 GDAPI godot_rect2_clip(const godot_rect2 *p_self, const godot_rect2 *p_b);
|
|
||||||
|
|
||||||
godot_rect2 GDAPI godot_rect2_merge(const godot_rect2 *p_self, const godot_rect2 *p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect2_has_point(const godot_rect2 *p_self, const godot_vector2 *p_point);
|
|
||||||
|
|
||||||
godot_rect2 GDAPI godot_rect2_grow(const godot_rect2 *p_self, const godot_real p_by);
|
|
||||||
|
|
||||||
godot_rect2 GDAPI godot_rect2_expand(const godot_rect2 *p_self, const godot_vector2 *p_to);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect2_operator_equal(const godot_rect2 *p_self, const godot_rect2 *p_b);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_rect2_get_position(const godot_rect2 *p_self);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_rect2_get_size(const godot_rect2 *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_rect2_set_position(godot_rect2 *p_self, const godot_vector2 *p_pos);
|
|
||||||
|
|
||||||
void GDAPI godot_rect2_set_size(godot_rect2 *p_self, const godot_vector2 *p_size);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_RECT2_H
|
|
||||||
|
|
@ -1,108 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* rect3.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_RECT3_H
|
|
||||||
#define GODOT_RECT3_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "plane.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self);
|
|
||||||
void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self);
|
|
||||||
void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
|
||||||
|
|
||||||
godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
|
||||||
|
|
||||||
godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self);
|
|
||||||
|
|
||||||
godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point);
|
|
||||||
|
|
||||||
godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_RECT3_H
|
|
||||||
|
|
@ -1,64 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* rid.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_RID_H
|
|
||||||
#define GODOT_RID_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define GODOT_RID_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_RID_SIZE];
|
|
||||||
} godot_rid;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gdnative.h"
|
|
||||||
|
|
||||||
void GDAPI godot_rid_new(godot_rid *r_dest);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_rid_get_id(const godot_rid *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_rid_new_with_resource(godot_rid *r_dest, const godot_object *p_from);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rid_operator_equal(const godot_rid *p_self, const godot_rid *p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_rid_operator_less(const godot_rid *p_self, const godot_rid *p_b);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_RID_H
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* string.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_STRING_H
|
|
||||||
#define GODOT_STRING_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <wchar.h>
|
|
||||||
|
|
||||||
#define GODOT_STRING_SIZE 8
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_STRING_SIZE];
|
|
||||||
} godot_string;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "gdnative.h"
|
|
||||||
|
|
||||||
void GDAPI godot_string_new(godot_string *r_dest);
|
|
||||||
void GDAPI godot_string_new_copy(godot_string *r_dest, const godot_string *p_src);
|
|
||||||
void GDAPI godot_string_new_data(godot_string *r_dest, const char *p_contents, const int p_size);
|
|
||||||
void GDAPI godot_string_new_unicode_data(godot_string *r_dest, const wchar_t *p_contents, const int p_size);
|
|
||||||
|
|
||||||
void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *p_size);
|
|
||||||
|
|
||||||
wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
|
|
||||||
const char GDAPI *godot_string_c_str(const godot_string *p_self);
|
|
||||||
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b);
|
|
||||||
godot_bool GDAPI godot_string_operator_less(const godot_string *p_self, const godot_string *p_b);
|
|
||||||
godot_string GDAPI godot_string_operator_plus(const godot_string *p_self, const godot_string *p_b);
|
|
||||||
|
|
||||||
// @Incomplete
|
|
||||||
// hmm, I guess exposing the whole API doesn't make much sense
|
|
||||||
// since the language used in the library has its own string funcs
|
|
||||||
|
|
||||||
void GDAPI godot_string_destroy(godot_string *p_self);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_STRING_H
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* transform.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_TRANSFORM_H
|
|
||||||
#define GODOT_TRANSFORM_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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 "basis.h"
|
|
||||||
#include "gdnative.h"
|
|
||||||
#include "variant.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
void GDAPI godot_transform_new_with_axis_origin(godot_transform *r_dest, const godot_vector3 *p_x_axis, const godot_vector3 *p_y_axis, const godot_vector3 *p_z_axis, const godot_vector3 *p_origin);
|
|
||||||
void GDAPI godot_transform_new(godot_transform *r_dest, const godot_basis *p_basis, const godot_vector3 *p_origin);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_transform_get_basis(const godot_transform *p_self);
|
|
||||||
void GDAPI godot_transform_set_basis(godot_transform *p_self, godot_basis *p_v);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_transform_get_origin(const godot_transform *p_self);
|
|
||||||
void GDAPI godot_transform_set_origin(godot_transform *p_self, godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_transform_as_string(const godot_transform *p_self);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_inverse(const godot_transform *p_self);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_affine_inverse(const godot_transform *p_self);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_orthonormalized(const godot_transform *p_self);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_rotated(const godot_transform *p_self, const godot_vector3 *p_axis, const godot_real p_phi);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_scaled(const godot_transform *p_self, const godot_vector3 *p_scale);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_translated(const godot_transform *p_self, const godot_vector3 *p_ofs);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_looking_at(const godot_transform *p_self, const godot_vector3 *p_target, const godot_vector3 *p_up);
|
|
||||||
|
|
||||||
godot_plane GDAPI godot_transform_xform_plane(const godot_transform *p_self, const godot_plane *p_v);
|
|
||||||
|
|
||||||
godot_plane GDAPI godot_transform_xform_inv_plane(const godot_transform *p_self, const godot_plane *p_v);
|
|
||||||
|
|
||||||
void GDAPI godot_transform_new_identity(godot_transform *r_dest);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_transform_operator_equal(const godot_transform *p_self, const godot_transform *p_b);
|
|
||||||
|
|
||||||
godot_transform GDAPI godot_transform_operator_multiply(const godot_transform *p_self, const godot_transform *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
|
|
||||||
|
|
||||||
godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
|
|
||||||
|
|
||||||
godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_TRANSFORM_H
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* transform2d.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_TRANSFORM2D_H
|
|
||||||
#define GODOT_TRANSFORM2D_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.h"
|
|
||||||
#include "variant.h"
|
|
||||||
#include "vector2.h"
|
|
||||||
|
|
||||||
void GDAPI godot_transform2d_new(godot_transform2d *r_dest, const godot_real p_rot, const godot_vector2 *p_pos);
|
|
||||||
void GDAPI godot_transform2d_new_axis_origin(godot_transform2d *r_dest, const godot_vector2 *p_x_axis, const godot_vector2 *p_y_axis, const godot_vector2 *p_origin);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_transform2d_as_string(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_affine_inverse(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_transform2d_get_rotation(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_transform2d_get_origin(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_transform2d_get_scale(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_orthonormalized(const godot_transform2d *p_self);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_rotated(const godot_transform2d *p_self, const godot_real p_phi);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_scaled(const godot_transform2d *p_self, const godot_vector2 *p_scale);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_translated(const godot_transform2d *p_self, const godot_vector2 *p_offset);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_transform2d_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_transform2d_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_transform2d_basis_xform_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
|
|
||||||
|
|
||||||
godot_vector2 GDAPI godot_transform2d_basis_xform_inv_vector2(const godot_transform2d *p_self, const godot_vector2 *p_v);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_interpolate_with(const godot_transform2d *p_self, const godot_transform2d *p_m, const godot_real p_c);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_transform2d_operator_equal(const godot_transform2d *p_self, const godot_transform2d *p_b);
|
|
||||||
|
|
||||||
godot_transform2d GDAPI godot_transform2d_operator_multiply(const godot_transform2d *p_self, const godot_transform2d *p_b);
|
|
||||||
|
|
||||||
void GDAPI godot_transform2d_new_identity(godot_transform2d *r_dest);
|
|
||||||
|
|
||||||
godot_rect2 GDAPI godot_transform2d_xform_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v);
|
|
||||||
|
|
||||||
godot_rect2 GDAPI godot_transform2d_xform_inv_rect2(const godot_transform2d *p_self, const godot_rect2 *p_v);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_TRANSFORM2D_H
|
|
||||||
|
|
@ -1,201 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* variant.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_VARIANT_H
|
|
||||||
#define GODOT_VARIANT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define GODOT_VARIANT_SIZE 24
|
|
||||||
|
|
||||||
#ifndef GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
|
|
||||||
#define GODOT_CORE_API_GODOT_VARIANT_TYPE_DEFINED
|
|
||||||
typedef struct {
|
|
||||||
uint8_t _dont_touch_that[GODOT_VARIANT_SIZE];
|
|
||||||
} godot_variant;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef enum godot_variant_type {
|
|
||||||
GODOT_VARIANT_TYPE_NIL,
|
|
||||||
|
|
||||||
// atomic types
|
|
||||||
GODOT_VARIANT_TYPE_BOOL,
|
|
||||||
GODOT_VARIANT_TYPE_INT,
|
|
||||||
GODOT_VARIANT_TYPE_REAL,
|
|
||||||
GODOT_VARIANT_TYPE_STRING,
|
|
||||||
|
|
||||||
// math types
|
|
||||||
|
|
||||||
GODOT_VARIANT_TYPE_VECTOR2, // 5
|
|
||||||
GODOT_VARIANT_TYPE_RECT2,
|
|
||||||
GODOT_VARIANT_TYPE_VECTOR3,
|
|
||||||
GODOT_VARIANT_TYPE_TRANSFORM2D,
|
|
||||||
GODOT_VARIANT_TYPE_PLANE,
|
|
||||||
GODOT_VARIANT_TYPE_QUAT, // 10
|
|
||||||
GODOT_VARIANT_TYPE_RECT3,
|
|
||||||
GODOT_VARIANT_TYPE_BASIS,
|
|
||||||
GODOT_VARIANT_TYPE_TRANSFORM,
|
|
||||||
|
|
||||||
// misc types
|
|
||||||
GODOT_VARIANT_TYPE_COLOR,
|
|
||||||
GODOT_VARIANT_TYPE_NODE_PATH, // 15
|
|
||||||
GODOT_VARIANT_TYPE_RID,
|
|
||||||
GODOT_VARIANT_TYPE_OBJECT,
|
|
||||||
GODOT_VARIANT_TYPE_DICTIONARY,
|
|
||||||
GODOT_VARIANT_TYPE_ARRAY, // 20
|
|
||||||
|
|
||||||
// arrays
|
|
||||||
GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY,
|
|
||||||
GODOT_VARIANT_TYPE_POOL_INT_ARRAY,
|
|
||||||
GODOT_VARIANT_TYPE_POOL_REAL_ARRAY,
|
|
||||||
GODOT_VARIANT_TYPE_POOL_STRING_ARRAY,
|
|
||||||
GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY, // 25
|
|
||||||
GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
|
|
||||||
GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
|
|
||||||
} godot_variant_type;
|
|
||||||
|
|
||||||
typedef enum godot_variant_call_error_error {
|
|
||||||
GODOT_CALL_ERROR_CALL_OK,
|
|
||||||
GODOT_CALL_ERROR_CALL_ERROR_INVALID_METHOD,
|
|
||||||
GODOT_CALL_ERROR_CALL_ERROR_INVALID_ARGUMENT,
|
|
||||||
GODOT_CALL_ERROR_CALL_ERROR_TOO_MANY_ARGUMENTS,
|
|
||||||
GODOT_CALL_ERROR_CALL_ERROR_TOO_FEW_ARGUMENTS,
|
|
||||||
GODOT_CALL_ERROR_CALL_ERROR_INSTANCE_IS_NULL,
|
|
||||||
} godot_variant_call_error_error;
|
|
||||||
|
|
||||||
typedef struct godot_variant_call_error {
|
|
||||||
godot_variant_call_error_error error;
|
|
||||||
int argument;
|
|
||||||
godot_variant_type expected;
|
|
||||||
} godot_variant_call_error;
|
|
||||||
|
|
||||||
#include "array.h"
|
|
||||||
#include "basis.h"
|
|
||||||
#include "color.h"
|
|
||||||
#include "dictionary.h"
|
|
||||||
#include "node_path.h"
|
|
||||||
#include "plane.h"
|
|
||||||
#include "pool_arrays.h"
|
|
||||||
#include "quat.h"
|
|
||||||
#include "rect2.h"
|
|
||||||
#include "rect3.h"
|
|
||||||
#include "rid.h"
|
|
||||||
#include "string.h"
|
|
||||||
#include "transform.h"
|
|
||||||
#include "transform2d.h"
|
|
||||||
#include "variant.h"
|
|
||||||
#include "vector2.h"
|
|
||||||
#include "vector3.h"
|
|
||||||
|
|
||||||
#include "gdnative.h"
|
|
||||||
|
|
||||||
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
|
|
||||||
|
|
||||||
void GDAPI godot_variant_new_copy(godot_variant *r_dest, const godot_variant *p_src);
|
|
||||||
|
|
||||||
void GDAPI godot_variant_new_nil(godot_variant *r_dest);
|
|
||||||
|
|
||||||
void GDAPI godot_variant_new_bool(godot_variant *p_v, const godot_bool p_b);
|
|
||||||
void GDAPI godot_variant_new_uint(godot_variant *r_dest, const uint64_t p_i);
|
|
||||||
void GDAPI godot_variant_new_int(godot_variant *r_dest, const int64_t p_i);
|
|
||||||
void GDAPI godot_variant_new_real(godot_variant *r_dest, const double p_r);
|
|
||||||
void GDAPI godot_variant_new_string(godot_variant *r_dest, const godot_string *p_s);
|
|
||||||
void GDAPI godot_variant_new_vector2(godot_variant *r_dest, const godot_vector2 *p_v2);
|
|
||||||
void GDAPI godot_variant_new_rect2(godot_variant *r_dest, const godot_rect2 *p_rect2);
|
|
||||||
void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3 *p_v3);
|
|
||||||
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d);
|
|
||||||
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane);
|
|
||||||
void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
|
|
||||||
void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3);
|
|
||||||
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
|
|
||||||
void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans);
|
|
||||||
void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color);
|
|
||||||
void GDAPI godot_variant_new_node_path(godot_variant *r_dest, const godot_node_path *p_np);
|
|
||||||
void GDAPI godot_variant_new_rid(godot_variant *r_dest, const godot_rid *p_rid);
|
|
||||||
void GDAPI godot_variant_new_object(godot_variant *r_dest, const godot_object *p_obj);
|
|
||||||
void GDAPI godot_variant_new_dictionary(godot_variant *r_dest, const godot_dictionary *p_dict);
|
|
||||||
void GDAPI godot_variant_new_array(godot_variant *r_dest, const godot_array *p_arr);
|
|
||||||
void GDAPI godot_variant_new_pool_byte_array(godot_variant *r_dest, const godot_pool_byte_array *p_pba);
|
|
||||||
void GDAPI godot_variant_new_pool_int_array(godot_variant *r_dest, const godot_pool_int_array *p_pia);
|
|
||||||
void GDAPI godot_variant_new_pool_real_array(godot_variant *r_dest, const godot_pool_real_array *p_pra);
|
|
||||||
void GDAPI godot_variant_new_pool_string_array(godot_variant *r_dest, const godot_pool_string_array *p_psa);
|
|
||||||
void GDAPI godot_variant_new_pool_vector2_array(godot_variant *r_dest, const godot_pool_vector2_array *p_pv2a);
|
|
||||||
void GDAPI godot_variant_new_pool_vector3_array(godot_variant *r_dest, const godot_pool_vector3_array *p_pv3a);
|
|
||||||
void GDAPI godot_variant_new_pool_color_array(godot_variant *r_dest, const godot_pool_color_array *p_pca);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_self);
|
|
||||||
uint64_t GDAPI godot_variant_as_uint(const godot_variant *p_self);
|
|
||||||
int64_t GDAPI godot_variant_as_int(const godot_variant *p_self);
|
|
||||||
double GDAPI godot_variant_as_real(const godot_variant *p_self);
|
|
||||||
godot_string GDAPI godot_variant_as_string(const godot_variant *p_self);
|
|
||||||
godot_vector2 GDAPI godot_variant_as_vector2(const godot_variant *p_self);
|
|
||||||
godot_rect2 GDAPI godot_variant_as_rect2(const godot_variant *p_self);
|
|
||||||
godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self);
|
|
||||||
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self);
|
|
||||||
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
|
|
||||||
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
|
|
||||||
godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self);
|
|
||||||
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
|
|
||||||
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self);
|
|
||||||
godot_color GDAPI godot_variant_as_color(const godot_variant *p_self);
|
|
||||||
godot_node_path GDAPI godot_variant_as_node_path(const godot_variant *p_self);
|
|
||||||
godot_rid GDAPI godot_variant_as_rid(const godot_variant *p_self);
|
|
||||||
godot_object GDAPI *godot_variant_as_object(const godot_variant *p_self);
|
|
||||||
godot_dictionary GDAPI godot_variant_as_dictionary(const godot_variant *p_self);
|
|
||||||
godot_array GDAPI godot_variant_as_array(const godot_variant *p_self);
|
|
||||||
godot_pool_byte_array GDAPI godot_variant_as_pool_byte_array(const godot_variant *p_self);
|
|
||||||
godot_pool_int_array GDAPI godot_variant_as_pool_int_array(const godot_variant *p_self);
|
|
||||||
godot_pool_real_array GDAPI godot_variant_as_pool_real_array(const godot_variant *p_self);
|
|
||||||
godot_pool_string_array GDAPI godot_variant_as_pool_string_array(const godot_variant *p_self);
|
|
||||||
godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_variant *p_self);
|
|
||||||
godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_self);
|
|
||||||
godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_self);
|
|
||||||
|
|
||||||
godot_variant GDAPI godot_variant_call(godot_variant *p_self, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount, godot_variant_call_error *r_error);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_variant_has_method(const godot_variant *p_self, const godot_string *p_method);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_self, const godot_variant *p_other);
|
|
||||||
godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_self, const godot_variant *p_other);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_variant_hash_compare(const godot_variant *p_self, const godot_variant *p_other);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_self, godot_bool *r_valid);
|
|
||||||
|
|
||||||
void GDAPI godot_variant_destroy(godot_variant *p_self);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* vector2.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_VECTOR2_H
|
|
||||||
#define GODOT_VECTOR2_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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.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
|
|
||||||
|
|
@ -1,135 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* vector3.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_VECTOR3_H
|
|
||||||
#define GODOT_VECTOR3_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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 "basis.h"
|
|
||||||
#include "gdnative.h"
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GODOT_VECTOR3_AXIS_X,
|
|
||||||
GODOT_VECTOR3_AXIS_Y,
|
|
||||||
GODOT_VECTOR3_AXIS_Z,
|
|
||||||
} godot_vector3_axis;
|
|
||||||
|
|
||||||
void GDAPI godot_vector3_new(godot_vector3 *r_dest, const godot_real p_x, const godot_real p_y, const godot_real p_z);
|
|
||||||
|
|
||||||
godot_string GDAPI godot_vector3_as_string(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_vector3_min_axis(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_int GDAPI godot_vector3_max_axis(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_length(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_length_squared(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_vector3_is_normalized(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_normalized(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_inverse(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_snapped(const godot_vector3 *p_self, const godot_vector3 *p_by);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_rotated(const godot_vector3 *p_self, const godot_vector3 *p_axis, const godot_real p_phi);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_linear_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_real p_t);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_cubic_interpolate(const godot_vector3 *p_self, const godot_vector3 *p_b, const godot_vector3 *p_pre_a, const godot_vector3 *p_post_b, const godot_real p_t);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_dot(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_cross(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_vector3_outer(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_basis GDAPI godot_vector3_to_diagonal_matrix(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_abs(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_floor(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_ceil(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_distance_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_angle_to(const godot_vector3 *p_self, const godot_vector3 *p_to);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_slide(const godot_vector3 *p_self, const godot_vector3 *p_n);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_bounce(const godot_vector3 *p_self, const godot_vector3 *p_n);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_reflect(const godot_vector3 *p_self, const godot_vector3 *p_n);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_add(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_substract(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_multiply_vector(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_multiply_scalar(const godot_vector3 *p_self, const godot_real p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_divide_vector(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_divide_scalar(const godot_vector3 *p_self, const godot_real p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_vector3_operator_equal(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_bool GDAPI godot_vector3_operator_less(const godot_vector3 *p_self, const godot_vector3 *p_b);
|
|
||||||
|
|
||||||
godot_vector3 GDAPI godot_vector3_operator_neg(const godot_vector3 *p_self);
|
|
||||||
|
|
||||||
void GDAPI godot_vector3_set_axis(godot_vector3 *p_self, const godot_vector3_axis p_axis, const godot_real p_val);
|
|
||||||
|
|
||||||
godot_real GDAPI godot_vector3_get_axis(const godot_vector3 *p_self, const godot_vector3_axis p_axis);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // GODOT_VECTOR3_H
|
|
||||||
|
|
@ -1,228 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* godot.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_NATIVESCRIPT_H
|
|
||||||
#define GODOT_NATIVESCRIPT_H
|
|
||||||
|
|
||||||
#include <godot/gdnative.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GDAPI_BUILT_IN
|
|
||||||
#define GDAPI_EXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#if defined(GDAPI_EXPORT)
|
|
||||||
#define GDCALLINGCONV
|
|
||||||
#define GDAPI __declspec(dllexport) GDCALLINGCONV
|
|
||||||
#else
|
|
||||||
#define GDCALLINGCONV
|
|
||||||
#define GDAPI __declspec(dllimport) GDCALLINGCONV
|
|
||||||
#endif
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#include "TargetConditionals.h"
|
|
||||||
#if TARGET_OS_IPHONE
|
|
||||||
#define GDCALLINGCONV
|
|
||||||
#define GDAPI
|
|
||||||
#elif TARGET_OS_MAC
|
|
||||||
#define GDCALLINGCONV __attribute__((sysv_abi))
|
|
||||||
#define GDAPI GDCALLINGCONV
|
|
||||||
#endif
|
|
||||||
#else
|
|
||||||
#define GDCALLINGCONV __attribute__((sysv_abi))
|
|
||||||
#define GDAPI GDCALLINGCONV
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This is for libraries *using* the header, NOT GODOT EXPOSING STUFF!!
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define GDN_EXPORT __declspec(dllexport)
|
|
||||||
#else
|
|
||||||
#define GDN_EXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <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);
|
|
||||||
godot_object GDAPI *godot_nativescript_new(const char *p_classname);
|
|
||||||
|
|
||||||
void GDAPI *godot_nativescript_get_userdata(godot_object *p_instance);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
--path:"$projectdir"
|
--path:"$projectdir"
|
||||||
--path:"$projectdir/../godotapi"
|
--path:"$projectdir/../godotapi"
|
||||||
--cincludes:"$projectdir/../godot_headers/"
|
|
||||||
--experimental
|
--experimental
|
||||||
--app:lib
|
--app:lib
|
||||||
--stackTrace:on
|
--stackTrace:on
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
author = "Xored Software, Inc."
|
author = "Xored Software, Inc."
|
||||||
description = "FPS Counter Sample"
|
description = "Simple Sample"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
bin = @["simple"]
|
bin = @["simple"]
|
||||||
|
|
||||||
requires "https://github.com/pragmagic/godot-nim.git >= 0.2.3 & < 0.3.0"
|
requires "https://github.com/pragmagic/godot-nim.git >= 0.3.0 & < 0.4.0"
|
||||||
|
|
||||||
task make, "build":
|
task make, "build":
|
||||||
const archPostfix = when sizeof(int) == 8: "_64" else: "_32"
|
const archPostfix = when sizeof(int) == 8: "_64" else: "_32"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
author = "Xored Software, Inc."
|
author = "Xored Software, Inc."
|
||||||
description = "Godot Engine bindings"
|
description = "Godot Engine bindings"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
||||||
|
|
@ -4,28 +4,21 @@ import hashes
|
||||||
import godotbase, poolarray, variant, strings
|
import godotbase, poolarray, variant, strings
|
||||||
|
|
||||||
proc initArray(dest: var Array) {.
|
proc initArray(dest: var Array) {.
|
||||||
importc: "godot_array_new", header: "godot/array.h".}
|
importc: "godot_array_new".}
|
||||||
proc initArray(dest: var Array; pca: PoolColorArray) {.
|
proc initArray(dest: var Array; pca: PoolColorArray) {.
|
||||||
importc: "godot_array_new_pool_coloarray",
|
importc: "godot_array_new_pool_coloarray".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc initArray(dest: var Array; pv3a: PoolVector3Array) {.
|
proc initArray(dest: var Array; pv3a: PoolVector3Array) {.
|
||||||
importc: "godot_array_new_pool_vector3_array",
|
importc: "godot_array_new_pool_vector3_array".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc initArray(dest: var Array; pv2a: PoolVector2Array) {.
|
proc initArray(dest: var Array; pv2a: PoolVector2Array) {.
|
||||||
importc: "godot_array_new_pool_vector2_array",
|
importc: "godot_array_new_pool_vector2_array".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc initArray(dest: var Array; psa: PoolStringArray) {.
|
proc initArray(dest: var Array; psa: PoolStringArray) {.
|
||||||
importc: "godot_array_new_pool_string_array",
|
importc: "godot_array_new_pool_string_array".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc initArray(dest: var Array; pra: PoolRealArray) {.
|
proc initArray(dest: var Array; pra: PoolRealArray) {.
|
||||||
importc: "godot_array_new_pool_real_array",
|
importc: "godot_array_new_pool_real_array".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc initArray(dest: var Array; pia: PoolIntArray) {.
|
proc initArray(dest: var Array; pia: PoolIntArray) {.
|
||||||
importc: "godot_array_new_pool_int_array",
|
importc: "godot_array_new_pool_int_array".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc initArray(dest: var Array; pba: PoolByteArray) {.
|
proc initArray(dest: var Array; pba: PoolByteArray) {.
|
||||||
importc: "godot_array_new_pool_byte_array",
|
importc: "godot_array_new_pool_byte_array".}
|
||||||
header: "godot/array.h".}
|
|
||||||
|
|
||||||
proc initArray*(): Array {.inline.} =
|
proc initArray*(): Array {.inline.} =
|
||||||
initArray(result)
|
initArray(result)
|
||||||
|
|
@ -54,79 +47,76 @@ proc initArray*(pba: PoolByteArray): Array {.inline.} =
|
||||||
proc `[]=`*(self: var Array; idx: cint;
|
proc `[]=`*(self: var Array; idx: cint;
|
||||||
value: Variant) {.
|
value: Variant) {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_set", header: "godot/array.h".}
|
importc: "godot_array_set".}
|
||||||
proc `[]`*(self: Array; idx: cint): Variant {.
|
proc `[]`*(self: Array; idx: cint): Variant {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_get", header: "godot/array.h".}
|
importc: "godot_array_get".}
|
||||||
proc mget*(self: var Array; idx: cint): ptr Variant {.
|
proc mget*(self: var Array; idx: cint): ptr Variant {.
|
||||||
importc: "godot_array_operator_index", header: "godot/array.h".}
|
importc: "godot_array_operator_index".}
|
||||||
|
|
||||||
proc add*(self: var Array; value: Variant) {.
|
proc add*(self: var Array; value: Variant) {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_append", header: "godot/array.h".}
|
importc: "godot_array_append".}
|
||||||
proc clear*(self: var Array) {.importc: "godot_array_clear",
|
proc clear*(self: var Array) {.importc: "godot_array_clear".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc count*(self: Array; value: Variant): cint {.
|
proc count*(self: Array; value: Variant): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_count", header: "godot/array.h".}
|
importc: "godot_array_count".}
|
||||||
proc isEmpty*(self: Array): bool {.
|
proc isEmpty*(self: Array): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_empty", header: "godot/array.h".}
|
importc: "godot_array_empty".}
|
||||||
proc erase*(self: var Array; value: Variant) {.
|
proc erase*(self: var Array; value: Variant) {.
|
||||||
importc: "godot_array_erase", header: "godot/array.h".}
|
importc: "godot_array_erase".}
|
||||||
proc first*(self: Array): Variant {.
|
proc first*(self: Array): Variant {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_front", header: "godot/array.h".}
|
importc: "godot_array_front".}
|
||||||
proc last*(self: Array): Variant {.
|
proc last*(self: Array): Variant {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_back", header: "godot/array.h".}
|
importc: "godot_array_back".}
|
||||||
proc find*(self: Array; what: Variant;
|
proc find*(self: Array; what: Variant;
|
||||||
f: cint): cint {.
|
f: cint): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_find", header: "godot/array.h".}
|
importc: "godot_array_find".}
|
||||||
proc findLast*(self: Array; what: Variant): cint {.
|
proc findLast*(self: Array; what: Variant): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_find_last", header: "godot/array.h".}
|
importc: "godot_array_find_last".}
|
||||||
proc contains*(self: Array; value: Variant): bool {.
|
proc contains*(self: Array; value: Variant): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_has", header: "godot/array.h".}
|
importc: "godot_array_has".}
|
||||||
|
|
||||||
proc godotHash*(self: Array): cint {.
|
proc godotHash*(self: Array): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_hash", header: "godot/array.h".}
|
importc: "godot_array_hash".}
|
||||||
proc hash*(self: Array): Hash {.inline.} =
|
proc hash*(self: Array): Hash {.inline.} =
|
||||||
hash(godotHash(self))
|
hash(godotHash(self))
|
||||||
|
|
||||||
proc insert*(self: var Array; pos: cint;
|
proc insert*(self: var Array; pos: cint;
|
||||||
value: Variant) {.
|
value: Variant) {.
|
||||||
importc: "godot_array_insert", header: "godot/array.h".}
|
importc: "godot_array_insert".}
|
||||||
proc reverse*(self: var Array) {.importc: "godot_array_invert",
|
proc reverse*(self: var Array) {.importc: "godot_array_invert".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc popLast*(self: var Array): Variant {.
|
proc popLast*(self: var Array): Variant {.
|
||||||
importc: "godot_array_pop_back", header: "godot/array.h".}
|
importc: "godot_array_pop_back".}
|
||||||
proc popFirst*(self: var Array): Variant {.
|
proc popFirst*(self: var Array): Variant {.
|
||||||
importc: "godot_array_pop_front", header: "godot/array.h".}
|
importc: "godot_array_pop_front".}
|
||||||
proc addLast*(self: var Array; value: Variant) {.
|
proc addLast*(self: var Array; value: Variant) {.
|
||||||
importc: "godot_array_push_back", header: "godot/array.h".}
|
importc: "godot_array_push_back".}
|
||||||
proc addFirst*(self: var Array; value: Variant) {.
|
proc addFirst*(self: var Array; value: Variant) {.
|
||||||
importc: "godot_array_push_front", header: "godot/array.h".}
|
importc: "godot_array_push_front".}
|
||||||
|
|
||||||
proc delete*(self: var Array; idx: cint) {.
|
proc delete*(self: var Array; idx: cint) {.
|
||||||
importc: "godot_array_remove", header: "godot/array.h".}
|
importc: "godot_array_remove".}
|
||||||
proc setLen*(self: var Array; size: cint) {.
|
proc setLen*(self: var Array; size: cint) {.
|
||||||
importc: "godot_array_resize", header: "godot/array.h".}
|
importc: "godot_array_resize".}
|
||||||
proc rfind*(self: Array; what: Variant;
|
proc rfind*(self: Array; what: Variant;
|
||||||
f: cint): cint {.
|
f: cint): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_rfind", header: "godot/array.h".}
|
importc: "godot_array_rfind".}
|
||||||
proc len*(self: Array): cint {.
|
proc len*(self: Array): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_array_size", header: "godot/array.h".}
|
importc: "godot_array_size".}
|
||||||
proc sort*(self: var Array) {.importc: "godot_array_sort",
|
proc sort*(self: var Array) {.importc: "godot_array_sort".}
|
||||||
header: "godot/array.h".}
|
|
||||||
proc sortCustom*(self: var Array; obj: var GodotObject;
|
proc sortCustom*(self: var Array; obj: var GodotObject;
|
||||||
funcName: GodotString) {.
|
funcName: GodotString) {.
|
||||||
importc: "godot_array_sort_custom", header: "godot/array.h".}
|
importc: "godot_array_sort_custom".}
|
||||||
|
|
||||||
iterator items*(arr: Array): Variant =
|
iterator items*(arr: Array): Variant =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
|
||||||
|
|
@ -1,140 +1,454 @@
|
||||||
# Copyright (c) 2017 Xored Software, Inc.
|
# Copyright (c) 2017 Xored Software, Inc.
|
||||||
|
|
||||||
|
import math
|
||||||
import godotbase, vector3, quat, strings
|
import godotbase, vector3, quat, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Basis* {.importc: "godot_basis", header: "godot/basis.h", byref.} = object
|
Basis* {.byref.} = object
|
||||||
|
elements*: array[3, Vector3]
|
||||||
|
|
||||||
proc initBasis(dest: var Basis) {.importc: "godot_basis_new",
|
proc setCells*(basis: var Basis, xx, xy, xz, yx, yy, yz, zx, zy, zz: float32) =
|
||||||
header: "godot/basis.h".}
|
basis.elements[0].x = xx
|
||||||
proc initBasis(dest: var Basis;
|
basis.elements[0].y = xy
|
||||||
xAxis: Vector3;
|
basis.elements[0].z = xz
|
||||||
yAxis: Vector3;
|
basis.elements[1].x = yx
|
||||||
zAxis: Vector3) {.
|
basis.elements[1].y = yy
|
||||||
importc: "godot_basis_new_with_rows", header: "godot/basis.h".}
|
basis.elements[1].z = yz
|
||||||
proc initBasis(dest: var Basis;
|
basis.elements[2].x = zx
|
||||||
euler: Quat) {.
|
basis.elements[2].y = zy
|
||||||
importc: "godot_basis_new_with_euler_quat", header: "godot/basis.h".}
|
basis.elements[2].z = zz
|
||||||
proc initBasis(dest: var Basis; axis: Vector3; phi: float32) {.
|
|
||||||
importc: "godot_basis_new_with_axis_and_angle", header: "godot/basis.h".}
|
proc `[]`*(self: Basis; row: range[0..2]): Vector3 {.inline.} =
|
||||||
proc initBasis(dest: var Basis; euler: Vector3) {.
|
self.elements[row]
|
||||||
importc: "godot_basis_new_with_euler", header: "godot/basis.h".}
|
|
||||||
|
proc `[]`*(self: var Basis; row: range[0..2]): var Vector3 {.inline.} =
|
||||||
|
self.elements[row]
|
||||||
|
|
||||||
|
proc `[]=`*(self: var Basis; row: range[0..2];
|
||||||
|
value: Vector3) {.inline.} =
|
||||||
|
self.elements[row] = value
|
||||||
|
|
||||||
|
proc `==`*(self, other: Basis): bool =
|
||||||
|
for i in 0..2:
|
||||||
|
for j in 0..2:
|
||||||
|
if self[i][j] != other[i][j]:
|
||||||
|
return false
|
||||||
|
result = true
|
||||||
|
|
||||||
|
proc isEqualApprox*(self, other: Basis): bool =
|
||||||
|
for i in 0..2:
|
||||||
|
for j in 0..2:
|
||||||
|
if not self[i][j].isEqualApprox(other[i][j]):
|
||||||
|
return false
|
||||||
|
result = true
|
||||||
|
|
||||||
|
proc tdotx*(self: Basis; v: Vector3): float32 {.inline.} =
|
||||||
|
self.elements[0].x * v.x + self.elements[1].x * v.y + self.elements[2].x * v.z
|
||||||
|
|
||||||
|
proc tdoty*(self: Basis; v: Vector3): float32 {.inline.} =
|
||||||
|
self.elements[0].y * v.x + self.elements[1].y * v.y + self.elements[2].y * v.z
|
||||||
|
|
||||||
|
proc tdotz*(self: Basis; v: Vector3): float32 {.inline.} =
|
||||||
|
self.elements[0].z * v.x + self.elements[1].z * v.y + self.elements[2].z * v.z
|
||||||
|
|
||||||
|
proc `+`*(self, other: Basis): Basis {.inline.} =
|
||||||
|
result[0] = self[0] + other[0]
|
||||||
|
result[1] = self[1] + other[1]
|
||||||
|
result[2] = self[2] + other[2]
|
||||||
|
|
||||||
|
proc `+=`*(self: var Basis, other: Basis) {.inline.} =
|
||||||
|
self[0] += other[0]
|
||||||
|
self[1] += other[1]
|
||||||
|
self[2] += other[2]
|
||||||
|
|
||||||
|
proc `-`*(self, other: Basis): Basis {.inline.} =
|
||||||
|
result[0] = self[0] - other[0]
|
||||||
|
result[1] = self[1] - other[1]
|
||||||
|
result[2] = self[2] - other[2]
|
||||||
|
|
||||||
|
proc `-=`*(self: var Basis, other: Basis) {.inline.} =
|
||||||
|
self[0] -= other[0]
|
||||||
|
self[1] -= other[1]
|
||||||
|
self[2] -= other[2]
|
||||||
|
|
||||||
|
proc `*`*(self, other: Basis): Basis {.inline.} =
|
||||||
|
result.setCells(
|
||||||
|
other.tdotx(self[0]), other.tdoty(self[0]), other.tdotz(self[0]),
|
||||||
|
other.tdotx(self[1]), other.tdoty(self[1]), other.tdotz(self[1]),
|
||||||
|
other.tdotx(self[2]), other.tdoty(self[2]), other.tdotz(self[2])
|
||||||
|
)
|
||||||
|
|
||||||
|
proc `*=`*(self: var Basis, other: Basis) {.inline.} =
|
||||||
|
self.setCells(
|
||||||
|
other.tdotx(self[0]), other.tdoty(self[0]), other.tdotz(self[0]),
|
||||||
|
other.tdotx(self[1]), other.tdoty(self[1]), other.tdotz(self[1]),
|
||||||
|
other.tdotx(self[2]), other.tdoty(self[2]), other.tdotz(self[2])
|
||||||
|
)
|
||||||
|
|
||||||
|
proc `*=`*(self: var Basis; b: float32) {.inline.} =
|
||||||
|
self[0] *= b
|
||||||
|
self[1] *= b
|
||||||
|
self[2] *= b
|
||||||
|
|
||||||
|
proc `*`*(self: Basis; b: float32): Basis {.inline.} =
|
||||||
|
result = self
|
||||||
|
result *= b
|
||||||
|
|
||||||
proc initBasis*(): Basis {.inline.} =
|
proc initBasis*(): Basis {.inline.} =
|
||||||
initBasis(result)
|
result.setCells(
|
||||||
|
1, 0, 0,
|
||||||
|
0, 1, 0,
|
||||||
|
0, 0, 1
|
||||||
|
)
|
||||||
|
|
||||||
proc initBasis*(xAxis, yAxis, zAxis: Vector3): Basis {.inline.} =
|
proc initBasis*(row0, row1, row2: Vector3): Basis {.inline.} =
|
||||||
initBasis(result, xAxis, yAxis, zAxis)
|
Basis(elements: [row0, row1, row2])
|
||||||
|
|
||||||
|
proc initBasis*(xx, xy, xz, yx, yy, yz, zx, zy, zz: float32): Basis =
|
||||||
|
result.setCells(xx, xy, xz, yx, yy, yz, zx, zy, zz)
|
||||||
|
|
||||||
proc initBasis*(euler: Quat): Basis {.inline.} =
|
proc initBasis*(euler: Quat): Basis {.inline.} =
|
||||||
initBasis(result, euler)
|
let d = euler.lengthSquared()
|
||||||
|
let s = 2.0 / d
|
||||||
|
let xs = euler.x * s
|
||||||
|
let ys = euler.y * s
|
||||||
|
let zs = euler.z * s
|
||||||
|
let wx = euler.w * xs
|
||||||
|
let wy = euler.w * ys
|
||||||
|
let wz = euler.w * zs
|
||||||
|
let xx = euler.x * xs
|
||||||
|
let xy = euler.x * ys
|
||||||
|
let xz = euler.x * zs
|
||||||
|
let yy = euler.y * ys
|
||||||
|
let yz = euler.y * zs
|
||||||
|
let zz = euler.z * zs
|
||||||
|
result.setCells(
|
||||||
|
1.0 - (yy + zz), xy - wz, xz + wy,
|
||||||
|
xy + wz, 1.0 - (xx + zz), yz - wx,
|
||||||
|
xz - wy, yz + wx, 1.0 - (xx + yy))
|
||||||
|
|
||||||
|
proc setAxisAngle(self: var Basis, axis: Vector3, phi: float32) =
|
||||||
|
assert(axis.isNormalized())
|
||||||
|
let axisSq = vec3(axis.x * axis.x, axis.y * axis.y, axis.z * axis.z)
|
||||||
|
|
||||||
|
let cosine = cos(phi);
|
||||||
|
let sine = sin(phi);
|
||||||
|
|
||||||
|
self.elements[0].x = axisSq.x + cosine * (1.0 - axisSq.x)
|
||||||
|
self.elements[0].y = axis.x * axis.y * (1.0 - cosine) - axis.z * sine
|
||||||
|
self.elements[0].z = axis.z * axis.x * (1.0 - cosine) + axis.y * sine
|
||||||
|
|
||||||
|
self.elements[1].x = axis.x * axis.y * (1.0 - cosine) + axis.z * sine
|
||||||
|
self.elements[1].y = axisSq.y + cosine * (1.0 - axisSq.y)
|
||||||
|
self.elements[1].z = axis.y * axis.z * (1.0 - cosine) - axis.x * sine
|
||||||
|
|
||||||
|
self.elements[2].x = axis.z * axis.x * (1.0 - cosine) - axis.y * sine
|
||||||
|
self.elements[2].y = axis.y * axis.z * (1.0 - cosine) + axis.x * sine
|
||||||
|
self.elements[2].z = axisSq.z + cosine * (1.0 - axisSq.z)
|
||||||
|
|
||||||
proc initBasis*(axis: Vector3, phi: float32): Basis {.inline.} =
|
proc initBasis*(axis: Vector3, phi: float32): Basis {.inline.} =
|
||||||
initBasis(result, axis, phi)
|
result.setAxisAngle(axis, phi)
|
||||||
|
|
||||||
|
proc setEuler*(self: var Basis, euler: Vector3) =
|
||||||
|
var c = cos(euler.x)
|
||||||
|
var s = sin(euler.x)
|
||||||
|
|
||||||
|
let xmat = initBasis(1.0, 0.0, 0.0, 0.0, c, -s, 0.0, s, c)
|
||||||
|
|
||||||
|
c = cos(euler.y)
|
||||||
|
s = sin(euler.y)
|
||||||
|
let ymat = initBasis(c, 0.0, s, 0.0, 1.0, 0.0, -s, 0.0, c)
|
||||||
|
|
||||||
|
c = cos(euler.z)
|
||||||
|
s = sin(euler.z)
|
||||||
|
let zmat = initBasis(c, -s, 0.0, s, c, 0.0, 0.0, 0.0, 1.0)
|
||||||
|
|
||||||
|
self = xmat * (ymat * zmat)
|
||||||
|
|
||||||
|
proc getEuler*(self: Basis): Vector3 =
|
||||||
|
result.y = arcsin(self.elements[0].z)
|
||||||
|
if result.y < PI * 0.5:
|
||||||
|
if result.y > -PI * 0.5:
|
||||||
|
result.x = arctan2(-self.elements[1].z, self.elements[2].z)
|
||||||
|
result.z = arctan2(-self.elements[0].y, self.elements[0].x)
|
||||||
|
else:
|
||||||
|
let r = arctan2(self.elements[1].x, self.elements[1].y)
|
||||||
|
result.x = -r
|
||||||
|
else:
|
||||||
|
let r = arctan2(self.elements[0].y, self.elements[1].y)
|
||||||
|
result.x = r
|
||||||
|
|
||||||
proc initBasis*(euler: Vector3): Basis {.inline.} =
|
proc initBasis*(euler: Vector3): Basis {.inline.} =
|
||||||
initBasis(result, euler)
|
result.setEuler(euler)
|
||||||
|
|
||||||
proc toGodotString*(self: Basis): GodotString {.
|
proc outer*(self, other: Vector3): Basis {.inline.} =
|
||||||
noSideEffect,
|
let row0 = vec3(self.x * other.x, self.x * other.y, self.x * other.z)
|
||||||
importc: "godot_basis_as_string", header: "godot/basis.h".}
|
let row1 = vec3(self.y * other.x, self.y * other.y, self.y * other.z)
|
||||||
|
let row2 = vec3(self.z * other.x, self.z * other.y, self.z * other.z)
|
||||||
|
initBasis(row0, row1, row2)
|
||||||
|
|
||||||
|
proc toDiagonalMatrix*(self: Vector3): Basis {.inline.} =
|
||||||
|
initBasis(
|
||||||
|
self.x, 0, 0,
|
||||||
|
0, self.y, 0,
|
||||||
|
0, 0, self.z
|
||||||
|
)
|
||||||
|
|
||||||
proc `$`*(self: Basis): string {.inline.} =
|
proc `$`*(self: Basis): string {.inline.} =
|
||||||
$self.toGodotString()
|
result = newStringOfCap(128)
|
||||||
|
for i in 0..2:
|
||||||
|
for j in 0..2:
|
||||||
|
if i != 0 or j != 0:
|
||||||
|
result.add(", ")
|
||||||
|
result.add($self[i][j])
|
||||||
|
|
||||||
proc inverse*(self: Basis): Basis {.
|
template cofac(row1, col1, row2, col2: int): float32 =
|
||||||
noSideEffect,
|
self.elements[row1][col1] * self.elements[row2][col2] -
|
||||||
importc: "godot_basis_inverse", header: "godot/basis.h".}
|
self.elements[row1][col2] * self.elements[row2][col1]
|
||||||
proc transposed*(self: Basis): Basis {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_transposed", header: "godot/basis.h".}
|
|
||||||
proc orthonormalized*(self: Basis): Basis {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_orthonormalized", header: "godot/basis.h".}
|
|
||||||
proc determinant*(self: Basis): float32 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_determinant", header: "godot/basis.h".}
|
|
||||||
proc rotated*(self: Basis; axis: Vector3;
|
|
||||||
phi: float32): Basis {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_rotated", header: "godot/basis.h".}
|
|
||||||
proc scaled*(self: Basis; scale: Vector3): Basis {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_scaled", header: "godot/basis.h".}
|
|
||||||
|
|
||||||
proc setScale*(self: var Basis; scale: Vector3) {.
|
proc determinant(self: Basis): float32 {.inline.} =
|
||||||
noSideEffect,
|
self[0][0] * cofac(1, 1, 2, 2) -
|
||||||
importc: "godot_basis_set_scale", header: "godot/basis.h".}
|
self[1][0] * cofac(0, 1, 2, 2) +
|
||||||
proc setRotationEuler*(self: var Basis;
|
self[2][0] * cofac(0, 1, 1, 2)
|
||||||
euler: Vector3) {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_set_rotation_euler", header: "godot/basis.h".}
|
|
||||||
proc setRotationAxisAngle*(self: var Basis; axis: Vector3; angle: float32) {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_set_rotation_axis_angle", header: "godot/basis.h".}
|
|
||||||
|
|
||||||
proc scale*(self: Basis): Vector3 {.
|
proc invert*(self: var Basis) =
|
||||||
noSideEffect,
|
let co = [cofac(1, 1, 2, 2), cofac(1, 2, 2, 0), cofac(1, 0, 2, 1)]
|
||||||
importc: "godot_basis_get_scale", header: "godot/basis.h".}
|
let det = self.elements[0][0] * co[0] +
|
||||||
proc euler*(self: Basis): Vector3 {.
|
self.elements[0][1] * co[1] +
|
||||||
noSideEffect,
|
self.elements[0][2] * co[2]
|
||||||
importc: "godot_basis_get_euler", header: "godot/basis.h".}
|
assert(det != 0)
|
||||||
|
let s = 1.0'f32 / det
|
||||||
|
self.setCells(
|
||||||
|
co[0] * s, cofac(0, 2, 2, 1) * s, cofac(0, 1, 1, 2) * s,
|
||||||
|
co[1] * s, cofac(0, 0, 2, 2) * s, cofac(0, 2, 1, 0) * s,
|
||||||
|
co[2] * s, cofac(0, 1, 2, 0) * s, cofac(0, 0, 1, 1) * s
|
||||||
|
)
|
||||||
|
|
||||||
proc tdotx*(self: Basis; x: Vector3): float32 {.
|
proc inverse*(self: Basis): Basis {.inline.} =
|
||||||
noSideEffect,
|
result = self
|
||||||
importc: "godot_basis_tdotx", header: "godot/basis.h".}
|
result.invert()
|
||||||
proc tdoty*(self: Basis; y: Vector3): float32 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_tdoty", header: "godot/basis.h".}
|
|
||||||
proc tdotz*(self: Basis; z: Vector3): float32 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_tdotz", header: "godot/basis.h".}
|
|
||||||
|
|
||||||
proc xform*(self: Basis; v: Vector3): Vector3 {.
|
proc axis*(self: Basis; idx: range[0..2]): Vector3 {.inline.} =
|
||||||
noSideEffect,
|
vec3(self[0][idx], self[1][idx], self[2][idx])
|
||||||
importc: "godot_basis_xform", header: "godot/basis.h".}
|
|
||||||
proc xformInv*(self: Basis; v: Vector3): Vector3 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_xform_inv", header: "godot/basis.h".}
|
|
||||||
|
|
||||||
proc orthogonalIndex*(self: Basis): cint {.
|
proc setAxis*(self: var Basis; idx: range[0..2]; value: Vector3) {.inline.} =
|
||||||
noSideEffect,
|
self.elements[0][idx] = value.x
|
||||||
importc: "godot_basis_get_orthogonal_index", header: "godot/basis.h".}
|
self.elements[1][idx] = value.y
|
||||||
|
self.elements[2][idx] = value.z
|
||||||
|
|
||||||
proc godot_basis_get_elements(self: Basis;
|
proc row*(self: Basis; row: range[0..2]): Vector3 {.inline.} =
|
||||||
elements: var array[3, Vector3]) {.
|
self.elements[row]
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_get_elements", header: "godot/basis.h".}
|
|
||||||
|
|
||||||
proc elements*(self: Basis): array[3, Vector3] {.inline.} =
|
proc setRow*(self: var Basis; row: range[0..2]; value: Vector3) {.inline.} =
|
||||||
godot_basis_get_elements(self, result)
|
self.elements[row] = value
|
||||||
|
|
||||||
proc `[]`*(self: Basis; axis: range[0..2]): Vector3 {.
|
proc getMainDiagonal*(self: Basis): Vector3 {.inline.} =
|
||||||
noSideEffect,
|
vec3(self.elements[0][0], self.elements[1][1], self.elements[2][2])
|
||||||
importc: "godot_basis_get_axis", header: "godot/basis.h".}
|
|
||||||
proc `[]=`*(self: var Basis; axis: range[0..2];
|
proc zero*(self: var Basis) {.inline.} =
|
||||||
value: Vector3) {.
|
self.elements[0].zero()
|
||||||
noSideEffect,
|
self.elements[1].zero()
|
||||||
importc: "godot_basis_set_axis", header: "godot/basis.h".}
|
self.elements[2].zero()
|
||||||
proc row*(self: Basis; row: cint): Vector3 {.
|
|
||||||
noSideEffect,
|
proc orthonormalize(self: var Basis) =
|
||||||
importc: "godot_basis_get_row", header: "godot/basis.h".}
|
var x = self.axis(0)
|
||||||
proc setRow*(self: var Basis; row: cint;
|
var y = self.axis(1)
|
||||||
value: Vector3) {.
|
var z = self.axis(2)
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_set_row", header: "godot/basis.h".}
|
x.normalize()
|
||||||
proc `==`*(self: Basis; b: Basis): bool {.
|
y = y - x * x.dot(y)
|
||||||
noSideEffect,
|
y.normalize()
|
||||||
importc: "godot_basis_operator_equal", header: "godot/basis.h".}
|
z = z - x * x.dot(z) - y * y.dot(z)
|
||||||
proc `+`*(self: Basis; b: Basis): Basis {.
|
z.normalize()
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_basis_operator_add", header: "godot/basis.h".}
|
self.setAxis(0, x)
|
||||||
proc `-`*(self: Basis; b: Basis): Basis {.
|
self.setAxis(1, y)
|
||||||
noSideEffect,
|
self.setAxis(2, z)
|
||||||
importc: "godot_basis_operator_substract", header: "godot/basis.h".}
|
|
||||||
proc `*`*(self: Basis; b: Basis): Basis {.
|
proc orthonormalized*(self: Basis): Basis {.inline.} =
|
||||||
noSideEffect,
|
result = self
|
||||||
importc: "godot_basis_operator_multiply_vector", header: "godot/basis.h".}
|
result.orthonormalize()
|
||||||
proc `*`*(self: Basis; b: float32): Basis {.
|
|
||||||
noSideEffect,
|
proc transpose*(self: var Basis) {.inline.} =
|
||||||
importc: "godot_basis_operator_multiply_scalar", header: "godot/basis.h".}
|
swap(self.elements[0].x, self.elements[1].x)
|
||||||
|
swap(self.elements[0].z, self.elements[2].x)
|
||||||
|
swap(self.elements[1].z, self.elements[2].y)
|
||||||
|
|
||||||
|
proc transposed*(self: Basis): Basis {.inline.} =
|
||||||
|
result = self
|
||||||
|
result.transpose()
|
||||||
|
|
||||||
|
proc isOrthogonal*(self: Basis): bool {.inline.} =
|
||||||
|
let id = initBasis()
|
||||||
|
let m = self * self.transposed()
|
||||||
|
result = id.isEqualApprox(m)
|
||||||
|
|
||||||
|
proc isRotation*(self: Basis): bool {.inline.} =
|
||||||
|
self.determinant().isEqualApprox(1.0) and self.isOrthogonal()
|
||||||
|
|
||||||
|
proc isSymmetric*(self: Basis): bool {.inline.} =
|
||||||
|
if not self.elements[0][1].isEqualApprox(self.elements[1][0]):
|
||||||
|
return false
|
||||||
|
if not self.elements[0][2].isEqualApprox(self.elements[2][0]):
|
||||||
|
return false
|
||||||
|
if not self.elements[1][2].isEqualApprox(self.elements[2][1]):
|
||||||
|
return false
|
||||||
|
result = true
|
||||||
|
|
||||||
|
proc scale*(self: var Basis, scale: Vector3) =
|
||||||
|
self[0].x *= scale.x
|
||||||
|
self[0].y *= scale.x
|
||||||
|
self[0].z *= scale.x
|
||||||
|
self[1].x *= scale.y
|
||||||
|
self[1].y *= scale.y
|
||||||
|
self[1].z *= scale.y
|
||||||
|
self[2].x *= scale.z
|
||||||
|
self[2].y *= scale.z
|
||||||
|
self[2].z *= scale.z
|
||||||
|
|
||||||
|
proc scaled*(self: Basis, scale: Vector3): Basis =
|
||||||
|
result = self
|
||||||
|
result.scale(scale)
|
||||||
|
|
||||||
|
proc rotated*(self: Basis; axis: Vector3; phi: float32): Basis {.inline.} =
|
||||||
|
initBasis(axis, phi) * self
|
||||||
|
|
||||||
|
proc rotate*(self: var Basis; axis: Vector3; phi: float32) {.inline.} =
|
||||||
|
self = self.rotated(axis, phi)
|
||||||
|
|
||||||
|
proc rotated*(self: Basis; euler: Vector3): Basis {.inline.} =
|
||||||
|
initBasis(euler) * self
|
||||||
|
|
||||||
|
proc rotate*(self: var Basis; euler: Vector3) {.inline.} =
|
||||||
|
self = self.rotated(euler)
|
||||||
|
|
||||||
|
proc getScale*(self: Basis): Vector3 =
|
||||||
|
let detSign = if self.determinant() > 0: 1'f32 else: -1'f32
|
||||||
|
result = detSign * vec3(
|
||||||
|
vec3(self.elements[0].x, self.elements[1].x, self.elements[2].x).length(),
|
||||||
|
vec3(self.elements[0].y, self.elements[1].y, self.elements[2].y).length(),
|
||||||
|
vec3(self.elements[0].z, self.elements[1].z, self.elements[2].z).length(),
|
||||||
|
)
|
||||||
|
|
||||||
|
proc getRotation*(self: Basis): Vector3 {.inline.} =
|
||||||
|
var m = self.orthonormalized()
|
||||||
|
let det = m.determinant()
|
||||||
|
if det < 0:
|
||||||
|
m.scale(vec3(-1, -1, -1))
|
||||||
|
result = m.getEuler()
|
||||||
|
|
||||||
|
proc setScale*(self: var Basis; scale: Vector3) =
|
||||||
|
let e = self.getEuler()
|
||||||
|
self = initBasis() # reset to identity
|
||||||
|
self.scale(scale)
|
||||||
|
self.rotate(e)
|
||||||
|
|
||||||
|
proc setRotationEuler*(self: var Basis; euler: Vector3) =
|
||||||
|
let s = self.getScale()
|
||||||
|
self = initBasis()
|
||||||
|
self.scale(s)
|
||||||
|
self.rotate(euler)
|
||||||
|
|
||||||
|
proc setRotationAxisAngle*(self: var Basis; axis: Vector3; angle: float32) =
|
||||||
|
let s = self.getScale()
|
||||||
|
self = initBasis()
|
||||||
|
self.scale(s)
|
||||||
|
self.rotate(axis, angle)
|
||||||
|
|
||||||
|
proc asQuat*(self: Basis): Quat =
|
||||||
|
let trace = self.elements[0].x + self.elements[1].y + self.elements[2].z
|
||||||
|
var temp: array[4, float32]
|
||||||
|
if trace > 0'f32:
|
||||||
|
var s = sqrt(trace + 1.0)
|
||||||
|
temp[3] = s * 0.5
|
||||||
|
s = 0.5 / s
|
||||||
|
|
||||||
|
temp[0] = (self.elements[2].y - self.elements[1].z) * s
|
||||||
|
temp[1] = (self.elements[0].z - self.elements[2].x) * s
|
||||||
|
temp[2] = (self.elements[1].x - self.elements[0].y) * s
|
||||||
|
else:
|
||||||
|
let i = if self.elements[0].x < self.elements[1].y:
|
||||||
|
if self.elements[1].y < self.elements[2].z: 2 else: 1
|
||||||
|
else:
|
||||||
|
if self.elements[0].x < self.elements[2].z: 2 else: 0
|
||||||
|
let j = (i + 1) mod 3
|
||||||
|
let k = (i + 2) mod 3
|
||||||
|
|
||||||
|
var s = sqrt(self.elements[i][i] - self.elements[j][j] -
|
||||||
|
self.elements[k][k] + 1.0)
|
||||||
|
temp[i] = s * 0.5
|
||||||
|
s = 0.5 / s
|
||||||
|
|
||||||
|
temp[3] = (self.elements[k][j] - self.elements[j][k]) * s
|
||||||
|
temp[j] = (self.elements[j][i] + self.elements[i][j]) * s
|
||||||
|
temp[k] = (self.elements[k][i] + self.elements[i][k]) * s
|
||||||
|
|
||||||
|
result = initQuat(temp[0], temp[1], temp[2], temp[3])
|
||||||
|
|
||||||
|
proc xform*(self: Basis; v: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(
|
||||||
|
self.elements[0].dot(v),
|
||||||
|
self.elements[1].dot(v),
|
||||||
|
self.elements[2].dot(v)
|
||||||
|
)
|
||||||
|
|
||||||
|
proc xformInv*(self: Basis; v: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(
|
||||||
|
self.elements[0].x * v.x + self.elements[1].x * v.y + self.elements[2].x * v.z,
|
||||||
|
self.elements[0].y * v.x + self.elements[1].y * v.y + self.elements[2].y * v.z,
|
||||||
|
self.elements[0].z * v.x + self.elements[1].z * v.y + self.elements[2].z * v.z,
|
||||||
|
)
|
||||||
|
|
||||||
|
const orthoBases = [
|
||||||
|
initBasis(1, 0, 0, 0, 1, 0, 0, 0, 1),
|
||||||
|
initBasis(0, -1, 0, 1, 0, 0, 0, 0, 1),
|
||||||
|
initBasis(-1, 0, 0, 0, -1, 0, 0, 0, 1),
|
||||||
|
initBasis(0, 1, 0, -1, 0, 0, 0, 0, 1),
|
||||||
|
initBasis(1, 0, 0, 0, 0, -1, 0, 1, 0),
|
||||||
|
initBasis(0, 0, 1, 1, 0, 0, 0, 1, 0),
|
||||||
|
initBasis(-1, 0, 0, 0, 0, 1, 0, 1, 0),
|
||||||
|
initBasis(0, 0, -1, -1, 0, 0, 0, 1, 0),
|
||||||
|
initBasis(1, 0, 0, 0, -1, 0, 0, 0, -1),
|
||||||
|
initBasis(0, 1, 0, 1, 0, 0, 0, 0, -1),
|
||||||
|
initBasis(-1, 0, 0, 0, 1, 0, 0, 0, -1),
|
||||||
|
initBasis(0, -1, 0, -1, 0, 0, 0, 0, -1),
|
||||||
|
initBasis(1, 0, 0, 0, 0, 1, 0, -1, 0),
|
||||||
|
initBasis(0, 0, -1, 1, 0, 0, 0, -1, 0),
|
||||||
|
initBasis(-1, 0, 0, 0, 0, -1, 0, -1, 0),
|
||||||
|
initBasis(0, 0, 1, -1, 0, 0, 0, -1, 0),
|
||||||
|
initBasis(0, 0, 1, 0, 1, 0, -1, 0, 0),
|
||||||
|
initBasis(0, -1, 0, 0, 0, 1, -1, 0, 0),
|
||||||
|
initBasis(0, 0, -1, 0, -1, 0, -1, 0, 0),
|
||||||
|
initBasis(0, 1, 0, 0, 0, -1, -1, 0, 0),
|
||||||
|
initBasis(0, 0, 1, 0, -1, 0, 1, 0, 0),
|
||||||
|
initBasis(0, 1, 0, 0, 0, 1, 1, 0, 0),
|
||||||
|
initBasis(0, 0, -1, 0, 1, 0, 1, 0, 0),
|
||||||
|
initBasis(0, -1, 0, 0, 0, -1, 1, 0, 0)
|
||||||
|
]
|
||||||
|
|
||||||
|
proc orthogonalIndex*(self: Basis): int =
|
||||||
|
var orth = self
|
||||||
|
for i in 0..2:
|
||||||
|
for j in 0..2:
|
||||||
|
var v = orth[i][j]
|
||||||
|
if v > 0.5:
|
||||||
|
v = 1.0'f32
|
||||||
|
elif v < -0.5:
|
||||||
|
v = -1.0'f32
|
||||||
|
else:
|
||||||
|
v = 0'f32
|
||||||
|
orth[i][j] = v
|
||||||
|
|
||||||
|
for idx, base in orthoBases:
|
||||||
|
if base == orth:
|
||||||
|
return idx
|
||||||
|
|
||||||
|
proc setOrthogonalIndex*(self: var Basis, idx: range[0..23]) =
|
||||||
|
self = orthoBases[idx]
|
||||||
|
|
||||||
|
proc rotate*(self: var Vector3; axis: Vector3; phi: float32) =
|
||||||
|
self = initBasis(axis, phi).xform(self)
|
||||||
|
|
||||||
|
proc rotated*(self: Vector3; axis: Vector3; phi: float32): Vector3 =
|
||||||
|
result = self
|
||||||
|
result.rotate(axis, phi)
|
||||||
|
|
|
||||||
|
|
@ -3,74 +3,69 @@
|
||||||
import godotbase, strings
|
import godotbase, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Color* {.importc: "godot_color", header: "godot/color.h", byref.} = object
|
Color* {.byref.} = object
|
||||||
|
r: float32
|
||||||
|
g: float32
|
||||||
|
b: float32
|
||||||
|
a: float32
|
||||||
|
|
||||||
proc initColor(dest: var Color; r, g, b, a: float32) {.
|
proc initColor*(r, g, b: float32; a: float32 = 1.0'f32): Color {.inline.} =
|
||||||
importc: "godot_color_new_rgba", header: "godot/color.h".}
|
Color(
|
||||||
proc initColor(dest: var Color; r, g, b: float32) {.
|
r: r,
|
||||||
importc: "godot_color_new_rgb",
|
g: g,
|
||||||
header: "godot/color.h".}
|
b: b,
|
||||||
|
a: a
|
||||||
|
)
|
||||||
|
|
||||||
proc initColor*(r, g, b, a: float32): Color {.inline.} =
|
proc initColor*(): Color {.inline.} =
|
||||||
initColor(result, r, g, b, a)
|
## Initializes black color with 1.0 alpha
|
||||||
|
initColor(0, 0, 0)
|
||||||
proc initColor*(r, g, b: float32): Color {.inline.} =
|
|
||||||
initColor(result, r, g, b)
|
|
||||||
|
|
||||||
proc r*(self: Color): float32 {.
|
|
||||||
importc: "godot_color_get_r", header: "godot/color.h".}
|
|
||||||
proc `r=`*(self: var Color; r: float32) {.
|
|
||||||
importc: "godot_color_set_r", header: "godot/color.h".}
|
|
||||||
proc g*(self: Color): float32 {.
|
|
||||||
importc: "godot_color_get_g", header: "godot/color.h".}
|
|
||||||
proc `g=`*(self: var Color; g: float32) {.
|
|
||||||
importc: "godot_color_set_g", header: "godot/color.h".}
|
|
||||||
proc b*(self: Color): float32 {.
|
|
||||||
importc: "godot_color_get_b", header: "godot/color.h".}
|
|
||||||
proc `b=`*(self: var Color; b: float32) {.
|
|
||||||
importc: "godot_color_set_b", header: "godot/color.h".}
|
|
||||||
proc a*(self: Color): float32 {.
|
|
||||||
importc: "godot_color_get_a", header: "godot/color.h".}
|
|
||||||
proc `a=`*(self: var Color; a: float32) {.
|
|
||||||
importc: "godot_color_set_a", header: "godot/color.h".}
|
|
||||||
|
|
||||||
proc h*(self: Color): float32 {.
|
proc h*(self: Color): float32 {.
|
||||||
importc: "godot_color_get_h", header: "godot/color.h".}
|
importc: "godot_color_get_h".}
|
||||||
proc s*(self: Color): float32 {.
|
proc s*(self: Color): float32 {.
|
||||||
importc: "godot_color_get_s", header: "godot/color.h".}
|
importc: "godot_color_get_s".}
|
||||||
proc v*(self: Color): float32 {.
|
proc v*(self: Color): float32 {.
|
||||||
importc: "godot_color_get_v", header: "godot/color.h".}
|
importc: "godot_color_get_v".}
|
||||||
|
|
||||||
proc toGodotString*(self: Color): GodotString {.
|
|
||||||
importc: "godot_color_as_string", header: "godot/color.h".}
|
|
||||||
proc `$`*(self: Color): string {.inline.} =
|
proc `$`*(self: Color): string {.inline.} =
|
||||||
$self.toGodotString()
|
result = newStringOfCap(50)
|
||||||
|
result.add($self.r)
|
||||||
|
result.add(", ")
|
||||||
|
result.add($self.g)
|
||||||
|
result.add(", ")
|
||||||
|
result.add($self.b)
|
||||||
|
result.add(", ")
|
||||||
|
result.add($self.a)
|
||||||
|
|
||||||
proc toHtml*(self: Color; with_alpha: bool): GodotString {.
|
proc toHtml*(self: Color; with_alpha: bool): GodotString {.
|
||||||
importc: "godot_color_to_html", header: "godot/color.h".}
|
importc: "godot_color_to_html".}
|
||||||
|
|
||||||
proc to32CInt(self: Color): cint {.
|
proc toARGB32*(self: Color): uint32 =
|
||||||
importc: "godot_color_to_32", header: "godot/color.h".}
|
result = uint8(self.a * 255)
|
||||||
proc toARGB32CInt(self: Color): cint {.
|
result = (result shl 8) or uint8(self.r * 255)
|
||||||
importc: "godot_color_to_ARGB32", header: "godot/color.h".}
|
result = (result shl 8) or uint8(self.g * 255)
|
||||||
|
result = (result shl 8) or uint8(self.b * 255)
|
||||||
proc to32*(self: Color): uint32 {.inline.}=
|
|
||||||
cast[uint32](to32CInt(self))
|
|
||||||
proc toARGB32*(self: Color): uint32 {.inline.} =
|
|
||||||
cast[uint32](toARGB32CInt(self))
|
|
||||||
|
|
||||||
proc gray*(self: Color): float32 {.
|
proc gray*(self: Color): float32 {.
|
||||||
importc: "godot_color_gray", header: "godot/color.h".}
|
importc: "godot_color_gray".}
|
||||||
proc inverted*(self: Color): Color {.
|
proc inverted*(self: Color): Color {.
|
||||||
importc: "godot_color_inverted", header: "godot/color.h".}
|
importc: "godot_color_inverted".}
|
||||||
proc contrasted*(self: Color): Color {.
|
proc contrasted*(self: Color): Color {.
|
||||||
importc: "godot_color_contrasted", header: "godot/color.h".}
|
importc: "godot_color_contrasted".}
|
||||||
proc lerp*(self: Color; b: Color; t: float32): Color {.
|
proc lerp*(self: Color; b: Color; t: float32): Color {.
|
||||||
importc: "godot_color_linear_interpolate", header: "godot/color.h".}
|
importc: "godot_color_linear_interpolate".}
|
||||||
proc blend*(self: Color; over: Color): Color {.
|
proc blend*(self: Color; over: Color): Color {.
|
||||||
importc: "godot_color_blend", header: "godot/color.h".}
|
importc: "godot_color_blend".}
|
||||||
|
|
||||||
proc `==`*(self, b: Color): bool {.
|
proc `==`*(a, b: Color): bool =
|
||||||
importc: "godot_color_operator_equal", header: "godot/color.h".}
|
a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a
|
||||||
proc `<`*(self, b: Color): bool {.
|
|
||||||
importc: "godot_color_operator_less", header: "godot/color.h".}
|
proc `<`*(a, b: Color): bool =
|
||||||
|
if a.r == b.r:
|
||||||
|
if a.g == b.g:
|
||||||
|
if a.b == b.b:
|
||||||
|
return a.a < b.a
|
||||||
|
return a.b < b.b
|
||||||
|
return a.g < b.g
|
||||||
|
return a.r < b.r
|
||||||
|
|
|
||||||
|
|
@ -4,26 +4,24 @@ import hashes
|
||||||
import godotbase, arrays, variant, strings
|
import godotbase, arrays, variant, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Dictionary* {.importc: "godot_dictionary",
|
Dictionary* {.byref.} = object
|
||||||
header: "godot/dictionary.h", byref.} = object
|
p: pointer
|
||||||
|
|
||||||
proc initVariant(dest: var Variant; dict: Dictionary) {.
|
proc initVariant(dest: var Variant; dict: Dictionary) {.
|
||||||
importc: "godot_variant_new_dictionary",
|
importc: "godot_variant_new_dictionary".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
|
|
||||||
proc variant*(dict: Dictionary): Variant {.inline.} =
|
proc variant*(dict: Dictionary): Variant {.inline.} =
|
||||||
initVariant(result, dict)
|
initVariant(result, dict)
|
||||||
|
|
||||||
proc asDictionary*(self: Variant): Dictionary {.
|
proc asDictionary*(self: Variant): Dictionary {.
|
||||||
importc: "godot_variant_as_dictionary", header: "godot/variant.h".}
|
importc: "godot_variant_as_dictionary".}
|
||||||
|
|
||||||
proc initDictionary(dest: var Dictionary;
|
proc initDictionary(dest: var Dictionary;
|
||||||
src: Dictionary) {.
|
src: Dictionary) {.
|
||||||
importc: "godot_dictionary_new_copy",
|
importc: "godot_dictionary_new_copy".}
|
||||||
header: "godot/dictionary.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var Dictionary) {.
|
proc deinit(self: var Dictionary) {.
|
||||||
importc: "godot_dictionary_destroy", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_destroy".}
|
||||||
|
|
||||||
proc `=`(self: var Dictionary, other: Dictionary) {.inline.} =
|
proc `=`(self: var Dictionary, other: Dictionary) {.inline.} =
|
||||||
initDictionary(self, other)
|
initDictionary(self, other)
|
||||||
|
|
@ -32,54 +30,49 @@ proc `=destroy`(self: Dictionary) {.inline.} =
|
||||||
unsafeAddr(self)[].deinit()
|
unsafeAddr(self)[].deinit()
|
||||||
|
|
||||||
proc initDictionary(dest: var Dictionary) {.
|
proc initDictionary(dest: var Dictionary) {.
|
||||||
importc: "godot_dictionary_new", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_new".}
|
||||||
proc initDictionary*(): Dictionary {.inline.} =
|
proc initDictionary*(): Dictionary {.inline.} =
|
||||||
initDictionary(result)
|
initDictionary(result)
|
||||||
|
|
||||||
proc len*(self: Dictionary): cint {.
|
proc len*(self: Dictionary): cint {.
|
||||||
importc: "godot_dictionary_size", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_size".}
|
||||||
proc isEmpty*(self: Dictionary): bool {.
|
proc isEmpty*(self: Dictionary): bool {.
|
||||||
importc: "godot_dictionary_empty", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_empty".}
|
||||||
proc clear*(self: var Dictionary) {.
|
proc clear*(self: var Dictionary) {.
|
||||||
importc: "godot_dictionary_clear", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_clear".}
|
||||||
proc contains*(self: Dictionary; key: Variant): bool {.
|
proc contains*(self: Dictionary; key: Variant): bool {.
|
||||||
importc: "godot_dictionary_has",
|
importc: "godot_dictionary_has".}
|
||||||
header: "godot/dictionary.h".}
|
|
||||||
proc contains*(self: Dictionary; keys: Array): bool {.
|
proc contains*(self: Dictionary; keys: Array): bool {.
|
||||||
importc: "godot_dictionary_has_all",
|
importc: "godot_dictionary_has_all".}
|
||||||
header: "godot/dictionary.h".}
|
|
||||||
proc del*(self: var Dictionary; key: Variant) {.
|
proc del*(self: var Dictionary; key: Variant) {.
|
||||||
importc: "godot_dictionary_erase", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_erase".}
|
||||||
|
|
||||||
proc godotHash*(self: Dictionary): cint {.
|
proc godotHash*(self: Dictionary): cint {.
|
||||||
importc: "godot_dictionary_hash", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_hash".}
|
||||||
proc hash*(self: Dictionary): Hash {.inline.} =
|
proc hash*(self: Dictionary): Hash {.inline.} =
|
||||||
hash(godotHash(self))
|
hash(godotHash(self))
|
||||||
|
|
||||||
proc keys*(self: Dictionary): Array {.
|
proc keys*(self: Dictionary): Array {.
|
||||||
importc: "godot_dictionary_keys", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_keys".}
|
||||||
proc values*(self: Dictionary): Array {.
|
proc values*(self: Dictionary): Array {.
|
||||||
importc: "godot_dictionary_values", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_values".}
|
||||||
proc `[]`*(self: Dictionary; key: Variant): Variant {.
|
proc `[]`*(self: Dictionary; key: Variant): Variant {.
|
||||||
importc: "godot_dictionary_get", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_get".}
|
||||||
|
|
||||||
proc `[]`*(self: Dictionary; keyStr: string): Variant =
|
proc `[]`*(self: Dictionary; keyStr: string): Variant =
|
||||||
let key = variant(keyStr)
|
let key = variant(keyStr)
|
||||||
result = self[key]
|
result = self[key]
|
||||||
|
|
||||||
proc `[]=`*(self: var Dictionary; key, value: Variant) {.
|
proc `[]=`*(self: var Dictionary; key, value: Variant) {.
|
||||||
importc: "godot_dictionary_set",
|
importc: "godot_dictionary_set".}
|
||||||
header: "godot/dictionary.h".}
|
|
||||||
proc mget*(self: var Dictionary; key: Variant): ptr Variant {.
|
proc mget*(self: var Dictionary; key: Variant): ptr Variant {.
|
||||||
importc: "godot_dictionary_operator_index",
|
importc: "godot_dictionary_operator_index".}
|
||||||
header: "godot/dictionary.h".}
|
|
||||||
|
|
||||||
proc `==`*(self, other: Dictionary): bool {.
|
proc `==`*(self, other: Dictionary): bool {.
|
||||||
importc: "godot_dictionary_operator_equal",
|
importc: "godot_dictionary_operator_equal".}
|
||||||
header: "godot/dictionary.h".}
|
|
||||||
|
|
||||||
proc toJson*(self: Dictionary): GodotString {.
|
proc toJson*(self: Dictionary): GodotString {.
|
||||||
importc: "godot_dictionary_to_json", header: "godot/dictionary.h".}
|
importc: "godot_dictionary_to_json".}
|
||||||
|
|
||||||
iterator keys*(dict: Dictionary): Variant =
|
iterator keys*(dict: Dictionary): Variant =
|
||||||
let keyArr = dict.keys()
|
let keyArr = dict.keys()
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
# Copyright (c) 2017 Xored Software, Inc.
|
# Copyright (c) 2017 Xored Software, Inc.
|
||||||
|
|
||||||
|
import math
|
||||||
|
|
||||||
type
|
type
|
||||||
Error* {.importc: "godot_error", header: "godot/gdnative.h",
|
Error* {.size: sizeof(cint), pure.} = enum
|
||||||
size: sizeof(cint), pure.} = enum
|
|
||||||
OK,
|
OK,
|
||||||
Failed, ## Generic fail error
|
Failed, ## Generic fail error
|
||||||
Unavailable, ## What is requested is unsupported/unavailable
|
Unavailable, ## What is requested is unsupported/unavailable
|
||||||
|
|
@ -59,17 +60,16 @@ type
|
||||||
const MAX_ARG_COUNT* = 128
|
const MAX_ARG_COUNT* = 128
|
||||||
|
|
||||||
type
|
type
|
||||||
GodotObject* {.importc: "godot_object", header: "godot/gdnative.h".} = object
|
GodotObject* = object
|
||||||
Array* {.importc: "godot_array", header: "godot/array.h", byref.} = object
|
Array* {.byref.} = object
|
||||||
Variant* {.importc: "godot_variant",
|
p: pointer
|
||||||
header: "godot/variant.h", byref.} = object
|
Variant* {.byref.} = object
|
||||||
|
data: array[24, byte]
|
||||||
|
|
||||||
proc initArray(dest: var Array, src: Array) {.
|
proc initArray(dest: var Array, src: Array) {.
|
||||||
importc: "godot_array_new_copy",
|
importc: "godot_array_new_copy".}
|
||||||
header: "godot/array.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var Array) {.importc: "godot_array_destroy",
|
proc deinit(self: var Array) {.importc: "godot_array_destroy".}
|
||||||
header: "godot/array.h".}
|
|
||||||
|
|
||||||
proc `=`(self: var Array, other: Array) {.inline.} =
|
proc `=`(self: var Array, other: Array) {.inline.} =
|
||||||
initArray(self, other)
|
initArray(self, other)
|
||||||
|
|
@ -78,10 +78,10 @@ proc `=destroy`(self: Array) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
proc initVariant(dest: var Variant; src: Variant) {.
|
proc initVariant(dest: var Variant; src: Variant) {.
|
||||||
importc: "godot_variant_new_copy", header: "godot/variant.h".}
|
importc: "godot_variant_new_copy".}
|
||||||
|
|
||||||
proc deinit*(self: var Variant) {.
|
proc deinit*(self: var Variant) {.
|
||||||
importc: "godot_variant_destroy", header: "godot/variant.h".}
|
importc: "godot_variant_destroy".}
|
||||||
|
|
||||||
proc `=`(self: var Variant, other: Variant) {.inline.} =
|
proc `=`(self: var Variant, other: Variant) {.inline.} =
|
||||||
initVariant(self, other)
|
initVariant(self, other)
|
||||||
|
|
@ -92,16 +92,61 @@ proc `=destroy`(self: Variant) {.inline.} =
|
||||||
# System Functions
|
# System Functions
|
||||||
|
|
||||||
proc godotAlloc*(bytes: cint): pointer {.
|
proc godotAlloc*(bytes: cint): pointer {.
|
||||||
importc: "godot_alloc", header: "godot/gdnative.h".}
|
importc: "godot_alloc".}
|
||||||
## Allocates the specified number of bytes.
|
## Allocates the specified number of bytes.
|
||||||
## Using this instead of stdlib proc will help Godot track how much memory
|
## Using this instead of stdlib proc will help Godot track how much memory
|
||||||
## is in use in debug mode.
|
## is in use in debug mode.
|
||||||
proc godotRealloc*(p: pointer; bytes: cint): pointer {.
|
proc godotRealloc*(p: pointer; bytes: cint): pointer {.
|
||||||
importc: "godot_realloc", header: "godot/gdnative.h".}
|
importc: "godot_realloc".}
|
||||||
## Reallocates the pointer for the specified number of bytes.
|
## Reallocates the pointer for the specified number of bytes.
|
||||||
## Using this instead of stdlib proc will help Godot track how much memory
|
## Using this instead of stdlib proc will help Godot track how much memory
|
||||||
## is in use in debug mode.
|
## is in use in debug mode.
|
||||||
proc godotFree*(p: pointer) {.importc: "godot_free", header: "godot/gdnative.h".}
|
proc godotFree*(p: pointer) {.importc: "godot_free".}
|
||||||
## Frees the memory pointed to by the pointer.
|
## Frees the memory pointed to by the pointer.
|
||||||
## Using this instead of stdlib proc will help Godot track how much memory
|
## Using this instead of stdlib proc will help Godot track how much memory
|
||||||
## is in use in debug mode.
|
## is in use in debug mode.
|
||||||
|
|
||||||
|
# print using Godot's error handler list
|
||||||
|
|
||||||
|
proc godotPrintError(description: cstring; function: cstring; file: cstring;
|
||||||
|
line: cint) {.
|
||||||
|
importc: "godot_print_error".}
|
||||||
|
|
||||||
|
proc godotPrintWarning(description: cstring; function: cstring;
|
||||||
|
file: cstring; line: cint) {.
|
||||||
|
importc: "godot_print_warning".}
|
||||||
|
|
||||||
|
template printWarning*(warn: typed) =
|
||||||
|
let (filename, line) = instantiationInfo()
|
||||||
|
godotPrintWarning(cstring($warn), nil, cstring(filename), line.cint)
|
||||||
|
|
||||||
|
template printError*(err: typed) =
|
||||||
|
let (filename, line) = instantiationInfo()
|
||||||
|
godotPrintError(cstring($err), nil, cstring(filename), line.cint)
|
||||||
|
|
||||||
|
# math helpers
|
||||||
|
|
||||||
|
const EPSILON = 0.00001'f32
|
||||||
|
proc isEqualApprox*(a, b: float32): bool {.inline.} =
|
||||||
|
abs(a - b) < EPSILON
|
||||||
|
|
||||||
|
proc isEqualApprox*(a, b: float64): bool {.inline.} =
|
||||||
|
abs(a - b) < EPSILON
|
||||||
|
|
||||||
|
proc sign*(a: float32): float32 {.inline.} =
|
||||||
|
if a < 0: -1.0'f32 else: 1.0'f32
|
||||||
|
|
||||||
|
proc sign*(a: float64): float64 {.inline.} =
|
||||||
|
if a < 0: -1.0'f64 else: 1.0'f64
|
||||||
|
|
||||||
|
proc stepify*(value, step: float64): float64 =
|
||||||
|
if step != 0'f64:
|
||||||
|
floor(value / step + 0.5'f64) * step
|
||||||
|
else:
|
||||||
|
value
|
||||||
|
|
||||||
|
proc stepify*(value, step: float32): float32 =
|
||||||
|
if step != 0'f32:
|
||||||
|
floor(value / step + 0.5'f32) * step
|
||||||
|
else:
|
||||||
|
value
|
||||||
|
|
|
||||||
|
|
@ -11,53 +11,44 @@ export godotbase, strings, vector2, rect2, vector3, transform2d, plane, quat,
|
||||||
|
|
||||||
# MethodBind API
|
# MethodBind API
|
||||||
|
|
||||||
type
|
type GodotMethodBind* = object
|
||||||
GodotMethodBind* {.importc: "godot_method_bind",
|
|
||||||
header: "godot/gdnative.h".} = object
|
|
||||||
|
|
||||||
proc getMethod*(className: cstring; methodName: cstring): ptr GodotMethodBind {.
|
proc getMethod*(className: cstring; methodName: cstring): ptr GodotMethodBind {.
|
||||||
importc: "godot_method_bind_get_method", header: "godot/gdnative.h".}
|
importc: "godot_method_bind_get_method".}
|
||||||
proc ptrCall*(methodBind: ptr GodotMethodBind;
|
proc ptrCall*(methodBind: ptr GodotMethodBind;
|
||||||
instance: ptr GodotObject;
|
instance: ptr GodotObject;
|
||||||
args: ptr array[MAX_ARG_COUNT, pointer];
|
args: ptr array[MAX_ARG_COUNT, pointer];
|
||||||
ret: pointer) {.
|
ret: pointer) {.
|
||||||
importc: "godot_method_bind_ptrcall", header: "godot/gdnative.h".}
|
importc: "godot_method_bind_ptrcall".}
|
||||||
proc call*(methodBind: ptr GodotMethodBind;
|
proc call*(methodBind: ptr GodotMethodBind;
|
||||||
instance: ptr GodotObject;
|
instance: ptr GodotObject;
|
||||||
args: var ptr array[MAX_ARG_COUNT, Variant]; argCount: cint;
|
args: var ptr array[MAX_ARG_COUNT, Variant]; argCount: cint;
|
||||||
callError: var VariantCallError): Variant {.
|
callError: var VariantCallError): Variant {.
|
||||||
importc: "godot_method_bind_call", header: "godot/gdnative.h".}
|
importc: "godot_method_bind_call".}
|
||||||
|
|
||||||
# Script API
|
# Script API
|
||||||
|
|
||||||
type
|
type
|
||||||
GodotNativeInitOptions* {.importc: "godot_gdnative_init_options",
|
GodotNativeInitOptions* = object
|
||||||
header: "godot/gdnative.h".} = object
|
inEditor*: bool
|
||||||
inEditor* {.importc: "in_editor".}: bool
|
coreApiHash*: uint64
|
||||||
coreApiHash* {.importc: "core_api_hash".}: uint64
|
editorApiHash*: uint64
|
||||||
editorApiHash* {.importc: "editor_api_hash".}: uint64
|
noApiHash*: uint64
|
||||||
noApiHash* {.importc: "no_api_hash".}: uint64
|
|
||||||
|
|
||||||
GodotNativeTerminateOptions* {.importc: "godot_gdnative_terminate_options",
|
GodotNativeTerminateOptions* = object
|
||||||
header: "godot/gdnative.h".} = object
|
inEditor*: bool
|
||||||
inEditor* {.importc: "in_editor".}: bool
|
|
||||||
|
|
||||||
GodotMethodRPCMode* {.importc: "godot_method_rpc_mode",
|
GodotMethodRPCMode* {.size: sizeof(cint), pure.} = enum
|
||||||
header: "godot_nativescript.h",
|
|
||||||
size: sizeof(cint), pure.} = enum
|
|
||||||
Disabled,
|
Disabled,
|
||||||
Remote,
|
Remote,
|
||||||
Sync,
|
Sync,
|
||||||
Master,
|
Master,
|
||||||
Slave
|
Slave
|
||||||
|
|
||||||
GodotMethodAttributes* {.importc: "godot_method_attributes",
|
GodotMethodAttributes* = object
|
||||||
header: "godot_nativescript.h".} = object
|
rpcMode*: GodotMethodRPCMode
|
||||||
rpcMode* {.importc: "rpc_type".}: GodotMethodRPCMode
|
|
||||||
|
|
||||||
GodotPropertyHint* {.importc: "godot_property_hint",
|
GodotPropertyHint* {.size: sizeof(cint), pure.} = enum
|
||||||
header: "godot_nativescript.h",
|
|
||||||
size: sizeof(cint), pure.} = enum
|
|
||||||
None, ## no hint provided.
|
None, ## no hint provided.
|
||||||
Range, ## hint_text = "min,max,step,slider; // slider is optional"
|
Range, ## hint_text = "min,max,step,slider; // slider is optional"
|
||||||
ExpRange, ## hint_text = "min,max,step", exponential edit
|
ExpRange, ## hint_text = "min,max,step", exponential edit
|
||||||
|
|
@ -126,9 +117,7 @@ const
|
||||||
GODOT_PROPERTY_USAGE_STORAGE_VALUE or GODOT_PROPERTY_USAGE_NETWORK_VALUE
|
GODOT_PROPERTY_USAGE_STORAGE_VALUE or GODOT_PROPERTY_USAGE_NETWORK_VALUE
|
||||||
|
|
||||||
type
|
type
|
||||||
GodotPropertyUsageFlags* {.importc: "godot_property_usage_flags",
|
GodotPropertyUsageFlags* {.size: sizeof(cint), pure.} = enum
|
||||||
header: "godot_nativescript.h", size: sizeof(cint),
|
|
||||||
pure.} = enum
|
|
||||||
Storage = GODOT_PROPERTY_USAGE_STORAGE_VALUE
|
Storage = GODOT_PROPERTY_USAGE_STORAGE_VALUE
|
||||||
Editor = GODOT_PROPERTY_USAGE_EDITOR_VALUE
|
Editor = GODOT_PROPERTY_USAGE_EDITOR_VALUE
|
||||||
Network = GODOT_PROPERTY_USAGE_NETWORK_VALUE
|
Network = GODOT_PROPERTY_USAGE_NETWORK_VALUE
|
||||||
|
|
@ -156,143 +145,98 @@ type
|
||||||
AnimateAsTrigger = GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER_VALUE
|
AnimateAsTrigger = GODOT_PROPERTY_USAGE_ANIMATE_AS_TRIGGER_VALUE
|
||||||
UpdateAllIfModified = GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED_VALUE
|
UpdateAllIfModified = GODOT_PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED_VALUE
|
||||||
|
|
||||||
GodotPropertyAttributes* {.importc: "godot_property_attributes",
|
GodotPropertyAttributes* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
rsetType*: GodotMethodRPCMode
|
||||||
rsetType* {.importc: "rset_type".}: GodotMethodRPCMode
|
typ*: cint
|
||||||
typ* {.importc: "type".}: cint
|
hint*: GodotPropertyHint
|
||||||
hint* {.importc: "hint".}: GodotPropertyHint
|
hintString*: GodotString
|
||||||
hintString* {.importc: "hint_string".}: GodotString
|
usage*: GodotPropertyUsageFlags
|
||||||
usage* {.importc: "usage".}: GodotPropertyUsageFlags
|
defaultValue*: Variant
|
||||||
defaultValue* {.importc: "default_value".}: Variant
|
|
||||||
|
|
||||||
GodotInstanceCreateFunc* {.importc: "godot_instance_create_func",
|
GodotInstanceCreateFunc* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
createFunc*:
|
||||||
createFunc* {.importc: "create_func".}:
|
|
||||||
proc (obj: ptr GodotObject; methodData: pointer): pointer {.noconv.}
|
proc (obj: ptr GodotObject; methodData: pointer): pointer {.noconv.}
|
||||||
## returns user data
|
## returns user data
|
||||||
methodData* {.importc: "method_data".}: pointer
|
methodData*: pointer
|
||||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
freeFunc*: proc (a2: pointer) {.noconv.}
|
||||||
|
|
||||||
GodotInstanceDestroyFunc* {.importc: "godot_instance_destroy_func",
|
GodotInstanceDestroyFunc* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
destroyFunc*:
|
||||||
destroyFunc* {.importc: "destroy_func".}:
|
|
||||||
proc (obj: ptr GodotObject; methodData: pointer;
|
proc (obj: ptr GodotObject; methodData: pointer;
|
||||||
userData: pointer) {.noconv.}
|
userData: pointer) {.noconv.}
|
||||||
methodData* {.importc: "method_data".}: pointer
|
methodData*: pointer
|
||||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
freeFunc*: proc (a2: pointer) {.noconv.}
|
||||||
|
|
||||||
proc godotScriptRegisterClass*(libHandle: pointer; name, base: cstring;
|
proc godotScriptRegisterClass*(libHandle: pointer; name, base: cstring;
|
||||||
create_func: GodotInstanceCreateFunc;
|
create_func: GodotInstanceCreateFunc;
|
||||||
destroy_func: GodotInstanceDestroyFunc) {.
|
destroy_func: GodotInstanceDestroyFunc) {.
|
||||||
importc: "godot_nativescript_register_class",
|
importc: "godot_nativescript_register_class".}
|
||||||
header: "godot_nativescript.h".}
|
|
||||||
proc godotScriptRegisterToolClass*(libHandle: pointer; name, base: cstring;
|
proc godotScriptRegisterToolClass*(libHandle: pointer; name, base: cstring;
|
||||||
createFunc: GodotInstanceCreateFunc;
|
createFunc: GodotInstanceCreateFunc;
|
||||||
destroyFunc: GodotInstanceDestroyFunc) {.
|
destroyFunc: GodotInstanceDestroyFunc) {.
|
||||||
importc: "godot_nativescript_register_tool_class",
|
importc: "godot_nativescript_register_tool_class".}
|
||||||
header: "godot_nativescript.h".}
|
|
||||||
type
|
type
|
||||||
GodotInstanceMethod* {.importc: "godot_instance_method",
|
GodotInstanceMethod* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
meth*:
|
||||||
meth* {.importc: "method".}:
|
|
||||||
proc (obj: ptr GodotObject; methodData: pointer;
|
proc (obj: ptr GodotObject; methodData: pointer;
|
||||||
userData: pointer; numArgs: cint;
|
userData: pointer; numArgs: cint;
|
||||||
args: var ptr array[MAX_ARG_COUNT, Variant]): Variant {.noconv.}
|
args: var ptr array[MAX_ARG_COUNT, Variant]): Variant {.noconv.}
|
||||||
methodData* {.importc: "method_data".}: pointer
|
methodData*: pointer
|
||||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
freeFunc*: proc (a2: pointer) {.noconv.}
|
||||||
|
|
||||||
proc godotScriptRegisterMethod*(libHandle: pointer;
|
proc godotScriptRegisterMethod*(libHandle: pointer;
|
||||||
name: cstring; function_name: cstring;
|
name: cstring; function_name: cstring;
|
||||||
attr: GodotMethodAttributes;
|
attr: GodotMethodAttributes;
|
||||||
meth: GodotInstanceMethod) {.
|
meth: GodotInstanceMethod) {.
|
||||||
importc: "godot_nativescript_register_method",
|
importc: "godot_nativescript_register_method".}
|
||||||
header: "godot_nativescript.h".}
|
|
||||||
type
|
type
|
||||||
GodotPropertySetFunc* {.importc: "godot_property_set_func",
|
GodotPropertySetFunc* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
setFunc*: proc (obj: ptr GodotObject; methodData: pointer;
|
||||||
setFunc* {.importc: "set_func".}: proc (obj: ptr GodotObject;
|
userData: pointer; value: Variant) {.noconv.}
|
||||||
methodData: pointer;
|
methodData*: pointer
|
||||||
userData: pointer;
|
freeFunc*: proc (a2: pointer) {.noconv.}
|
||||||
value: Variant) {.noconv.}
|
|
||||||
methodData* {.importc: "method_data".}: pointer
|
|
||||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
|
||||||
|
|
||||||
GodotPropertyGetFunc* {.importc: "godot_property_get_func",
|
GodotPropertyGetFunc* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
getFunc*: proc (obj: ptr GodotObject; methodData: pointer;
|
||||||
getFunc* {.importc: "get_func".}:
|
userData: pointer): Variant {.noconv.}
|
||||||
proc (obj: ptr GodotObject; methodData: pointer;
|
methodData*: pointer
|
||||||
userData: pointer): Variant {.noconv.}
|
freeFunc*: proc (a2: pointer) {.noconv.}
|
||||||
methodData* {.importc: "method_data".}: pointer
|
|
||||||
freeFunc* {.importc: "free_func".}: proc (a2: pointer) {.noconv.}
|
|
||||||
|
|
||||||
proc godotScriptRegisterProperty*(libHandle: pointer;
|
proc godotScriptRegisterProperty*(libHandle: pointer;
|
||||||
name: cstring; path: cstring;
|
name: cstring; path: cstring;
|
||||||
attr: var GodotPropertyAttributes;
|
attr: var GodotPropertyAttributes;
|
||||||
setFunc: GodotPropertySetFunc;
|
setFunc: GodotPropertySetFunc;
|
||||||
getFunc: GodotPropertyGetFunc) {.
|
getFunc: GodotPropertyGetFunc) {.
|
||||||
importc: "godot_nativescript_register_property",
|
importc: "godot_nativescript_register_property".}
|
||||||
header: "godot_nativescript.h".}
|
|
||||||
|
|
||||||
type
|
type
|
||||||
GodotSignalArgument* {.importc: "godot_signal_argument",
|
GodotSignalArgument* {.bycopy.} = object
|
||||||
header: "godot_nativescript.h", bycopy.} = object
|
name*: GodotString
|
||||||
name* {.importc: "name".}: GodotString
|
typ*: cint
|
||||||
typ* {.importc: "type".}: cint
|
hint*: GodotPropertyHint
|
||||||
hint* {.importc: "hint".}: GodotPropertyHint
|
hintString*: GodotString
|
||||||
hintString* {.importc: "hint_string".}: GodotString
|
usage*: GodotPropertyUsageFlags
|
||||||
usage* {.importc: "usage".}: GodotPropertyUsageFlags
|
defaultValue*: Variant
|
||||||
defaultValue* {.importc: "default_value".}: Variant
|
|
||||||
|
|
||||||
GodotSignal* {.importc: "godot_signal",
|
GodotSignal* = object
|
||||||
header: "godot_nativescript.h".} = object
|
name*: GodotString
|
||||||
name* {.importc: "name".}: GodotString
|
numArgs*: cint
|
||||||
numArgs* {.importc: "num_args".}: cint
|
args*: ptr GodotSignalArgument
|
||||||
args* {.importc: "args".}: ptr GodotSignalArgument
|
numDefaultArgs*: cint
|
||||||
numDefaultArgs* {.importc: "num_default_args".}: cint
|
defaultArgs*: ptr Variant
|
||||||
defaultArgs* {.importc: "default_args".}: ptr Variant
|
|
||||||
|
|
||||||
proc godotScriptRegisterSignal*(libHandle: pointer; name: cstring;
|
proc godotScriptRegisterSignal*(libHandle: pointer; name: cstring;
|
||||||
signal: GodotSignal) {.
|
signal: GodotSignal) {.
|
||||||
importc: "godot_nativescript_register_signal",
|
importc: "godot_nativescript_register_signal".}
|
||||||
header: "godot_nativescript.h".}
|
|
||||||
|
|
||||||
proc getUserdata*(instance: ptr GodotObject): pointer {.
|
proc getUserdata*(instance: ptr GodotObject): pointer {.
|
||||||
importc: "godot_nativescript_get_userdata", header: "godot_nativescript.h".}
|
importc: "godot_nativescript_get_userdata".}
|
||||||
|
|
||||||
proc godotNew*(p_classname: cstring): ptr GodotObject {.
|
proc godotNew*(p_classname: cstring): ptr GodotObject {.
|
||||||
importc: "godot_nativescript_new", header: "godot_nativescript.h".}
|
importc: "godot_nativescript_new".}
|
||||||
|
|
||||||
proc godotStackBottom*(): pointer {.
|
proc godotStackBottom*(): pointer {.
|
||||||
importc: "godot_get_stack_bottom", header: "godot/gdnative.h".}
|
importc: "godot_get_stack_bottom".}
|
||||||
|
|
||||||
proc deinit*(o: ptr GodotObject) {.
|
proc deinit*(o: ptr GodotObject) {.
|
||||||
importc: "godot_object_destroy", header: "godot/gdnative.h".}
|
importc: "godot_object_destroy".}
|
||||||
|
|
||||||
# print using Godot's error handler list
|
|
||||||
|
|
||||||
proc godotPrintError(description: cstring; function: cstring; file: cstring;
|
|
||||||
line: cint) {.
|
|
||||||
importc: "godot_print_error", header: "godot/gdnative.h".}
|
|
||||||
|
|
||||||
proc godotPrintWarning(description: cstring; function: cstring;
|
|
||||||
file: cstring; line: cint) {.
|
|
||||||
importc: "godot_print_warning", header: "godot/gdnative.h".}
|
|
||||||
|
|
||||||
proc godotPrint(message: GodotString) {.
|
|
||||||
importc: "godot_print", header: "godot/gdnative.h".}
|
|
||||||
|
|
||||||
proc print*(message: string) {.inline.} =
|
|
||||||
let s = message.toGodotString()
|
|
||||||
godotPrint(s)
|
|
||||||
|
|
||||||
proc print*(message: cstring) {.inline.} =
|
|
||||||
let s = message.toGodotString()
|
|
||||||
godotPrint(s)
|
|
||||||
|
|
||||||
template printWarning*(warn: typed) =
|
|
||||||
let (filename, line) = instantiationInfo()
|
|
||||||
godotPrintWarning(cstring($warn), nil, cstring(filename), line.cint)
|
|
||||||
|
|
||||||
template printError*(err: typed) =
|
|
||||||
let (filename, line) = instantiationInfo()
|
|
||||||
godotPrintError(cstring($err), nil, cstring(filename), line.cint)
|
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
import godotbase, strings
|
import godotbase, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
NodePath* {.importc: "godot_node_path",
|
NodePath* {.byref.} = object
|
||||||
header: "godot/node_path.h", byref.} = object
|
p: pointer
|
||||||
|
|
||||||
proc initNodePath(dest: var NodePath; s: GodotString) {.
|
proc initNodePath(dest: var NodePath; s: GodotString) {.
|
||||||
importc: "godot_node_path_new", header: "godot/node_path.h".}
|
importc: "godot_node_path_new".}
|
||||||
proc initNodePath(dest: var NodePath;
|
proc initNodePath(dest: var NodePath;
|
||||||
src: NodePath) {.
|
src: NodePath) {.
|
||||||
importc: "godot_node_path_new_copy", header: "godot/node_path.h".}
|
importc: "godot_node_path_new_copy".}
|
||||||
proc deinit(self: var NodePath) {.
|
proc deinit(self: var NodePath) {.
|
||||||
importc: "godot_node_path_destroy", header: "godot/node_path.h".}
|
importc: "godot_node_path_destroy".}
|
||||||
|
|
||||||
proc initNodePath*(s: string): NodePath {.inline.} =
|
proc initNodePath*(s: string): NodePath {.inline.} =
|
||||||
initNodePath(result, s.toGodotString())
|
initNodePath(result, s.toGodotString())
|
||||||
|
|
@ -24,32 +24,28 @@ proc `=`(self: var NodePath, other: NodePath) {.inline.} =
|
||||||
initNodePath(self, other)
|
initNodePath(self, other)
|
||||||
|
|
||||||
proc toGodotString*(self: NodePath): GodotString {.
|
proc toGodotString*(self: NodePath): GodotString {.
|
||||||
importc: "godot_node_path_as_string", header: "godot/node_path.h".}
|
importc: "godot_node_path_as_string".}
|
||||||
proc `$`*(self: NodePath): string {.inline.} =
|
proc `$`*(self: NodePath): string {.inline.} =
|
||||||
let s = self.toGodotString()
|
let s = self.toGodotString()
|
||||||
result = $s
|
result = $s
|
||||||
|
|
||||||
proc isAbsolute*(self: NodePath): bool {.
|
proc isAbsolute*(self: NodePath): bool {.
|
||||||
importc: "godot_node_path_is_absolute", header: "godot/node_path.h".}
|
importc: "godot_node_path_is_absolute".}
|
||||||
proc nameCount*(self: NodePath): cint {.
|
proc nameCount*(self: NodePath): cint {.
|
||||||
importc: "godot_node_path_get_name_count",
|
importc: "godot_node_path_get_name_count".}
|
||||||
header: "godot/node_path.h".}
|
|
||||||
proc getName*(self: NodePath; idx: cint): GodotString {.
|
proc getName*(self: NodePath; idx: cint): GodotString {.
|
||||||
importc: "godot_node_path_get_name", header: "godot/node_path.h".}
|
importc: "godot_node_path_get_name".}
|
||||||
proc subnameCount*(self: NodePath): cint {.
|
proc subnameCount*(self: NodePath): cint {.
|
||||||
importc: "godot_node_path_get_subname_count",
|
importc: "godot_node_path_get_subname_count".}
|
||||||
header: "godot/node_path.h".}
|
|
||||||
proc getSubname*(self: NodePath; idx: cint): GodotString {.
|
proc getSubname*(self: NodePath; idx: cint): GodotString {.
|
||||||
importc: "godot_node_path_get_subname",
|
importc: "godot_node_path_get_subname".}
|
||||||
header: "godot/node_path.h".}
|
|
||||||
proc property*(self: NodePath): GodotString {.
|
proc property*(self: NodePath): GodotString {.
|
||||||
importc: "godot_node_path_get_property", header: "godot/node_path.h".}
|
importc: "godot_node_path_get_property".}
|
||||||
proc isEmpty*(self: NodePath): bool {.
|
proc isEmpty*(self: NodePath): bool {.
|
||||||
importc: "godot_node_path_is_empty", header: "godot/node_path.h".}
|
importc: "godot_node_path_is_empty".}
|
||||||
|
|
||||||
proc `==`*(a, b: NodePath): bool {.
|
proc `==`*(a, b: NodePath): bool {.
|
||||||
importc: "godot_node_path_operator_equal",
|
importc: "godot_node_path_operator_equal".}
|
||||||
header: "godot/node_path.h".}
|
|
||||||
|
|
||||||
converter fromString*(s: string): NodePath =
|
converter fromString*(s: string): NodePath =
|
||||||
initNodePath(result, s.toGodotString())
|
initNodePath(result, s.toGodotString())
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,16 @@
|
||||||
import godotbase, vector3, strings
|
import godotbase, vector3, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Plane* {.importc: "godot_plane", header: "godot/plane.h", byref.} = object
|
Plane* {.byref.} = object
|
||||||
|
normal*: Vector3
|
||||||
|
d*: float32
|
||||||
|
|
||||||
proc initPlane(dest: var Plane; a, b, c, d: float32) {.
|
proc initPlane(dest: var Plane; a, b, c, d: float32) {.
|
||||||
importc: "godot_plane_new_with_reals", header: "godot/plane.h".}
|
importc: "godot_plane_new_with_reals".}
|
||||||
proc initPlane(dest: var Plane; v1, v2, v3: Vector3) {.
|
proc initPlane(dest: var Plane; v1, v2, v3: Vector3) {.
|
||||||
importc: "godot_plane_new_with_vectors",
|
importc: "godot_plane_new_with_vectors".}
|
||||||
header: "godot/plane.h".}
|
|
||||||
proc initPlane(dest: var Plane; normal: Vector3; d: float32) {.
|
proc initPlane(dest: var Plane; normal: Vector3; d: float32) {.
|
||||||
importc: "godot_plane_new_with_normal",
|
importc: "godot_plane_new_with_normal".}
|
||||||
header: "godot/plane.h".}
|
|
||||||
|
|
||||||
proc initPlane*(a, b, c, d: float32): Plane =
|
proc initPlane*(a, b, c, d: float32): Plane =
|
||||||
initPlane(result, a, b, c, d)
|
initPlane(result, a, b, c, d)
|
||||||
|
|
@ -23,62 +23,48 @@ proc initPlane*(v1, v2, v3: Vector3): Plane =
|
||||||
proc initPlane*(normal: Vector3; d: float32): Plane =
|
proc initPlane*(normal: Vector3; d: float32): Plane =
|
||||||
initPlane(result, normal, d)
|
initPlane(result, normal, d)
|
||||||
|
|
||||||
proc toGodotString*(self: Plane): GodotString {.
|
proc toGodotString(self: Plane): GodotString {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_as_string", header: "godot/plane.h".}
|
importc: "godot_plane_as_string".}
|
||||||
proc `$`*(self: Plane): string {.inline.} =
|
proc `$`*(self: Plane): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
|
|
||||||
proc normalized*(self: Plane): Plane {.
|
proc normalized*(self: Plane): Plane {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_normalized", header: "godot/plane.h".}
|
importc: "godot_plane_normalized".}
|
||||||
proc center*(self: Plane): Vector3 {.
|
proc center*(self: Plane): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_center", header: "godot/plane.h".}
|
importc: "godot_plane_center".}
|
||||||
proc getAnyPoint*(self: Plane): Vector3 {.
|
proc getAnyPoint*(self: Plane): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_get_any_point", header: "godot/plane.h".}
|
importc: "godot_plane_get_any_point".}
|
||||||
proc isPointOver*(self: Plane; point: Vector3): bool {.
|
proc isPointOver*(self: Plane; point: Vector3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_is_point_over",
|
importc: "godot_plane_is_point_over".}
|
||||||
header: "godot/plane.h".}
|
|
||||||
proc distanceTo*(self: Plane; point: Vector3): float32 {.
|
proc distanceTo*(self: Plane; point: Vector3): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_distance_to", header: "godot/plane.h".}
|
importc: "godot_plane_distance_to".}
|
||||||
proc contains*(self: Plane; point: Vector3;
|
proc contains*(self: Plane; point: Vector3;
|
||||||
epsilon: float32): bool {.
|
epsilon: float32): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_has_point", header: "godot/plane.h".}
|
importc: "godot_plane_has_point".}
|
||||||
proc project*(self: Plane; point: Vector3): Vector3 {.
|
proc project*(self: Plane; point: Vector3): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_project", header: "godot/plane.h".}
|
importc: "godot_plane_project".}
|
||||||
proc intersect3*(self: Plane; dest: var Vector3;
|
proc intersect3*(self: Plane; dest: var Vector3;
|
||||||
b, c: Plane): bool {.
|
b, c: Plane): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_intersect_3",
|
importc: "godot_plane_intersect_3".}
|
||||||
header: "godot/plane.h".}
|
|
||||||
proc intersectsRay*(self: Plane; dest: var Vector3;
|
proc intersectsRay*(self: Plane; dest: var Vector3;
|
||||||
v, dir: Vector3): bool {.
|
v, dir: Vector3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_intersects_ray",
|
importc: "godot_plane_intersects_ray".}
|
||||||
header: "godot/plane.h".}
|
|
||||||
proc intersectsSegment*(self: Plane; dest: var Vector3;
|
proc intersectsSegment*(self: Plane; dest: var Vector3;
|
||||||
segmentBegin, segmentEnd: Vector3): bool {.
|
segmentBegin, segmentEnd: Vector3): bool {.
|
||||||
noSideEffect, importc: "godot_plane_intersects_segment",
|
noSideEffect, importc: "godot_plane_intersects_segment".}
|
||||||
header: "godot/plane.h".}
|
|
||||||
proc `-`*(self: Plane): Plane {.
|
proc `-`*(self: Plane): Plane {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_operator_neg", header: "godot/plane.h".}
|
importc: "godot_plane_operator_neg".}
|
||||||
proc `==`*(a, b: Plane): bool {.
|
proc `==`*(a, b: Plane): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_plane_operator_equal", header: "godot/plane.h".}
|
importc: "godot_plane_operator_equal".}
|
||||||
proc normal*(self: Plane): Vector3 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_plane_get_normal", header: "godot/plane.h".}
|
|
||||||
proc `normal=`*(self: var Plane; normal: Vector3) {.
|
|
||||||
importc: "godot_plane_set_normal", header: "godot/plane.h".}
|
|
||||||
proc d*(self: Plane): float32 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_plane_get_d", header: "godot/plane.h".}
|
|
||||||
proc `d=`*(self: var Plane; d: float32) {.
|
|
||||||
importc: "godot_plane_set_d", header: "godot/plane.h".}
|
|
||||||
|
|
|
||||||
|
|
@ -3,35 +3,33 @@
|
||||||
import godotbase, color, vector2, vector3, strings
|
import godotbase, color, vector2, vector3, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
PoolByteArray* {.importc: "godot_pool_byte_array",
|
PoolByteArray* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
PoolIntArray* {.importc: "godot_pool_int_array",
|
PoolIntArray* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
PoolRealArray* {.importc: "godot_pool_real_array",
|
PoolRealArray* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
PoolStringArray* {.importc: "godot_pool_string_array",
|
PoolStringArray* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
PoolVector2Array* {.importc: "godot_pool_vector2_array",
|
PoolVector2Array* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
PoolVector3Array* {.importc: "godot_pool_vector3_array",
|
PoolVector3Array* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
PoolColorArray* {.importc: "godot_pool_color_array",
|
PoolColorArray* {.byref.} = object
|
||||||
header: "godot/pool_arrays.h", byref.} = object
|
p: pointer
|
||||||
|
|
||||||
# byte
|
# byte
|
||||||
|
|
||||||
proc initPoolByteArray(dest: var PoolByteArray) {.
|
proc initPoolByteArray(dest: var PoolByteArray) {.
|
||||||
importc: "godot_pool_byte_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_new".}
|
||||||
proc initPoolByteArray(dest: var PoolByteArray;
|
proc initPoolByteArray(dest: var PoolByteArray;
|
||||||
src: PoolByteArray) {.
|
src: PoolByteArray) {.
|
||||||
importc: "godot_pool_byte_array_new_copy",
|
importc: "godot_pool_byte_array_new_copy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc initPoolByteArray(dest: var PoolByteArray; arr: Array) {.
|
proc initPoolByteArray(dest: var PoolByteArray; arr: Array) {.
|
||||||
importc: "godot_pool_byte_array_new_with_array",
|
importc: "godot_pool_byte_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var PoolByteArray) {.
|
proc deinit(self: var PoolByteArray) {.
|
||||||
importc: "godot_pool_byte_array_destroy", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_destroy".}
|
||||||
|
|
||||||
proc initPoolByteArray*(): PoolByteArray {.inline.} =
|
proc initPoolByteArray*(): PoolByteArray {.inline.} =
|
||||||
initPoolByteArray(result)
|
initPoolByteArray(result)
|
||||||
|
|
@ -47,33 +45,31 @@ proc `=destroy`(self: PoolByteArray) {.inline.} =
|
||||||
|
|
||||||
proc add*(self: var PoolByteArray;
|
proc add*(self: var PoolByteArray;
|
||||||
data: uint8) {.
|
data: uint8) {.
|
||||||
importc: "godot_pool_byte_array_append", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_append".}
|
||||||
proc addFirst*(self: var PoolByteArray, data: uint8) {.
|
proc addFirst*(self: var PoolByteArray, data: uint8) {.
|
||||||
importc: "godot_pool_byte_array_push_back", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_push_back".}
|
||||||
proc add*(self: var PoolByteArray;
|
proc add*(self: var PoolByteArray;
|
||||||
arr: PoolByteArray) {.
|
arr: PoolByteArray) {.
|
||||||
importc: "godot_pool_byte_array_append_array",
|
importc: "godot_pool_byte_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolByteArray; idx: cint;
|
proc insert*(self: var PoolByteArray; idx: cint;
|
||||||
data: uint8): Error {.
|
data: uint8): Error {.
|
||||||
importc: "godot_pool_byte_array_insert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_insert".}
|
||||||
proc delete*(self: var PoolByteArray; idx: cint) {.
|
proc delete*(self: var PoolByteArray; idx: cint) {.
|
||||||
importc: "godot_pool_byte_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_remove".}
|
||||||
|
|
||||||
proc reverse*(self: var PoolByteArray) {.
|
proc reverse*(self: var PoolByteArray) {.
|
||||||
importc: "godot_pool_byte_array_invert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_invert".}
|
||||||
proc setLen*(self: var PoolByteArray; size: cint) {.
|
proc setLen*(self: var PoolByteArray; size: cint) {.
|
||||||
importc: "godot_pool_byte_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_resize".}
|
||||||
|
|
||||||
proc `[]=`*(self: var PoolByteArray; idx: cint; data: uint8) {.
|
proc `[]=`*(self: var PoolByteArray; idx: cint; data: uint8) {.
|
||||||
importc: "godot_pool_byte_array_set", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_set".}
|
||||||
proc `[]`*(self: PoolByteArray; idx: cint): uint8 {.
|
proc `[]`*(self: PoolByteArray; idx: cint): uint8 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_byte_array_get",
|
importc: "godot_pool_byte_array_get".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc len*(self: PoolByteArray): cint {.
|
proc len*(self: PoolByteArray): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_byte_array_size", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_byte_array_size".}
|
||||||
|
|
||||||
iterator items*(arr: PoolByteArray): byte =
|
iterator items*(arr: PoolByteArray): byte =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
@ -84,16 +80,15 @@ iterator pairs*(arr: PoolByteArray): tuple[key: cint, val: byte] =
|
||||||
yield (i, arr[i])
|
yield (i, arr[i])
|
||||||
|
|
||||||
proc initPoolIntArray(dest: var PoolIntArray) {.
|
proc initPoolIntArray(dest: var PoolIntArray) {.
|
||||||
importc: "godot_pool_int_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_new".}
|
||||||
proc initPoolIntArray(dest: var PoolIntArray;
|
proc initPoolIntArray(dest: var PoolIntArray;
|
||||||
src: PoolIntArray) {.
|
src: PoolIntArray) {.
|
||||||
importc: "godot_pool_int_array_new_copy", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_new_copy".}
|
||||||
proc initPoolIntArray(dest: var PoolIntArray;
|
proc initPoolIntArray(dest: var PoolIntArray;
|
||||||
arr: Array) {.
|
arr: Array) {.
|
||||||
importc: "godot_pool_int_array_new_with_array",
|
importc: "godot_pool_int_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc deinit(self: var PoolIntArray) {.
|
proc deinit(self: var PoolIntArray) {.
|
||||||
importc: "godot_pool_int_array_destroy", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_destroy".}
|
||||||
|
|
||||||
proc initPoolIntArray*(): PoolIntArray {.inline.} =
|
proc initPoolIntArray*(): PoolIntArray {.inline.} =
|
||||||
initPoolIntArray(result)
|
initPoolIntArray(result)
|
||||||
|
|
@ -108,32 +103,29 @@ proc `=destroy`(self: PoolIntArray) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
proc add*(self: var PoolIntArray; data: cint) {.
|
proc add*(self: var PoolIntArray; data: cint) {.
|
||||||
importc: "godot_pool_int_array_append", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_append".}
|
||||||
proc addFirst*(self: var PoolIntArray; data: cint) {.
|
proc addFirst*(self: var PoolIntArray; data: cint) {.
|
||||||
importc: "godot_pool_int_array_push_back", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_push_back".}
|
||||||
proc add*(self: var PoolIntArray; arr: PoolIntArray) {.
|
proc add*(self: var PoolIntArray; arr: PoolIntArray) {.
|
||||||
importc: "godot_pool_int_array_append_array",
|
importc: "godot_pool_int_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolIntArray; idx: cint;
|
proc insert*(self: var PoolIntArray; idx: cint;
|
||||||
data: cint): Error {.
|
data: cint): Error {.
|
||||||
importc: "godot_pool_int_array_insert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_insert".}
|
||||||
proc delete*(self: var PoolIntArray; idx: cint) {.
|
proc delete*(self: var PoolIntArray; idx: cint) {.
|
||||||
importc: "godot_pool_int_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_remove".}
|
||||||
proc reverse*(self: var PoolIntArray) {.
|
proc reverse*(self: var PoolIntArray) {.
|
||||||
importc: "godot_pool_int_array_invert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_invert".}
|
||||||
|
|
||||||
proc setLen*(self: var PoolIntArray; size: cint) {.
|
proc setLen*(self: var PoolIntArray; size: cint) {.
|
||||||
importc: "godot_pool_int_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_resize".}
|
||||||
proc `[]=`*(self: var PoolIntArray; idx: cint; data: cint) {.
|
proc `[]=`*(self: var PoolIntArray; idx: cint; data: cint) {.
|
||||||
importc: "godot_pool_int_array_set", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_int_array_set".}
|
||||||
proc `[]`*(self: PoolIntArray; idx: cint): cint {.
|
proc `[]`*(self: PoolIntArray; idx: cint): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_int_array_get",
|
importc: "godot_pool_int_array_get".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc len*(self: PoolIntArray): cint {.
|
proc len*(self: PoolIntArray): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_int_array_size",
|
importc: "godot_pool_int_array_size".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
iterator items*(arr: PoolIntArray): cint =
|
iterator items*(arr: PoolIntArray): cint =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
@ -146,17 +138,15 @@ iterator pairs*(arr: PoolIntArray): tuple[key: cint, val: cint] =
|
||||||
# Real
|
# Real
|
||||||
|
|
||||||
proc initPoolRealArray(dest: var PoolRealArray) {.
|
proc initPoolRealArray(dest: var PoolRealArray) {.
|
||||||
importc: "godot_pool_real_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_new".}
|
||||||
proc initPoolRealArray(dest: var PoolRealArray;
|
proc initPoolRealArray(dest: var PoolRealArray;
|
||||||
src: PoolRealArray) {.
|
src: PoolRealArray) {.
|
||||||
importc: "godot_pool_real_array_new_copy",
|
importc: "godot_pool_real_array_new_copy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc initPoolRealArray(dest: var PoolRealArray; arr: Array) {.
|
proc initPoolRealArray(dest: var PoolRealArray; arr: Array) {.
|
||||||
importc: "godot_pool_real_array_new_with_array",
|
importc: "godot_pool_real_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var PoolRealArray) {.
|
proc deinit(self: var PoolRealArray) {.
|
||||||
importc: "godot_pool_real_array_destroy", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_destroy".}
|
||||||
|
|
||||||
proc initPoolRealArray*(): PoolRealArray {.inline.} =
|
proc initPoolRealArray*(): PoolRealArray {.inline.} =
|
||||||
initPoolRealArray(result)
|
initPoolRealArray(result)
|
||||||
|
|
@ -171,31 +161,28 @@ proc `=destroy`(self: PoolRealArray) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
proc add*(self: var PoolRealArray; data: float32) {.
|
proc add*(self: var PoolRealArray; data: float32) {.
|
||||||
importc: "godot_pool_real_array_append",
|
importc: "godot_pool_real_array_append".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc addFirst*(self: var PoolRealArray; data: float32) {.
|
proc addFirst*(self: var PoolRealArray; data: float32) {.
|
||||||
importc: "godot_pool_real_array_push_back", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_push_back".}
|
||||||
proc add*(self: var PoolRealArray; arr: PoolRealArray) {.
|
proc add*(self: var PoolRealArray; arr: PoolRealArray) {.
|
||||||
importc: "godot_pool_real_array_append_array",
|
importc: "godot_pool_real_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolRealArray;
|
proc insert*(self: var PoolRealArray;
|
||||||
idx: cint; data: float32): Error {.
|
idx: cint; data: float32): Error {.
|
||||||
importc: "godot_pool_real_array_insert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_insert".}
|
||||||
proc delete*(self: var PoolRealArray; idx: cint) {.
|
proc delete*(self: var PoolRealArray; idx: cint) {.
|
||||||
importc: "godot_pool_real_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_remove".}
|
||||||
proc reverse*(self: var PoolRealArray) {.
|
proc reverse*(self: var PoolRealArray) {.
|
||||||
importc: "godot_pool_real_array_invert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_invert".}
|
||||||
proc setLen*(self: var PoolRealArray; size: cint) {.
|
proc setLen*(self: var PoolRealArray; size: cint) {.
|
||||||
importc: "godot_pool_real_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_resize".}
|
||||||
proc `[]=`*(self: var PoolRealArray; idx: cint; data: float32) {.
|
proc `[]=`*(self: var PoolRealArray; idx: cint; data: float32) {.
|
||||||
importc: "godot_pool_real_array_set", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_set".}
|
||||||
proc `[]`*(self: PoolRealArray; idx: cint): float32 {.
|
proc `[]`*(self: PoolRealArray; idx: cint): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_real_array_get",
|
importc: "godot_pool_real_array_get".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc len*(self: PoolRealArray): cint {.
|
proc len*(self: PoolRealArray): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_real_array_size", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_real_array_size".}
|
||||||
|
|
||||||
iterator items*(arr: PoolRealArray): float32 =
|
iterator items*(arr: PoolRealArray): float32 =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
@ -208,18 +195,15 @@ iterator pairs*(arr: PoolRealArray): tuple[key: cint, val: float32] =
|
||||||
# String
|
# String
|
||||||
|
|
||||||
proc initPoolStringArray(dest: var PoolStringArray) {.
|
proc initPoolStringArray(dest: var PoolStringArray) {.
|
||||||
importc: "godot_pool_string_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_string_array_new".}
|
||||||
proc initPoolStringArray(dest: var PoolStringArray;
|
proc initPoolStringArray(dest: var PoolStringArray;
|
||||||
src: PoolStringArray) {.
|
src: PoolStringArray) {.
|
||||||
importc: "godot_pool_string_array_new_copy",
|
importc: "godot_pool_string_array_new_copy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc initPoolStringArray(dest: var PoolStringArray; arr: Array) {.
|
proc initPoolStringArray(dest: var PoolStringArray; arr: Array) {.
|
||||||
importc: "godot_pool_string_array_new_with_array",
|
importc: "godot_pool_string_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var PoolStringArray) {.
|
proc deinit(self: var PoolStringArray) {.
|
||||||
importc: "godot_pool_string_array_destroy",
|
importc: "godot_pool_string_array_destroy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc initPoolStringArray*(): PoolStringArray {.inline.} =
|
proc initPoolStringArray*(): PoolStringArray {.inline.} =
|
||||||
initPoolStringArray(result)
|
initPoolStringArray(result)
|
||||||
|
|
@ -234,36 +218,29 @@ proc `=destroy`(self: PoolStringArray) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
proc add*(self: var PoolStringArray; data: GodotString) {.
|
proc add*(self: var PoolStringArray; data: GodotString) {.
|
||||||
importc: "godot_pool_string_array_append",
|
importc: "godot_pool_string_array_append".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc addFirst*(self: var PoolStringArray; data: GodotString) {.
|
proc addFirst*(self: var PoolStringArray; data: GodotString) {.
|
||||||
importc: "godot_pool_string_array_push_back",
|
importc: "godot_pool_string_array_push_back".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc add*(self: var PoolStringArray; arr: PoolStringArray) {.
|
proc add*(self: var PoolStringArray; arr: PoolStringArray) {.
|
||||||
importc: "godot_pool_string_array_append_array",
|
importc: "godot_pool_string_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolStringArray;
|
proc insert*(self: var PoolStringArray;
|
||||||
idx: cint; data: GodotString): Error {.
|
idx: cint; data: GodotString): Error {.
|
||||||
importc: "godot_pool_string_array_insert",
|
importc: "godot_pool_string_array_insert".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc delete*(self: var PoolStringArray; idx: cint) {.
|
proc delete*(self: var PoolStringArray; idx: cint) {.
|
||||||
importc: "godot_pool_string_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_string_array_remove".}
|
||||||
proc reverse*(self: var PoolStringArray) {.
|
proc reverse*(self: var PoolStringArray) {.
|
||||||
importc: "godot_pool_string_array_invert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_string_array_invert".}
|
||||||
proc setLen*(self: var PoolStringArray; size: cint) {.
|
proc setLen*(self: var PoolStringArray; size: cint) {.
|
||||||
importc: "godot_pool_string_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_string_array_resize".}
|
||||||
proc `[]=`*(self: var PoolStringArray; idx: cint;
|
proc `[]=`*(self: var PoolStringArray; idx: cint;
|
||||||
data: GodotString) {.
|
data: GodotString) {.
|
||||||
importc: "godot_pool_string_array_set",
|
importc: "godot_pool_string_array_set".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc `[]`*(self: PoolStringArray; idx: cint): GodotString {.
|
proc `[]`*(self: PoolStringArray; idx: cint): GodotString {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_string_array_get",
|
importc: "godot_pool_string_array_get".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc len*(self: PoolStringArray): cint {.
|
proc len*(self: PoolStringArray): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_string_array_size",
|
importc: "godot_pool_string_array_size".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
iterator items*(arr: PoolStringArray): GodotString =
|
iterator items*(arr: PoolStringArray): GodotString =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
@ -276,17 +253,15 @@ iterator pairs*(arr: PoolStringArray): tuple[key: cint, val: GodotString] =
|
||||||
# Vector2
|
# Vector2
|
||||||
|
|
||||||
proc initPoolVector2Array(dest: var PoolVector2Array) {.
|
proc initPoolVector2Array(dest: var PoolVector2Array) {.
|
||||||
importc: "godot_pool_vector2_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_new".}
|
||||||
proc initPoolVector2Array(dest: var PoolVector2Array;
|
proc initPoolVector2Array(dest: var PoolVector2Array;
|
||||||
src: PoolVector2Array) {.
|
src: PoolVector2Array) {.
|
||||||
importc: "godot_pool_vector2_array_new_copy",
|
importc: "godot_pool_vector2_array_new_copy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc initPoolVector2Array(dest: var PoolVector2Array; arr: Array) {.
|
proc initPoolVector2Array(dest: var PoolVector2Array; arr: Array) {.
|
||||||
importc: "godot_pool_vector2_array_new_with_array",
|
importc: "godot_pool_vector2_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var PoolVector2Array) {.
|
proc deinit(self: var PoolVector2Array) {.
|
||||||
importc: "godot_pool_vector2_array_destroy", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_destroy".}
|
||||||
|
|
||||||
proc initPoolVector2Array*(): PoolVector2Array {.inline.} =
|
proc initPoolVector2Array*(): PoolVector2Array {.inline.} =
|
||||||
initPoolVector2Array(result)
|
initPoolVector2Array(result)
|
||||||
|
|
@ -301,35 +276,30 @@ proc `=destroy`(self: PoolVector2Array) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
proc add*(self: var PoolVector2Array; data: Vector2) {.
|
proc add*(self: var PoolVector2Array; data: Vector2) {.
|
||||||
importc: "godot_pool_vector2_array_append",
|
importc: "godot_pool_vector2_array_append".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc addFirst*(self: var PoolVector2Array; data: Vector2) {.
|
proc addFirst*(self: var PoolVector2Array; data: Vector2) {.
|
||||||
importc: "godot_pool_vector2_array_push_back",
|
importc: "godot_pool_vector2_array_push_back".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc add*(self: var PoolVector2Array;
|
proc add*(self: var PoolVector2Array;
|
||||||
arr: PoolVector2Array) {.
|
arr: PoolVector2Array) {.
|
||||||
importc: "godot_pool_vector2_array_append_array",
|
importc: "godot_pool_vector2_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolVector2Array;
|
proc insert*(self: var PoolVector2Array;
|
||||||
idx: cint; data: Vector2): Error {.
|
idx: cint; data: Vector2): Error {.
|
||||||
importc: "godot_pool_vector2_array_insert",
|
importc: "godot_pool_vector2_array_insert".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc delete*(self: var PoolVector2Array; idx: cint) {.
|
proc delete*(self: var PoolVector2Array; idx: cint) {.
|
||||||
importc: "godot_pool_vector2_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_remove".}
|
||||||
proc reverse*(self: var PoolVector2Array) {.
|
proc reverse*(self: var PoolVector2Array) {.
|
||||||
importc: "godot_pool_vector2_array_invert",
|
importc: "godot_pool_vector2_array_invert".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc setLen*(self: var PoolVector2Array; size: cint) {.
|
proc setLen*(self: var PoolVector2Array; size: cint) {.
|
||||||
importc: "godot_pool_vector2_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_resize".}
|
||||||
proc `[]=`*(self: var PoolVector2Array; idx: cint;
|
proc `[]=`*(self: var PoolVector2Array; idx: cint;
|
||||||
data: ptr Vector2) {.
|
data: ptr Vector2) {.
|
||||||
importc: "godot_pool_vector2_array_set", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_set".}
|
||||||
proc `[]`*(self: PoolVector2Array; idx: cint): Vector2 {.
|
proc `[]`*(self: PoolVector2Array; idx: cint): Vector2 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_vector2_array_get", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_get".}
|
||||||
proc len*(self: PoolVector2Array): cint {.
|
proc len*(self: PoolVector2Array): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_vector2_array_size", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector2_array_size".}
|
||||||
|
|
||||||
iterator items*(arr: PoolVector2Array): Vector2 =
|
iterator items*(arr: PoolVector2Array): Vector2 =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
@ -342,18 +312,15 @@ iterator pairs*(arr: PoolVector2Array): tuple[key: cint, val: Vector2] =
|
||||||
# Vector3
|
# Vector3
|
||||||
|
|
||||||
proc initPoolVector3Array*(dest: var PoolVector3Array) {.
|
proc initPoolVector3Array*(dest: var PoolVector3Array) {.
|
||||||
importc: "godot_pool_vector3_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector3_array_new".}
|
||||||
proc initPoolVector3Array*(dest: var PoolVector3Array;
|
proc initPoolVector3Array*(dest: var PoolVector3Array;
|
||||||
src: PoolVector3Array) {.
|
src: PoolVector3Array) {.
|
||||||
importc: "godot_pool_vector3_array_new_copy",
|
importc: "godot_pool_vector3_array_new_copy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc initPoolVector3Array*(dest: var PoolVector3Array; arr: Array) {.
|
proc initPoolVector3Array*(dest: var PoolVector3Array; arr: Array) {.
|
||||||
importc: "godot_pool_vector3_array_new_with_array",
|
importc: "godot_pool_vector3_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var PoolVector3Array) {.
|
proc deinit(self: var PoolVector3Array) {.
|
||||||
importc: "godot_pool_vector3_array_destroy",
|
importc: "godot_pool_vector3_array_destroy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc initPoolVector3Array*(): PoolVector3Array {.inline.} =
|
proc initPoolVector3Array*(): PoolVector3Array {.inline.} =
|
||||||
initPoolVector3Array(result)
|
initPoolVector3Array(result)
|
||||||
|
|
@ -369,39 +336,32 @@ proc `=destroy`(self: PoolVector3Array) {.inline.} =
|
||||||
|
|
||||||
proc add*(self: var PoolVector3Array;
|
proc add*(self: var PoolVector3Array;
|
||||||
data: Vector3) {.
|
data: Vector3) {.
|
||||||
importc: "godot_pool_vector3_array_append",
|
importc: "godot_pool_vector3_array_append".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc addFirst*(self: var PoolVector3Array;
|
proc addFirst*(self: var PoolVector3Array;
|
||||||
data: Vector3) {.
|
data: Vector3) {.
|
||||||
importc: "godot_pool_vector3_array_push_back",
|
importc: "godot_pool_vector3_array_push_back".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc add*(self: var PoolVector3Array;
|
proc add*(self: var PoolVector3Array;
|
||||||
arr: PoolVector3Array) {.
|
arr: PoolVector3Array) {.
|
||||||
importc: "godot_pool_vector3_array_append_array",
|
importc: "godot_pool_vector3_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolVector3Array;
|
proc insert*(self: var PoolVector3Array;
|
||||||
idx: cint; data: Vector3): Error {.
|
idx: cint; data: Vector3): Error {.
|
||||||
importc: "godot_pool_vector3_array_insert",
|
importc: "godot_pool_vector3_array_insert".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc delete*(self: var PoolVector3Array; idx: cint) {.
|
proc delete*(self: var PoolVector3Array; idx: cint) {.
|
||||||
importc: "godot_pool_vector3_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector3_array_remove".}
|
||||||
proc reverse*(self: var PoolVector3Array) {.
|
proc reverse*(self: var PoolVector3Array) {.
|
||||||
importc: "godot_pool_vector3_array_invert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector3_array_invert".}
|
||||||
proc setLen*(self: var PoolVector3Array; size: cint) {.
|
proc setLen*(self: var PoolVector3Array; size: cint) {.
|
||||||
importc: "godot_pool_vector3_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_vector3_array_resize".}
|
||||||
proc `[]=`*(self: var PoolVector3Array;
|
proc `[]=`*(self: var PoolVector3Array;
|
||||||
idx: cint; data: Vector3) {.
|
idx: cint; data: Vector3) {.
|
||||||
importc: "godot_pool_vector3_array_set",
|
importc: "godot_pool_vector3_array_set".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc `[]`*(self: PoolVector3Array;
|
proc `[]`*(self: PoolVector3Array;
|
||||||
idx: cint): Vector3 {.
|
idx: cint): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_vector3_array_get",
|
importc: "godot_pool_vector3_array_get".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc len*(self: PoolVector3Array): cint {.
|
proc len*(self: PoolVector3Array): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_vector3_array_size",
|
importc: "godot_pool_vector3_array_size".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
iterator items*(arr: PoolVector3Array): Vector3 =
|
iterator items*(arr: PoolVector3Array): Vector3 =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
@ -414,17 +374,15 @@ iterator pairs*(arr: PoolVector3Array): tuple[key: cint, val: Vector3] =
|
||||||
# Color
|
# Color
|
||||||
|
|
||||||
proc initPoolColorArray(dest: var PoolColorArray) {.
|
proc initPoolColorArray(dest: var PoolColorArray) {.
|
||||||
importc: "godot_pool_color_array_new", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_new".}
|
||||||
proc initPoolColorArray(dest: var PoolColorArray;
|
proc initPoolColorArray(dest: var PoolColorArray;
|
||||||
src: PoolColorArray) {.
|
src: PoolColorArray) {.
|
||||||
importc: "godot_pool_color_array_new_copy",
|
importc: "godot_pool_color_array_new_copy".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc initPoolColorArray(dest: var PoolColorArray; arr: Array) {.
|
proc initPoolColorArray(dest: var PoolColorArray; arr: Array) {.
|
||||||
importc: "godot_pool_color_array_new_with_array",
|
importc: "godot_pool_color_array_new_with_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
|
|
||||||
proc deinit(self: var PoolColorArray) {.
|
proc deinit(self: var PoolColorArray) {.
|
||||||
importc: "godot_pool_color_array_destroy", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_destroy".}
|
||||||
|
|
||||||
proc initPoolColorArray*(): PoolColorArray {.inline.} =
|
proc initPoolColorArray*(): PoolColorArray {.inline.} =
|
||||||
initPoolColorArray(result)
|
initPoolColorArray(result)
|
||||||
|
|
@ -439,33 +397,29 @@ proc `=destroy`(self: PoolColorArray) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
proc add*(self: var PoolColorArray; data: Color) {.
|
proc add*(self: var PoolColorArray; data: Color) {.
|
||||||
importc: "godot_pool_color_array_append",
|
importc: "godot_pool_color_array_append".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc addFirst*(self: var PoolColorArray; data: Color) {.
|
proc addFirst*(self: var PoolColorArray; data: Color) {.
|
||||||
importc: "godot_pool_color_array_push_back",
|
importc: "godot_pool_color_array_push_back".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc add*(self: var PoolColorArray; arr: PoolColorArray) {.
|
proc add*(self: var PoolColorArray; arr: PoolColorArray) {.
|
||||||
importc: "godot_pool_color_array_append_array",
|
importc: "godot_pool_color_array_append_array".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc insert*(self: var PoolColorArray;
|
proc insert*(self: var PoolColorArray;
|
||||||
idx: cint; data: Color): Error {.
|
idx: cint; data: Color): Error {.
|
||||||
importc: "godot_pool_color_array_insert",
|
importc: "godot_pool_color_array_insert".}
|
||||||
header: "godot/pool_arrays.h".}
|
|
||||||
proc delete*(self: var PoolColorArray; idx: cint) {.
|
proc delete*(self: var PoolColorArray; idx: cint) {.
|
||||||
importc: "godot_pool_color_array_remove", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_remove".}
|
||||||
proc reverse*(self: var PoolColorArray) {.
|
proc reverse*(self: var PoolColorArray) {.
|
||||||
importc: "godot_pool_color_array_invert", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_invert".}
|
||||||
proc setLen*(self: var PoolColorArray; size: cint) {.
|
proc setLen*(self: var PoolColorArray; size: cint) {.
|
||||||
importc: "godot_pool_color_array_resize", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_resize".}
|
||||||
proc `[]=`*(self: var PoolColorArray; idx: cint;
|
proc `[]=`*(self: var PoolColorArray; idx: cint;
|
||||||
data: Color) {.
|
data: Color) {.
|
||||||
importc: "godot_pool_color_array_set", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_set".}
|
||||||
proc `[]`*(self: PoolColorArray; idx: cint): Color {.
|
proc `[]`*(self: PoolColorArray; idx: cint): Color {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_color_array_get", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_get".}
|
||||||
proc len*(self: PoolColorArray): cint {.
|
proc len*(self: PoolColorArray): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_pool_color_array_size", header: "godot/pool_arrays.h".}
|
importc: "godot_pool_color_array_size".}
|
||||||
|
|
||||||
iterator items*(arr: PoolColorArray): Color =
|
iterator items*(arr: PoolColorArray): Color =
|
||||||
for i in 0..<arr.len:
|
for i in 0..<arr.len:
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,16 @@
|
||||||
import godotbase, vector3, strings
|
import godotbase, vector3, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Quat* {.importc: "godot_quat", header: "godot/quat.h", byref.} = object
|
Quat* {.byref.} = object
|
||||||
|
x*: float32
|
||||||
|
y*: float32
|
||||||
|
z*: float32
|
||||||
|
w*: float32
|
||||||
|
|
||||||
proc initQuat(dest: var Quat; x, y, z, w: float32) {.
|
proc initQuat(dest: var Quat; x, y, z, w: float32) {.
|
||||||
importc: "godot_quat_new", header: "godot/quat.h".}
|
importc: "godot_quat_new".}
|
||||||
proc initQuat(dest: var Quat; axis: Vector3; angle: float32) {.
|
proc initQuat(dest: var Quat; axis: Vector3; angle: float32) {.
|
||||||
importc: "godot_quat_new_with_axis_angle",
|
importc: "godot_quat_new_with_axis_angle".}
|
||||||
header: "godot/quat.h".}
|
|
||||||
|
|
||||||
proc initQuat*(x, y, z, w: float32): Quat {.inline.} =
|
proc initQuat*(x, y, z, w: float32): Quat {.inline.} =
|
||||||
initQuat(result, x, y, z, w)
|
initQuat(result, x, y, z, w)
|
||||||
|
|
@ -19,96 +22,93 @@ proc initQuat*(axis: Vector3; angle: float32): Quat {.inline.} =
|
||||||
|
|
||||||
proc x*(self: Quat): float32 {.
|
proc x*(self: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_get_x", header: "godot/quat.h".}
|
importc: "godot_quat_get_x".}
|
||||||
proc `x=`*(self: var Quat; val: float32) {.
|
proc `x=`*(self: var Quat; val: float32) {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_set_x", header: "godot/quat.h".}
|
importc: "godot_quat_set_x".}
|
||||||
proc y*(self: Quat): float32 {.
|
proc y*(self: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_get_y", header: "godot/quat.h".}
|
importc: "godot_quat_get_y".}
|
||||||
proc `y=`*(self: var Quat; val: float32) {.
|
proc `y=`*(self: var Quat; val: float32) {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_set_y", header: "godot/quat.h".}
|
importc: "godot_quat_set_y".}
|
||||||
proc z*(self: Quat): float32 {.
|
proc z*(self: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_get_z", header: "godot/quat.h".}
|
importc: "godot_quat_get_z".}
|
||||||
proc `z=`*(self: var Quat; val: float32) {.
|
proc `z=`*(self: var Quat; val: float32) {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_set_z", header: "godot/quat.h".}
|
importc: "godot_quat_set_z".}
|
||||||
proc w*(self: Quat): float32 {.
|
proc w*(self: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_get_w", header: "godot/quat.h".}
|
importc: "godot_quat_get_w".}
|
||||||
proc `w=`*(self: var Quat; val: float32) {.
|
proc `w=`*(self: var Quat; val: float32) {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_set_w", header: "godot/quat.h".}
|
importc: "godot_quat_set_w".}
|
||||||
|
|
||||||
proc toGodotString*(self: Quat): GodotString {.
|
proc toGodotString*(self: Quat): GodotString {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_as_string", header: "godot/quat.h".}
|
importc: "godot_quat_as_string".}
|
||||||
proc `$`*(self: Quat): string {.inline.} =
|
proc `$`*(self: Quat): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
|
|
||||||
proc length*(self: Quat): float32 {.
|
proc length*(self: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_length", header: "godot/quat.h".}
|
importc: "godot_quat_length".}
|
||||||
proc lengthSquared*(self: Quat): float32 {.
|
proc lengthSquared*(self: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_length_squared", header: "godot/quat.h".}
|
importc: "godot_quat_length_squared".}
|
||||||
proc normalized*(self: Quat): Quat {.
|
proc normalized*(self: Quat): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_normalized", header: "godot/quat.h".}
|
importc: "godot_quat_normalized".}
|
||||||
proc isNormalized*(self: Quat): bool {.
|
proc isNormalized*(self: Quat): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_is_normalized", header: "godot/quat.h".}
|
importc: "godot_quat_is_normalized".}
|
||||||
proc inverse*(self: Quat): Quat {.
|
proc inverse*(self: Quat): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_inverse", header: "godot/quat.h".}
|
importc: "godot_quat_inverse".}
|
||||||
proc dot*(a, b: Quat): float32 {.
|
proc dot*(a, b: Quat): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_dot", header: "godot/quat.h".}
|
importc: "godot_quat_dot".}
|
||||||
proc xform*(self: Quat; v: Vector3): Vector3 {.
|
proc xform*(self: Quat; v: Vector3): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_xform", header: "godot/quat.h".}
|
importc: "godot_quat_xform".}
|
||||||
proc slerp*(self: Quat; b: Quat; t: float32): Quat {.
|
proc slerp*(self: Quat; b: Quat; t: float32): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_slerp", header: "godot/quat.h".}
|
importc: "godot_quat_slerp".}
|
||||||
proc slerpni*(self: Quat; b: Quat; t: float32): Quat {.
|
proc slerpni*(self: Quat; b: Quat; t: float32): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_slerpni", header: "godot/quat.h".}
|
importc: "godot_quat_slerpni".}
|
||||||
proc cubicSlerp*(self, b, pre_a, post_b: Quat;
|
proc cubicSlerp*(self, b, pre_a, post_b: Quat;
|
||||||
t: float32): Quat {.
|
t: float32): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_cubic_slerp",
|
importc: "godot_quat_cubic_slerp".}
|
||||||
header: "godot/quat.h".}
|
|
||||||
proc `*`*(a: Quat, b: float32): Quat {.
|
proc `*`*(a: Quat, b: float32): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_operator_multiply",
|
importc: "godot_quat_operator_multiply".}
|
||||||
header: "godot/quat.h".}
|
|
||||||
proc `*=`*(a: var Quat, b: float32) {.inline.} =
|
proc `*=`*(a: var Quat, b: float32) {.inline.} =
|
||||||
a = a * b
|
a = a * b
|
||||||
|
|
||||||
proc `+`*(a, b: Quat): Quat {.
|
proc `+`*(a, b: Quat): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_operator_add", header: "godot/quat.h".}
|
importc: "godot_quat_operator_add".}
|
||||||
proc `+=`*(a: var Quat, b: Quat) {.inline.} =
|
proc `+=`*(a: var Quat, b: Quat) {.inline.} =
|
||||||
a = a + b
|
a = a + b
|
||||||
|
|
||||||
proc `-`*(a, b: Quat): Quat {.
|
proc `-`*(a, b: Quat): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_operator_substract",
|
importc: "godot_quat_operator_substract".}
|
||||||
header: "godot/quat.h".}
|
|
||||||
proc `-=`* (a: var Quat, b: Quat) {.inline.} =
|
proc `-=`* (a: var Quat, b: Quat) {.inline.} =
|
||||||
a = a - b
|
a = a - b
|
||||||
|
|
||||||
proc `/`*(self: Quat; b: float32): Quat {.
|
proc `/`*(self: Quat; b: float32): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_operator_divide", header: "godot/quat.h".}
|
importc: "godot_quat_operator_divide".}
|
||||||
proc `/=`*(self: var Quat, b: float32) {.inline.} =
|
proc `/=`*(self: var Quat, b: float32) {.inline.} =
|
||||||
self = self / b
|
self = self / b
|
||||||
|
|
||||||
proc `==`*(a, b: Quat): bool {.
|
proc `==`*(a, b: Quat): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_operator_equal", header: "godot/quat.h".}
|
importc: "godot_quat_operator_equal".}
|
||||||
proc `-`*(self: Quat): Quat {.
|
proc `-`*(self: Quat): Quat {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_quat_operator_neg", header: "godot/quat.h".}
|
importc: "godot_quat_operator_neg".}
|
||||||
|
|
|
||||||
|
|
@ -3,66 +3,49 @@
|
||||||
import godotbase, vector2, strings
|
import godotbase, vector2, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Rect2* {.importc: "godot_rect2", header: "godot/rect2.h", byref.} = object
|
Rect2* {.byref.} = object
|
||||||
|
position*: Vector2
|
||||||
proc initRect2(dest: var Rect2; pos, size: Vector2) {.
|
size*: Vector2
|
||||||
importc: "godot_rect2_new_with_position_and_size",
|
|
||||||
header: "godot/rect2.h".}
|
|
||||||
proc initRect2(dest: var Rect2; x, y, sizeX, sizeY: float32) {.
|
|
||||||
importc: "godot_rect2_new", header: "godot/rect2.h".}
|
|
||||||
|
|
||||||
proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
proc initRect2*(pos, size: Vector2): Rect2 {.inline.} =
|
||||||
initRect2(result, pos, size)
|
Rect2(position: pos, size: size)
|
||||||
|
|
||||||
proc initRect2*(x, y, sizeX, sizeY: float32): Rect2 {.inline.} =
|
proc initRect2*(x, y, sizeX, sizeY: float32): Rect2 {.inline.} =
|
||||||
initRect2(result, x, y, sizeX, sizeY)
|
Rect2(position: vec2(x, y), size: vec2(sizeX, sizeY))
|
||||||
|
|
||||||
proc toGodotString*(self: Rect2): GodotString {.
|
proc toGodotString*(self: Rect2): GodotString {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_as_string", header: "godot/rect2.h".}
|
importc: "godot_rect2_as_string".}
|
||||||
proc `$`*(self: Rect2): string {.inline.} =
|
proc `$`*(self: Rect2): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
|
|
||||||
proc area*(self: Rect2): float32 {.
|
proc area*(self: Rect2): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_get_area", header: "godot/rect2.h".}
|
importc: "godot_rect2_get_area".}
|
||||||
proc intersects*(a, b: Rect2): bool {.
|
proc intersects*(a, b: Rect2): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_intersects", header: "godot/rect2.h".}
|
importc: "godot_rect2_intersects".}
|
||||||
proc encloses*(a, b: Rect2): bool {.
|
proc encloses*(a, b: Rect2): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_encloses", header: "godot/rect2.h".}
|
importc: "godot_rect2_encloses".}
|
||||||
proc hasNoArea*(self: Rect2): bool {.
|
proc hasNoArea*(self: Rect2): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_has_no_area", header: "godot/rect2.h".}
|
importc: "godot_rect2_has_no_area".}
|
||||||
proc clip*(a, b: Rect2): Rect2 {.
|
proc clip*(a, b: Rect2): Rect2 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_clip", header: "godot/rect2.h".}
|
importc: "godot_rect2_clip".}
|
||||||
proc merge*(a, b: Rect2): Rect2 {.
|
proc merge*(a, b: Rect2): Rect2 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_merge", header: "godot/rect2.h".}
|
importc: "godot_rect2_merge".}
|
||||||
proc contains*(self: Rect2; point: Vector2): bool {.
|
proc contains*(self: Rect2; point: Vector2): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_has_point", header: "godot/rect2.h".}
|
importc: "godot_rect2_has_point".}
|
||||||
proc grow*(self: Rect2; by: float32): Rect2 {.
|
proc grow*(self: Rect2; by: float32): Rect2 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_grow", header: "godot/rect2.h".}
|
importc: "godot_rect2_grow".}
|
||||||
proc expand*(self: Rect2; to: Vector2): Rect2 {.
|
proc expand*(self: Rect2; to: Vector2): Rect2 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_expand", header: "godot/rect2.h".}
|
importc: "godot_rect2_expand".}
|
||||||
proc `==`*(a, b: Rect2): bool {.
|
proc `==`*(a, b: Rect2): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect2_operator_equal",
|
importc: "godot_rect2_operator_equal".}
|
||||||
header: "godot/rect2.h".}
|
|
||||||
proc position*(self: Rect2): Vector2 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect2_get_position", header: "godot/rect2.h".}
|
|
||||||
proc size*(self: Rect2): Vector2 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect2_get_size", header: "godot/rect2.h".}
|
|
||||||
proc setPosition*(self: var Rect2; pos: Vector2) {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect2_set_position", header: "godot/rect2.h".}
|
|
||||||
proc setSize*(self: var Rect2; size: Vector2) {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect2_set_size", header: "godot/rect2.h".}
|
|
||||||
|
|
|
||||||
|
|
@ -3,98 +3,78 @@
|
||||||
import godotbase, plane, vector3, strings
|
import godotbase, plane, vector3, strings
|
||||||
|
|
||||||
type
|
type
|
||||||
Rect3* {.importc: "godot_rect3", header: "godot/rect3.h", byref.} = object
|
Rect3* {.byref.} = object
|
||||||
|
position*: Vector3
|
||||||
proc initRect3(dest: var Rect3; pos, size: Vector3) {.
|
size*: Vector3
|
||||||
importc: "godot_rect3_new", header: "godot/rect3.h".}
|
|
||||||
|
|
||||||
proc initRect3*(pos, size: Vector3): Rect3 {.inline.} =
|
proc initRect3*(pos, size: Vector3): Rect3 {.inline.} =
|
||||||
initRect3(result, pos, size)
|
Rect3(position: pos, size: size)
|
||||||
|
|
||||||
proc position*(self: Rect3): Vector3 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect3_get_position", header: "godot/rect3.h".}
|
|
||||||
proc setPosition*(self: var Rect3; v: Vector3) {.
|
|
||||||
noSideEffect
|
|
||||||
importc: "godot_rect3_set_position", header: "godot/rect3.h".}
|
|
||||||
proc size*(self: Rect3): Vector3 {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect3_get_size", header: "godot/rect3.h".}
|
|
||||||
proc setSize*(self: var Rect3; v: Vector3) {.
|
|
||||||
noSideEffect,
|
|
||||||
importc: "godot_rect3_set_size", header: "godot/rect3.h".}
|
|
||||||
proc toGodotString*(self: Rect3): GodotString {.
|
proc toGodotString*(self: Rect3): GodotString {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_as_string", header: "godot/rect3.h".}
|
importc: "godot_rect3_as_string".}
|
||||||
proc `$`*(self: Rect3): string {.inline.} =
|
proc `$`*(self: Rect3): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
proc area*(self: Rect3): float32 {.
|
proc area*(self: Rect3): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_area", header: "godot/rect3.h".}
|
importc: "godot_rect3_get_area".}
|
||||||
proc hasNoArea*(self: Rect3): bool {.
|
proc hasNoArea*(self: Rect3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_has_no_area", header: "godot/rect3.h".}
|
importc: "godot_rect3_has_no_area".}
|
||||||
proc hasNoSurface*(self: Rect3): bool {.
|
proc hasNoSurface*(self: Rect3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_has_no_surface", header: "godot/rect3.h".}
|
importc: "godot_rect3_has_no_surface".}
|
||||||
proc intersects*(a, b: Rect3): bool {.
|
proc intersects*(a, b: Rect3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_intersects", header: "godot/rect3.h".}
|
importc: "godot_rect3_intersects".}
|
||||||
proc encloses*(self, other: Rect3): bool {.
|
proc encloses*(self, other: Rect3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_encloses", header: "godot/rect3.h".}
|
importc: "godot_rect3_encloses".}
|
||||||
proc merge*(self, other: Rect3): Rect3 {.
|
proc merge*(self, other: Rect3): Rect3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_merge", header: "godot/rect3.h".}
|
importc: "godot_rect3_merge".}
|
||||||
proc intersection*(self, other: Rect3): Rect3 {.
|
proc intersection*(self, other: Rect3): Rect3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_intersection", header: "godot/rect3.h".}
|
importc: "godot_rect3_intersection".}
|
||||||
proc intersectsPlane*(self: Rect3; plane: Plane): bool {.
|
proc intersectsPlane*(self: Rect3; plane: Plane): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_intersects_plane",
|
importc: "godot_rect3_intersects_plane".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {.
|
proc intersectsSegment*(self: Rect3; start, to: Vector3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_intersects_segment",
|
importc: "godot_rect3_intersects_segment".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
proc contains*(self: Rect3; point: Vector3): bool {.
|
proc contains*(self: Rect3; point: Vector3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_has_point", header: "godot/rect3.h".}
|
importc: "godot_rect3_has_point".}
|
||||||
proc getSupport*(self: Rect3; dir: Vector3): Vector3 {.
|
proc getSupport*(self: Rect3; dir: Vector3): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_support", header: "godot/rect3.h".}
|
importc: "godot_rect3_get_support".}
|
||||||
proc getLongestAxis*(self: Rect3): Vector3 {.
|
proc getLongestAxis*(self: Rect3): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_longest_axis", header: "godot/rect3.h".}
|
importc: "godot_rect3_get_longest_axis".}
|
||||||
proc getLongestAxisIndex*(self: Rect3): cint {.
|
proc getLongestAxisIndex*(self: Rect3): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_longest_axis_index",
|
importc: "godot_rect3_get_longest_axis_index".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
proc getLongestAxisSize*(self: Rect3): float32 {.
|
proc getLongestAxisSize*(self: Rect3): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_longest_axis_size",
|
importc: "godot_rect3_get_longest_axis_size".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
proc getShortestAxis*(self: Rect3): Vector3 {.
|
proc getShortestAxis*(self: Rect3): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_shortest_axis", header: "godot/rect3.h".}
|
importc: "godot_rect3_get_shortest_axis".}
|
||||||
proc getShortestAxisIndex*(self: Rect3): cint {.
|
proc getShortestAxisIndex*(self: Rect3): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_shortest_axis_index",
|
importc: "godot_rect3_get_shortest_axis_index".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
proc getShortestAxisSize*(self: Rect3): float32 {.
|
proc getShortestAxisSize*(self: Rect3): float32 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_shortest_axis_size",
|
importc: "godot_rect3_get_shortest_axis_size".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
proc expand*(self: Rect3; toPoint: Vector3): Rect3 {.
|
proc expand*(self: Rect3; toPoint: Vector3): Rect3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_expand", header: "godot/rect3.h".}
|
importc: "godot_rect3_expand".}
|
||||||
proc grow*(self: Rect3; by: float32): Rect3 {.
|
proc grow*(self: Rect3; by: float32): Rect3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_grow", header: "godot/rect3.h".}
|
importc: "godot_rect3_grow".}
|
||||||
proc getEndpoint*(self: Rect3; idx: cint): Vector3 {.
|
proc getEndpoint*(self: Rect3; idx: cint): Vector3 {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_get_endpoint", header: "godot/rect3.h".}
|
importc: "godot_rect3_get_endpoint".}
|
||||||
proc `==`*(a, b: Rect3): bool {.
|
proc `==`*(a, b: Rect3): bool {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rect3_operator_equal",
|
importc: "godot_rect3_operator_equal".}
|
||||||
header: "godot/rect3.h".}
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
import godotbase
|
import godotbase
|
||||||
|
|
||||||
type
|
type
|
||||||
RID* {.importc: "godot_rid", header: "godot/rid.h", byref.} = object
|
RID* {.byref.} = object
|
||||||
|
p: pointer
|
||||||
|
|
||||||
proc initRID(dest: var RID) {.
|
proc initRID(dest: var RID) {.
|
||||||
importc: "godot_rid_new",
|
importc: "godot_rid_new".}
|
||||||
header: "godot/rid.h".}
|
|
||||||
proc initRID(dest: var RID; obj: ptr GodotObject) {.
|
proc initRID(dest: var RID; obj: ptr GodotObject) {.
|
||||||
importc: "godot_rid_new_with_resource", header: "godot/rid.h".}
|
importc: "godot_rid_new_with_resource".}
|
||||||
|
|
||||||
proc initRID*(): RID {.inline.} =
|
proc initRID*(): RID {.inline.} =
|
||||||
initRID(result)
|
initRID(result)
|
||||||
|
|
@ -17,12 +17,12 @@ proc initRID*(obj: ptr GodotObject): RID {.inline.} =
|
||||||
|
|
||||||
proc idCInt(self: RID): cint {.
|
proc idCInt(self: RID): cint {.
|
||||||
noSideEffect,
|
noSideEffect,
|
||||||
importc: "godot_rid_get_id", header: "godot/rid.h".}
|
importc: "godot_rid_get_id".}
|
||||||
|
|
||||||
proc id*(self: RID): uint32 {.inline.} =
|
proc id*(self: RID): uint32 {.inline.} =
|
||||||
cast[uint32](self.idCInt())
|
cast[uint32](self.idCInt())
|
||||||
|
|
||||||
proc `==`*(a, b: RID): bool {.
|
proc `==`*(a, b: RID): bool {.
|
||||||
importc: "godot_rid_operator_equal", header: "godot/rid.h".}
|
importc: "godot_rid_operator_equal".}
|
||||||
proc `<`*(a, b: RID): bool {.
|
proc `<`*(a, b: RID): bool {.
|
||||||
importc: "godot_rid_operator_less", header: "godot/rid.h".}
|
importc: "godot_rid_operator_less".}
|
||||||
|
|
|
||||||
|
|
@ -3,22 +3,21 @@
|
||||||
import godotbase
|
import godotbase
|
||||||
|
|
||||||
type
|
type
|
||||||
GodotString* {.importc: "godot_string", header: "godot/string.h",
|
GodotString* {.byref.} = object
|
||||||
byref.} = object
|
p: pointer
|
||||||
|
|
||||||
proc initGodotString(dest: var GodotString) {.
|
proc initGodotString(dest: var GodotString) {.
|
||||||
importc: "godot_string_new", header: "godot/string.h".}
|
importc: "godot_string_new".}
|
||||||
proc initGodotString(dest: var GodotString; src: GodotString) {.
|
proc initGodotString(dest: var GodotString; src: GodotString) {.
|
||||||
importc: "godot_string_new_copy", header: "godot/string.h".}
|
importc: "godot_string_new_copy".}
|
||||||
proc initGodotString(dest: var GodotString; contents: cstring;
|
proc initGodotString(dest: var GodotString; contents: cstring;
|
||||||
size: cint) {.
|
size: cint) {.
|
||||||
importc: "godot_string_new_data", header: "godot/string.h".}
|
importc: "godot_string_new_data".}
|
||||||
## Initializes ``dest`` from UTF-8 ``contents``
|
## Initializes ``dest`` from UTF-8 ``contents``
|
||||||
proc getData(self: GodotString; dest: cstring;
|
proc getData(self: GodotString; dest: cstring;
|
||||||
size: var cint) {.
|
size: var cint) {.
|
||||||
noSideEffect
|
noSideEffect
|
||||||
importc: "godot_string_get_data",
|
importc: "godot_string_get_data".}
|
||||||
header: "godot/string.h".}
|
|
||||||
## Converts ``self`` into UTF-8 encoding, putting the result into ``dest``.
|
## Converts ``self`` into UTF-8 encoding, putting the result into ``dest``.
|
||||||
|
|
||||||
proc len*(self: GodotString): cint {.inline.} =
|
proc len*(self: GodotString): cint {.inline.} =
|
||||||
|
|
@ -26,19 +25,15 @@ proc len*(self: GodotString): cint {.inline.} =
|
||||||
getData(self, nil, result)
|
getData(self, nil, result)
|
||||||
|
|
||||||
proc cstring*(self: GodotString): cstring {.
|
proc cstring*(self: GodotString): cstring {.
|
||||||
importc: "godot_string_c_str", header: "godot/string.h".}
|
importc: "godot_string_c_str".}
|
||||||
proc `==`*(self, b: GodotString): bool {.
|
proc `==`*(self, b: GodotString): bool {.
|
||||||
importc: "godot_string_operator_equal",
|
importc: "godot_string_operator_equal".}
|
||||||
header: "godot/string.h".}
|
|
||||||
proc `<`*(self, b: GodotString): bool {.
|
proc `<`*(self, b: GodotString): bool {.
|
||||||
importc: "godot_string_operator_less",
|
importc: "godot_string_operator_less".}
|
||||||
header: "godot/string.h".}
|
|
||||||
proc `&`*(self, b: GodotString): GodotString {.
|
proc `&`*(self, b: GodotString): GodotString {.
|
||||||
importc: "godot_string_operator_plus",
|
importc: "godot_string_operator_plus".}
|
||||||
header: "godot/string.h".}
|
|
||||||
|
|
||||||
proc deinit*(self: var GodotString) {.importc: "godot_string_destroy",
|
proc deinit*(self: var GodotString) {.importc: "godot_string_destroy".}
|
||||||
header: "godot/string.h".}
|
|
||||||
proc `=destroy`(self: GodotString) {.inline.} =
|
proc `=destroy`(self: GodotString) {.inline.} =
|
||||||
unsafeAddr(self).deinit()
|
unsafeAddr(self).deinit()
|
||||||
|
|
||||||
|
|
@ -66,3 +61,14 @@ proc toGodotString*(s: cstring): GodotString {.inline.} =
|
||||||
initGodotString(result)
|
initGodotString(result)
|
||||||
else:
|
else:
|
||||||
initGodotString(result, s, cint(s.len + 1))
|
initGodotString(result, s, cint(s.len + 1))
|
||||||
|
|
||||||
|
proc godotPrint(message: GodotString) {.
|
||||||
|
importc: "godot_print".}
|
||||||
|
|
||||||
|
proc print*(message: string) {.inline.} =
|
||||||
|
let s = message.toGodotString()
|
||||||
|
godotPrint(s)
|
||||||
|
|
||||||
|
proc print*(message: cstring) {.inline.} =
|
||||||
|
let s = message.toGodotString()
|
||||||
|
godotPrint(s)
|
||||||
|
|
|
||||||
|
|
@ -1,82 +1,64 @@
|
||||||
# Copyright (c) 2017 Xored Software, Inc.
|
# Copyright (c) 2017 Xored Software, Inc.
|
||||||
|
|
||||||
|
import godotbase, basis, vector3, strings, plane, rect3
|
||||||
|
|
||||||
type
|
type
|
||||||
Transform* {.importc: "godot_transform", header: "godot/transform.h",
|
Transform* {.byref.} = object
|
||||||
byref.} = object
|
basis*: Basis
|
||||||
|
origin*: Vector3
|
||||||
import godotbase, basis, variant, vector3, strings, plane, rect3
|
|
||||||
|
|
||||||
proc initTransform(dest: var Transform) {.
|
|
||||||
importc: "godot_transform_new_identity", header: "godot/transform.h".}
|
|
||||||
## Initializes the ``dest`` as identity transform.
|
|
||||||
proc initTransform(dest: var Transform;
|
|
||||||
xAxis, yAxis, zAxis, origin: Vector3) {.
|
|
||||||
importc: "godot_transform_new_with_axis_origin",
|
|
||||||
header: "godot/transform.h".}
|
|
||||||
proc initTransform(dest: var Transform; basis: Basis;
|
|
||||||
origin: Vector3) {.
|
|
||||||
importc: "godot_transform_new",
|
|
||||||
header: "godot/transform.h".}
|
|
||||||
|
|
||||||
proc initTransform*(): Transform {.inline.} =
|
proc initTransform*(): Transform {.inline.} =
|
||||||
initTransform(result)
|
discard
|
||||||
|
|
||||||
proc initTransform*(xAxis, yAxis, zAxis,
|
proc initTransform*(xAxis, yAxis, zAxis,
|
||||||
origin: Vector3): Transform {.inline.} =
|
origin: Vector3): Transform {.inline.} =
|
||||||
initTransform(result, xAxis, yAxis, zAxis, origin)
|
var basis: Basis
|
||||||
|
basis.setAxis(0, xAxis)
|
||||||
|
basis.setAxis(1, yAxis)
|
||||||
|
basis.setAxis(2, zAxis)
|
||||||
|
Transform(basis: basis, origin: origin)
|
||||||
|
|
||||||
proc initTransform*(basis: Basis, origin: Vector3): Transform {.inline.} =
|
proc initTransform*(basis: Basis, origin: Vector3): Transform {.inline.} =
|
||||||
initTransform(result, basis, origin)
|
Transform(basis: basis, origin: origin)
|
||||||
|
|
||||||
proc basis*(self: Transform): Basis {.
|
|
||||||
importc: "godot_transform_get_basis", header: "godot/transform.h".}
|
|
||||||
proc `basis=`*(self: var Transform; v: Basis) {.
|
|
||||||
importc: "godot_transform_set_basis", header: "godot/transform.h".}
|
|
||||||
proc origin*(self: Transform): Vector3 {.
|
|
||||||
importc: "godot_transform_get_origin", header: "godot/transform.h".}
|
|
||||||
proc `origin=`*(self: var Transform; v: Vector3) {.
|
|
||||||
importc: "godot_transform_set_origin", header: "godot/transform.h".}
|
|
||||||
|
|
||||||
proc toGodotString*(self: Transform): GodotString {.
|
proc toGodotString*(self: Transform): GodotString {.
|
||||||
importc: "godot_transform_as_string", header: "godot/transform.h".}
|
importc: "godot_transform_as_string".}
|
||||||
proc `$`*(self: Transform): string {.inline.} =
|
proc `$`*(self: Transform): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
|
|
||||||
proc inverse*(self: Transform): Transform {.
|
proc inverse*(self: Transform): Transform {.
|
||||||
importc: "godot_transform_inverse", header: "godot/transform.h".}
|
importc: "godot_transform_inverse".}
|
||||||
proc affineInverse*(self: Transform): Transform {.
|
proc affineInverse*(self: Transform): Transform {.
|
||||||
importc: "godot_transform_affine_inverse",
|
importc: "godot_transform_affine_inverse".}
|
||||||
header: "godot/transform.h".}
|
|
||||||
proc orthonormalized*(self: Transform): Transform {.
|
proc orthonormalized*(self: Transform): Transform {.
|
||||||
importc: "godot_transform_orthonormalized",
|
importc: "godot_transform_orthonormalized".}
|
||||||
header: "godot/transform.h".}
|
|
||||||
proc rotated*(self: Transform; axis: Vector3;
|
proc rotated*(self: Transform; axis: Vector3;
|
||||||
phi: float32): Transform {.
|
phi: float32): Transform {.
|
||||||
importc: "godot_transform_rotated", header: "godot/transform.h".}
|
importc: "godot_transform_rotated".}
|
||||||
proc scaled*(self: Transform; scale: Vector3): Transform {.
|
proc scaled*(self: Transform; scale: Vector3): Transform {.
|
||||||
importc: "godot_transform_scaled", header: "godot/transform.h".}
|
importc: "godot_transform_scaled".}
|
||||||
proc translated*(self: Transform; offset: Vector3): Transform {.
|
proc translated*(self: Transform; offset: Vector3): Transform {.
|
||||||
importc: "godot_transform_translated", header: "godot/transform.h".}
|
importc: "godot_transform_translated".}
|
||||||
proc lookingAt*(self: Transform;
|
proc lookingAt*(self: Transform;
|
||||||
target, up: Vector3): Transform {.
|
target, up: Vector3): Transform {.
|
||||||
importc: "godot_transform_looking_at", header: "godot/transform.h".}
|
importc: "godot_transform_looking_at".}
|
||||||
|
|
||||||
proc xformPlane*(self: Transform; v: Plane): Plane {.
|
proc xformPlane*(self: Transform; v: Plane): Plane {.
|
||||||
importc: "godot_transform_xform_plane", header: "godot/transform.h".}
|
importc: "godot_transform_xform_plane".}
|
||||||
proc xformInvPlane*(self: Transform; v: Plane): Plane {.
|
proc xformInvPlane*(self: Transform; v: Plane): Plane {.
|
||||||
importc: "godot_transform_xform_inv_plane", header: "godot/transform.h".}
|
importc: "godot_transform_xform_inv_plane".}
|
||||||
proc xformVector3*(self: Transform; v: Vector3): Vector3 {.
|
proc xformVector3*(self: Transform; v: Vector3): Vector3 {.
|
||||||
importc: "godot_transform_xform_vector3", header: "godot/transform.h".}
|
importc: "godot_transform_xform_vector3".}
|
||||||
proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {.
|
proc xformInvVector3*(self: Transform; v: Vector3): Vector3 {.
|
||||||
importc: "godot_transform_xform_inv_vector3", header: "godot/transform.h".}
|
importc: "godot_transform_xform_inv_vector3".}
|
||||||
proc xformRect3*(self: Transform; v: Vector3): Rect3 {.
|
proc xformRect3*(self: Transform; v: Vector3): Rect3 {.
|
||||||
importc: "godot_transform_xform_rect3", header: "godot/transform.h".}
|
importc: "godot_transform_xform_rect3".}
|
||||||
proc xformInvRect3*(self: Transform; v: Vector3): Vector3 {.
|
proc xformInvRect3*(self: Transform; v: Vector3): Vector3 {.
|
||||||
importc: "godot_transform_xform_inv_rect3", header: "godot/transform.h".}
|
importc: "godot_transform_xform_inv_rect3".}
|
||||||
|
|
||||||
proc `==`*(self: Transform; b: Transform): bool {.
|
proc `==`*(self: Transform; b: Transform): bool {.
|
||||||
importc: "godot_transform_operator_equal", header: "godot/transform.h".}
|
importc: "godot_transform_operator_equal".}
|
||||||
proc `*`*(a, b: Transform): Transform {.
|
proc `*`*(a, b: Transform): Transform {.
|
||||||
importc: "godot_transform_operator_multiply", header: "godot/transform.h".}
|
importc: "godot_transform_operator_multiply".}
|
||||||
proc `*=`*(a: var Transform, b: Transform) {.inline.} =
|
proc `*=`*(a: var Transform, b: Transform) {.inline.} =
|
||||||
a = a * b
|
a = a * b
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
# Copyright (c) 2017 Xored Software, Inc.
|
# Copyright (c) 2017 Xored Software, Inc.
|
||||||
|
|
||||||
type
|
import godotbase, strings, vector2, rect2
|
||||||
Transform2D* {.importc: "godot_transform2d", header: "godot/transform2d.h",
|
|
||||||
byref.} = object
|
|
||||||
|
|
||||||
import godotbase, strings, variant, vector2, rect2
|
type
|
||||||
|
Transform2D* {.byref.} = object
|
||||||
|
elements: array[3, Vector2]
|
||||||
|
|
||||||
proc initTransform2D(dest: var Transform2D) {.
|
proc initTransform2D(dest: var Transform2D) {.
|
||||||
importc: "godot_transform2d_new_identity", header: "godot/transform2d.h".}
|
importc: "godot_transform2d_new_identity".}
|
||||||
proc initTransform2D(dest: var Transform2D; rot: float32; pos: Vector2) {.
|
proc initTransform2D(dest: var Transform2D; rot: float32; pos: Vector2) {.
|
||||||
importc: "godot_transform2d_new", header: "godot/transform2d.h".}
|
importc: "godot_transform2d_new".}
|
||||||
proc initTransform2D(dest: var Transform2D; xAxis, yAxis, origin: Vector2) {.
|
proc initTransform2D(dest: var Transform2D; xAxis, yAxis, origin: Vector2) {.
|
||||||
importc: "godot_transform2d_new_axis_origin",
|
importc: "godot_transform2d_new_axis_origin".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
|
|
||||||
proc initTransform2D*(): Transform2D {.inline.} =
|
proc initTransform2D*(): Transform2D {.inline.} =
|
||||||
initTransform2D(result)
|
initTransform2D(result)
|
||||||
|
|
@ -24,68 +23,51 @@ proc initTransform2D*(xAxis, yAxis, origin: Vector2): Transform2D {.inline.} =
|
||||||
initTransform2D(result, xAxis, yAxis, origin)
|
initTransform2D(result, xAxis, yAxis, origin)
|
||||||
|
|
||||||
proc toGodotString*(self: Transform2D): GodotString {.
|
proc toGodotString*(self: Transform2D): GodotString {.
|
||||||
importc: "godot_transform2d_as_string",
|
importc: "godot_transform2d_as_string".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc `$`*(self: Transform2D): string {.inline.} =
|
proc `$`*(self: Transform2D): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
|
|
||||||
proc inverse*(self: Transform2D): Transform2D {.
|
proc inverse*(self: Transform2D): Transform2D {.
|
||||||
importc: "godot_transform2d_inverse", header: "godot/transform2d.h".}
|
importc: "godot_transform2d_inverse".}
|
||||||
proc affineInverse*(self: Transform2D): Transform2D {.
|
proc affineInverse*(self: Transform2D): Transform2D {.
|
||||||
importc: "godot_transform2d_affine_inverse",
|
importc: "godot_transform2d_affine_inverse".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc rotation*(self: Transform2D): float32 {.
|
proc rotation*(self: Transform2D): float32 {.
|
||||||
importc: "godot_transform2d_get_rotation",
|
importc: "godot_transform2d_get_rotation".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc origin*(self: Transform2D): Vector2 {.
|
proc origin*(self: Transform2D): Vector2 {.
|
||||||
importc: "godot_transform2d_get_origin",
|
importc: "godot_transform2d_get_origin".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc scale*(self: Transform2D): Vector2 {.
|
proc scale*(self: Transform2D): Vector2 {.
|
||||||
importc: "godot_transform2d_get_scale",
|
importc: "godot_transform2d_get_scale".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc orthonormalized*(self: Transform2D): Transform2D {.
|
proc orthonormalized*(self: Transform2D): Transform2D {.
|
||||||
importc: "godot_transform2d_orthonormalized",
|
importc: "godot_transform2d_orthonormalized".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc rotated*(self: Transform2D; phi: float32): Transform2D {.
|
proc rotated*(self: Transform2D; phi: float32): Transform2D {.
|
||||||
importc: "godot_transform2d_rotated",
|
importc: "godot_transform2d_rotated".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc scaled*(self: Transform2D; scale: Vector2): Transform2D {.
|
proc scaled*(self: Transform2D; scale: Vector2): Transform2D {.
|
||||||
importc: "godot_transform2d_scaled",
|
importc: "godot_transform2d_scaled".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc translated*(self: Transform2D;
|
proc translated*(self: Transform2D;
|
||||||
offset: Vector2): Transform2D {.
|
offset: Vector2): Transform2D {.
|
||||||
importc: "godot_transform2d_translated",
|
importc: "godot_transform2d_translated".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
proc xformVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
||||||
importc: "godot_transform2d_xform_vector2",
|
importc: "godot_transform2d_xform_vector2".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
proc xformInvVector2*(self: Transform2D; v: Vector2): Vector2 {.
|
||||||
importc: "godot_transform2d_xform_inv_vector2",
|
importc: "godot_transform2d_xform_inv_vector2".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc basisXformVector2*(self: Transform2D;
|
proc basisXformVector2*(self: Transform2D;
|
||||||
v: Vector2): Vector2 {.
|
v: Vector2): Vector2 {.
|
||||||
importc: "godot_transform2d_basis_xform_vector2",
|
importc: "godot_transform2d_basis_xform_vector2".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc basisXformInvVector2*(self: Transform2D;
|
proc basisXformInvVector2*(self: Transform2D;
|
||||||
v: Vector2): Vector2 {.
|
v: Vector2): Vector2 {.
|
||||||
importc: "godot_transform2d_basis_xform_inv_vector2",
|
importc: "godot_transform2d_basis_xform_inv_vector2".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc xformRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
proc xformRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
||||||
importc: "godot_transform2d_xform_rect2", header: "godot/transform2d.h".}
|
importc: "godot_transform2d_xform_rect2".}
|
||||||
proc xformInvRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
proc xformInvRect2*(self: Transform2D; v: Rect2): Rect2 {.
|
||||||
importc: "godot_transform2d_xform_inv_rect2",
|
importc: "godot_transform2d_xform_inv_rect2".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
|
|
||||||
proc interpolateWith*(self, m: Transform2D;
|
proc interpolateWith*(self, m: Transform2D;
|
||||||
c: float32): Transform2D {.
|
c: float32): Transform2D {.
|
||||||
importc: "godot_transform2d_interpolate_with",
|
importc: "godot_transform2d_interpolate_with".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc `==`*(a, b: Transform2D): bool {.
|
proc `==`*(a, b: Transform2D): bool {.
|
||||||
importc: "godot_transform2d_operator_equal",
|
importc: "godot_transform2d_operator_equal".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
proc `*`*(a, b: Transform2D): Transform2D {.
|
proc `*`*(a, b: Transform2D): Transform2D {.
|
||||||
importc: "godot_transform2d_operator_multiply",
|
importc: "godot_transform2d_operator_multiply".}
|
||||||
header: "godot/transform2d.h".}
|
|
||||||
|
|
||||||
proc `*=`*(a: var Transform2D, b: Transform2D) {.inline.} =
|
proc `*=`*(a: var Transform2D, b: Transform2D) {.inline.} =
|
||||||
a = a * b
|
a = a * b
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,7 @@ import strings, transform, transform2d, vector2
|
||||||
import vector3, color
|
import vector3, color
|
||||||
|
|
||||||
type
|
type
|
||||||
VariantType* {.importc: "godot_variant_type", header: "godot/variant.h",
|
VariantType* {.size: sizeof(cint), pure.} = enum
|
||||||
size: sizeof(cint), pure.} = enum
|
|
||||||
Nil, ## atomic types
|
Nil, ## atomic types
|
||||||
Bool,
|
Bool,
|
||||||
Int,
|
Int,
|
||||||
|
|
@ -38,10 +37,7 @@ type
|
||||||
PoolVector3Array,
|
PoolVector3Array,
|
||||||
PoolColorArray
|
PoolColorArray
|
||||||
|
|
||||||
VariantCallErrorType* {.importc: "godot_variant_call_error_error",
|
VariantCallErrorType* {.size: sizeof(cint), pure.} = enum
|
||||||
header: "godot/variant.h",
|
|
||||||
size: sizeof(cint),
|
|
||||||
pure.} = enum
|
|
||||||
OK,
|
OK,
|
||||||
InvalidMethod,
|
InvalidMethod,
|
||||||
InvalidArgument,
|
InvalidArgument,
|
||||||
|
|
@ -49,80 +45,69 @@ type
|
||||||
TooFewArguments,
|
TooFewArguments,
|
||||||
InstanceIsNull
|
InstanceIsNull
|
||||||
|
|
||||||
VariantCallError* {.importc: "godot_variant_call_error",
|
VariantCallError* = object
|
||||||
header: "godot/variant.h".} = object
|
error*: VariantCallErrorType
|
||||||
error* {.importc: "error".}: VariantCallErrorType
|
argument*: cint
|
||||||
argument* {.importc: "argument".}: cint
|
expected*: VariantType
|
||||||
expected* {.importc: "expected".}: VariantType
|
|
||||||
|
|
||||||
proc getType*(p: Variant): VariantType {.
|
proc getType*(p: Variant): VariantType {.
|
||||||
importc: "godot_variant_get_type", header: "godot/variant.h".}
|
importc: "godot_variant_get_type".}
|
||||||
|
|
||||||
proc initNilVariant(dest: var Variant) {.
|
proc initNilVariant(dest: var Variant) {.
|
||||||
importc: "godot_variant_new_nil", header: "godot/variant.h".}
|
importc: "godot_variant_new_nil".}
|
||||||
proc initVariant(dest: var Variant; b: bool) {.
|
proc initVariant(dest: var Variant; b: bool) {.
|
||||||
importc: "godot_variant_new_bool", header: "godot/variant.h".}
|
importc: "godot_variant_new_bool".}
|
||||||
proc initVariant(dest: var Variant; i: uint64) {.
|
proc initVariant(dest: var Variant; i: uint64) {.
|
||||||
importc: "godot_variant_new_uint", header: "godot/variant.h".}
|
importc: "godot_variant_new_uint".}
|
||||||
proc initVariant(dest: var Variant; i: int64) {.
|
proc initVariant(dest: var Variant; i: int64) {.
|
||||||
importc: "godot_variant_new_int", header: "godot/variant.h".}
|
importc: "godot_variant_new_int".}
|
||||||
proc initVariant(dest: var Variant; r: cdouble) {.
|
proc initVariant(dest: var Variant; r: cdouble) {.
|
||||||
importc: "godot_variant_new_real", header: "godot/variant.h".}
|
importc: "godot_variant_new_real".}
|
||||||
proc initVariant(dest: var Variant; s: GodotString) {.
|
proc initVariant(dest: var Variant; s: GodotString) {.
|
||||||
importc: "godot_variant_new_string", header: "godot/variant.h".}
|
importc: "godot_variant_new_string".}
|
||||||
proc initVariant(dest: var Variant; v2: Vector2) {.
|
proc initVariant(dest: var Variant; v2: Vector2) {.
|
||||||
importc: "godot_variant_new_vector2", header: "godot/variant.h".}
|
importc: "godot_variant_new_vector2".}
|
||||||
proc initVariant(dest: var Variant; rect2: Rect2) {.
|
proc initVariant(dest: var Variant; rect2: Rect2) {.
|
||||||
importc: "godot_variant_new_rect2", header: "godot/variant.h".}
|
importc: "godot_variant_new_rect2".}
|
||||||
proc initVariant(dest: var Variant; v3: Vector3) {.
|
proc initVariant(dest: var Variant; v3: Vector3) {.
|
||||||
importc: "godot_variant_new_vector3", header: "godot/variant.h".}
|
importc: "godot_variant_new_vector3".}
|
||||||
proc initVariant(dest: var Variant; t2d: Transform2D) {.
|
proc initVariant(dest: var Variant; t2d: Transform2D) {.
|
||||||
importc: "godot_variant_new_transform2d",
|
importc: "godot_variant_new_transform2d".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; plane: Plane) {.
|
proc initVariant(dest: var Variant; plane: Plane) {.
|
||||||
importc: "godot_variant_new_plane", header: "godot/variant.h".}
|
importc: "godot_variant_new_plane".}
|
||||||
proc initVariant(dest: var Variant; quat: Quat) {.
|
proc initVariant(dest: var Variant; quat: Quat) {.
|
||||||
importc: "godot_variant_new_quat", header: "godot/variant.h".}
|
importc: "godot_variant_new_quat".}
|
||||||
proc initVariant(dest: var Variant; rect3: Rect3) {.
|
proc initVariant(dest: var Variant; rect3: Rect3) {.
|
||||||
importc: "godot_variant_new_rect3", header: "godot/variant.h".}
|
importc: "godot_variant_new_rect3".}
|
||||||
proc initVariant(dest: var Variant; basis: Basis) {.
|
proc initVariant(dest: var Variant; basis: Basis) {.
|
||||||
importc: "godot_variant_new_basis", header: "godot/variant.h".}
|
importc: "godot_variant_new_basis".}
|
||||||
proc initVariant(dest: var Variant;
|
proc initVariant(dest: var Variant;
|
||||||
trans: Transform) {.
|
trans: Transform) {.
|
||||||
importc: "godot_variant_new_transform",
|
importc: "godot_variant_new_transform".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; color: Color) {.
|
proc initVariant(dest: var Variant; color: Color) {.
|
||||||
importc: "godot_variant_new_color", header: "godot/variant.h".}
|
importc: "godot_variant_new_color".}
|
||||||
proc initVariant(dest: var Variant; nodePath: NodePath) {.
|
proc initVariant(dest: var Variant; nodePath: NodePath) {.
|
||||||
importc: "godot_variant_new_node_path",
|
importc: "godot_variant_new_node_path".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; rid: RID) {.
|
proc initVariant(dest: var Variant; rid: RID) {.
|
||||||
importc: "godot_variant_new_rid", header: "godot/variant.h".}
|
importc: "godot_variant_new_rid".}
|
||||||
proc initVariant(dest: var Variant; obj: ptr GodotObject) {.
|
proc initVariant(dest: var Variant; obj: ptr GodotObject) {.
|
||||||
importc: "godot_variant_new_object", header: "godot/variant.h".}
|
importc: "godot_variant_new_object".}
|
||||||
proc initVariant(dest: var Variant; arr: Array) {.
|
proc initVariant(dest: var Variant; arr: Array) {.
|
||||||
importc: "godot_variant_new_array", header: "godot/variant.h".}
|
importc: "godot_variant_new_array".}
|
||||||
proc initVariant(dest: var Variant; pba: PoolByteArray) {.
|
proc initVariant(dest: var Variant; pba: PoolByteArray) {.
|
||||||
importc: "godot_variant_new_pool_byte_array",
|
importc: "godot_variant_new_pool_byte_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; pia: PoolIntArray) {.
|
proc initVariant(dest: var Variant; pia: PoolIntArray) {.
|
||||||
importc: "godot_variant_new_pool_int_array",
|
importc: "godot_variant_new_pool_int_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; pra: PoolRealArray) {.
|
proc initVariant(dest: var Variant; pra: PoolRealArray) {.
|
||||||
importc: "godot_variant_new_pool_real_array",
|
importc: "godot_variant_new_pool_real_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; psa: PoolStringArray) {.
|
proc initVariant(dest: var Variant; psa: PoolStringArray) {.
|
||||||
importc: "godot_variant_new_pool_string_array",
|
importc: "godot_variant_new_pool_string_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; pv2a: PoolVector2Array) {.
|
proc initVariant(dest: var Variant; pv2a: PoolVector2Array) {.
|
||||||
importc: "godot_variant_new_pool_vector2_array",
|
importc: "godot_variant_new_pool_vector2_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; pv3a: PoolVector3Array) {.
|
proc initVariant(dest: var Variant; pv3a: PoolVector3Array) {.
|
||||||
importc: "godot_variant_new_pool_vector3_array",
|
importc: "godot_variant_new_pool_vector3_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc initVariant(dest: var Variant; pca: PoolColorArray) {.
|
proc initVariant(dest: var Variant; pca: PoolColorArray) {.
|
||||||
importc: "godot_variant_new_pool_color_array",
|
importc: "godot_variant_new_pool_color_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
|
|
||||||
proc variant*(): Variant {.inline.} =
|
proc variant*(): Variant {.inline.} =
|
||||||
initNilVariant(result)
|
initNilVariant(result)
|
||||||
|
|
@ -210,82 +195,75 @@ proc variant*(pca: PoolColorArray): Variant {.inline.} =
|
||||||
initVariant(result, pca)
|
initVariant(result, pca)
|
||||||
|
|
||||||
proc asBool*(self: Variant): bool {.
|
proc asBool*(self: Variant): bool {.
|
||||||
importc: "godot_variant_as_bool", header: "godot/variant.h".}
|
importc: "godot_variant_as_bool".}
|
||||||
proc asUint*(self: Variant): uint64 {.
|
proc asUint*(self: Variant): uint64 {.
|
||||||
importc: "godot_variant_as_uint", header: "godot/variant.h".}
|
importc: "godot_variant_as_uint".}
|
||||||
proc asInt*(self: Variant): int64 {.
|
proc asInt*(self: Variant): int64 {.
|
||||||
importc: "godot_variant_as_int", header: "godot/variant.h".}
|
importc: "godot_variant_as_int".}
|
||||||
proc asReal*(self: Variant): cdouble {.
|
proc asReal*(self: Variant): cdouble {.
|
||||||
importc: "godot_variant_as_real", header: "godot/variant.h".}
|
importc: "godot_variant_as_real".}
|
||||||
proc asGodotString*(self: Variant): GodotString {.
|
proc asGodotString*(self: Variant): GodotString {.
|
||||||
importc: "godot_variant_as_string", header: "godot/variant.h".}
|
importc: "godot_variant_as_string".}
|
||||||
|
|
||||||
proc asString*(self: Variant): string =
|
proc asString*(self: Variant): string =
|
||||||
let s = self.asGodotString()
|
let s = self.asGodotString()
|
||||||
result = $s
|
result = $s
|
||||||
|
|
||||||
proc asVector2*(self: Variant): Vector2 {.
|
proc asVector2*(self: Variant): Vector2 {.
|
||||||
importc: "godot_variant_as_vector2", header: "godot/variant.h".}
|
importc: "godot_variant_as_vector2".}
|
||||||
proc asRect2*(self: Variant): Rect2 {.
|
proc asRect2*(self: Variant): Rect2 {.
|
||||||
importc: "godot_variant_as_rect2", header: "godot/variant.h".}
|
importc: "godot_variant_as_rect2".}
|
||||||
proc asVector3*(self: Variant): Vector3 {.
|
proc asVector3*(self: Variant): Vector3 {.
|
||||||
importc: "godot_variant_as_vector3", header: "godot/variant.h".}
|
importc: "godot_variant_as_vector3".}
|
||||||
proc asTransform2D*(self: Variant): Transform2D {.
|
proc asTransform2D*(self: Variant): Transform2D {.
|
||||||
importc: "godot_variant_as_transform2d", header: "godot/variant.h".}
|
importc: "godot_variant_as_transform2d".}
|
||||||
proc asPlane*(self: Variant): Plane {.
|
proc asPlane*(self: Variant): Plane {.
|
||||||
importc: "godot_variant_as_plane", header: "godot/variant.h".}
|
importc: "godot_variant_as_plane".}
|
||||||
proc asQuat*(self: Variant): Quat {.
|
proc asQuat*(self: Variant): Quat {.
|
||||||
importc: "godot_variant_as_quat", header: "godot/variant.h".}
|
importc: "godot_variant_as_quat".}
|
||||||
proc asRect3*(self: Variant): Rect3 {.
|
proc asRect3*(self: Variant): Rect3 {.
|
||||||
importc: "godot_variant_as_rect3", header: "godot/variant.h".}
|
importc: "godot_variant_as_rect3".}
|
||||||
proc asBasis*(self: Variant): Basis {.
|
proc asBasis*(self: Variant): Basis {.
|
||||||
importc: "godot_variant_as_basis", header: "godot/variant.h".}
|
importc: "godot_variant_as_basis".}
|
||||||
proc asTransform*(self: Variant): Transform {.
|
proc asTransform*(self: Variant): Transform {.
|
||||||
importc: "godot_variant_as_transform", header: "godot/variant.h".}
|
importc: "godot_variant_as_transform".}
|
||||||
proc asColor*(self: Variant): Color {.
|
proc asColor*(self: Variant): Color {.
|
||||||
importc: "godot_variant_as_color", header: "godot/variant.h".}
|
importc: "godot_variant_as_color".}
|
||||||
proc asNodePath*(self: Variant): NodePath {.
|
proc asNodePath*(self: Variant): NodePath {.
|
||||||
importc: "godot_variant_as_node_path", header: "godot/variant.h".}
|
importc: "godot_variant_as_node_path".}
|
||||||
proc asRid*(self: Variant): RID {.
|
proc asRid*(self: Variant): RID {.
|
||||||
importc: "godot_variant_as_rid", header: "godot/variant.h".}
|
importc: "godot_variant_as_rid".}
|
||||||
proc asObject*(self: Variant): ptr GodotObject {.
|
proc asObject*(self: Variant): ptr GodotObject {.
|
||||||
importc: "godot_variant_as_object", header: "godot/variant.h".}
|
importc: "godot_variant_as_object".}
|
||||||
proc asArray*(self: Variant): Array {.
|
proc asArray*(self: Variant): Array {.
|
||||||
importc: "godot_variant_as_array", header: "godot/variant.h".}
|
importc: "godot_variant_as_array".}
|
||||||
proc asPoolByteArray*(self: Variant): PoolByteArray {.
|
proc asPoolByteArray*(self: Variant): PoolByteArray {.
|
||||||
importc: "godot_variant_as_pool_byte_array",
|
importc: "godot_variant_as_pool_byte_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc asPoolIntArray*(self: Variant): PoolIntArray {.
|
proc asPoolIntArray*(self: Variant): PoolIntArray {.
|
||||||
importc: "godot_variant_as_pool_int_array",
|
importc: "godot_variant_as_pool_int_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc asPoolRealArray*(self: Variant): PoolRealArray {.
|
proc asPoolRealArray*(self: Variant): PoolRealArray {.
|
||||||
importc: "godot_variant_as_pool_real_array",
|
importc: "godot_variant_as_pool_real_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc asPoolStringArray*(self: Variant): PoolStringArray {.
|
proc asPoolStringArray*(self: Variant): PoolStringArray {.
|
||||||
importc: "godot_variant_as_pool_string_array",
|
importc: "godot_variant_as_pool_string_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc asPoolVector2Array*(self: Variant): PoolVector2Array {.
|
proc asPoolVector2Array*(self: Variant): PoolVector2Array {.
|
||||||
importc: "godot_variant_as_pool_vector2_array",
|
importc: "godot_variant_as_pool_vector2_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc asPoolVector3Array*(self: Variant): PoolVector3Array {.
|
proc asPoolVector3Array*(self: Variant): PoolVector3Array {.
|
||||||
importc: "godot_variant_as_pool_vector3_array",
|
importc: "godot_variant_as_pool_vector3_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
proc asPoolColorArray*(self: Variant): PoolColorArray {.
|
proc asPoolColorArray*(self: Variant): PoolColorArray {.
|
||||||
importc: "godot_variant_as_pool_color_array",
|
importc: "godot_variant_as_pool_color_array".}
|
||||||
header: "godot/variant.h".}
|
|
||||||
|
|
||||||
proc call*(self: Variant; meth: GodotString;
|
proc call*(self: Variant; meth: GodotString;
|
||||||
args: var array[MAX_ARG_COUNT, Variant]; argCount: cint;
|
args: var array[MAX_ARG_COUNT, Variant]; argCount: cint;
|
||||||
error: var VariantCallError): Variant {.
|
error: var VariantCallError): Variant {.
|
||||||
importc: "godot_variant_call", header: "godot/variant.h".}
|
importc: "godot_variant_call".}
|
||||||
|
|
||||||
proc hasMethod*(self: Variant; meth: GodotString): bool {.
|
proc hasMethod*(self: Variant; meth: GodotString): bool {.
|
||||||
importc: "godot_variant_has_method", header: "godot/variant.h".}
|
importc: "godot_variant_has_method".}
|
||||||
proc `==`*(self, other: Variant): bool {.
|
proc `==`*(self, other: Variant): bool {.
|
||||||
importc: "godot_variant_operator_equal", header: "godot/variant.h".}
|
importc: "godot_variant_operator_equal".}
|
||||||
proc `<`*(self, other: Variant): bool {.
|
proc `<`*(self, other: Variant): bool {.
|
||||||
importc: "godot_variant_operator_less", header: "godot/variant.h".}
|
importc: "godot_variant_operator_less".}
|
||||||
proc hashCompare*(self, other: Variant): bool {.
|
proc hashCompare*(self, other: Variant): bool {.
|
||||||
importc: "godot_variant_hash_compare", header: "godot/variant.h".}
|
importc: "godot_variant_hash_compare".}
|
||||||
proc booleanize*(self: Variant; isValid: var bool): bool {.
|
proc booleanize*(self: Variant; isValid: var bool): bool {.
|
||||||
importc: "godot_variant_booleanize", header: "godot/variant.h".}
|
importc: "godot_variant_booleanize".}
|
||||||
|
|
|
||||||
|
|
@ -1,117 +1,108 @@
|
||||||
# Copyright (c) 2017 Xored Software, Inc.
|
# Copyright (c) 2017 Xored Software, Inc.
|
||||||
|
|
||||||
type
|
|
||||||
Vector2* {.importc: "godot_vector2", header: "godot/vector2.h",
|
|
||||||
byref.} = object
|
|
||||||
|
|
||||||
import godotbase, strings
|
import godotbase, strings
|
||||||
|
|
||||||
proc initVector2(dest: var Vector2; x, y: float32) {.
|
type
|
||||||
importc: "godot_vector2_new", header: "godot/vector2.h".}
|
Vector2* {.byref.} = object
|
||||||
|
x*: float32
|
||||||
|
y*: float32
|
||||||
|
|
||||||
proc vec2*(x, y: float32): Vector2 {.inline.} =
|
proc vec2*(x, y: float32): Vector2 {.inline.} =
|
||||||
initVector2(result, x, y)
|
Vector2(x: x, y: y)
|
||||||
|
|
||||||
proc toGodotString*(self: Vector2): GodotString {.
|
proc toGodotString*(self: Vector2): GodotString {.
|
||||||
importc: "godot_vector2_as_string", header: "godot/vector2.h".}
|
importc: "godot_vector2_as_string".}
|
||||||
proc `$`*(self: Vector2): string {.inline.} =
|
proc `$`*(self: Vector2): string {.inline.} =
|
||||||
$self.toGodotString()
|
$self.toGodotString()
|
||||||
|
|
||||||
proc normalized*(self: Vector2): Vector2 {.
|
proc normalized*(self: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_normalized", header: "godot/vector2.h".}
|
importc: "godot_vector2_normalized".}
|
||||||
proc length*(self: Vector2): float32 {.
|
proc length*(self: Vector2): float32 {.
|
||||||
importc: "godot_vector2_length", header: "godot/vector2.h".}
|
importc: "godot_vector2_length".}
|
||||||
proc angle*(self: Vector2): float32 {.
|
proc angle*(self: Vector2): float32 {.
|
||||||
importc: "godot_vector2_angle", header: "godot/vector2.h".}
|
importc: "godot_vector2_angle".}
|
||||||
proc lengthSquared*(self: Vector2): float32 {.
|
proc lengthSquared*(self: Vector2): float32 {.
|
||||||
importc: "godot_vector2_length_squared", header: "godot/vector2.h".}
|
importc: "godot_vector2_length_squared".}
|
||||||
proc isNormalized*(self: Vector2): bool {.
|
proc isNormalized*(self: Vector2): bool {.
|
||||||
importc: "godot_vector2_is_normalized", header: "godot/vector2.h".}
|
importc: "godot_vector2_is_normalized".}
|
||||||
proc distanceTo*(self, to: Vector2): float32 {.
|
proc distanceTo*(self, to: Vector2): float32 {.
|
||||||
importc: "godot_vector2_distance_to",
|
importc: "godot_vector2_distance_to".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
proc distanceSquaredTo*(self, to: Vector2): float32 {.
|
proc distanceSquaredTo*(self, to: Vector2): float32 {.
|
||||||
importc: "godot_vector2_distance_squared_to",
|
importc: "godot_vector2_distance_squared_to".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
proc angleTo*(self, to: Vector2): float32 {.
|
proc angleTo*(self, to: Vector2): float32 {.
|
||||||
importc: "godot_vector2_angle_to", header: "godot/vector2.h".}
|
importc: "godot_vector2_angle_to".}
|
||||||
proc angleToPoint*(self, to: Vector2): float32 {.
|
proc angleToPoint*(self, to: Vector2): float32 {.
|
||||||
importc: "godot_vector2_angle_to_point",
|
importc: "godot_vector2_angle_to_point".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
proc lerp*(self, b: Vector2; t: float32): Vector2 {.
|
proc lerp*(self, b: Vector2; t: float32): Vector2 {.
|
||||||
importc: "godot_vector2_linear_interpolate",
|
importc: "godot_vector2_linear_interpolate".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
proc cubicInterpolate*(self, b, pre_a, post_b: Vector2; t: float32): Vector2 {.
|
proc cubicInterpolate*(self, b, pre_a, post_b: Vector2; t: float32): Vector2 {.
|
||||||
importc: "godot_vector2_cubic_interpolate",
|
importc: "godot_vector2_cubic_interpolate".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
proc rotated*(self: Vector2; phi: float32): Vector2 {.
|
proc rotated*(self: Vector2; phi: float32): Vector2 {.
|
||||||
importc: "godot_vector2_rotated", header: "godot/vector2.h".}
|
importc: "godot_vector2_rotated".}
|
||||||
proc tangent*(self: Vector2): Vector2 {.
|
proc tangent*(self: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_tangent", header: "godot/vector2.h".}
|
importc: "godot_vector2_tangent".}
|
||||||
proc floor*(self: Vector2): Vector2 {.
|
proc floor*(self: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_floor", header: "godot/vector2.h".}
|
importc: "godot_vector2_floor".}
|
||||||
proc snapped*(self: Vector2; by: Vector2): Vector2 {.
|
proc snapped*(self: Vector2; by: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_snapped", header: "godot/vector2.h".}
|
importc: "godot_vector2_snapped".}
|
||||||
proc aspect*(self: Vector2): float32 {.
|
proc aspect*(self: Vector2): float32 {.
|
||||||
importc: "godot_vector2_aspect", header: "godot/vector2.h".}
|
importc: "godot_vector2_aspect".}
|
||||||
proc dot*(a, b: Vector2): float32 {.
|
proc dot*(a, b: Vector2): float32 {.
|
||||||
importc: "godot_vector2_dot", header: "godot/vector2.h".}
|
importc: "godot_vector2_dot".}
|
||||||
proc slide*(self, n: Vector2): Vector2 {.
|
proc slide*(self, n: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_slide", header: "godot/vector2.h".}
|
importc: "godot_vector2_slide".}
|
||||||
proc bounce*(self, n: Vector2): Vector2 {.
|
proc bounce*(self, n: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_bounce", header: "godot/vector2.h".}
|
importc: "godot_vector2_bounce".}
|
||||||
proc reflect*(self, n: Vector2): Vector2 {.
|
proc reflect*(self, n: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_reflect", header: "godot/vector2.h".}
|
importc: "godot_vector2_reflect".}
|
||||||
proc abs*(self: Vector2): Vector2 {.
|
proc abs*(self: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_abs", header: "godot/vector2.h".}
|
importc: "godot_vector2_abs".}
|
||||||
proc clamped*(self: Vector2; length: float32): Vector2 {.
|
proc clamped*(self: Vector2; length: float32): Vector2 {.
|
||||||
importc: "godot_vector2_clamped", header: "godot/vector2.h".}
|
importc: "godot_vector2_clamped".}
|
||||||
|
|
||||||
proc `+`*(a, b: Vector2): Vector2 {.
|
proc `+`*(a, b: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_operator_add", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_add".}
|
||||||
proc `+=`*(a: var Vector2, b: Vector2) {.inline.} =
|
proc `+=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||||
a += b
|
a += b
|
||||||
|
|
||||||
proc `-`*(a, b: Vector2): Vector2 {.
|
proc `-`*(a, b: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_operator_substract", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_substract".}
|
||||||
proc `-=`*(a: var Vector2, b: Vector2) {.inline.} =
|
proc `-=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||||
a = a - b
|
a = a - b
|
||||||
|
|
||||||
proc `*`*(a, b: Vector2): Vector2 {.
|
proc `*`*(a, b: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_operator_multiply_vector",
|
importc: "godot_vector2_operator_multiply_vector".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
|
|
||||||
proc `*=`*(a: var Vector2, b: Vector2) {.inline.} =
|
proc `*=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||||
a = a * b
|
a = a * b
|
||||||
|
|
||||||
proc `*`*(self: Vector2, scalar: float32): Vector2 {.
|
proc `*`*(self: Vector2, scalar: float32): Vector2 {.
|
||||||
importc: "godot_vector2_operator_multiply_scalar",
|
importc: "godot_vector2_operator_multiply_scalar".}
|
||||||
header: "godot/vector2.h".}
|
|
||||||
proc `*=`*(self: var Vector2, scalar: float32) {.inline.} =
|
proc `*=`*(self: var Vector2, scalar: float32) {.inline.} =
|
||||||
self = self * scalar
|
self = self * scalar
|
||||||
|
|
||||||
proc `/`*(a, b: Vector2): Vector2 {.
|
proc `/`*(a, b: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_operator_divide_vector", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_divide_vector".}
|
||||||
proc `/=`*(a: var Vector2, b: Vector2) {.inline.} =
|
proc `/=`*(a: var Vector2, b: Vector2) {.inline.} =
|
||||||
a = a / b
|
a = a / b
|
||||||
|
|
||||||
proc `/`*(self: Vector2; scalar: float32): Vector2 {.
|
proc `/`*(self: Vector2; scalar: float32): Vector2 {.
|
||||||
importc: "godot_vector2_operator_divide_scalar", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_divide_scalar".}
|
||||||
proc `/=`*(self: var Vector2; scalar: float32) {.inline.} =
|
proc `/=`*(self: var Vector2; scalar: float32) {.inline.} =
|
||||||
self = self / scalar
|
self = self / scalar
|
||||||
|
|
||||||
proc `==`*(a, b: Vector2): bool {.
|
proc `==`*(a, b: Vector2): bool {.
|
||||||
importc: "godot_vector2_operator_equal", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_equal".}
|
||||||
proc `<`*(a, b: Vector2): bool {.
|
proc `<`*(a, b: Vector2): bool {.
|
||||||
importc: "godot_vector2_operator_less", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_less".}
|
||||||
proc `-`*(self: Vector2): Vector2 {.
|
proc `-`*(self: Vector2): Vector2 {.
|
||||||
importc: "godot_vector2_operator_neg", header: "godot/vector2.h".}
|
importc: "godot_vector2_operator_neg".}
|
||||||
|
|
||||||
proc `x=`*(self: var Vector2; x: float32) {.
|
proc `x=`*(self: var Vector2; x: float32) {.
|
||||||
importc: "godot_vector2_set_x", header: "godot/vector2.h".}
|
importc: "godot_vector2_set_x".}
|
||||||
proc `y=`*(self: var Vector2; y: float32) {.
|
proc `y=`*(self: var Vector2; y: float32) {.
|
||||||
importc: "godot_vector2_set_y", header: "godot/vector2.h".}
|
importc: "godot_vector2_set_y".}
|
||||||
proc x*(self: Vector2): float32 {.
|
proc x*(self: Vector2): float32 {.
|
||||||
importc: "godot_vector2_get_x", header: "godot/vector2.h".}
|
importc: "godot_vector2_get_x".}
|
||||||
proc y*(self: Vector2): float32 {.
|
proc y*(self: Vector2): float32 {.
|
||||||
importc: "godot_vector2_get_y", header: "godot/vector2.h".}
|
importc: "godot_vector2_get_y".}
|
||||||
|
|
|
||||||
|
|
@ -1,148 +1,241 @@
|
||||||
# Copyright (c) 2017 Xored Software, Inc.
|
# Copyright (c) 2017 Xored Software, Inc.
|
||||||
|
|
||||||
type
|
import math
|
||||||
Vector3* {.importc: "godot_vector3", header: "godot/vector3.h",
|
import godotbase, strings
|
||||||
byref.} = object
|
|
||||||
|
|
||||||
import godotbase, basis, strings
|
|
||||||
|
|
||||||
type
|
type
|
||||||
Vector3Axis {.importc: "godot_vector3_axis", header: "godot/vector3.h",
|
Vector3* {.byref.} = object
|
||||||
size: sizeof(cint), pure.} = enum
|
x*: float32
|
||||||
X,
|
y*: float32
|
||||||
Y,
|
z*: float32
|
||||||
Z
|
|
||||||
|
|
||||||
proc initVector3*(dest: var Vector3; x, y, z: float32) {.
|
proc vec3*(): Vector3 {.inline.} =
|
||||||
importc: "godot_vector3_new", header: "godot/vector3.h".}
|
Vector3()
|
||||||
|
|
||||||
proc vec3*(x, y, z: float32): Vector3 {.inline.} =
|
proc vec3*(x, y, z: float32): Vector3 {.inline.} =
|
||||||
initVector3(result, x, y, z)
|
Vector3(x: x, y: y, z: z)
|
||||||
|
|
||||||
proc toGodotString*(self: Vector3): GodotString {.
|
|
||||||
importc: "godot_vector3_as_string", header: "godot/vector3.h".}
|
|
||||||
proc `$`*(self: Vector3): string {.inline.} =
|
proc `$`*(self: Vector3): string {.inline.} =
|
||||||
$self.toGodotString()
|
result = newStringOfCap(40)
|
||||||
|
result.add('(')
|
||||||
|
result.add($self.x)
|
||||||
|
result.add(", ")
|
||||||
|
result.add($self.y)
|
||||||
|
result.add(", ")
|
||||||
|
result.add($self.z)
|
||||||
|
result.add(')')
|
||||||
|
|
||||||
proc minAxis*(self: Vector3): cint {.
|
proc `+`*(a, b: Vector3): Vector3 {.inline.} =
|
||||||
importc: "godot_vector3_min_axis", header: "godot/vector3.h".}
|
result.x = a.x + b.x
|
||||||
proc maxAxis*(self: Vector3): cint {.
|
result.y = a.y + b.y
|
||||||
importc: "godot_vector3_max_axis", header: "godot/vector3.h".}
|
result.z = a.z + b.z
|
||||||
proc length*(self: Vector3): float32 {.
|
|
||||||
importc: "godot_vector3_length", header: "godot/vector3.h".}
|
|
||||||
proc lengthSquared*(self: Vector3): float32 {.
|
|
||||||
importc: "godot_vector3_length_squared", header: "godot/vector3.h".}
|
|
||||||
proc isNormalized*(self: Vector3): bool {.
|
|
||||||
importc: "godot_vector3_is_normalized", header: "godot/vector3.h".}
|
|
||||||
proc normalized*(self: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_normalized", header: "godot/vector3.h".}
|
|
||||||
proc inverse*(self: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_inverse", header: "godot/vector3.h".}
|
|
||||||
proc snapped*(self: Vector3; by: float32): Vector3 {.
|
|
||||||
importc: "godot_vector3_snapped", header: "godot/vector3.h".}
|
|
||||||
proc rotated*(self: Vector3; axis: Vector3;
|
|
||||||
phi: float32): Vector3 {.
|
|
||||||
importc: "godot_vector3_rotated", header: "godot/vector3.h".}
|
|
||||||
proc lerp*(self: Vector3; b: Vector3; t: float32): Vector3 {.
|
|
||||||
importc: "godot_vector3_linear_interpolate", header: "godot/vector3.h".}
|
|
||||||
proc cubicInterpolate*(self, b, preA, postB: Vector3;
|
|
||||||
t: float32): Vector3 {.
|
|
||||||
importc: "godot_vector3_cubic_interpolate", header: "godot/vector3.h".}
|
|
||||||
proc dot*(a, b: Vector3): float32 {.
|
|
||||||
importc: "godot_vector3_dot", header: "godot/vector3.h".}
|
|
||||||
proc cross*(a, b: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_cross", header: "godot/vector3.h".}
|
|
||||||
proc outer*(a, b: Vector3): Basis {.
|
|
||||||
importc: "godot_vector3_outer", header: "godot/vector3.h".}
|
|
||||||
proc toDiagonalMatrix*(self: Vector3): Basis {.
|
|
||||||
importc: "godot_vector3_to_diagonal_matrix", header: "godot/vector3.h".}
|
|
||||||
proc abs*(self: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_abs", header: "godot/vector3.h".}
|
|
||||||
proc floor*(self: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_floor", header: "godot/vector3.h".}
|
|
||||||
proc ceil*(self: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_ceil", header: "godot/vector3.h".}
|
|
||||||
proc distanceTo*(a, b: Vector3): float32 {.
|
|
||||||
importc: "godot_vector3_distance_to", header: "godot/vector3.h".}
|
|
||||||
proc distanceSquaredTo*(a, b: Vector3): float32 {.
|
|
||||||
importc: "godot_vector3_distance_squared_to", header: "godot/vector3.h".}
|
|
||||||
proc angleTo*(self, to: Vector3): float32 {.
|
|
||||||
importc: "godot_vector3_angle_to", header: "godot/vector3.h".}
|
|
||||||
proc slide*(self, n: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_slide", header: "godot/vector3.h".}
|
|
||||||
proc bounce*(self, n: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_bounce", header: "godot/vector3.h".}
|
|
||||||
proc reflect*(self, b: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_reflect", header: "godot/vector3.h".}
|
|
||||||
|
|
||||||
proc `+`*(a, b: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_add", header: "godot/vector3.h".}
|
|
||||||
proc `+=`*(a: var Vector3, b: Vector3) {.inline.} =
|
proc `+=`*(a: var Vector3, b: Vector3) {.inline.} =
|
||||||
a = a + b
|
a.x += b.x
|
||||||
|
a.y += b.y
|
||||||
|
a.z += b.z
|
||||||
|
|
||||||
|
proc `-`*(a, b: Vector3): Vector3 {.inline.} =
|
||||||
|
result.x = a.x - b.x
|
||||||
|
result.y = a.y - b.y
|
||||||
|
result.z = a.z - b.z
|
||||||
|
|
||||||
proc `-`*(a, b: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_substract", header: "godot/vector3.h".}
|
|
||||||
proc `-=`*(a: var Vector3, b: Vector3) {.inline.} =
|
proc `-=`*(a: var Vector3, b: Vector3) {.inline.} =
|
||||||
a = a - b
|
a.x -= b.x
|
||||||
|
a.y -= b.y
|
||||||
|
a.z -= b.z
|
||||||
|
|
||||||
|
proc `*`*(a, b: Vector3): Vector3 {.inline.} =
|
||||||
|
result.x = a.x * b.x
|
||||||
|
result.y = a.y * b.y
|
||||||
|
result.z = a.z * b.z
|
||||||
|
|
||||||
proc `*`*(a, b: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_multiply_vector",
|
|
||||||
header: "godot/vector3.h".}
|
|
||||||
proc `*=`*(a: var Vector3, b: Vector3) {.inline.}=
|
proc `*=`*(a: var Vector3, b: Vector3) {.inline.}=
|
||||||
a = a * b
|
a.x *= b.x
|
||||||
|
a.y *= b.y
|
||||||
|
a.z *= b.z
|
||||||
|
|
||||||
|
proc `*`*(a: Vector3; b: float32): Vector3 {.inline.} =
|
||||||
|
result.x = a.x * b
|
||||||
|
result.y = a.y * b
|
||||||
|
result.z = a.z * b
|
||||||
|
|
||||||
|
proc `*`*(b: float32; a: Vector3): Vector3 {.inline.} =
|
||||||
|
a * b
|
||||||
|
|
||||||
proc `*`*(self: Vector3; b: float32): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_multiply_scalar",
|
|
||||||
header: "godot/vector3.h".}
|
|
||||||
proc `*=`*(a: var Vector3; b: float32) {.inline.} =
|
proc `*=`*(a: var Vector3; b: float32) {.inline.} =
|
||||||
a = a * b
|
a.x *= b
|
||||||
|
a.y *= b
|
||||||
|
a.z *= b
|
||||||
|
|
||||||
|
proc `/`*(a, b: Vector3): Vector3 =
|
||||||
|
result.x = a.x / b.x
|
||||||
|
result.y = a.y / b.y
|
||||||
|
result.z = a.z / b.z
|
||||||
|
|
||||||
proc `/`*(a, b: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_divide_vector",
|
|
||||||
header: "godot/vector3.h".}
|
|
||||||
proc `/=`*(a: var Vector3; b: Vector3) {.inline.} =
|
proc `/=`*(a: var Vector3; b: Vector3) {.inline.} =
|
||||||
a = a / b
|
a.x /= b.x
|
||||||
|
a.y /= b.y
|
||||||
|
a.z /= b.z
|
||||||
|
|
||||||
|
proc `/`*(a: Vector3; b: float32): Vector3 =
|
||||||
|
result.x = a.x / b
|
||||||
|
result.y = a.y / b
|
||||||
|
result.z = a.z / b
|
||||||
|
|
||||||
proc `/`*(self: Vector3; b: float32): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_divide_scalar",
|
|
||||||
header: "godot/vector3.h".}
|
|
||||||
proc `/=`*(a: var Vector3; b: float32) {.inline.} =
|
proc `/=`*(a: var Vector3; b: float32) {.inline.} =
|
||||||
a = a / b
|
a.x /= b
|
||||||
|
a.y /= b
|
||||||
|
a.z /= b
|
||||||
|
|
||||||
proc `==`*(a, b: Vector3): bool {.
|
proc `==`*(a, b: Vector3): bool {.inline.} =
|
||||||
importc: "godot_vector3_operator_equal", header: "godot/vector3.h".}
|
a.x == b.x and a.y == b.y and a.z == b.z
|
||||||
proc `<`*(a, b: Vector3): bool {.
|
|
||||||
importc: "godot_vector3_operator_less", header: "godot/vector3.h".}
|
|
||||||
proc `-`*(self: Vector3): Vector3 {.
|
|
||||||
importc: "godot_vector3_operator_neg", header: "godot/vector3.h".}
|
|
||||||
|
|
||||||
proc setAxis(self: var Vector3; axis: Vector3Axis;
|
proc `<`*(a, b: Vector3): bool =
|
||||||
val: float32) {.
|
if a.x == b.x:
|
||||||
importc: "godot_vector3_set_axis", header: "godot/vector3.h".}
|
if a.y == b.y:
|
||||||
proc getAxis(self: Vector3; axis: Vector3Axis): float32 {.
|
return a.z < b.z
|
||||||
importc: "godot_vector3_get_axis", header: "godot/vector3.h".}
|
return a.y < b.y
|
||||||
|
return a.x < b.x
|
||||||
|
|
||||||
proc `[]`(self: Vector3, idx: range[0..2]): float32 {.inline.} =
|
proc `-`*(self: Vector3): Vector3 =
|
||||||
self.getAxis(Vector3Axis(idx))
|
result.x = -self.x
|
||||||
|
result.y = -self.y
|
||||||
|
result.z = -self.z
|
||||||
|
|
||||||
proc `[]=`(self: var Vector3, idx: range[0..2],
|
proc `[]`*(self: Vector3, idx: range[0..2]): float32 {.inline.} =
|
||||||
val: float32): float32 {.inline.} =
|
cast[array[3, float32]](self)[idx]
|
||||||
self.setAxis(Vector3Axis(idx), val)
|
|
||||||
|
|
||||||
proc x*(self: Vector3): float32 {.inline.} =
|
proc `[]`*(self: var Vector3, idx: range[0..2]): var float32 {.inline.} =
|
||||||
self.getAxis(Vector3Axis.X)
|
cast[ptr array[3, float32]](addr self)[][idx]
|
||||||
|
|
||||||
proc `x=`*(self: var Vector3, val: float32) {.inline.} =
|
proc `[]=`*(self: var Vector3, idx: range[0..2],
|
||||||
self.setAxis(Vector3Axis.X, val)
|
val: float32) {.inline.} =
|
||||||
|
case idx:
|
||||||
|
of 0: self.x = val
|
||||||
|
of 1: self.y = val
|
||||||
|
of 2: self.z = val
|
||||||
|
|
||||||
proc y*(self: Vector3): float32 {.inline.} =
|
proc minAxis*(self: Vector3): int {.inline.} =
|
||||||
self.getAxis(Vector3Axis.Y)
|
if self.x < self.y:
|
||||||
|
if self.x < self.z: 0 else: 2
|
||||||
|
else:
|
||||||
|
if self.y < self.z: 1 else: 2
|
||||||
|
|
||||||
proc `y=`*(self: var Vector3, val: float32) {.inline.} =
|
proc maxAxis*(self: Vector3): int {.inline.} =
|
||||||
self.setAxis(Vector3Axis.Y, val)
|
if self.x < self.y:
|
||||||
|
if self.y < self.z: 2 else: 1
|
||||||
|
else:
|
||||||
|
if self.x < self.z: 2 else: 0
|
||||||
|
|
||||||
proc z*(self: Vector3): float32 {.inline.} =
|
proc length*(self: Vector3): float32 {.inline.} =
|
||||||
self.getAxis(Vector3Axis.Z)
|
let x2 = self.x * self.x
|
||||||
|
let y2 = self.y * self.y
|
||||||
|
let z2 = self.z * self.z
|
||||||
|
|
||||||
proc `z=`*(self: var Vector3, val: float32) {.inline.} =
|
result = sqrt(x2 + y2 + z2)
|
||||||
self.setAxis(Vector3Axis.Z, val)
|
|
||||||
|
proc lengthSquared*(self: Vector3): float32 {.inline.} =
|
||||||
|
let x2 = self.x * self.x
|
||||||
|
let y2 = self.y * self.y
|
||||||
|
let z2 = self.z * self.z
|
||||||
|
|
||||||
|
result = x2 + y2 + z2
|
||||||
|
|
||||||
|
proc normalize*(self: var Vector3) {.inline.} =
|
||||||
|
let len = self.length()
|
||||||
|
if len == 0:
|
||||||
|
self.x = 0
|
||||||
|
self.y = 0
|
||||||
|
self.z = 0
|
||||||
|
else:
|
||||||
|
self.x /= len
|
||||||
|
self.y /= len
|
||||||
|
self.z /= len
|
||||||
|
|
||||||
|
proc normalized*(self: Vector3): Vector3 {.inline.} =
|
||||||
|
result = self
|
||||||
|
result.normalize()
|
||||||
|
|
||||||
|
proc isNormalized*(self: Vector3): bool {.inline.} =
|
||||||
|
self.lengthSquared().isEqualApprox(1.0'f32)
|
||||||
|
|
||||||
|
proc zero*(self: var Vector3) {.inline.} =
|
||||||
|
self.x = 0
|
||||||
|
self.y = 0
|
||||||
|
self.z = 0
|
||||||
|
|
||||||
|
proc inverse*(self: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(1.0'f32 / self.x, 1.0'f32 / self.y, 1.0'f32 / self.z)
|
||||||
|
|
||||||
|
proc cross*(self, other: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(
|
||||||
|
self.y * other.z - self.z * other.y,
|
||||||
|
self.z * other.x - self.x * other.z,
|
||||||
|
self.x * other.y - self.y * other.x)
|
||||||
|
|
||||||
|
proc dot*(self, other: Vector3): float32 {.inline.} =
|
||||||
|
self.x * other.x + self.y * other.y + self.z * other.z
|
||||||
|
|
||||||
|
proc abs*(self: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(abs(self.x), abs(self.y), abs(self.z))
|
||||||
|
|
||||||
|
proc sign*(self: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(sign(self.x), sign(self.y), sign(self.z))
|
||||||
|
|
||||||
|
proc floor*(self: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(floor(self.x), floor(self.y), floor(self.z))
|
||||||
|
|
||||||
|
proc ceil*(self: Vector3): Vector3 {.inline.} =
|
||||||
|
vec3(ceil(self.x), ceil(self.y), ceil(self.z))
|
||||||
|
|
||||||
|
proc lerp*(self: Vector3, other: Vector3, t: float32): Vector3 {.inline.} =
|
||||||
|
vec3(
|
||||||
|
self.x + t * (other.x - self.x),
|
||||||
|
self.y + t * (other.y - self.y),
|
||||||
|
self.z + t * (other.z - self.z)
|
||||||
|
)
|
||||||
|
|
||||||
|
proc distanceTo*(self, other: Vector3): float32 {.inline.} =
|
||||||
|
(other - self).length()
|
||||||
|
|
||||||
|
proc distanceSquaredTo*(self, other: Vector3): float32 {.inline.} =
|
||||||
|
(other - self).lengthSquared()
|
||||||
|
|
||||||
|
proc angleTo*(self, other: Vector3): float32 {.inline.} =
|
||||||
|
arctan2(self.cross(other).length(), self.dot(other))
|
||||||
|
|
||||||
|
proc slide*(self, n: Vector3): Vector3 {.inline.} =
|
||||||
|
assert(n.isNormalized())
|
||||||
|
result = self - n * self.dot(n)
|
||||||
|
|
||||||
|
proc reflect*(self, n: Vector3): Vector3 {.inline.} =
|
||||||
|
assert(n.isNormalized())
|
||||||
|
result = 2.0'f32 * n * self.dot(n) - self
|
||||||
|
|
||||||
|
proc bounce*(self, n: Vector3): Vector3 {.inline.} =
|
||||||
|
-self.reflect(n)
|
||||||
|
|
||||||
|
proc snap*(self: var Vector3, other: Vector3) =
|
||||||
|
self.x = stepify(self.x, other.x)
|
||||||
|
self.y = stepify(self.y, other.y)
|
||||||
|
self.z = stepify(self.z, other.z)
|
||||||
|
|
||||||
|
proc snapped*(self: Vector3, other: Vector3): Vector3 =
|
||||||
|
result = self
|
||||||
|
result.snap(other)
|
||||||
|
|
||||||
|
proc cubicInterpolate*(self, b, preA, postB: Vector3;
|
||||||
|
t: float32): Vector3 =
|
||||||
|
let p0 = preA
|
||||||
|
let p1 = self
|
||||||
|
let p2 = b
|
||||||
|
let p3 = postB
|
||||||
|
|
||||||
|
let t2 = t * t
|
||||||
|
let t3 = t2 * t
|
||||||
|
|
||||||
|
result = 0.5 * ((p1 * 2.0) +
|
||||||
|
(-p0 + p2) * t +
|
||||||
|
(2.0 * p0 - 5.0 * p1 + 4 * p2 - p3) * t2 +
|
||||||
|
(-p0 + 3.0 * p1 - 3.0 * p2 + p3) * t3)
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ proc `as`*[T: NimGodotObject](obj: NimGodotObject, t: typedesc[T]): T =
|
||||||
result = T(obj)
|
result = T(obj)
|
||||||
|
|
||||||
proc getSingletonGodot*(name: cstring): ptr GodotObject {.
|
proc getSingletonGodot*(name: cstring): ptr GodotObject {.
|
||||||
importc: "godot_global_get_singleton", header: "godot/gdnative.h".}
|
importc: "godot_global_get_singleton".}
|
||||||
|
|
||||||
proc newRStrLit(s: string): NimNode {.compileTime.} =
|
proc newRStrLit(s: string): NimNode {.compileTime.} =
|
||||||
result = newNimNode(nnkRStrLit)
|
result = newNimNode(nnkRStrLit)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue