renamed dlscript module to gdnative

This commit is contained in:
Karroffel 2017-04-09 21:07:53 +02:00
parent 0198d2e03c
commit c7f8b22ba0
71 changed files with 2448 additions and 1300 deletions

View file

@ -1,9 +0,0 @@
#ifndef API_GENERATOR_H
#define API_GENERATOR_H
#include "core/ustring.h"
#include "typedefs.h"
Error generate_c_api(const String &p_path);
#endif // API_GENERATOR_H

View file

@ -1,58 +0,0 @@
#include "godot_basis.h"
#include "math/matrix3.h"
#ifdef __cplusplus
extern "C" {
#endif
void _basis_api_anchor() {
}
void GDAPI godot_basis_new(godot_basis *p_basis) {
Basis *basis = (Basis *)p_basis;
*basis = Basis();
}
void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) {
Basis *basis = (Basis *)p_basis;
Quat *euler = (Quat *)p_euler;
*basis = Basis(*euler);
}
void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) {
Basis *basis = (Basis *)p_basis;
Vector3 *euler = (Vector3 *)p_euler;
*basis = Basis(*euler);
}
godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) {
const Basis *basis = (const Basis *)p_basis;
godot_quat quat;
Quat *p_quat = (Quat *)&quat;
*p_quat = basis->operator Quat();
return quat;
}
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) {
const Basis *basis = (const Basis *)p_basis;
godot_vector3 euler;
Vector3 *p_euler = (Vector3 *)&euler;
*p_euler = basis->get_euler();
return euler;
}
/*
* p_elements is a pointer to an array of 3 (!!) vector3
*/
void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) {
Basis *basis = (Basis *)p_basis;
Vector3 *elements = (Vector3 *)p_elements;
elements[0] = basis->elements[0];
elements[1] = basis->elements[1];
elements[2] = basis->elements[2];
}
#ifdef __cplusplus
}
#endif

View file

@ -1,34 +0,0 @@
#ifndef GODOT_DLSCRIPT_BASIS_H
#define GODOT_DLSCRIPT_BASIS_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
typedef struct godot_basis {
uint8_t _dont_touch_that[36];
} godot_basis;
#endif
#include "../godot.h"
void GDAPI godot_basis_new(godot_basis *p_basis);
void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler);
void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler);
godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis);
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis);
/*
* p_elements is a pointer to an array of 3 (!!) vector3
*/
void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_BASIS_H

View file

@ -1,34 +0,0 @@
#include "godot_color.h"
#include "color.h"
#ifdef __cplusplus
extern "C" {
#endif
void _color_api_anchor() {
}
void GDAPI godot_color_new(godot_color *p_color) {
Color *color = (Color *)p_color;
*color = Color();
}
void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
Color *color = (Color *)p_color;
*color = Color(r, g, b, a);
}
uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
const Color *color = (const Color *)p_color;
return color->to_32();
}
float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
Color *color = (Color *)p_color;
return &color->operator[](idx);
}
#ifdef __cplusplus
}
#endif

View file

@ -1,29 +0,0 @@
#ifndef GODOT_DLSCRIPT_COLOR_H
#define GODOT_DLSCRIPT_COLOR_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
typedef struct godot_color {
uint8_t _dont_touch_that[16];
} godot_color;
#endif
#include "../godot.h"
void GDAPI godot_color_new(godot_color *p_color);
void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a);
uint32_t GDAPI godot_color_get_32(const godot_color *p_color);
float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_COLOR_H

View file

@ -1,51 +0,0 @@
#ifndef GODOT_DLSCRIPT_DICTIONARY_H
#define GODOT_DLSCRIPT_DICTIONARY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED
typedef struct godot_dictionary {
uint8_t _dont_touch_that[8];
} godot_dictionary;
#endif
#include "godot_array.h"
#include "godot_variant.h"
void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
void GDAPI godot_dictionary_clear(godot_dictionary *p_dict);
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys);
uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict);
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict);
godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json);
godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict);
godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_DICTIONARY_H

View file

@ -1,39 +0,0 @@
#ifndef GODOT_DLSCRIPT_NODE_PATH_H
#define GODOT_DLSCRIPT_NODE_PATH_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
typedef struct godot_node_path {
uint8_t _dont_touch_that[8];
} godot_node_path;
#endif
#include "../godot.h"
void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from);
void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from);
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx);
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx);
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np);
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np);
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np);
void GDAPI godot_node_path_destroy(godot_node_path *p_np);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_NODE_PATH_H

View file

@ -1,48 +0,0 @@
#include "godot_plane.h"
#include "math/plane.h"
#ifdef __cplusplus
extern "C" {
#endif
void _plane_api_anchor() {
}
void GDAPI godot_plane_new(godot_plane *p_pl) {
Plane *pl = (Plane *)p_pl;
*pl = Plane();
}
void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) {
Plane *pl = (Plane *)p_pl;
const Vector3 *normal = (const Vector3 *)p_normal;
*pl = Plane(*normal, p_d);
}
void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) {
Plane *pl = (Plane *)p_pl;
const Vector3 *normal = (const Vector3 *)p_normal;
pl->set_normal(*normal);
}
godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) {
const Plane *pl = (const Plane *)p_pl;
const Vector3 normal = pl->get_normal();
godot_vector3 *v3 = (godot_vector3 *)&normal;
return *v3;
}
void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) {
Plane *pl = (Plane *)p_pl;
pl->d = p_d;
}
godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) {
const Plane *pl = (const Plane *)p_pl;
return pl->d;
}
#ifdef __cplusplus
}
#endif

View file

@ -1,37 +0,0 @@
#ifndef GODOT_DLSCRIPT_PLANE_H
#define GODOT_DLSCRIPT_PLANE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
typedef struct godot_plane {
uint8_t _dont_touch_that[16];
} godot_plane;
#endif
#include "godot_vector3.h"
void GDAPI godot_plane_new(godot_plane *p_pl);
void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d);
// @Incomplete
// These are additional valid constructors
// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal);
// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal);
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl);
godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl);
void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_PLANE_H

View file

@ -1,77 +0,0 @@
#include "godot_quat.h"
#include "math/quat.h"
#ifdef __cplusplus
extern "C" {
#endif
void _quat_api_anchor() {
}
void GDAPI godot_quat_new(godot_quat *p_quat) {
Quat *quat = (Quat *)p_quat;
*quat = Quat();
}
void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) {
Quat *quat = (Quat *)p_quat;
*quat = Quat(x, y, z, w);
}
void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) {
Quat *quat = (Quat *)p_quat;
const Vector3 *axis = (const Vector3 *)p_axis;
*quat = Quat(*axis, p_angle);
}
void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) {
Quat *quat = (Quat *)p_quat;
const Vector3 *v0 = (const Vector3 *)p_v0;
const Vector3 *v1 = (const Vector3 *)p_v1;
*quat = Quat(*v0, *v1);
}
godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) {
Quat *quat = (Quat *)p_quat;
Vector3 euler = quat->get_euler();
return *(godot_vector3 *)&euler;
}
void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) {
Quat *quat = (Quat *)p_quat;
const Vector3 *euler = (const Vector3 *)p_euler;
quat->set_euler(*euler);
}
godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) {
Quat *quat = (Quat *)p_quat;
switch (p_idx) {
case 0:
return &quat->x;
case 1:
return &quat->y;
case 2:
return &quat->z;
default:
return &quat->y;
}
}
godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) {
const Quat *quat = (const Quat *)p_quat;
switch (p_idx) {
case 0:
return quat->x;
case 1:
return quat->y;
case 2:
return quat->z;
default:
return quat->y;
}
}
#ifdef __cplusplus
}
#endif

