msvc and clang-format

This commit is contained in:
Karroffel
2017-03-15 16:23:45 +01:00
parent 915d5311e1
commit 85145fdf4a
18 changed files with 45 additions and 107 deletions

View File

@@ -40,9 +40,9 @@ extern "C" {
#if !defined(_WIN32) && !defined(_MSC_VER)
#define GDAPI
#elif defined(GDAPI_EXPORT)
#define GDAPI __declspec(dllexport)
#define GDAPI __declspec(dllexport) __stdcall
#else
#define GDAPI __declspec(dllimport)
#define GDAPI __declspec(dllimport) __stdcall
#endif
#include <stdbool.h>
@@ -257,7 +257,7 @@ typedef struct godot_instance_create_func {
void *(*create_func)(godot_object *, void *);
void *method_data;
void (*free_func)(void *);
} godot_instance_create_func;
} godot_script_instance_func;
typedef struct godot_instance_destroy_func {
// instance pointer, method data, user data

View File

@@ -49,7 +49,7 @@ godot_int GDAPI godot_array_find(const godot_array *p_arr, const godot_variant *
godot_int GDAPI godot_array_find_last(const godot_array *p_arr, const godot_variant *p_what);
godot_bool GDAPI godot_array_has(const godot_array *p_arr,const godot_variant *p_value);
godot_bool GDAPI godot_array_has(const godot_array *p_arr, const godot_variant *p_value);
uint32_t GDAPI godot_array_hash(const godot_array *p_arr);
@@ -81,7 +81,6 @@ void GDAPI godot_array_sort_custom(godot_array *p_arr, godot_object *p_obj, cons
void GDAPI godot_array_destroy(godot_array *p_arr);
#ifdef __cplusplus
}
#endif

View File

@@ -13,14 +13,12 @@ typedef struct godot_basis {
} 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);
@@ -29,8 +27,6 @@ godot_vector3 GDAPI godot_basis_get_euler(const godot_basis *p_basis);
*/
void GDAPI godot_basis_get_elements(godot_basis *p_basis, godot_vector3 *p_elements);
#ifdef __cplusplus
}
#endif

View File

@@ -13,7 +13,6 @@ typedef struct godot_color {
} godot_color;
#endif
#include "../godot.h"
void GDAPI godot_color_new(godot_color *p_color);
@@ -23,7 +22,6 @@ 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

View File

@@ -13,9 +13,8 @@ typedef struct godot_dictionary {
} godot_dictionary;
#endif
#include "godot_variant.h"
#include "godot_array.h"
#include "godot_variant.h"
void GDAPI godot_dictionary_new(godot_dictionary *p_dict);
@@ -45,7 +44,6 @@ godot_array GDAPI godot_dictionary_values(const godot_dictionary *p_dict);
void GDAPI godot_dictionary_destroy(godot_dictionary *p_dict);
#ifdef __cplusplus
}
#endif

View File

@@ -13,7 +13,6 @@ typedef struct godot_image {
} godot_image;
#endif
#include "godot_pool_arrays.h"
#include "../godot.h"
@@ -65,9 +64,6 @@ enum godot_image_format {
};
typedef enum godot_image_format godot_image_format;
void GDAPI godot_image_new(godot_image *p_img);
// p_len can be -1
void GDAPI godot_image_new_with_png_jpg(godot_image *p_img, const uint8_t *p_mem_png_jpg, int p_len);
@@ -92,7 +88,6 @@ int GDAPI godot_image_get_mipmap_count(const godot_image *p_img);
void GDAPI godot_image_destroy(godot_image *p_img);
#ifdef __cplusplus
}
#endif

View File

