diff --git a/.gitignore b/.gitignore deleted file mode 100644 index ad3cc00..0000000 --- a/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -*.o -*.os -*.so -*.dylib -.import -*.import -*.dblite -*.dll -*.exp -*.lib -*.obj -logs -.vscode/ diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 828a556..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "godot_headers"] - path = godot_headers - url = https://github.com/GodotNativeTools/godot_headers diff --git a/SConstruct b/SConstruct deleted file mode 100644 index e7ead64..0000000 --- a/SConstruct +++ /dev/null @@ -1,79 +0,0 @@ -#!python -import os, subprocess - -opts = Variables([], ARGUMENTS) - -# Gets the standard flags CC, CCX, etc. -env = DefaultEnvironment() - -# Define our options -opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release'])) -opts.Add(EnumVariable('platform', "Compilation platform", '', ['', 'windows', 'x11', 'linux', 'osx'])) -opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", '', ['', 'windows', 'x11', 'linux', 'osx'])) -opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no')) -opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'demo/bin/')) -opts.Add(PathVariable('target_name', 'The library name.', 'libsimple', PathVariable.PathAccept)) - -# Local dependency paths, adapt them to your setup -godot_headers_path = "godot_headers/" - -# only support 64 at this time.. -bits = 64 - -# Updates the environment with the option variables. -opts.Update(env) - -# Process some arguments -if env['use_llvm']: - env['CC'] = 'clang' - env['CXX'] = 'clang++' - -if env['p'] != '': - env['platform'] = env['p'] - -if env['platform'] == '': - print("No valid target platform selected.") - quit(); - -# Check our platform specifics -if env['platform'] == "osx": - env['target_path'] += 'osx/' - if env['target'] in ('debug', 'd'): - env.Append(CCFLAGS = ['-g','-O2', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64']) - else: - env.Append(CCFLAGS = ['-g','-O3', '-arch', 'x86_64']) - env.Append(LINKFLAGS = ['-arch', 'x86_64']) - -elif env['platform'] in ('x11', 'linux'): - env['target_path'] += 'x11/' - if env['target'] in ('debug', 'd'): - env.Append(CCFLAGS = ['-fPIC', '-g3','-Og', '-std=c++17']) - else: - env.Append(CCFLAGS = ['-fPIC', '-g','-O3', '-std=c++17']) - -elif env['platform'] == "windows": - env['target_path'] += 'win64/' - # This makes sure to keep the session environment variables on windows, - # that way you can run scons in a vs 2017 prompt and it will find all the required tools - env.Append(ENV = os.environ) - - env.Append(CCFLAGS = ['-DWIN32', '-D_WIN32', '-D_WINDOWS', '-W3', '-GR', '-D_CRT_SECURE_NO_WARNINGS']) - if env['target'] in ('debug', 'd'): - env.Append(CCFLAGS = ['-EHsc', '-D_DEBUG', '-MDd']) - else: - env.Append(CCFLAGS = ['-O2', '-EHsc', '-DNDEBUG', '-MD']) - -# make sure our binding library is properly includes -env.Append(CPPPATH=['.', godot_headers_path]) - -# tweak this if you want to use different folders, or more folders, to store your source code in. -env.Append(CPPPATH=['src/']) -sources = Glob('src/*.c') - -library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources) - -Default(library) - -# Generates help for the -h scons option. -Help(opts.GenerateHelpText(env)) diff --git a/demo/bin/test.gdnlib b/demo/bin/test.gdnlib deleted file mode 100644 index 84734e3..0000000 --- a/demo/bin/test.gdnlib +++ /dev/null @@ -1,18 +0,0 @@ -[general] - -singleton=false -load_once=true -symbol_prefix="godot_" -reloadable=true - -[entry] - -X11.64="res://bin/x11/libsimple.so" -Windows.64="res://bin/win64/libsimple.dll" -OSX.64="res://bin/osx/libsimple.dylib" - -[dependencies] - -X11.64=[ ] -Windows=[ ] -OSX.64=[ ] diff --git a/demo/bin/test.gdns b/demo/bin/test.gdns deleted file mode 100644 index 18c1798..0000000 --- a/demo/bin/test.gdns +++ /dev/null @@ -1,10 +0,0 @@ -[gd_resource type="NativeScript" load_steps=2 format=2] - -[ext_resource path="res://bin/test.gdnlib" type="GDNativeLibrary" id=1] - -[resource] - -resource_name = "SIMPLE" -class_name = "SIMPLE" -library = ExtResource( 1 ) -_sections_unfolded = [ "Resource" ] diff --git a/demo/default_env.tres b/demo/default_env.tres deleted file mode 100644 index 20207a4..0000000 --- a/demo/default_env.tres +++ /dev/null @@ -1,7 +0,0 @@ -[gd_resource type="Environment" load_steps=2 format=2] - -[sub_resource type="ProceduralSky" id=1] - -[resource] -background_mode = 2 -background_sky = SubResource( 1 ) diff --git a/demo/demo.gd b/demo/demo.gd deleted file mode 100644 index 7d34378..0000000 --- a/demo/demo.gd +++ /dev/null @@ -1,9 +0,0 @@ -extends Control - -# load the SIMPLE library -const SIMPLE = preload("res://bin/test.gdns") -onready var data = SIMPLE.new() - -func _on_Button_pressed(): - $Label.text = "Data = " + data.get_data() - \ No newline at end of file diff --git a/demo/icon.png b/demo/icon.png deleted file mode 100644 index 2b65815..0000000 Binary files a/demo/icon.png and /dev/null differ diff --git a/demo/new_script.gd b/demo/new_script.gd deleted file mode 100644 index 03b9fc6..0000000 --- a/demo/new_script.gd +++ /dev/null @@ -1,13 +0,0 @@ -extends Node - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass diff --git a/demo/project.godot b/demo/project.godot deleted file mode 100644 index 6f88083..0000000 --- a/demo/project.godot +++ /dev/null @@ -1,24 +0,0 @@ -; Engine configuration file. -; It's best edited using the editor UI and not directly, -; since the parameters that go here are not all obvious. -; -; Format: -; [section] ; section goes between [] -; param=value ; assign values to parameters - -config_version=4 - -_global_script_classes=[ ] -_global_script_class_icons={ - -} - -[application] - -config/name="demo" -run/main_scene="res://test.tscn" -config/icon="res://icon.png" - -[rendering] - -environment/default_environment="res://default_env.tres" diff --git a/demo/test.tscn b/demo/test.tscn deleted file mode 100644 index 19bd56d..0000000 --- a/demo/test.tscn +++ /dev/null @@ -1,3 +0,0 @@ -[gd_scene format=2] - -[node name="Spatial" type="Spatial"] diff --git a/godot_headers b/godot_headers deleted file mode 160000 index 4fa11f8..0000000 --- a/godot_headers +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 4fa11f8c2a8029df7d6f30904297afcb42c4906c diff --git a/src/test.c b/src/test.c deleted file mode 100644 index 371e353..0000000 --- a/src/test.c +++ /dev/null @@ -1,91 +0,0 @@ -#include -#include -#include -#include - -typedef struct user_data_struct -{ - char data[256]; -} user_data_struct; - -const godot_gdnative_core_api_struct *api = NULL; -const godot_gdnative_ext_nativescript_api_struct *nativescript_api = NULL; - -GDCALLINGCONV void *simple_constructor(godot_object *p_instance, void *p_method_data); -GDCALLINGCONV void simple_destructor(godot_object *p_instance, void *p_method_data, void *p_user_data); -godot_variant simple_get_data(godot_object *p_instance, void *p_method_data, void *p_user_data, int p_num_args, godot_variant **p_args); - -void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *p_options) -{ - api = p_options->api_struct; - - // now find our extensions - for (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]; - }; - break; - default: - break; - }; - }; -} - -void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *p_options) -{ - api = NULL; - nativescript_api = NULL; -} - -void GDN_EXPORT godot_nativescript_init(void *p_handle) -{ - godot_instance_create_func create = {NULL, NULL, NULL}; - create.create_func = &simple_constructor; - - godot_instance_destroy_func destroy = {NULL, NULL, NULL}; - destroy.destroy_func = &simple_destructor; - - nativescript_api->godot_nativescript_register_class(p_handle, "SIMPLE", "Reference", create, destroy); - - godot_instance_method get_data = {NULL, NULL, NULL}; - get_data.method = &simple_get_data; - - godot_method_attributes attributes = {GODOT_METHOD_RPC_MODE_DISABLED}; - - nativescript_api->godot_nativescript_register_method(p_handle, "SIMPLE", "get_data", attributes, get_data); -} - -GDCALLINGCONV void *simple_constructor(godot_object *p_instance, void *p_method_data) -{ - printf("SIMPLE._init()\n"); - - user_data_struct *user_data = api->godot_alloc(sizeof(user_data_struct)); - strcpy(user_data->data, "World from GDNative!"); - - return user_data; -} - -GDCALLINGCONV void simple_destructor(godot_object *p_instance, void *p_method_data, void *p_user_data) -{ - printf("SIMPLE._byebye()\n"); - - api->godot_free(p_user_data); -} - -godot_variant simple_get_data(godot_object *p_instance, void *p_method_data, void *p_user_data, int p_num_args, godot_variant **p_args) -{ - godot_string data; - godot_variant ret; - user_data_struct *user_data = (user_data_struct *)p_user_data; - - api->godot_string_new(&data); - api->godot_string_parse_utf8(&data, user_data->data); - api->godot_variant_new_string(&ret, &data); - api->godot_string_destroy(&data); - - return ret; -}