Añadir funcion de prueba y enlazarla para su llamada desde gdscript

Signed-off-by: somebody_master <somebody_master@somebodyserver.mooo.com>
This commit is contained in:
Somebody Master 2023-02-16 21:57:27 +01:00
parent 62e3977704
commit 17530e09f2
Signed by: somebody_master
GPG Key ID: 78315CFDF0B25505
5 changed files with 35 additions and 3 deletions

10
Test.gd Normal file
View File

@ -0,0 +1,10 @@
extends Test
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
start_test()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

8
TestGDExtension.tscn Normal file
View File

@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://ccd73px2acqli"]
[ext_resource type="Script" path="res://Test.gd" id="1_3ucc5"]
[node name="Node3D" type="Node3D"]
[node name="Test" type="Test" parent="."]
script = ExtResource("1_3ucc5")

View File

@ -1 +1,12 @@
#include "test.h"
#include <godot_cpp/variant/utility_functions.hpp>
void Test::start_test() {
UtilityFunctions::print("Hello world form GDExtension");
}
void Test::_bind_methods() {
ClassDB:
ClassDB::bind_method(D_METHOD("start_test"), &Test::start_test);
}

View File

@ -8,8 +8,10 @@ using namespace godot;
class Test : public Node3D {
GDCLASS(Test, Node3D);
protected:
static void _bind_methods() {}
};
public:
void start_test();
protected:
static void _bind_methods();
};
#endif

View File

@ -11,6 +11,7 @@ config_version=5
[application]
config/name="TestGDExtension"
run/main_scene="res://TestGDExtension.tscn"
config/features=PackedStringArray("4.0", "Forward Plus")
config/icon="res://icon.svg"