View file

@ -1,33 +0,0 @@
#ifndef GODOT_DLSCRIPT_QUAT_H
#define GODOT_DLSCRIPT_QUAT_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
typedef struct godot_quat {
uint8_t _dont_touch_that[16];
} godot_quat;
#endif
#include "../godot.h"
void GDAPI godot_quat_new(godot_quat *p_quat);
void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w);
void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle);
void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1);
godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat);
void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler);
godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx);
godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_QUAT_H

View file

@ -1,48 +0,0 @@
#include "godot_rect2.h"
#include "math/math_2d.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rect2_api_anchor() {
}
void GDAPI godot_rect2_new(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
*rect = Rect2();
}
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
Rect2 *rect = (Rect2 *)p_rect;
const Vector2 *pos = (const Vector2 *)p_pos;
const Vector2 *size = (const Vector2 *)p_size;
*rect = Rect2(*pos, *size);
}
godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
return (godot_vector2 *)&rect->pos;
}
void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) {
Rect2 *rect = (Rect2 *)p_rect;
const Vector2 *pos = (const Vector2 *)p_pos;
rect->pos = *pos;
}
godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
return (godot_vector2 *)&rect->size;
}
void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) {
Rect2 *rect = (Rect2 *)p_rect;
const Vector2 *size = (const Vector2 *)p_size;
rect->size = *size;
}
#ifdef __cplusplus
}
#endif

View file

@ -1,31 +0,0 @@
#ifndef GODOT_DLSCRIPT_RECT2_H
#define GODOT_DLSCRIPT_RECT2_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_RECT2_TYPE_DEFINED
typedef struct godot_rect2 {
uint8_t _dont_touch_that[16];
} godot_rect2;
#endif
#include "../godot.h"
void GDAPI godot_rect2_new(godot_rect2 *p_rect);
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size);
godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect);
void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos);
godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect);
void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_RECT3_H

View file

@ -1,48 +0,0 @@
#include "godot_rect3.h"
#include "math/rect3.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rect3_api_anchor() {
}
void GDAPI godot_rect3_new(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
*rect = Rect3();
}
void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *pos = (const Vector3 *)p_pos;
const Vector3 *size = (const Vector3 *)p_size;
*rect = Rect3(*pos, *size);
}
godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
return (godot_vector3 *)&rect->pos;
}
void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *pos = (const Vector3 *)p_pos;
rect->pos = *pos;
}
godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
return (godot_vector3 *)&rect->size;
}
void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *size = (const Vector3 *)p_size;
rect->size = *size;
}
#ifdef __cplusplus
}
#endif

View file

@ -1,31 +0,0 @@
#ifndef GODOT_DLSCRIPT_RECT3_H
#define GODOT_DLSCRIPT_RECT3_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
typedef struct godot_rect3 {
uint8_t _dont_touch_that[24];
} godot_rect3;
#endif
#include "../godot.h"
void GDAPI godot_rect3_new(godot_rect3 *p_rect);
void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size);
godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect);
void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos);
godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect);
void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_RECT3_H

View file

@ -1,36 +0,0 @@
#include "godot_rid.h"
#include "object.h"
#include "resource.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rid_api_anchor() {
}
void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) {
Resource *res_from = ((Object *)p_from)->cast_to<Resource>();
RID *rid = (RID *)p_rid;
memnew_placement(rid, RID);
if (res_from) {
*rid = RID(res_from->get_rid());
}
}
uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) {
RID *rid = (RID *)p_rid;
return rid->get_id();
}
void GDAPI godot_rid_destroy(godot_rid *p_rid) {
((RID *)p_rid)->~RID();
}
#ifdef __cplusplus
}
#endif

View file

@ -1,28 +0,0 @@
#ifndef GODOT_DLSCRIPT_RID_H
#define GODOT_DLSCRIPT_RID_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
typedef struct godot_rid {
uint8_t _dont_touch_that[8];
} godot_rid;
#endif
#include "../godot.h"
void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from);
uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
void GDAPI godot_rid_destroy(godot_rid *p_rid);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_RID_H

View file

@ -1,83 +0,0 @@
#include "godot_string.h"
#include "string_db.h"
#include "ustring.h"
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
void _string_api_anchor() {
}
void GDAPI godot_string_new(godot_string *p_str) {
String *p = (String *)p_str;
memnew_placement(p, String);
// *p = String(); // useless here
}
void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) {
String *p = (String *)p_str;
memnew_placement(p, String);
*p = String::utf8(p_contents, p_size);
}
void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) {
String *p = (String *)p_str;
if (p_size != NULL) {
*p_size = p->length();
}
if (p_dest != NULL) {
memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType));
}
}
void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) {
String *dest = (String *)p_dest;
String *src = (String *)p_src;
*dest = *src;
}
wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) {
String *s = (String *)p_str;
return &(s->operator[](p_idx));
}
const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) {
const String *s = (const String *)p_str;
return s->c_str();
}
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) {
String *a = (String *)p_a;
String *b = (String *)p_b;
return *a == *b;
}
godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) {
String *a = (String *)p_a;
String *b = (String *)p_b;
return *a < *b;
}
void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) {
String *dest = (String *)p_dest;
const String *a = (String *)p_a;
const String *b = (String *)p_b;
String tmp = *a + *b;
godot_string_new(p_dest);
*dest = tmp;
}
void GDAPI godot_string_destroy(godot_string *p_str) {
String *p = (String *)p_str;
p->~String();
}
#ifdef __cplusplus
}
#endif

View file

@ -1,42 +0,0 @@
#ifndef GODOT_DLSCRIPT_STRING_H
#define GODOT_DLSCRIPT_STRING_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
typedef struct godot_string {
uint8_t _dont_touch_that[8];
} godot_string;
#endif
#include "../godot.h"
void GDAPI godot_string_new(godot_string *p_str);
void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size);
void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src);
wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx);
const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str);
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b);
godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b);
void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b);
// @Incomplete
// hmm, I guess exposing the whole API doesn't make much sense
// since the language used in the library has its own string funcs
void GDAPI godot_string_destroy(godot_string *p_str);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_STRING_H

View file

@ -1,42 +0,0 @@
#include "godot_transform.h"
#include "math/transform.h"
#ifdef __cplusplus
extern "C" {
#endif
void _transform_api_anchor() {
}
void GDAPI godot_transform_new(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
*trans = Transform();
}
void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) {
Transform *trans = (Transform *)p_trans;
const Basis *basis = (const Basis *)p_basis;
*trans = Transform(*basis);
}
void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) {
Transform *trans = (Transform *)p_trans;
const Basis *basis = (const Basis *)p_basis;
const Vector3 *origin = (const Vector3 *)p_origin;
*trans = Transform(*basis, *origin);
}
godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
return (godot_basis *)&trans->basis;
}
godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
return (godot_vector3 *)&trans->origin;
}
#ifdef __cplusplus
}
#endif

