Updated the C demos

- removed godot_headers submodule
- updated c submodules to godot-headers
- updated SConstruct to compile with windows and godot-headers submodule, msvc was not picked up properly
- updated api for instance_binding.c so it compiles
This commit is contained in:
geekrelief
2021-04-06 16:14:19 -07:00
committed by Aaron Franke
parent 6fdd07cc41
commit 7996654ff2
8 changed files with 30 additions and 24 deletions

18
.gitmodules vendored
View File

@@ -1,9 +1,9 @@
[submodule "c/simple/godot_headers"]
path = c/simple/godot_headers
url = https://github.com/godotengine/godot_headers
[submodule "c/glfw/godot_headers"]
path = c/glfw/godot_headers
url = https://github.com/godotengine/godot_headers
[submodule "c/instance_binding/godot_headers"]
path = c/instance_binding/godot_headers
url = https://github.com/godotengine/godot_headers
[submodule "c/simple/godot-headers"]
path = c/simple/godot-headers
url = https://github.com/godotengine/godot-headers.git
[submodule "c/glfw/godot-headers"]
path = c/glfw/godot-headers
url = https://github.com/godotengine/godot-headers.git
[submodule "c/instance_binding/godot-headers"]
path = c/instance_binding/godot-headers
url = https://github.com/godotengine/godot-headers.git

View File

@@ -4,7 +4,7 @@ import os, subprocess
opts = Variables([], ARGUMENTS)
# Define the relative path to the Godot headers.
godot_headers_path = "godot_headers/"
godot_headers_path = "godot-headers/"
# Gets the standard flags CC, CCX, etc.
env = DefaultEnvironment()
@@ -64,7 +64,8 @@ elif env["platform"] == "windows":
# This makes sure to keep the session environment variables
# on Windows, so that you can run scons in a VS 2017 prompt
# and it will find all the required tools.
env.Append(ENV=os.environ)
env = Environment(ENV=os.environ)
opts.Update(env)
env.Append(CCFLAGS=["-DWIN32", "-D_WIN32", "-D_WINDOWS", "-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS"])
if env["target"] in ("debug", "d"):

View File

@@ -4,7 +4,7 @@ import os, subprocess
opts = Variables([], ARGUMENTS)
# Define the relative path to the Godot headers.
godot_headers_path = "godot_headers/"
godot_headers_path = "godot-headers/"
# Gets the standard flags CC, CCX, etc.
env = DefaultEnvironment()
@@ -64,7 +64,8 @@ elif env["platform"] == "windows":
# This makes sure to keep the session environment variables
# on Windows, so that you can run scons in a VS 2017 prompt
# and it will find all the required tools.
env.Append(ENV=os.environ)
env = Environment(ENV=os.environ)
opts.Update(env)
env.Append(CCFLAGS=["-DWIN32", "-D_WIN32", "-D_WINDOWS", "-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS"])
if env["target"] in ("debug", "d"):

View File

@@ -23,7 +23,7 @@ typedef struct wrapper_object {
char *message;
} wrapper_object;
void *create_wrapper_object(void *data, godot_object *object) {
void *create_wrapper_object(void *data, const void *global_type_tag, godot_object *object) {
printf("we are now creating a wrapper object...\n");
fflush(stdout);
@@ -47,7 +47,7 @@ void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *options) {
api = options->api_struct;
// now find our extensions
for (int i = 0; i < api->num_extensions; i++) {
for (unsigned int i = 0; i < api->num_extensions; i++) {
switch (api->extensions[i]->type) {
case GDNATIVE_EXT_NATIVESCRIPT: {
nativescript_api = (godot_gdnative_ext_nativescript_api_struct *)api->extensions[i];
@@ -78,20 +78,23 @@ void GDN_EXPORT godot_nativescript_init(void *handle) {
// register instance binding functions
{
godot_instance_binding_functions bind = {};
bind.alloc_instance_binding_data = &create_wrapper_object;
bind.free_instance_binding_data = &destroy_wrapper_object;
godot_instance_binding_functions bind = {
.alloc_instance_binding_data = &create_wrapper_object,
.free_instance_binding_data = &destroy_wrapper_object
};
language_binding_index = nativescript_1_1_api->godot_nativescript_register_instance_binding_data_functions(bind);
}
// register class
{
godot_instance_create_func constructor = {};
constructor.create_func = &ibd_constructor;
godot_instance_create_func constructor = {
.create_func = &ibd_constructor
};
godot_instance_destroy_func destructor = {};
destructor.destroy_func = &ibd_destructor;
godot_instance_destroy_func destructor = {
.destroy_func = &ibd_destructor
};
nativescript_api->godot_nativescript_register_class(handle, "InstanceBinding", "Reference", constructor, destructor);
}

View File

@@ -4,7 +4,7 @@ import os, subprocess
opts = Variables([], ARGUMENTS)
# Define the relative path to the Godot headers.
godot_headers_path = "godot_headers/"
godot_headers_path = "godot-headers/"
# Gets the standard flags CC, CCX, etc.
env = DefaultEnvironment()
@@ -64,7 +64,8 @@ elif env["platform"] == "windows":
# This makes sure to keep the session environment variables
# on Windows, so that you can run scons in a VS 2017 prompt
# and it will find all the required tools.
env.Append(ENV=os.environ)
env = Environment(ENV=os.environ)
opts.Update(env)
env.Append(CCFLAGS=["-DWIN32", "-D_WIN32", "-D_WINDOWS", "-W3", "-GR", "-D_CRT_SECURE_NO_WARNINGS"])
if env["target"] in ("debug", "d"):