Compare commits
10 Commits
b206f3d0c7
...
9ef1455170
Author | SHA1 | Date | |
---|---|---|---|
9ef1455170 | |||
6d419069b2 | |||
720bd3d2a9 | |||
6631753c83 | |||
94e1fbf82b | |||
f1a0aaccd7 | |||
78c4323b8f | |||
c405a5b3d1 | |||
0bed67b74e | |||
7384d4ec10 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,7 +2,7 @@
|
||||
.godot/
|
||||
.vscode
|
||||
gdextension/.sconsign.dblite
|
||||
.ccls-cache
|
||||
.ccls-cache/
|
||||
.ccls
|
||||
compile_commands.json
|
||||
Export/
|
||||
|
4
Test.gd
4
Test.gd
@ -2,8 +2,8 @@ extends Test
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
start_test();
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta: float) -> void:
|
||||
pass;
|
||||
pass
|
||||
|
@ -5,4 +5,5 @@
|
||||
[node name="Node3D" type="Node3D"]
|
||||
|
||||
[node name="Test" type="Test" parent="."]
|
||||
f_value = 0.596
|
||||
script = ExtResource("1_3ucc5")
|
||||
|
@ -58,6 +58,7 @@ function clean() {
|
||||
# Build by passing the platform as a variable
|
||||
function build() {
|
||||
cd "$_build_folder" || clean_exit 1 "$_error_build_folder"
|
||||
echo -e "\nCompiling for $1...\n"
|
||||
scons "platform=$1" target=template_release
|
||||
scons "platform=$1" target=template_debug
|
||||
cd ..
|
||||
@ -74,7 +75,7 @@ function build() {
|
||||
# Analize build process to create compile_commands.json
|
||||
function build_db() {
|
||||
cd "$_build_folder" || clean_exit 1 "$_error_build_folder"
|
||||
|
||||
echo -e "\nCompiling c++ db...\n"
|
||||
if [ ! -f "../${_bin_folder}/compile_commands.json" ]; then
|
||||
clean "$_default_platform"
|
||||
bear --output "../${_bin_folder}/compile_commands.json" -- scons platform="$_default_platform"
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 4d3afc0ad0c5445831418830a33c6adb3e0a9aa8
|
||||
Subproject commit d12cf071bbdcfda6875e78167d282278ab420878
|
@ -1,17 +1,39 @@
|
||||
#ifndef TEST_HPP
|
||||
#define TEST_HPP
|
||||
|
||||
#include <godot_cpp/classes/mesh_instance3d.hpp>
|
||||
#include <godot_cpp/classes/node3d.hpp>
|
||||
|
||||
#include <godot_cpp/classes/texture2d.hpp>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
class Test : public Node3D {
|
||||
GDCLASS(Test, Node3D);
|
||||
|
||||
public:
|
||||
void start_test();
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
|
||||
private:
|
||||
int i_value = 0;
|
||||
float f_value = 0.0;
|
||||
String s_value = "Hello";
|
||||
Ref<Texture2D> tex_value;
|
||||
|
||||
public:
|
||||
int get_i_value();
|
||||
void set_i_value(int input);
|
||||
|
||||
float get_f_value();
|
||||
void set_f_value(float input);
|
||||
|
||||
String get_s_value();
|
||||
void set_s_value(String s);
|
||||
|
||||
Ref<Texture2D> get_tex_value();
|
||||
void set_tex_value(Ref<Texture2D> tex);
|
||||
void start();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -31,8 +31,8 @@ void uninitialize_test_module(ModuleInitializationLevel p_level) {
|
||||
|
||||
extern "C" {
|
||||
// Initialization.
|
||||
GDExtensionBool GDE_EXPORT test_library_init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);
|
||||
GDExtensionBool GDE_EXPORT test_library_init(const GDExtensionInterfaceGetProcAddress p_get_proc_address, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) {
|
||||
GDExtensionBinding::InitObject init_obj(p_get_proc_address, p_library, r_initialization);
|
||||
init_obj.register_initializer(initialize_test_module);
|
||||
init_obj.register_terminator(uninitialize_test_module);
|
||||
init_obj.set_minimum_library_initialization_level(MODULE_INITIALIZATION_LEVEL_SCENE);
|
||||
|
@ -1,12 +1,72 @@
|
||||
#include "test.hpp"
|
||||
|
||||
#include <godot_cpp/variant/utility_functions.hpp>
|
||||
|
||||
void Test::start_test() {
|
||||
UtilityFunctions::print("Hello world form GDExtension");
|
||||
}
|
||||
#include <godot_cpp/variant/variant.hpp>
|
||||
|
||||
void Test::_bind_methods() {
|
||||
ClassDB:
|
||||
ClassDB::bind_method(D_METHOD("start_test"), &Test::start_test);
|
||||
ClassDB::bind_method(D_METHOD("get_i_value"), &Test::get_i_value);
|
||||
ClassDB::bind_method(D_METHOD("set_i_value", "i_val"), &Test::set_i_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::INT, "i_value"), "set_i_value", "get_i_value");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_f_value"), &Test::get_f_value);
|
||||
ClassDB::bind_method(D_METHOD("set_f_value", "f_val"), &Test::set_f_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "f_value"), "set_f_value", "get_f_value");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_s_value"), &Test::get_s_value);
|
||||
ClassDB::bind_method(D_METHOD("set_s_value", "s_val"), &Test::set_s_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "s_value"), "set_s_value", "get_s_value");
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_tex_value"), &Test::get_tex_value);
|
||||
ClassDB::bind_method(D_METHOD("set_tex_value", "tex"), &Test::set_tex_value);
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "tex_value", PROPERTY_HINT_RESOURCE_TYPE, "Texture2D"), "set_tex_value", "get_tex_value");
|
||||
ClassDB::bind_method(D_METHOD("start"), &Test::start);
|
||||
}
|
||||
|
||||
int Test::get_i_value() {
|
||||
return i_value;
|
||||
}
|
||||
|
||||
void Test::set_i_value(int input) {
|
||||
i_value = input;
|
||||
}
|
||||
|
||||
float Test::get_f_value() {
|
||||
return f_value;
|
||||
}
|
||||
|
||||
void Test::set_f_value(float input) {
|
||||
f_value = input;
|
||||
}
|
||||
|
||||
String Test::get_s_value() {
|
||||
return s_value;
|
||||
}
|
||||
|
||||
void Test::set_s_value(String s) {
|
||||
s_value = s;
|
||||
}
|
||||
|
||||
Ref<Texture2D> Test::get_tex_value() {
|
||||
return tex_value;
|
||||
}
|
||||
|
||||
void Test::set_tex_value(Ref<Texture2D> tex) {
|
||||
tex_value = tex;
|
||||
}
|
||||
|
||||
void Test::start() {
|
||||
Node3D *node3d = memnew_arr(Node3D, 100);
|
||||
|
||||
uint64_t *i = (uint64_t *)memalloc(sizeof(uint64_t));
|
||||
|
||||
uint64_t *node3d_size = (uint64_t *)node3d - 1;
|
||||
|
||||
for (*i = 0; *i < *node3d_size; *i = *i + 1) {
|
||||
UtilityFunctions::print(&node3d[*i]);
|
||||
}
|
||||
|
||||
UtilityFunctions::print(*node3d_size);
|
||||
memdelete_arr(node3d);
|
||||
memdelete(i);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ config_version=5
|
||||
|
||||
config/name="TestGDExtension"
|
||||
run/main_scene="res://TestGDExtension.tscn"
|
||||
config/features=PackedStringArray("4.0", "Forward Plus")
|
||||
config/features=PackedStringArray("4.1", "Forward Plus")
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[dotnet]
|
||||
|
@ -1,12 +1,13 @@
|
||||
[configuration]
|
||||
|
||||
entry_symbol = "test_library_init"
|
||||
compatibility_minimum = 4.1
|
||||
|
||||
[libraries]
|
||||
|
||||
linux.debug.x86_64 = "res://build/libtest.linux.template_debug.x86_64.so"
|
||||
linux.release.x86_64 = "res://build/libtest.linux.template_release.x86_64.so"
|
||||
windows.debug.x86_64 = "res://build/libtest.windows.template_debug.x86_64.so"
|
||||
windows.release.x86_64 = "res://build/libtest.windows.template_release.x86_64.so"
|
||||
windows.debug.x86_64 = "res://build/libtest.windows.template_debug.x86_64.dll"
|
||||
windows.release.x86_64 = "res://build/libtest.windows.template_release.x86_64.dll"
|
||||
android.debug.x86_64 = "res://build/libtest.android.template_debug.x86_64.so"
|
||||
android.release.x86_64 = "res://build/libtest.android.template_release.x86_64.so"
|
||||
|
Loading…
Reference in New Issue
Block a user