View file

@ -1,29 +0,0 @@
#ifndef GODOT_DLSCRIPT_TRANSFORM_H
#define GODOT_DLSCRIPT_TRANSFORM_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
typedef struct godot_transform {
uint8_t _dont_touch_that[48];
} godot_transform;
#endif
#include "../godot.h"
void GDAPI godot_transform_new(godot_transform *p_trans);
void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis);
void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin);
godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans);
godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DLSCRIPT_TRANSFORM_H

View file

@ -1,59 +0,0 @@
#include "godot_transform2d.h"
#include "../godot.h"
#include "math/math_2d.h"
#ifdef __cplusplus
extern "C" {
#endif
void _transform2d_api_anchor() {
}
void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) {
Transform2D *t = (Transform2D *)p_t;
*t = Transform2D();
}
void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *a = (Vector2 *)p_a;
Vector2 *b = (Vector2 *)p_b;
Vector2 *c = (Vector2 *)p_c;
*t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y);
}
void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *pos = (Vector2 *)p_pos;
*t = Transform2D(p_rot, *pos);
}
godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) {
const Transform2D *t = (const Transform2D *)p_t;
const Vector2 *e = &t->operator[](p_idx);
return (godot_vector2 const *)e;
}
godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *e = &t->operator[](p_idx);
return (godot_vector2 *)e;
}
godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) {
return *godot_transform2d_const_index(p_t, p_axis);
}
void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) {
godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis);
*origin_v = *p_vec;
}
// @Incomplete
// See header file
#ifdef __cplusplus
}
#endif

View file

@ -1,48 +0,0 @@
#ifndef GODOT_TRANSFORM2D_H
#define GODOT_TRANSFORM2D_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
typedef struct godot_transform2d {
uint8_t _dont_touch_that[24];
} godot_transform2d;
#endif
#include "../godot.h"
#include "godot_vector2.h"
void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t);
void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c);
void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos);
/*
godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v);
godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v);
*/
godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx);
godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx);
godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis);
void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec);
/*
void GDAPI godot_transform2d_invert(godot_transform2d *p_t);
godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t);
*/
// @Incomplete
// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings.
#ifdef __cplusplus
}
#endif
#endif // GODOT_TRANSFORM2D_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* api_generator.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "api_generator.h"
#ifdef TOOLS_ENABLED

View file