@@ -13,7 +13,6 @@ typedef struct godot_input_event {
} godot_input_event;
#endif
enum godot_input_event_type {
GODOT_INPUT_EVENT_TYPE_NONE,
GODOT_INPUT_EVENT_TYPE_KEY,
@@ -28,23 +27,20 @@ enum godot_input_event_type {
};
typedef enum godot_input_event_type godot_input_event_type;
enum {
GODOT_BUTTON_LEFT=1,
GODOT_BUTTON_RIGHT=2,
GODOT_BUTTON_MIDDLE=3,
GODOT_BUTTON_WHEEL_UP=4,
GODOT_BUTTON_WHEEL_DOWN=5,
GODOT_BUTTON_WHEEL_LEFT=6,
GODOT_BUTTON_WHEEL_RIGHT=7,
GODOT_BUTTON_MASK_LEFT=(1<<(GODOT_BUTTON_LEFT-1)),
GODOT_BUTTON_MASK_RIGHT=(1<<(GODOT_BUTTON_RIGHT-1)),
GODOT_BUTTON_MASK_MIDDLE=(1<<(GODOT_BUTTON_MIDDLE-1)),
GODOT_BUTTON_LEFT = 1,
GODOT_BUTTON_RIGHT = 2,
GODOT_BUTTON_MIDDLE = 3,
GODOT_BUTTON_WHEEL_UP = 4,
GODOT_BUTTON_WHEEL_DOWN = 5,
GODOT_BUTTON_WHEEL_LEFT = 6,
GODOT_BUTTON_WHEEL_RIGHT = 7,
GODOT_BUTTON_MASK_LEFT = (1 << (GODOT_BUTTON_LEFT - 1)),
GODOT_BUTTON_MASK_RIGHT = (1 << (GODOT_BUTTON_RIGHT - 1)),
GODOT_BUTTON_MASK_MIDDLE = (1 << (GODOT_BUTTON_MIDDLE - 1)),
};
enum {
GODOT_JOY_BUTTON_0 = 0,
@@ -85,20 +81,20 @@ enum {
GODOT_JOY_SNES_Y = GODOT_JOY_BUTTON_2,
GODOT_JOY_SNES_X = GODOT_JOY_BUTTON_3,
GODOT_JOY_SONY_CIRCLE=GODOT_JOY_SNES_A,
GODOT_JOY_SONY_X=GODOT_JOY_SNES_B,
GODOT_JOY_SONY_SQUARE=GODOT_JOY_SNES_Y,
GODOT_JOY_SONY_TRIANGLE=GODOT_JOY_SNES_X,
GODOT_JOY_SONY_CIRCLE = GODOT_JOY_SNES_A,
GODOT_JOY_SONY_X = GODOT_JOY_SNES_B,
GODOT_JOY_SONY_SQUARE = GODOT_JOY_SNES_Y,
GODOT_JOY_SONY_TRIANGLE = GODOT_JOY_SNES_X,
GODOT_JOY_SEGA_B=GODOT_JOY_SNES_A,
GODOT_JOY_SEGA_A=GODOT_JOY_SNES_B,
GODOT_JOY_SEGA_X=GODOT_JOY_SNES_Y,
GODOT_JOY_SEGA_Y=GODOT_JOY_SNES_X,
GODOT_JOY_SEGA_B = GODOT_JOY_SNES_A,
GODOT_JOY_SEGA_A = GODOT_JOY_SNES_B,
GODOT_JOY_SEGA_X = GODOT_JOY_SNES_Y,
GODOT_JOY_SEGA_Y = GODOT_JOY_SNES_X,
GODOT_JOY_XBOX_B=GODOT_JOY_SEGA_B,
GODOT_JOY_XBOX_A=GODOT_JOY_SEGA_A,
GODOT_JOY_XBOX_X=GODOT_JOY_SEGA_X,
GODOT_JOY_XBOX_Y=GODOT_JOY_SEGA_Y,
GODOT_JOY_XBOX_B = GODOT_JOY_SEGA_B,
GODOT_JOY_XBOX_A = GODOT_JOY_SEGA_A,
GODOT_JOY_XBOX_X = GODOT_JOY_SEGA_X,
GODOT_JOY_XBOX_Y = GODOT_JOY_SEGA_Y,
GODOT_JOY_DS_A = GODOT_JOY_SNES_A,
GODOT_JOY_DS_B = GODOT_JOY_SNES_B,
@@ -113,15 +109,15 @@ enum {
// end of history
GODOT_JOY_AXIS_0=0,
GODOT_JOY_AXIS_1=1,
GODOT_JOY_AXIS_2=2,
GODOT_JOY_AXIS_3=3,
GODOT_JOY_AXIS_4=4,
GODOT_JOY_AXIS_5=5,
GODOT_JOY_AXIS_6=6,
GODOT_JOY_AXIS_7=7,
GODOT_JOY_AXIS_MAX=8,
GODOT_JOY_AXIS_0 = 0,
GODOT_JOY_AXIS_1 = 1,
GODOT_JOY_AXIS_2 = 2,
GODOT_JOY_AXIS_3 = 3,
GODOT_JOY_AXIS_4 = 4,
GODOT_JOY_AXIS_5 = 5,
GODOT_JOY_AXIS_6 = 6,
GODOT_JOY_AXIS_7 = 7,
GODOT_JOY_AXIS_MAX = 8,
GODOT_JOY_ANALOG_0_X = GODOT_JOY_AXIS_0,
GODOT_JOY_ANALOG_0_Y = GODOT_JOY_AXIS_1,
@@ -136,17 +132,10 @@ enum {
GODOT_JOY_ANALOG_R2 = GODOT_JOY_AXIS_7,
};
#include "../godot.h"
void GDAPI godot_input_event_new(godot_input_event *p_ie);
godot_bool GDAPI godot_input_event_is_pressed(const godot_input_event *p_ie);
godot_bool GDAPI godot_input_event_is_action(const godot_input_event *p_ie, const godot_string *p_action);
godot_bool GDAPI godot_input_event_is_action_pressed(const godot_input_event *p_ie, const godot_string *p_action);
@@ -164,8 +153,6 @@ uint32_t GDAPI *godot_input_event_get_id(godot_input_event *p_ie);
godot_input_event_type GDAPI *godot_input_event_get_type(godot_input_event *p_ie);
godot_int GDAPI *godot_input_event_get_device(godot_input_event *p_ie);
godot_bool GDAPI *godot_input_event_mod_get_alt(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mod_get_ctrl(godot_input_event *p_event);
godot_bool GDAPI *godot_input_event_mod_get_command(godot_input_event *p_event);
@@ -212,8 +199,6 @@ float GDAPI *godot_input_event_screen_drag_get_relative_y(godot_input_event *p_e
float GDAPI *godot_input_event_screen_drag_get_speed_x(godot_input_event *p_event);
float GDAPI *godot_input_event_screen_drag_get_speed_y(godot_input_event *p_event);
#ifdef __cplusplus
}
#endif

View File

@@ -31,7 +31,6 @@ 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

View File

@@ -30,8 +30,6 @@ 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

View File

@@ -13,7 +13,6 @@ typedef struct godot_rect2 {
} godot_rect2;
#endif
#include "../godot.h"
void GDAPI godot_rect2_new(godot_rect2 *p_rect);
@@ -25,7 +24,6 @@ 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

View File

@@ -13,7 +13,6 @@ typedef struct godot_rect3 {
} godot_rect3;
#endif
#include "../godot.h"
void GDAPI godot_rect3_new(godot_rect3 *p_rect);
@@ -25,7 +24,6 @@ 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

View File

@@ -21,7 +21,6 @@ uint32_t GDAPI godot_rid_get_rid(const godot_rid *p_rid);
void GDAPI godot_rid_destroy(godot_rid *p_rid);
#ifdef __cplusplus
}
#endif

View File

@@ -13,7 +13,6 @@ typedef struct godot_string {
} godot_string;
#endif
#include "../godot.h"
void GDAPI godot_string_new(godot_string *p_str);
@@ -30,15 +29,12 @@ godot_bool GDAPI godot_string_operator_equal(const godot_string *p_a, const godo
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

View File

@@ -13,7 +13,6 @@ typedef struct godot_transform {
} godot_transform;
#endif
#include "../godot.h"
void GDAPI godot_transform_new(godot_transform *p_trans);
@@ -23,7 +22,6 @@ void GDAPI godot_transform_new_with_basis_origin(godot_transform *p_trans, const
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

View File

@@ -7,7 +7,6 @@ extern "C" {
#include <stdint.h>
#ifndef GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
#define GODOT_CORE_API_GODOT_TRANSFORM2D_TYPE_DEFINED
typedef struct godot_transform2d {
@@ -39,7 +38,6 @@ 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.

View File

@@ -1,8 +1,6 @@
#ifndef GODOT_VARIANT_H
#define GODOT_VARIANT_H
#ifdef __cplusplus
extern "C" {
#endif
@@ -15,17 +13,15 @@ typedef struct godot_variant {
} godot_variant;
#endif
struct godot_transform2d;
typedef struct godot_transform2d godot_transform2d;
#include "godot_transform2d.h"
#include "godot_array.h"
#include "godot_dictionary.h"
#include "godot_input_event.h"
#include "godot_node_path.h"
#include "godot_rid.h"
#include "godot_input_event.h"
#include "godot_dictionary.h"
#include "godot_array.h"
#include "godot_transform2d.h"
enum godot_variant_type {
GODOT_VARIANT_TYPE_NIL,
@@ -38,38 +34,37 @@ enum godot_variant_type {
// math types
GODOT_VARIANT_TYPE_VECTOR2, // 5
GODOT_VARIANT_TYPE_VECTOR2, // 5
GODOT_VARIANT_TYPE_RECT2,
GODOT_VARIANT_TYPE_VECTOR3,
GODOT_VARIANT_TYPE_TRANSFORM2D,
GODOT_VARIANT_TYPE_PLANE,
GODOT_VARIANT_TYPE_QUAT, // 10
GODOT_VARIANT_TYPE_QUAT, // 10
GODOT_VARIANT_TYPE_RECT3, //sorry naming convention fail :( not like it's used often
GODOT_VARIANT_TYPE_BASIS,
GODOT_VARIANT_TYPE_TRANSFORM,
// misc types
GODOT_VARIANT_TYPE_COLOR,
GODOT_VARIANT_TYPE_IMAGE, // 15
GODOT_VARIANT_TYPE_IMAGE, // 15
GODOT_VARIANT_TYPE_NODE_PATH,
GODOT_VARIANT_TYPE_RID,
GODOT_VARIANT_TYPE_OBJECT,
GODOT_VARIANT_TYPE_INPUT_EVENT,
GODOT_VARIANT_TYPE_DICTIONARY, // 20
GODOT_VARIANT_TYPE_DICTIONARY, // 20
GODOT_VARIANT_TYPE_ARRAY,
// arrays
GODOT_VARIANT_TYPE_POOL_BYTE_ARRAY,
GODOT_VARIANT_TYPE_POOL_INT_ARRAY,
GODOT_VARIANT_TYPE_POOL_REAL_ARRAY,
GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, // 25
GODOT_VARIANT_TYPE_POOL_STRING_ARRAY, // 25
GODOT_VARIANT_TYPE_POOL_VECTOR2_ARRAY,
GODOT_VARIANT_TYPE_POOL_VECTOR3_ARRAY,
GODOT_VARIANT_TYPE_POOL_COLOR_ARRAY,
};
typedef enum godot_variant_type godot_variant_type;
godot_variant_type GDAPI godot_variant_get_type(const godot_variant *p_v);
void GDAPI godot_variant_copy(godot_variant *p_dest, const godot_variant *p_src);
@@ -105,8 +100,6 @@ void GDAPI godot_variant_new_pool_vector2_array(godot_variant *p_v, const godot_
void GDAPI godot_variant_new_pool_vector3_array(godot_variant *p_v, const godot_pool_vector3_array *p_pv3a);
void GDAPI godot_variant_new_pool_color_array(godot_variant *p_v, const godot_pool_color_array *p_pca);
godot_bool GDAPI godot_variant_as_bool(const godot_variant *p_v);
uint64_t GDAPI godot_variant_as_int(const godot_variant *p_v);
godot_real GDAPI godot_variant_as_real(const godot_variant *p_v);
@@ -136,13 +129,10 @@ godot_pool_vector2_array GDAPI godot_variant_as_pool_vector2_array(const godot_v
godot_pool_vector3_array GDAPI godot_variant_as_pool_vector3_array(const godot_variant *p_v);
godot_pool_color_array GDAPI godot_variant_as_pool_color_array(const godot_variant *p_v);
godot_variant GDAPI godot_variant_call(godot_variant *p_v, const godot_string *p_method, const godot_variant **p_args, const godot_int p_argcount /*, godot_variant_call_error *r_error */);
godot_bool GDAPI godot_variant_has_method(godot_variant *p_v, const godot_string *p_method);
godot_bool GDAPI godot_variant_operator_equal(const godot_variant *p_a, const godot_variant *p_b);
godot_bool GDAPI godot_variant_operator_less(const godot_variant *p_a, const godot_variant *p_b);
@@ -152,7 +142,6 @@ godot_bool GDAPI godot_variant_booleanize(const godot_variant *p_v, godot_bool *
void GDAPI godot_variant_destroy(godot_variant *p_v);
#ifdef __cplusplus
}
#endif

View File

@@ -32,8 +32,6 @@ godot_real GDAPI godot_vector2_length_squared(const godot_vector2 *p_v);
godot_real GDAPI godot_vector2_distance_to(const godot_vector2 *p_a, const godot_vector2 *p_b);
godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, const godot_vector2 *p_b);
// @Incomplete
/*
* missing:
@@ -63,8 +61,6 @@ godot_real GDAPI godot_vector2_distance_squared_to(const godot_vector2 *p_a, con
* to_string
*/
void GDAPI godot_vector2_operator_add(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
void GDAPI godot_vector2_operator_subtract(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
void GDAPI godot_vector2_operator_multiply_vector(godot_vector2 *p_dest, const godot_vector2 *p_a, const godot_vector2 *p_b);
@@ -75,7 +71,6 @@ void GDAPI godot_vector2_operator_divide_scalar(godot_vector2 *p_dest, const god
godot_bool GDAPI godot_vector2_operator_equal(const godot_vector2 *p_a, const godot_vector2 *p_b);
godot_bool GDAPI godot_vector2_operator_less(const godot_vector2 *p_a, const godot_vector2 *p_b);
#ifdef __cplusplus
}
#endif

View File

@@ -61,7 +61,6 @@ godot_real GDAPI godot_vector3_distance_squared_to(const godot_vector3 *p_a, con
* reflect
*/
void GDAPI godot_vector3_operator_add(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
void GDAPI godot_vector3_operator_subtract(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);
void GDAPI godot_vector3_operator_multiply_vector(godot_vector3 *p_dest, const godot_vector3 *p_a, const godot_vector3 *p_b);