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:
parent
62e3977704
commit
17530e09f2
10
Test.gd
Normal file
10
Test.gd
Normal 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
8
TestGDExtension.tscn
Normal 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")
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user