@ -0,0 +1,38 @@
/*************************************************************************/
/* api_generator.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 API_GENERATOR_H
#define API_GENERATOR_H
#include "core/ustring.h"
#include "typedefs.h"
Error generate_c_api(const String &p_path);
#endif // API_GENERATOR_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/
/* dl_script.h */
/* gdnative.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -27,8 +27,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef DL_SCRIPT_H
#define DL_SCRIPT_H
#ifndef GDNATIVE_H
#define GDNATIVE_H
#include "io/resource_loader.h"
#include "io/resource_saver.h"
@ -40,26 +40,22 @@
#include "godot.h"
#ifdef TOOLS_ENABLED
#define DLSCRIPT_EDITOR_FEATURES
#endif
class DLScriptData;
class DLLibrary;
class GDNativeScriptData;
class GDNativeLibrary;
struct NativeLibrary {
StringName path;
void *handle;
DLLibrary *dllib;
GDNativeLibrary *dllib;
Map<StringName, DLScriptData *> scripts;
Map<StringName, GDNativeScriptData *> scripts;
static Error initialize(NativeLibrary *&p_native_lib, const StringName p_path);
static Error terminate(NativeLibrary *&p_native_lib);
};
struct DLScriptData {
struct GDNativeScriptData {
/* typedef void* (InstanceFunc)(godot_object* instance);
typedef void (DestroyFunc)(godot_object* instance,void* userdata);
typedef godot_variant (MethodFunc)(godot_object *instance, void *userdata, void *method_data, int arg_count,godot_variant **args);
@ -111,18 +107,18 @@ struct DLScriptData {
Map<StringName, Signal> signals_; // QtCreator doesn't like the name signals
StringName base;
StringName base_native_type;
DLScriptData *base_data;
GDNativeScriptData *base_data;
godot_instance_create_func create_func;
godot_instance_destroy_func destroy_func;
bool is_tool;
DLScriptData() {
GDNativeScriptData() {
base = StringName();
base_data = NULL;
is_tool = false;
}
DLScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
GDNativeScriptData(StringName p_base, godot_instance_create_func p_instance, godot_instance_destroy_func p_free) {
base = p_base;
base_data = NULL;
create_func = p_instance;
@ -131,16 +127,16 @@ struct DLScriptData {
}
};
class DLLibrary;
class GDNativeLibrary;
class DLScript : public Script {
GDCLASS(DLScript, Script);
class GDNativeScript : public Script {
GDCLASS(GDNativeScript, Script);
Ref<DLLibrary> library;
Ref<GDNativeLibrary> library;
StringName script_name;
StringName base_native_type;
Set<Object *> instances;
DLScriptData *script_data;
GDNativeScriptData *script_data;
#ifdef TOOLS_ENABLED
Set<PlaceHolderScriptInstance *> placeholders;
@ -148,10 +144,10 @@ class DLScript : public Script {
virtual void _placeholder_erased(PlaceHolderScriptInstance *p_placeholder);
#endif
friend class DLInstance;
friend class DLScriptLanguage;
friend class DLReloadNode;
friend class DLLibrary;
friend class GDNativeInstance;
friend class GDNativeScriptLanguage;
friend class GDNativeReloadNode;
friend class GDNativeLibrary;
protected:
static void _bind_methods();
@ -188,32 +184,32 @@ public:
virtual void get_script_method_list(List<MethodInfo> *p_list) const;
virtual void get_script_property_list(List<PropertyInfo> *p_list) const;
Ref<DLLibrary> get_library() const;
void set_library(Ref<DLLibrary> p_library);
Ref<GDNativeLibrary> get_library() const;
void set_library(Ref<GDNativeLibrary> p_library);
StringName get_script_name() const;
void set_script_name(StringName p_script_name);
DLScript();
~DLScript();
GDNativeScript();
~GDNativeScript();
};
class DLLibrary : public Resource {
class GDNativeLibrary : public Resource {
_THREAD_SAFE_CLASS_
GDCLASS(DLLibrary, Resource);
OBJ_SAVE_TYPE(DLLibrary);
GDCLASS(GDNativeLibrary, Resource);
OBJ_SAVE_TYPE(GDNativeLibrary);
Map<StringName, String> platform_files;
NativeLibrary *native_library;
static DLLibrary *currently_initialized_library;
static GDNativeLibrary *currently_initialized_library;
protected:
friend class DLScript;
friend class GDNativeScript;
friend class NativeLibrary;
friend class DLReloadNode;
friend class GDNativeReloadNode;
DLScriptData *get_script_data(const StringName p_name);
GDNativeScriptData *get_script_data(const StringName p_name);
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
@ -225,7 +221,7 @@ public:
Error _initialize();
Error _terminate();
static DLLibrary *get_currently_initialized_library();
static GDNativeLibrary *get_currently_initialized_library();
void _register_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
void _register_tool_script(const StringName p_name, const StringName p_base, godot_instance_create_func p_instance_func, godot_instance_destroy_func p_destroy_func);
@ -236,18 +232,18 @@ public:
void set_platform_file(StringName p_platform, String p_file);
String get_platform_file(StringName p_platform) const;
DLLibrary();
~DLLibrary();
GDNativeLibrary();
~GDNativeLibrary();
};
class DLInstance : public ScriptInstance {
friend class DLScript;
class GDNativeInstance : public ScriptInstance {
friend class GDNativeScript;
Object *owner;
Ref<DLScript> script;
Ref<GDNativeScript> script;
void *userdata;
void _ml_call_reversed(DLScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
void _ml_call_reversed(GDNativeScriptData *data_ptr, const StringName &p_method, const Variant **p_args, int p_argcount);
public:
_FORCE_INLINE_ Object *get_owner() { return owner; }
@ -280,19 +276,19 @@ public:
virtual RPCMode get_rpc_mode(const StringName &p_method) const;
virtual RPCMode get_rset_mode(const StringName &p_variable) const;
DLInstance();
~DLInstance();
GDNativeInstance();
~GDNativeInstance();
};
class DLReloadNode;
class GDNativeReloadNode;
class DLScriptLanguage : public ScriptLanguage {
friend class DLScript;
friend class DLInstance;
friend class DLReloadNode;
friend class DLLibrary;
class GDNativeScriptLanguage : public ScriptLanguage {
friend class GDNativeScript;
friend class GDNativeInstance;
friend class GDNativeReloadNode;
friend class GDNativeLibrary;
static DLScriptLanguage *singleton;
static GDNativeScriptLanguage *singleton;
Variant *_global_array; // @Unused necessary?
Vector<Variant> global_array; // @Unused necessary?
@ -303,7 +299,7 @@ class DLScriptLanguage : public ScriptLanguage {
Mutex *lock;
Set<DLScript *> script_list;
Set<GDNativeScript *> script_list;
bool profiling;
uint64_t script_frame_time;
@ -317,7 +313,7 @@ class DLScriptLanguage : public ScriptLanguage {
public:
Map<StringName, NativeLibrary *> initialized_libraries;
_FORCE_INLINE_ static DLScriptLanguage *get_singleton() { return singleton; }
_FORCE_INLINE_ static GDNativeScriptLanguage *get_singleton() { return singleton; }
virtual String get_name() const;
@ -391,18 +387,18 @@ public:
/* HACKER FUNCTIONS */
void _compile_dummy_for_the_api();
DLScriptLanguage();
~DLScriptLanguage();
GDNativeScriptLanguage();
~GDNativeScriptLanguage();
};
class DLReloadNode : public Node {
GDCLASS(DLReloadNode, Node)
class GDNativeReloadNode : public Node {
GDCLASS(GDNativeReloadNode, Node)
public:
static void _bind_methods();
void _notification(int p_what);
};
class ResourceFormatLoaderDLScript : public ResourceFormatLoader {
class ResourceFormatLoaderGDNativeScript : public ResourceFormatLoader {
public:
virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
@ -410,12 +406,10 @@ public:
virtual String get_resource_type(const String &p_path) const;
};
class ResourceFormatSaverDLScript : public ResourceFormatSaver {
class ResourceFormatSaverGDNativeScript : public ResourceFormatSaver {
virtual Error save(const String &p_path, const RES &p_resource, uint32_t p_flags = 0);
virtual bool recognize(const RES &p_resource) const;
virtual void get_recognized_extensions(const RES &p_resource, List<String> *p_extensions) const;
};
// ugly, but hey
#endif // DL_SCRIPT_H
#endif // GDNATIVE_H

View file

@ -1,5 +1,5 @@
/*************************************************************************/
/* godot_c.cpp */
/* godot.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -30,7 +30,7 @@
#include "godot.h"
#include "class_db.h"
#include "dl_script.h"
#include "gdnative.h"
#include "global_config.h"
#include "global_constants.h"
#include "variant.h"
@ -126,7 +126,7 @@ void GDAPI godot_method_bind_varcall(godot_method_bind *p_method_bind)
// Script API
void GDAPI godot_script_register_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
DLLibrary *library = DLLibrary::get_currently_initialized_library();
GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@ -135,7 +135,7 @@ void GDAPI godot_script_register_class(const char *p_name, const char *p_base, g
}
void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_base, godot_instance_create_func p_create_func, godot_instance_destroy_func p_destroy_func) {
DLLibrary *library = DLLibrary::get_currently_initialized_library();
GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@ -144,7 +144,7 @@ void GDAPI godot_script_register_tool_class(const char *p_name, const char *p_ba
}
void GDAPI godot_script_register_method(const char *p_name, const char *p_function_name, godot_method_attributes p_attr, godot_instance_method p_method) {
DLLibrary *library = DLLibrary::get_currently_initialized_library();
GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@ -153,7 +153,7 @@ void GDAPI godot_script_register_method(const char *p_name, const char *p_functi
}
void GDAPI godot_script_register_property(const char *p_name, const char *p_path, godot_property_attributes *p_attr, godot_property_set_func p_set_func, godot_property_get_func p_get_func) {
DLLibrary *library = DLLibrary::get_currently_initialized_library();
GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@ -163,7 +163,7 @@ void GDAPI godot_script_register_property(const char *p_name, const char *p_path
}
void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal) {
DLLibrary *library = DLLibrary::get_currently_initialized_library();
GDNativeLibrary *library = GDNativeLibrary::get_currently_initialized_library();
if (!library) {
ERR_EXPLAIN("Attempt to register script after initializing library!");
ERR_FAIL();
@ -172,12 +172,12 @@ void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *
library->_register_script_signal(p_name, p_signal);
}
void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) {
void GDAPI *godot_native_get_userdata(godot_object *p_instance) {
Object *instance = (Object *)p_instance;
if (!instance)
return NULL;
if (instance->get_script_instance() && instance->get_script_instance()->get_language() == DLScriptLanguage::get_singleton()) {
return ((DLInstance *)instance->get_script_instance())->get_userdata();
if (instance->get_script_instance() && instance->get_script_instance()->get_language() == GDNativeScriptLanguage::get_singleton()) {
return ((GDNativeInstance *)instance->get_script_instance())->get_userdata();
}
return NULL;
}
@ -185,7 +185,7 @@ void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance) {
godot_dictionary GDAPI godot_get_global_constants() {
godot_dictionary constants;
godot_dictionary_new(&constants);
Dictionary *p_constants = (Dictionary*)&constants;
Dictionary *p_constants = (Dictionary *)&constants;
const int constants_count = GlobalConstants::get_global_constant_count();
for (int i = 0; i < constants_count; ++i) {
const char *name = GlobalConstants::get_global_constant_name(i);

View file

@ -1,5 +1,5 @@
/*************************************************************************/
/* godot_c.h */
/* godot.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@ -217,16 +217,16 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj
////// Script API
typedef struct godot_dlscript_init_options {
typedef struct godot_native_init_options {
godot_bool in_editor;
uint64_t core_api_hash;
uint64_t editor_api_hash;
uint64_t no_api_hash;
} godot_dlscript_init_options;
} godot_native_init_options;
typedef struct godot_dlscript_terminate_options {
typedef struct godot_native_terminate_options {
godot_bool in_editor;
} godot_dlscript_terminate_options;
} godot_native_terminate_options;
typedef enum godot_method_rpc_mode {
GODOT_METHOD_RPC_MODE_DISABLED,
@ -374,7 +374,7 @@ typedef struct godot_signal {
void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *p_signal);
void GDAPI *godot_dlinstance_get_userdata(godot_object *p_instance);
void GDAPI *godot_native_get_userdata(godot_object *p_instance);
godot_dictionary GDAPI godot_get_global_constants();

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_array.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_array.h"
#include "core/array.h"

View file

@ -1,5 +1,35 @@
#ifndef GODOT_DLSCRIPT_ARRAY_H
#define GODOT_DLSCRIPT_ARRAY_H
/*************************************************************************/
/* godot_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" {
@ -85,4 +115,4 @@ void GDAPI godot_array_destroy(godot_array *p_arr);
}
#endif
#endif // GODOT_DLSCRIPT_ARRAY_H
#endif // GODOT_ARRAY_H

View file

@ -0,0 +1,87 @@
/*************************************************************************/
/* godot_basis.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_basis.h"
#include "math/matrix3.h"
#ifdef __cplusplus
extern "C" {
#endif
void _basis_api_anchor() {
}
void GDAPI godot_basis_new(godot_basis *p_basis) {
Basis *basis = (Basis *)p_basis;
*basis = Basis();
}
void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler) {
Basis *basis = (Basis *)p_basis;
Quat *euler = (Quat *)p_euler;
*basis = Basis(*euler);
}
void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler) {
Basis *basis = (Basis *)p_basis;
Vector3 *euler = (Vector3 *)p_euler;
*basis = Basis(*euler);
}
godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis) {
const Basis *basis = (const Basis *)p_basis;
godot_quat quat;
Quat *p_quat = (Quat *)&quat;
*p_quat = basis->operator Quat();
return quat;
}
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis) {
const Basis *basis = (const Basis *)p_basis;
godot_vector3 euler;
Vector3 *p_euler = (Vector3 *)&euler;
*p_euler = basis->get_euler();
return euler;
}
/*
* p_elements is a pointer to an array of 3 (!!) vector3
*/
void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements) {
Basis *basis = (Basis *)p_basis;
Vector3 *elements = (Vector3 *)p_elements;
elements[0] = basis->elements[0];
elements[1] = basis->elements[1];
elements[2] = basis->elements[2];
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,63 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_BASIS_TYPE_DEFINED
typedef struct godot_basis {
uint8_t _dont_touch_that[36];
} godot_basis;
#endif
#include "../godot.h"
void GDAPI godot_basis_new(godot_basis *p_basis);
void GDAPI godot_basis_new_with_euler_quat(godot_basis *p_basis, const godot_quat *p_euler);
void GDAPI godot_basis_new_with_euler(godot_basis *p_basis, const godot_vector3 *p_euler);
godot_quat GDAPI godot_basis_as_quat(const godot_basis *p_basis);
godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis);
/*
* p_elements is a pointer to an array of 3 (!!) vector3
*/
void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements);
#ifdef __cplusplus
}
#endif
#endif // GODOT_BASIS_H

