mirror of
https://github.com/godotengine/gdnative-demos.git
synced 2026-01-03 14:09:44 +03:00
Commit files changed by file_format.sh
This commit is contained in:
@@ -10,7 +10,7 @@ git clone --recursive https://github.com/GodotNativeTools/godot-cpp
|
||||
|
||||
|
||||
### Updating the api.json
|
||||
Our api.json file contains meta data of all the classes that are part of the Godot core and are needed to generate the C++ binding classes for use in GDNative modules.
|
||||
Our api.json file contains meta data of all the classes that are part of the Godot core and are needed to generate the C++ binding classes for use in GDNative modules.
|
||||
|
||||
This file is supplied with our godot_headers repository for your convinience but if you are running a custom build of Godot and need access to classes that have recent changes a new api.json file must be generated. You do this by starting your Godot executable with the following parameters:
|
||||
|
||||
|
||||
@@ -9,12 +9,12 @@ onready var window = preload(\"res://GLFW.gdns\").new()
|
||||
|
||||
func _ready():
|
||||
|
||||
# create a 200x200 px window
|
||||
# create a 200x200 px window
|
||||
window.create(200, 200, \"Hello from Godot!\")
|
||||
|
||||
|
||||
# connect the \"closed\" signal
|
||||
window.connect(\"closed\", self, \"on_window_close\")
|
||||
|
||||
|
||||
func on_window_close():
|
||||
# the window emits a signal when the users requests
|
||||
# to close it. So let's close it :D
|
||||
|
||||
@@ -10,7 +10,7 @@ target = ARGUMENTS.get("target", "debug")
|
||||
platform = ARGUMENTS.get("p", "linux")
|
||||
platform = ARGUMENTS.get("platform", platform)
|
||||
|
||||
# This makes sure to keep the session environment variables on windows,
|
||||
# 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 = Environment()
|
||||
if platform == "windows":
|
||||
|
||||
@@ -6,5 +6,5 @@ onready var data = InstanceBindingDemo.new()
|
||||
|
||||
func _on_Button_pressed():
|
||||
# do the test here
|
||||
|
||||
pass
|
||||
|
||||
pass
|
||||
|
||||
@@ -80,7 +80,6 @@ void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *optio
|
||||
|
||||
void GDN_EXPORT godot_nativescript_init(void *handle)
|
||||
{
|
||||
|
||||
printf("nativescript_init\n");
|
||||
|
||||
fflush(stdout);
|
||||
|
||||
@@ -25,7 +25,7 @@ void GDN_EXPORT godot_gdnative_init(godot_gdnative_init_options *p_options) {
|
||||
}; break;
|
||||
default: break;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_options *p_options) {
|
||||
@@ -52,7 +52,7 @@ void GDN_EXPORT godot_nativescript_init(void *p_handle) {
|
||||
|
||||
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!");
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
platform = ARGUMENTS.get("p", "linux")
|
||||
platform = ARGUMENTS.get("platform", platform)
|
||||
|
||||
# This makes sure to keep the session environment variables on windows,
|
||||
# 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 = Environment()
|
||||
if platform == "windows":
|
||||
@@ -21,7 +21,7 @@ target = ARGUMENTS.get("target", "debug")
|
||||
if ARGUMENTS.get("use_llvm", "no") == "yes":
|
||||
env["CXX"] = "clang++"
|
||||
|
||||
# put stuff that is the same for all first, saves duplication
|
||||
# put stuff that is the same for all first, saves duplication
|
||||
if platform == "osx":
|
||||
env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup'])
|
||||
|
||||
@@ -6,4 +6,4 @@ onready var simple_instance = Simple.new()
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
$Label.text = "C++ code says: " + simple_instance.get_data()
|
||||
$Label.text = "C++ code says: " + simple_instance.get_data()
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
class Simple : public godot::Reference {
|
||||
GODOT_CLASS(Simple, godot::Reference)
|
||||
|
||||
|
||||
godot::String data;
|
||||
public:
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
platform = ARGUMENTS.get("p", "linux")
|
||||
platform = ARGUMENTS.get("platform", platform)
|
||||
|
||||
# This makes sure to keep the session environment variables on windows,
|
||||
# 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 = Environment()
|
||||
if platform == "windows":
|
||||
@@ -21,7 +21,7 @@ target = ARGUMENTS.get("target", "debug")
|
||||
if ARGUMENTS.get("use_llvm", "no") == "yes":
|
||||
env["CXX"] = "clang++"
|
||||
|
||||
# put stuff that is the same for all first, saves duplication
|
||||
# put stuff that is the same for all first, saves duplication
|
||||
if platform == "osx":
|
||||
env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup'])
|
||||
|
||||
@@ -21,7 +21,6 @@ public:
|
||||
}
|
||||
|
||||
int test_method(String s) {
|
||||
|
||||
Godot::print(s);
|
||||
count++;
|
||||
|
||||
@@ -49,4 +48,4 @@ public:
|
||||
static void _register_methods() {
|
||||
register_method("test_method", &TestClass::test_method);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# GDNative example of a kinematic character
|
||||
|
||||
This is a demo showing how to use GDNative together with the cpp_bindings layer to implement a couple of new nodes.
|
||||
This is a demo showing how to use GDNative together with the cpp_bindings layer to implement a couple of new nodes.
|
||||
This demo was originally created by Ramesh Ravone.
|
||||
|
||||
Before compiling this module you must clone https://github.com/GodotNativeTools/godot_headers and https://github.com/GodotNativeTools/godot-cpp
|
||||
|
||||
@@ -5,7 +5,7 @@ import os
|
||||
platform = ARGUMENTS.get("p", "linux")
|
||||
platform = ARGUMENTS.get("platform", platform)
|
||||
|
||||
# This makes sure to keep the session environment variables on windows,
|
||||
# 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 = Environment()
|
||||
if platform == "windows":
|
||||
@@ -21,7 +21,7 @@ target = ARGUMENTS.get("target", "debug")
|
||||
if ARGUMENTS.get("use_llvm", "no") == "yes":
|
||||
env["CXX"] = "clang++"
|
||||
|
||||
# put stuff that is the same for all first, saves duplication
|
||||
# put stuff that is the same for all first, saves duplication
|
||||
if platform == "osx":
|
||||
env.Append(CCFLAGS = ['-g','-O3', '-std=c++14', '-arch', 'x86_64'])
|
||||
env.Append(LINKFLAGS = ['-arch', 'x86_64', '-framework', 'Cocoa', '-Wl,-undefined,dynamic_lookup'])
|
||||
|
||||
@@ -14,4 +14,4 @@ OSX.64="res://Script/bin/libkinematic_char.dylib"
|
||||
|
||||
X11.64=[]
|
||||
Windows.64=[]
|
||||
OSX.64=[]
|
||||
OSX.64=[]
|
||||
|
||||
@@ -30,7 +30,6 @@ extern "C" void GDN_EXPORT godot_gdnative_terminate(godot_gdnative_terminate_opt
|
||||
}
|
||||
|
||||
extern "C" void GDN_EXPORT godot_nativescript_init(void *handle) {
|
||||
|
||||
Godot::nativescript_init(handle);
|
||||
|
||||
register_class<GDPlayer>();
|
||||
|
||||
Reference in New Issue
Block a user