View file

@ -0,0 +1,63 @@
/*************************************************************************/
/* godot_color.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_color.h"
#include "color.h"
#ifdef __cplusplus
extern "C" {
#endif
void _color_api_anchor() {
}
void GDAPI godot_color_new(godot_color *p_color) {
Color *color = (Color *)p_color;
*color = Color();
}
void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a) {
Color *color = (Color *)p_color;
*color = Color(r, g, b, a);
}
uint32_t GDAPI godot_color_get_32(const godot_color *p_color) {
const Color *color = (const Color *)p_color;
return color->to_32();
}
float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx) {
Color *color = (Color *)p_color;
return &color->operator[](idx);
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,58 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_COLOR_TYPE_DEFINED
typedef struct godot_color {
uint8_t _dont_touch_that[16];
} godot_color;
#endif
#include "../godot.h"
void GDAPI godot_color_new(godot_color *p_color);
void GDAPI godot_color_new_rgba(godot_color *p_color, const godot_real r, const godot_real g, const godot_real b, const godot_real a);
uint32_t GDAPI godot_color_get_32(const godot_color *p_color);
float GDAPI *godot_color_index(godot_color *p_color, const godot_int idx);
#ifdef __cplusplus
}
#endif
#endif // GODOT_COLOR_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_dictionary.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_dictionary.h"
#include "core/dictionary.h"

View file

@ -0,0 +1,80 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_DICITIONARY_TYPE_DEFINED
typedef struct godot_dictionary {
uint8_t _dont_touch_that[8];
} godot_dictionary;
#endif
#include "godot_array.h"
#include "godot_variant.h"
void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
void GDAPI godot_dictionary_clear(godot_dictionary *p_dict);
godot_bool GDAPI godot_dictionary_empty(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_erase(godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_has(const godot_dictionary *p_dict, const godot_variant *p_key);
godot_bool GDAPI godot_dictionary_has_all(const godot_dictionary *p_dict, const godot_array *p_keys);
uint32_t GDAPI godot_dictionary_hash(const godot_dictionary *p_dict);
godot_array GDAPI godot_dictionary_keys(const godot_dictionary *p_dict);
godot_int GDAPI godot_dictionary_parse_json(godot_dictionary *p_dict, const godot_string *p_json);
godot_variant GDAPI *godot_dictionary_operator_index(godot_dictionary *p_dict, const godot_variant *p_key);
godot_int GDAPI godot_dictionary_size(const godot_dictionary *p_dict);
godot_string GDAPI godot_dictionary_to_json(const godot_dictionary *p_dict);
godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
#ifdef __cplusplus
}
#endif
#endif // GODOT_DICTIONARY_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_image.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_image.h"
#include "image.h"

View file

@ -1,5 +1,34 @@
#ifndef GODOT_DLSCRIPT_IMAGE_H
#define GODOT_DLSCRIPT_IMAGE_H
/*************************************************************************/
/* godot_image.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_IMAGE_H
#define GODOT_IMAGE_H
#ifdef __cplusplus
extern "C" {
@ -92,4 +121,4 @@ void GDAPI godot_image_destroy(godot_image *p_img);
}
#endif
#endif // GODOT_DLSCRIPT_IMAGE_H
#endif // GODOT_IMAGE_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_input_event.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_input_event.h"
#include "os/input_event.h"

View file

@ -1,5 +1,34 @@
#ifndef GODOT_DLSCRIPT_INPUT_EVENT_H
#define GODOT_DLSCRIPT_INPUT_EVENT_H
/*************************************************************************/
/* godot_input_event.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_INPUT_EVENT_H
#define GODOT_INPUT_EVENT_H
#ifdef __cplusplus
extern "C" {
@ -203,4 +232,4 @@ float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_even
}
#endif
#endif // GODOT_DLSCRIPT_INPUT_EVENT_H
#endif // GODOT_INPUT_EVENT_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_node_path.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_node_path.h"
#include "path_db.h"

View file

@ -0,0 +1,68 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_NODE_PATH_TYPE_DEFINED
typedef struct godot_node_path {
uint8_t _dont_touch_that[8];
} godot_node_path;
#endif
#include "../godot.h"
void GDAPI godot_node_path_new(godot_node_path *p_np, const godot_string *p_from);
void GDAPI godot_node_path_copy(godot_node_path *p_np, const godot_node_path *p_from);
godot_string GDAPI godot_node_path_get_name(const godot_node_path *p_np, const godot_int p_idx);
godot_int GDAPI godot_node_path_get_name_count(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_get_property(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_get_subname(const godot_node_path *p_np, const godot_int p_idx);
godot_int GDAPI godot_node_path_get_subname_count(const godot_node_path *p_np);
godot_bool GDAPI godot_node_path_is_absolute(const godot_node_path *p_np);
godot_bool GDAPI godot_node_path_is_empty(const godot_node_path *p_np);
godot_string GDAPI godot_node_path_as_string(const godot_node_path *p_np);
void GDAPI godot_node_path_destroy(godot_node_path *p_np);
#ifdef __cplusplus
}
#endif
#endif // GODOT_NODE_PATH_H

View file

@ -0,0 +1,77 @@
/*************************************************************************/
/* godot_plane.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_plane.h"
#include "math/plane.h"
#ifdef __cplusplus
extern "C" {
#endif
void _plane_api_anchor() {
}
void GDAPI godot_plane_new(godot_plane *p_pl) {
Plane *pl = (Plane *)p_pl;
*pl = Plane();
}
void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d) {
Plane *pl = (Plane *)p_pl;
const Vector3 *normal = (const Vector3 *)p_normal;
*pl = Plane(*normal, p_d);
}
void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal) {
Plane *pl = (Plane *)p_pl;
const Vector3 *normal = (const Vector3 *)p_normal;
pl->set_normal(*normal);
}
godot_vector3 godot_plane_get_normal(const godot_plane *p_pl) {
const Plane *pl = (const Plane *)p_pl;
const Vector3 normal = pl->get_normal();
godot_vector3 *v3 = (godot_vector3 *)&normal;
return *v3;
}
void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d) {
Plane *pl = (Plane *)p_pl;
pl->d = p_d;
}
godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl) {
const Plane *pl = (const Plane *)p_pl;
return pl->d;
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,66 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_PLANE_TYPE_DEFINED
typedef struct godot_plane {
uint8_t _dont_touch_that[16];
} godot_plane;
#endif
#include "godot_vector3.h"
void GDAPI godot_plane_new(godot_plane *p_pl);
void GDAPI godot_plane_new_with_normal(godot_plane *p_pl, const godot_vector3 *p_normal, const godot_real p_d);
// @Incomplete
// These are additional valid constructors
// _FORCE_INLINE_ Plane(const Vector3 &p_normal, real_t p_d);
// _FORCE_INLINE_ Plane(const Vector3 &p_point, const Vector3& p_normal);
// _FORCE_INLINE_ Plane(const Vector3 &p_point1, const Vector3 &p_point2,const Vector3 &p_point3,ClockDirection p_dir = CLOCKWISE);
void GDAPI godot_plane_set_normal(godot_plane *p_pl, const godot_vector3 *p_normal);
godot_vector3 GDAPI godot_plane_get_normal(const godot_plane *p_pl);
godot_real GDAPI godot_plane_get_d(const godot_plane *p_pl);
void GDAPI godot_plane_set_d(godot_plane *p_pl, const godot_real p_d);
#ifdef __cplusplus
}
#endif
#endif // GODOT_PLANE_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_pool_arrays.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_pool_arrays.h"
#include "array.h"

View file

@ -1,5 +1,34 @@
#ifndef GODOT_DLSCRIPT_POOL_ARRAYS_H
#define GODOT_DLSCRIPT_POOL_ARRAYS_H
/*************************************************************************/
/* godot_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" {
@ -253,4 +282,4 @@ void GDAPI godot_pool_color_array_destroy(godot_pool_color_array *p_pca);
}
#endif
#endif // GODOT_DLSCRIPT_POOL_ARRAYS_H
#endif // GODOT_POOL_ARRAYS_H

View file

@ -0,0 +1,106 @@
/*************************************************************************/
/* godot_quat.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_quat.h"
#include "math/quat.h"
#ifdef __cplusplus
extern "C" {
#endif
void _quat_api_anchor() {
}
void GDAPI godot_quat_new(godot_quat *p_quat) {
Quat *quat = (Quat *)p_quat;
*quat = Quat();
}
void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w) {
Quat *quat = (Quat *)p_quat;
*quat = Quat(x, y, z, w);
}
void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle) {
Quat *quat = (Quat *)p_quat;
const Vector3 *axis = (const Vector3 *)p_axis;
*quat = Quat(*axis, p_angle);
}
void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1) {
Quat *quat = (Quat *)p_quat;
const Vector3 *v0 = (const Vector3 *)p_v0;
const Vector3 *v1 = (const Vector3 *)p_v1;
*quat = Quat(*v0, *v1);
}
godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat) {
Quat *quat = (Quat *)p_quat;
Vector3 euler = quat->get_euler();
return *(godot_vector3 *)&euler;
}
void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler) {
Quat *quat = (Quat *)p_quat;
const Vector3 *euler = (const Vector3 *)p_euler;
quat->set_euler(*euler);
}
godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx) {
Quat *quat = (Quat *)p_quat;
switch (p_idx) {
case 0:
return &quat->x;
case 1:
return &quat->y;
case 2:
return &quat->z;
default:
return &quat->y;
}
}
godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx) {
const Quat *quat = (const Quat *)p_quat;
switch (p_idx) {
case 0:
return quat->x;
case 1:
return quat->y;
case 2:
return quat->z;
default:
return quat->y;
}
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,62 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_QUAT_TYPE_DEFINED
typedef struct godot_quat {
uint8_t _dont_touch_that[16];
} godot_quat;
#endif
#include "../godot.h"
void GDAPI godot_quat_new(godot_quat *p_quat);
void GDAPI godot_quat_new_with_elements(godot_quat *p_quat, const godot_real x, const godot_real y, const godot_real z, const godot_real w);
void GDAPI godot_quat_new_with_rotation(godot_quat *p_quat, const godot_vector3 *p_axis, const godot_real p_angle);
void GDAPI godot_quat_new_with_shortest_arc(godot_quat *p_quat, const godot_vector3 *p_v0, const godot_vector3 *p_v1);
godot_vector3 GDAPI godot_quat_get_euler(const godot_quat *p_quat);
void GDAPI godot_quat_set_euler(godot_quat *p_quat, const godot_vector3 *p_euler);
godot_real GDAPI *godot_quat_index(godot_quat *p_quat, const godot_int p_idx);
godot_real GDAPI godot_quat_const_index(const godot_quat *p_quat, const godot_int p_idx);
#ifdef __cplusplus
}
#endif
#endif // GODOT_QUAT_H

View file

@ -0,0 +1,77 @@
/*************************************************************************/
/* godot_rect2.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_rect2.h"
#include "math/math_2d.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rect2_api_anchor() {
}
void GDAPI godot_rect2_new(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
*rect = Rect2();
}
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size) {
Rect2 *rect = (Rect2 *)p_rect;
const Vector2 *pos = (const Vector2 *)p_pos;
const Vector2 *size = (const Vector2 *)p_size;
*rect = Rect2(*pos, *size);
}
godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
return (godot_vector2 *)&rect->pos;
}
void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos) {
Rect2 *rect = (Rect2 *)p_rect;
const Vector2 *pos = (const Vector2 *)p_pos;
rect->pos = *pos;
}
godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect) {
Rect2 *rect = (Rect2 *)p_rect;
return (godot_vector2 *)&rect->size;
}
void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size) {
Rect2 *rect = (Rect2 *)p_rect;
const Vector2 *size = (const Vector2 *)p_size;
rect->size = *size;
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,60 @@
/*************************************************************************/
/* godot_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
typedef struct godot_rect2 {
uint8_t _dont_touch_that[16];
} godot_rect2;
#endif
#include "../godot.h"
void GDAPI godot_rect2_new(godot_rect2 *p_rect);
void GDAPI godot_rect2_new_with_pos_and_size(godot_rect2 *p_rect, const godot_vector2 *p_pos, const godot_vector2 *p_size);
godot_vector2 GDAPI *godot_rect2_get_pos(godot_rect2 *p_rect);
void GDAPI godot_rect2_set_pos(godot_rect2 *p_rect, const godot_vector2 *p_pos);
godot_vector2 GDAPI *godot_rect2_get_size(godot_rect2 *p_rect);
void GDAPI godot_rect2_set_size(godot_rect2 *p_rect, const godot_vector2 *p_size);
#ifdef __cplusplus
}
#endif
#endif // GODOT_RECT3_H

View file

@ -0,0 +1,77 @@
/*************************************************************************/
/* godot_rect3.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_rect3.h"
#include "math/rect3.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rect3_api_anchor() {
}
void GDAPI godot_rect3_new(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
*rect = Rect3();
}
void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *pos = (const Vector3 *)p_pos;
const Vector3 *size = (const Vector3 *)p_size;
*rect = Rect3(*pos, *size);
}
godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
return (godot_vector3 *)&rect->pos;
}
void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *pos = (const Vector3 *)p_pos;
rect->pos = *pos;
}
godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect) {
Rect3 *rect = (Rect3 *)p_rect;
return (godot_vector3 *)&rect->size;
}
void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size) {
Rect3 *rect = (Rect3 *)p_rect;
const Vector3 *size = (const Vector3 *)p_size;
rect->size = *size;
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,60 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
typedef struct godot_rect3 {
uint8_t _dont_touch_that[24];
} godot_rect3;
#endif
#include "../godot.h"
void GDAPI godot_rect3_new(godot_rect3 *p_rect);
void GDAPI godot_rect3_new_with_pos_and_size(godot_rect3 *p_rect, const godot_vector3 *p_pos, const godot_vector3 *p_size);
godot_vector3 GDAPI *godot_rect3_get_pos(godot_rect3 *p_rect);
void GDAPI godot_rect3_set_pos(godot_rect3 *p_rect, const godot_vector3 *p_pos);
godot_vector3 GDAPI *godot_rect3_get_size(godot_rect3 *p_rect);
void GDAPI godot_rect3_set_size(godot_rect3 *p_rect, const godot_vector3 *p_size);
#ifdef __cplusplus
}
#endif
#endif // GODOT_RECT3_H

View file

@ -0,0 +1,65 @@
/*************************************************************************/
/* godot_rid.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_rid.h"
#include "object.h"
#include "resource.h"
#ifdef __cplusplus
extern "C" {
#endif
void _rid_api_anchor() {
}
void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from) {
Resource *res_from = ((Object *)p_from)->cast_to<Resource>();
RID *rid = (RID *)p_rid;
memnew_placement(rid, RID);
if (res_from) {
*rid = RID(res_from->get_rid());
}
}
uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid) {
RID *rid = (RID *)p_rid;
return rid->get_id();
}
void GDAPI godot_rid_destroy(godot_rid *p_rid) {
((RID *)p_rid)->~RID();
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,57 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_RID_TYPE_DEFINED
typedef struct godot_rid {
uint8_t _dont_touch_that[8];
} godot_rid;
#endif
#include "../godot.h"
void GDAPI godot_rid_new(godot_rid *p_rid, godot_object *p_from);
uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
void GDAPI godot_rid_destroy(godot_rid *p_rid);
#ifdef __cplusplus
}
#endif
#endif // GODOT_RID_H

View file

@ -0,0 +1,112 @@
/*************************************************************************/
/* godot_string.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_string.h"
#include "string_db.h"
#include "ustring.h"
#include <string.h>
#ifdef __cplusplus
extern "C" {
#endif
void _string_api_anchor() {
}
void GDAPI godot_string_new(godot_string *p_str) {
String *p = (String *)p_str;
memnew_placement(p, String);
// *p = String(); // useless here
}
void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size) {
String *p = (String *)p_str;
memnew_placement(p, String);
*p = String::utf8(p_contents, p_size);
}
void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size) {
String *p = (String *)p_str;
if (p_size != NULL) {
*p_size = p->length();
}
if (p_dest != NULL) {
memcpy(p_dest, p->ptr(), *p_size * sizeof(CharType));
}
}
void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src) {
String *dest = (String *)p_dest;
String *src = (String *)p_src;
*dest = *src;
}
wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx) {
String *s = (String *)p_str;
return &(s->operator[](p_idx));
}
const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str) {
const String *s = (const String *)p_str;
return s->c_str();
}
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b) {
String *a = (String *)p_a;
String *b = (String *)p_b;
return *a == *b;
}
godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b) {
String *a = (String *)p_a;
String *b = (String *)p_b;
return *a < *b;
}
void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b) {
String *dest = (String *)p_dest;
const String *a = (String *)p_a;
const String *b = (String *)p_b;
String tmp = *a + *b;
godot_string_new(p_dest);
*dest = tmp;
}
void GDAPI godot_string_destroy(godot_string *p_str) {
String *p = (String *)p_str;
p->~String();
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,71 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_STRING_TYPE_DEFINED
typedef struct godot_string {
uint8_t _dont_touch_that[8];
} godot_string;
#endif
#include "../godot.h"
void GDAPI godot_string_new(godot_string *p_str);
void GDAPI godot_string_new_data(godot_string *p_str, const char *p_contents, const int p_size);
void GDAPI godot_string_get_data(const godot_string *p_str, wchar_t *p_dest, int *p_size);
void GDAPI godot_string_copy_string(const godot_string *p_dest, const godot_string *p_src);
wchar_t GDAPI *godot_string_operator_index(godot_string *p_str, const godot_int p_idx);
const wchar_t GDAPI *godot_string_c_str(const godot_string *p_str);
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godot_string *p_b);
godot_bool GDAPI godot_string_operator_less(const godot_string *p_a, const godot_string *p_b);
void GDAPI godot_string_operator_plus(godot_string *p_dest, const godot_string *p_a, const godot_string *p_b);
// @Incomplete
// hmm, I guess exposing the whole API doesn't make much sense
// since the language used in the library has its own string funcs
void GDAPI godot_string_destroy(godot_string *p_str);
#ifdef __cplusplus
}
#endif
#endif // GODOT_STRING_H

View file

@ -0,0 +1,71 @@
/*************************************************************************/
/* godot_transform.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_transform.h"
#include "math/transform.h"
#ifdef __cplusplus
extern "C" {
#endif
void _transform_api_anchor() {
}
void GDAPI godot_transform_new(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
*trans = Transform();
}
void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis) {
Transform *trans = (Transform *)p_trans;
const Basis *basis = (const Basis *)p_basis;
*trans = Transform(*basis);
}
void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin) {
Transform *trans = (Transform *)p_trans;
const Basis *basis = (const Basis *)p_basis;
const Vector3 *origin = (const Vector3 *)p_origin;
*trans = Transform(*basis, *origin);
}
godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
return (godot_basis *)&trans->basis;
}
godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans) {
Transform *trans = (Transform *)p_trans;
return (godot_vector3 *)&trans->origin;
}
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,58 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_TRANSFORM_TYPE_DEFINED
typedef struct godot_transform {
uint8_t _dont_touch_that[48];
} godot_transform;
#endif
#include "../godot.h"
void GDAPI godot_transform_new(godot_transform *p_trans);
void GDAPI godot_transform_new_with_basis(godot_transform *p_trans, const godot_basis *p_basis);
void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const godot_basis *p_basis, const godot_vector3 *p_origin);
godot_basis GDAPI *godot_transform_get_basis(godot_transform *p_trans);
godot_vector3 GDAPI *godot_transform_get_origin(godot_transform *p_trans);
#ifdef __cplusplus
}
#endif
#endif // GODOT_TRANSFORM_H

View file

@ -0,0 +1,88 @@
/*************************************************************************/
/* godot_transform2d.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_transform2d.h"
#include "../godot.h"
#include "math/math_2d.h"
#ifdef __cplusplus
extern "C" {
#endif
void _transform2d_api_anchor() {
}
void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t) {
Transform2D *t = (Transform2D *)p_t;
*t = Transform2D();
}
void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *a = (Vector2 *)p_a;
Vector2 *b = (Vector2 *)p_b;
Vector2 *c = (Vector2 *)p_c;
*t = Transform2D(a->x, a->y, b->x, b->y, c->x, c->y);
}
void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *pos = (Vector2 *)p_pos;
*t = Transform2D(p_rot, *pos);
}
godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx) {
const Transform2D *t = (const Transform2D *)p_t;
const Vector2 *e = &t->operator[](p_idx);
return (godot_vector2 const *)e;
}
godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx) {
Transform2D *t = (Transform2D *)p_t;
Vector2 *e = &t->operator[](p_idx);
return (godot_vector2 *)e;
}
godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis) {
return *godot_transform2d_const_index(p_t, p_axis);
}
void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec) {
godot_vector2 *origin_v = godot_transform2d_index(p_t, p_axis);
*origin_v = *p_vec;
}
// @Incomplete
// See header file
#ifdef __cplusplus
}
#endif

View file

@ -0,0 +1,77 @@
/*************************************************************************/
/* godot_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>
#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
typedef struct godot_transform2d {
uint8_t _dont_touch_that[24];
} godot_transform2d;
#endif
#include "../godot.h"
#include "godot_vector2.h"
void GDAPI godot_transform2d_new_identity(godot_transform2d *p_t);
void GDAPI godot_transform2d_new_elements(godot_transform2d *p_t, const godot_vector2 *p_a, const godot_vector2 *p_b, const godot_vector2 *p_c);
void GDAPI godot_transform2d_new(godot_transform2d *p_t, const godot_real p_rot, const godot_vector2 *p_pos);
/*
godot_real GDAPI godot_transform2d_tdotx(const godot_transform2d *p_t, const godot_vector2 *p_v);
godot_real GDAPI godot_transform2d_tdoty(const godot_transform2d *p_t, const godot_vector2 *p_v);
*/
godot_vector2 const GDAPI *godot_transform2d_const_index(const godot_transform2d *p_t, const godot_int p_idx);
godot_vector2 GDAPI *godot_transform2d_index(godot_transform2d *p_t, const godot_int p_idx);
godot_vector2 GDAPI godot_transform2d_get_axis(const godot_transform2d *p_t, const godot_int p_axis);
void GDAPI godot_transform2d_set_axis(godot_transform2d *p_t, const godot_int p_axis, const godot_vector2 *p_vec);
/*
void GDAPI godot_transform2d_invert(godot_transform2d *p_t);
godot_transform2d GDAPI godot_transform2d_inverse(const godot_transform2d *p_t);
*/
// @Incomplete
// I feel like it should be enough to expose get and set, the whole logic can be done in the bindings.
#ifdef __cplusplus
}
#endif
#endif // GODOT_TRANSFORM2D_H

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_variant.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_variant.h"
#include "../godot.h"

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_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

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_vector2.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_vector2.h"
#include "math/math_2d.h"

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_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

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_vector3.cpp */
/*************************************************************************/
/* 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. */
/*************************************************************************/
#include "godot_vector3.h"
#include "math/vector3.h"

View file

@ -1,3 +1,32 @@
/*************************************************************************/
/* godot_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

View file

@ -28,43 +28,39 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_types.h"
#include "dl_script.h"
#include "gdnative.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
DLScriptLanguage *script_language_dl = NULL;
ResourceFormatLoaderDLScript *resource_loader_dl = NULL;
ResourceFormatSaverDLScript *resource_saver_dl = NULL;
GDNativeScriptLanguage *script_language_gdn = NULL;
ResourceFormatLoaderGDNativeScript *resource_loader_gdn = NULL;
ResourceFormatSaverGDNativeScript *resource_saver_gdn = NULL;
//ResourceFormatLoaderDLLibrary *resource_loader_dllib=NULL;
void register_dlscript_types() {
void register_gdnative_types() {
ClassDB::register_class<DLLibrary>();
ClassDB::register_class<DLScript>();
ClassDB::register_class<GDNativeLibrary>();
ClassDB::register_class<GDNativeScript>();
script_language_dl = memnew(DLScriptLanguage);
//script_language_gd->init();
ScriptServer::register_language(script_language_dl);
resource_loader_dl = memnew(ResourceFormatLoaderDLScript);
ResourceLoader::add_resource_format_loader(resource_loader_dl);
resource_saver_dl = memnew(ResourceFormatSaverDLScript);
ResourceSaver::add_resource_format_saver(resource_saver_dl);
// resource_loader_dllib=memnew( ResourceFormatLoaderDLLibrary );
// ResourceLoader::add_resource_format_loader(resource_loader_gd);
script_language_gdn = memnew(GDNativeScriptLanguage);
ScriptServer::register_language(script_language_gdn);
resource_loader_gdn = memnew(ResourceFormatLoaderGDNativeScript);
ResourceLoader::add_resource_format_loader(resource_loader_gdn);
resource_saver_gdn = memnew(ResourceFormatSaverGDNativeScript);
ResourceSaver::add_resource_format_saver(resource_saver_gdn);
}
void unregister_dlscript_types() {
void unregister_gdnative_types() {
ScriptServer::unregister_language(script_language_dl);
ScriptServer::unregister_language(script_language_gdn);
if (script_language_dl)
memdelete(script_language_dl);
if (script_language_gdn)
memdelete(script_language_gdn);
if (resource_loader_dl)
memdelete(resource_loader_dl);
if (resource_loader_gdn)
memdelete(resource_loader_gdn);
if (resource_saver_dl)
memdelete(resource_saver_dl);
if (resource_saver_gdn)
memdelete(resource_saver_gdn);
}

View file

@ -27,5 +27,5 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
void register_dlscript_types();
void unregister_dlscript_types();
void register_gdnative_types();
void unregister_gdnative_types();